aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorPaul Westbrook <pwestbro@google.com>2015-11-16 09:31:35 -0800
committerPaul Westbrook <pwestbro@google.com>2015-12-07 23:13:11 +0000
commit321dae66a2e2c6efbc85f990eaa2aefd192602a3 (patch)
treead36c0231ff63623550680bb88edfb1893d63891 /examples
parent894b6b4f6d75bf8d1c9bd145b792d0213f831c34 (diff)
downloadlibweave-321dae66a2e2c6efbc85f990eaa2aefd192602a3.tar.gz
Allow change of model manifest id
Add support for changing model manifest id. This will allow OEMs to easily modify the model in their device code The specification of the model manifest ids for the sample devices will happen in a following CL. Change-Id: Ic36161b21df82d62233d54dd18b516cbf4fea16c Reviewed-on: https://weave-review.googlesource.com/1790 Reviewed-by: Paul Westbrook <pwestbro@google.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/daemon/common/daemon.h9
-rw-r--r--examples/provider/file_config_store.cc6
-rw-r--r--examples/provider/file_config_store.h3
3 files changed, 10 insertions, 8 deletions
diff --git a/examples/daemon/common/daemon.h b/examples/daemon/common/daemon.h
index 0e05b88..5a90988 100644
--- a/examples/daemon/common/daemon.h
+++ b/examples/daemon/common/daemon.h
@@ -19,10 +19,11 @@
class Daemon {
public:
struct Options {
- bool force_bootstrapping_ = false;
- bool disable_security_ = false;
- bool disable_privet_ = false;
+ bool force_bootstrapping_{false};
+ bool disable_security_{false};
+ bool disable_privet_{false};
std::string registration_ticket_;
+ std::string model_id_{"AAAAA"};
static void ShowUsage(const std::string& name) {
LOG(ERROR) << "\nUsage: " << name << " <option(s)>"
@@ -69,7 +70,7 @@ class Daemon {
Daemon(const Options& opts)
: config_store_{new weave::examples::FileConfigStore(
- opts.disable_security_)},
+ opts.disable_security_, opts.model_id_)},
task_runner_{new weave::examples::EventTaskRunner},
http_client_{new weave::examples::CurlHttpClient(task_runner_.get())},
network_{new weave::examples::EventNetworkImpl(task_runner_.get())},
diff --git a/examples/provider/file_config_store.cc b/examples/provider/file_config_store.cc
index 8e72792..7d4e31b 100644
--- a/examples/provider/file_config_store.cc
+++ b/examples/provider/file_config_store.cc
@@ -19,8 +19,8 @@ const char kSettingsDir[] = "/var/lib/weave/";
const char kSettingsPath[] = "/var/lib/weave/weave_settings.json";
const char kCategory[] = "example";
-FileConfigStore::FileConfigStore(bool disable_security)
- : disable_security_{disable_security} {}
+FileConfigStore::FileConfigStore(bool disable_security, const std::string& model_id)
+ : disable_security_{disable_security}, model_id_{model_id} {}
bool FileConfigStore::LoadDefaults(Settings* settings) {
char host_name[HOST_NAME_MAX] = {};
@@ -35,7 +35,7 @@ bool FileConfigStore::LoadDefaults(Settings* settings) {
settings->firmware_version = uname_data.sysname;
settings->oem_name = "Unknown";
settings->model_name = "Unknown";
- settings->model_id = "AAAAA";
+ settings->model_id = model_id_;
settings->pairing_modes = {PairingType::kEmbeddedCode};
settings->embedded_code = "0000";
diff --git a/examples/provider/file_config_store.h b/examples/provider/file_config_store.h
index e4d16a9..8764cc5 100644
--- a/examples/provider/file_config_store.h
+++ b/examples/provider/file_config_store.h
@@ -16,7 +16,7 @@ namespace examples {
class FileConfigStore : public provider::ConfigStore {
public:
- explicit FileConfigStore(bool disable_security);
+ explicit FileConfigStore(bool disable_security, const std::string& model_id);
bool LoadDefaults(Settings* settings) override;
std::string LoadSettings() override;
@@ -24,6 +24,7 @@ class FileConfigStore : public provider::ConfigStore {
private:
bool disable_security_{false};
+ std::string model_id_{"AAAAA"};
};
} // namespace examples