chromeos-dbus-bindings: fix some stuff in README
There were some typos in the example code, and I added a short
explanation of why proxy methods always have a boolean return
value and error out-argument.
BUG=None
TEST=md_browser
Change-Id: Id589ea84f6075a7fa65be2e1249d1d60fb91db4a
diff --git a/README.md b/README.md
index 2f14781..cc955eb 100644
--- a/README.md
+++ b/README.md
@@ -248,7 +248,7 @@
dbus_object_.RegisterAsync(cb);
}
- // org::chromium::FrobinatorAdaptor overrides.
+ // org::chromium::FrobinatorInterface overrides.
bool Frobinate(brillo::ErrorPtr* error,
int32_t foo,
const brillo::VariantDictionary& bar,
@@ -300,10 +300,20 @@
dbus::Bus::Options options;
options.bus_type = dbus::Bus::SYSTEM;
scoped_refptr<dbus::Bus> bus(new dbus::Bus(options));
+
auto frobinator = base::MakeUnique<org::chromium::FrobinatorProxy>(bus);
-frobinator.Frobinate(42, {{ "qux", brillo::Any("squawk") }});
+brillo::ErrorPtr error;
+if (!frobinator->Frobinate(42, {{ "qux", brillo::Any("squawk") }}, &error))
+ LOG(WARNING) << "Frobinate failed: " << error->GetMessage();
+
```
+All methods on proxies are specified like `normal` kind methods on interfaces,
+with the exception that the error argument appears at the end rather than the
+beginning. Even if they are marked `simple` in the interface, there are other
+possibilities for errors, such as timeouts, which need to be reported to the
+client.
+
[D-Bus]: https://www.freedesktop.org/wiki/Software/dbus/
[libbrillo]: https://android.googlesource.com/platform/external/libbrillo/+/master/brillo/dbus/
[the introspection API]: https://dbus.freedesktop.org/doc/dbus-specification.html#introspection-format