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/manager.h b/buffet/manager.h
index 318ee74..ab5171f 100644
--- a/buffet/manager.h
+++ b/buffet/manager.h
@@ -63,6 +63,8 @@
// Handles calls to org.chromium.Buffet.Manager.UpdateState().
void UpdateState(DBusMethodResponse<> response,
const chromeos::VariantDictionary& property_set) override;
+ // Handles calls to org.chromium.Buffet.Manager.GetState().
+ bool GetState(chromeos::ErrorPtr* error, std::string* state) override;
// Handles calls to org.chromium.Buffet.Manager.AddCommand().
void AddCommand(DBusMethodResponse<> response,
const std::string& json_command) override;