buffet: Fix state update notification to GCD cloud server
Device state notification from buffet's state manager are coming
with state property names in form "package_name.property_name" and
that's how they were reported to the GCD server instead of being
split in JSON as {"package_name": {"property_name": value}}.
Also added "buffet_client GetState" command to retrieve actual
internal device state from buffet bypassing the GCD server-dependent
GetDeviceInfo. This is useful for debugging and also in case of
local-only workflow (with no GCD server present).
Finally, modified "buffet_client UpdateState" to allow complex
non-string state properties to be set. Now this command expects
a property name followed by a properly formed json value for the
property. Strings now require double-quotes. Integers, Booleans,
lists and dictionaries can now be set too.
BUG=chromium:449250
TEST=FEATURES=test USE=examples emerge-link buffet
Deployed and tested on device
Change-Id: Id2c97b422c56ec6648994ab37bb47284a6fb2041
Reviewed-on: https://chromium-review.googlesource.com/241955
Tested-by: Alex Vakulenko <avakulenko@chromium.org>
Reviewed-by: Anton Muhin <antonm@chromium.org>
Commit-Queue: Alex Vakulenko <avakulenko@chromium.org>
diff --git a/buffet/dbus_bindings/org.chromium.Buffet.Manager.xml b/buffet/dbus_bindings/org.chromium.Buffet.Manager.xml
index 4490dac..daf1458 100644
--- a/buffet/dbus_bindings/org.chromium.Buffet.Manager.xml
+++ b/buffet/dbus_bindings/org.chromium.Buffet.Manager.xml
@@ -28,6 +28,10 @@
<arg name="property_set" type="a{sv}" direction="in"/>
<annotation name="org.chromium.DBus.Method.Kind" value="async"/>
</method>
+ <method name="GetState">
+ <arg name="device_info" type="s" direction="out"/>
+ <annotation name="org.chromium.DBus.Method.Kind" value="normal"/>
+ </method>
<method name="AddCommand">
<arg name="json_command" type="s" direction="in"/>
<annotation name="org.chromium.DBus.Method.Kind" value="async"/>