buffet: Allow setting command results. Next step in command results support: now there is CommandInstance::SetResults method which allows results modifications. BUG=chromium:435607 TEST=cros_workon_make --test buffet Change-Id: I1f5da9c3613a2996cea3f65f07945cc64bfeda2e Reviewed-on: https://chromium-review.googlesource.com/231337 Reviewed-by: Alex Vakulenko <avakulenko@chromium.org> Tested-by: Anton Muhin <antonm@chromium.org> Commit-Queue: Anton Muhin <antonm@chromium.org>
diff --git a/buffet/commands/schema_utils.h b/buffet/commands/schema_utils.h index 33261f0..597a580 100644 --- a/buffet/commands/schema_utils.h +++ b/buffet/commands/schema_utils.h
@@ -15,12 +15,14 @@ #include <base/values.h> #include <chromeos/any.h> #include <chromeos/errors/error.h> +#include <chromeos/variant_dictionary.h> namespace buffet { class PropType; class PropValue; class ObjectSchema; +class ObjectValue; namespace native_types { // C++ representation of object values. @@ -122,6 +124,10 @@ // Has special handling for Object types where native_types::Object are // converted to chromeos::VariantDictionary. chromeos::Any PropValueToDBusVariant(const PropValue* value); +// Converts native_types::Object to chromeos::VariantDictionary +// with proper conversion of all nested properties. +chromeos::VariantDictionary +ObjectToDBusVariant(const native_types::Object& object); // Converts D-Bus variant to PropValue. // Has special handling for Object types where chromeos::VariantDictionary // is converted to native_types::Object. @@ -129,6 +135,11 @@ const PropType* type, const chromeos::Any& value, chromeos::ErrorPtr* error); +// Converts D-Bus variant to ObjectValue. +bool ObjectFromDBusVariant(const ObjectSchema* object_schema, + const chromeos::VariantDictionary& dict, + native_types::Object* obj, + chromeos::ErrorPtr* error); } // namespace buffet