privetd: Implement privet/v3/commands/execute
Privetd forwards JSON with command to buffet. Buffet updates command and
returns JSON representation of the command.
BUG=brillo:428
TEST=unittest
Change-Id: I7bdd4a70dd94e3dc3b4a974c7ac734e44564ac6e
Reviewed-on: https://chromium-review.googlesource.com/262216
Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
Reviewed-by: Vitaly Buka <vitalybuka@chromium.org>
Commit-Queue: Vitaly Buka <vitalybuka@chromium.org>
Tested-by: Vitaly Buka <vitalybuka@chromium.org>
diff --git a/buffet/manager.cc b/buffet/manager.cc
index 01f73b1..e486d5a 100644
--- a/buffet/manager.cc
+++ b/buffet/manager.cc
@@ -165,7 +165,7 @@
return true;
}
-void Manager::AddCommand(DBusMethodResponse<> response,
+void Manager::AddCommand(DBusMethodResponse<std::string> response,
const std::string& json_command) {
static int next_id = 0;
std::string error_message;
@@ -184,9 +184,10 @@
response->ReplyWithError(error.get());
return;
}
- command_instance->SetID(std::to_string(++next_id));
+ std::string id = std::to_string(++next_id);
+ command_instance->SetID(id);
command_manager_->AddCommand(std::move(command_instance));
- response->Return();
+ response->Return(id);
}
void Manager::GetCommand(DBusMethodResponse<std::string> response,