ledflasher: Split out the trait name from the command name

weaved::Service::AddCommandHandler() and SetStateProperty() now
expect the trait name as a separate argument.

BUG: 26443877
Change-Id: Id5a1f2ff779c13a7c6fb9cb3a71c5e23ff0cddb1
diff --git a/src/ledflasher/ledflasher.cpp b/src/ledflasher/ledflasher.cpp
index 55c0f5a..7a991b1 100644
--- a/src/ledflasher/ledflasher.cpp
+++ b/src/ledflasher/ledflasher.cpp
@@ -33,6 +33,7 @@
 
 namespace {
 const char kWeaveComponent[] = "ledflasher";
+const char kWeaveTrait[] = "_ledflasher";
 }  // anonymous namespace
 
 using brillo::examples::ledflasher::ILEDService;
@@ -103,18 +104,15 @@
   if (!weave_service)
     return;
 
-  weave_service->AddComponent(kWeaveComponent, {"_ledflasher"}, nullptr);
+  weave_service->AddComponent(kWeaveComponent, {kWeaveTrait}, nullptr);
   weave_service->AddCommandHandler(
-      kWeaveComponent,
-      "_ledflasher.set",
+      kWeaveComponent, kWeaveTrait, "set",
       base::Bind(&Daemon::OnSet, weak_ptr_factory_.GetWeakPtr()));
   weave_service->AddCommandHandler(
-      kWeaveComponent,
-      "_ledflasher.toggle",
+      kWeaveComponent, kWeaveTrait, "toggle",
       base::Bind(&Daemon::OnToggle, weak_ptr_factory_.GetWeakPtr()));
   weave_service->AddCommandHandler(
-      kWeaveComponent,
-      "_ledflasher.animate",
+      kWeaveComponent, kWeaveTrait, "animate",
       base::Bind(&Daemon::OnAnimate, weak_ptr_factory_.GetWeakPtr()));
 
   UpdateDeviceState();
@@ -235,8 +233,6 @@
     {"_ledflasher.status", status_},
     {"_ledflasher.leds", leds},
   };
-  // TODO: Come up with a design for ledflasher.cpp such that this call never
-  // fails.
   weave_service->SetStateProperties(kWeaveComponent, state_change, nullptr);
 }