Add support for legacy state/commandDefs to ComponentManager
Added methods to convert legacy state/stateDefs/commandDefs to
the new trait definitions and components and functions to convert
the trait definitions/component tree back to old commandDefs and
state.
Change-Id: Ia03142c53d00bbc4f880389166982167e3c8b1e9
Reviewed-on: https://weave-review.googlesource.com/1787
Reviewed-by: Vitaly Buka <vitalybuka@google.com>
diff --git a/src/component_manager.h b/src/component_manager.h
index 31f9228..fbc18aa 100644
--- a/src/component_manager.h
+++ b/src/component_manager.h
@@ -178,6 +178,17 @@
virtual std::string FindComponentWithTrait(
const std::string& trait) const = 0;
+ // Support for legacy APIs. Setting command and state definitions.
+ // This translates into modifying a trait definition.
+ virtual bool AddLegacyCommandDefinitions(const base::DictionaryValue& dict,
+ ErrorPtr* error) = 0;
+ virtual bool AddLegacyStateDefinitions(const base::DictionaryValue& dict,
+ ErrorPtr* error) = 0;
+ // Returns device state for legacy APIs.
+ virtual const base::DictionaryValue& GetLegacyState() const = 0;
+ // Returns command definitions for legacy APIs.
+ virtual const base::DictionaryValue& GetLegacyCommandDefinitions() const = 0;
+
DISALLOW_COPY_AND_ASSIGN(ComponentManager);
};