Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(21)

Unified Diff: tools/battor_agent/battor_agent.cc

Issue 1567683002: Makes the BattOrConnection read messages instead of bytes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Code review Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/battor_agent/battor_agent.h ('k') | tools/battor_agent/battor_agent_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/battor_agent/battor_agent.cc
diff --git a/tools/battor_agent/battor_agent.cc b/tools/battor_agent/battor_agent.cc
index 65289a63ad50b7ef76981d78c265180b9936e170..5f66d7f24e906955319c9c765637ffa1e545af35 100644
--- a/tools/battor_agent/battor_agent.cc
+++ b/tools/battor_agent/battor_agent.cc
@@ -114,9 +114,9 @@ void BattOrAgent::OnBytesSent(bool success) {
}
}
-void BattOrAgent::OnBytesRead(bool success,
- BattOrMessageType type,
- scoped_ptr<vector<char>> bytes) {
+void BattOrAgent::OnMessageRead(bool success,
+ BattOrMessageType type,
+ scoped_ptr<vector<char>> bytes) {
if (!success) {
CompleteCommand(BATTOR_ERROR_RECEIVE_ERROR);
return;
@@ -182,7 +182,7 @@ void BattOrAgent::PerformAction(Action action) {
SendControlMessage(BATTOR_CONTROL_MESSAGE_TYPE_INIT, 0, 0);
break;
case Action::READ_INIT_ACK:
- connection_->ReadBytes(sizeof(BattOrControlMessageAck));
+ connection_->ReadMessage(BATTOR_MESSAGE_TYPE_CONTROL_ACK);
break;
case Action::SEND_SET_GAIN:
// Set the BattOr's gain. Setting the gain tells the BattOr the range of
@@ -191,13 +191,13 @@ void BattOrAgent::PerformAction(Action action) {
0);
break;
case Action::READ_SET_GAIN_ACK:
- connection_->ReadBytes(sizeof(BattOrControlMessageAck));
+ connection_->ReadMessage(BATTOR_MESSAGE_TYPE_CONTROL_ACK);
break;
case Action::SEND_START_TRACING:
SendControlMessage(BATTOR_CONTROL_MESSAGE_TYPE_START_SAMPLING_SD, 0, 0);
break;
case Action::READ_START_TRACING_ACK:
- connection_->ReadBytes(sizeof(BattOrControlMessageAck));
+ connection_->ReadMessage(BATTOR_MESSAGE_TYPE_CONTROL_ACK);
break;
case Action::INVALID:
NOTREACHED();
« no previous file with comments | « tools/battor_agent/battor_agent.h ('k') | tools/battor_agent/battor_agent_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698