buffet: Expose RegistrationStatus over DBus
This new property lets applications monitor Buffet's connection to
cloud services.
BUG=brillo:16
TEST=Unittests, buffet_Registration has been expanded appropriately.
CQ-DEPEND=CL:*199337
Change-Id: I30253e8199cb65068a74dd8b780a8ab0954bf9fa
Reviewed-on: https://chromium-review.googlesource.com/250011
Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
Tested-by: Christopher Wiley <wiley@chromium.org>
Commit-Queue: Christopher Wiley <wiley@chromium.org>
diff --git a/buffet/registration_status.cc b/buffet/registration_status.cc
new file mode 100644
index 0000000..4fb1721
--- /dev/null
+++ b/buffet/registration_status.cc
@@ -0,0 +1,25 @@
+// Copyright 2015 The Chromium OS Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "buffet/registration_status.h"
+
+namespace buffet {
+
+std::string StatusToString(RegistrationStatus status) {
+ switch (status) {
+ case RegistrationStatus::kOffline:
+ return "offline";
+ case RegistrationStatus::kCloudError:
+ return "cloud_error";
+ case RegistrationStatus::kUnregistered:
+ return "unregistered";
+ case RegistrationStatus::kRegistering:
+ return "registering";
+ case RegistrationStatus::kRegistered:
+ return "registered";
+ }
+ return "unknown";
+}
+
+} // namespace buffet