Remove CommandDefinition class
In preparation for traits support, remove CommandDefinition class
and incorporate the missing functionality into CommandDictionary.
BUG: 25841719
Change-Id: Iead48aa0503e9de6061c4c1588b0b930dd82c8d0
Reviewed-on: https://weave-review.googlesource.com/1680
Reviewed-by: Alex Vakulenko <avakulenko@google.com>
diff --git a/src/device_registration_info.cc b/src/device_registration_info.cc
index 0c914b7..30e8862 100644
--- a/src/device_registration_info.cc
+++ b/src/device_registration_info.cc
@@ -21,7 +21,6 @@
#include "src/bind_lambda.h"
#include "src/commands/cloud_command_proxy.h"
-#include "src/commands/command_definition.h"
#include "src/commands/command_manager.h"
#include "src/commands/schema_constants.h"
#include "src/data_encoding.h"
@@ -480,10 +479,8 @@
std::unique_ptr<base::DictionaryValue>
DeviceRegistrationInfo::BuildDeviceResource(ErrorPtr* error) {
// Limit only to commands that are visible to the cloud.
- auto commands =
- command_manager_->GetCommandDictionary().GetCommandsAsJson(error);
- if (!commands)
- return nullptr;
+ const base::DictionaryValue& commands =
+ command_manager_->GetCommandDictionary().GetCommandsAsJson();
const base::DictionaryValue& state = state_manager_->GetState();
@@ -505,7 +502,7 @@
channel->SetString("supportedType", "pull");
}
resource->Set("channel", channel.release());
- resource->Set("commandDefs", commands.release());
+ resource->Set("commandDefs", commands.DeepCopy());
resource->Set("state", state.DeepCopy());
return resource;