Add support of Components/Traits to local privet APIs
Added support for new privet APIs /privet/v3/traits and
/privet/v3/components to obtain the full trait/component trees
as well as expanded the existing /privet/v3/checkForUpdates to
include the component/trait fingerprints.
BUG: 25917521
Change-Id: Ib753817f88f611935057ca7bd1a1bf02addfb69c
Reviewed-on: https://weave-review.googlesource.com/1791
Reviewed-by: Vitaly Buka <vitalybuka@google.com>
diff --git a/src/privet/privet_handler.h b/src/privet/privet_handler.h
index cc80d43..6bc4ac6 100644
--- a/src/privet/privet_handler.h
+++ b/src/privet/privet_handler.h
@@ -46,6 +46,7 @@
~PrivetHandler() override;
void OnTraitDefsChanged() override;
+ void OnStateChanged() override;
void OnComponentTreeChanged() override;
std::vector<std::string> GetHttpPaths() const;
@@ -118,6 +119,12 @@
void HandleCheckForUpdates(const base::DictionaryValue& input,
const UserInfo& user_info,
const RequestCallback& callback);
+ void HandleTraits(const base::DictionaryValue& input,
+ const UserInfo& user_info,
+ const RequestCallback& callback);
+ void HandleComponents(const base::DictionaryValue& input,
+ const UserInfo& user_info,
+ const RequestCallback& callback);
void ReplyWithSetupStatus(const RequestCallback& callback) const;
void ReplyToUpdateRequest(const RequestCallback& callback) const;
@@ -139,14 +146,16 @@
RequestCallback callback;
int request_id = 0;
int state_fingerprint = -1;
- int command_defs_fingerprint = -1;
+ int traits_fingerprint = -1;
+ int components_fingerprint = -1;
};
std::vector<UpdateRequestParameters> update_requests_;
int last_update_request_id_{0};
uint64_t last_user_id_{0};
int state_fingerprint_{0};
- int command_defs_fingerprint_{0};
+ int traits_fingerprint_{0};
+ int components_fingerprint_{0};
ScopedObserver<CloudDelegate, CloudDelegate::Observer> cloud_observer_{this};
base::WeakPtrFactory<PrivetHandler> weak_ptr_factory_{this};