diff options
author | Johan Euphrosine <proppy@google.com> | 2016-02-23 12:25:47 -0800 |
---|---|---|
committer | Johan Euphrosine <proppy@google.com> | 2016-02-24 00:23:35 +0000 |
commit | 7f2a5dcefb7e5d9785efeb4c68542fd3b2e4865f (patch) | |
tree | e8b71ba06b1b28206f13b952a7434465a8a189ce | |
parent | 89b3495b6bce7f8a2545ba983ca6dfda29026555 (diff) | |
download | libweave-7f2a5dcefb7e5d9785efeb4c68542fd3b2e4865f.tar.gz |
daemon: register device after component init
Bug:27276010
Change-Id: I97b2d00b5a8ca3c716ff3d8f2b042e2242579f28
Reviewed-on: https://weave-review.googlesource.com/2713
Reviewed-by: Johan Euphrosine <proppy@google.com>
-rw-r--r-- | examples/daemon/common/daemon.h | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/examples/daemon/common/daemon.h b/examples/daemon/common/daemon.h index 0b3c25a..22591a2 100644 --- a/examples/daemon/common/daemon.h +++ b/examples/daemon/common/daemon.h @@ -92,16 +92,18 @@ class Daemon { http_client_.get(), network_.get(), dns_sd_.get(), http_server_.get(), wifi_.get(), bluetooth_.get()); - if (!opts.registration_ticket.empty()) { - weave::RegistrationData data; - data.ticket_id = opts.registration_ticket; - data.service_url = opts.service_url; - device_->Register(data, base::Bind(&OnRegisterDeviceDone, device_.get())); + registration_data_.ticket_id = opts.registration_ticket; + registration_data_.service_url = opts.service_url; } } - void Run() { task_runner_->Run(); } + void Run() { + if (!registration_data_.ticket_id.empty()) { + device_->Register(registration_data_, base::Bind(&OnRegisterDeviceDone, device_.get())); + } + task_runner_->Run(); + } weave::Device* GetDevice() const { return device_.get(); } @@ -127,4 +129,5 @@ class Daemon { std::unique_ptr<weave::examples::HttpServerImpl> http_server_; std::unique_ptr<weave::examples::WifiImpl> wifi_; std::unique_ptr<weave::Device> device_; + weave::RegistrationData registration_data_; }; |