buffet: Add DeviceId DBus property

Privetd needs to be notified when GCD ID is changed.

CQ-DEPEND=CL:260681
BUG=brillo:572
TEST=manual, register device using privetd, edit id in buffet.state, restart
             buffet, check if privetd has new id

Change-Id: I590ee22f134261711f78da75a4766043e0867bf5
Reviewed-on: https://chromium-review.googlesource.com/260303
Reviewed-by: Vitaly Buka <vitalybuka@chromium.org>
Tested-by: Vitaly Buka <vitalybuka@chromium.org>
Commit-Queue: Vitaly Buka <vitalybuka@chromium.org>
diff --git a/buffet/manager.cc b/buffet/manager.cc
index 7a4a9ca..53ec9c9 100644
--- a/buffet/manager.cc
+++ b/buffet/manager.cc
@@ -72,7 +72,7 @@
           base::Bind(&Manager::OnRegistrationStatusChange,
                      base::Unretained(this))));
   // Reset D-Bus properties.
-  OnRegistrationStatusChange(device_info_->GetRegistrationStatus());
+  OnRegistrationStatusChange();
   device_info_->Load();
   dbus_adaptor_.RegisterWithDBusObject(&dbus_object_);
   dbus_object_.RegisterAsync(cb);
@@ -90,17 +90,7 @@
     return;
   }
 
-  std::string device_id;
-  if (registered) {
-    error.reset();
-    device_id = device_info_->GetDeviceId(&error);
-    if (error) {
-      response->ReplyWithError(error.get());
-      return;
-    }
-  }
-
-  response->Return(device_id);
+  response->Return(registered ? device_info_->GetDeviceId() : std::string());
 }
 
 void Manager::GetDeviceInfo(DBusMethodResponse<std::string> response) {
@@ -205,8 +195,10 @@
   return message;
 }
 
-void Manager::OnRegistrationStatusChange(RegistrationStatus status) {
-  dbus_adaptor_.SetStatus(StatusToString(status));
+void Manager::OnRegistrationStatusChange() {
+  dbus_adaptor_.SetStatus(
+      StatusToString(device_info_->GetRegistrationStatus()));
+  dbus_adaptor_.SetDeviceId(device_info_->GetDeviceId());
 }
 
 }  // namespace buffet