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

Unified Diff: tools/battor_agent/battor_connection_impl.h

Issue 2000743002: [battor agent] Add 'read more bytes' logic in the BattOr connection (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 | « no previous file | tools/battor_agent/battor_connection_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/battor_agent/battor_connection_impl.h
diff --git a/tools/battor_agent/battor_connection_impl.h b/tools/battor_agent/battor_connection_impl.h
index 0631451beda0a698f03c956d1dfa2fa8bc604965..8184452e6ebfbcd559b683827a7b4940446e2a7b 100644
--- a/tools/battor_agent/battor_connection_impl.h
+++ b/tools/battor_agent/battor_connection_impl.h
@@ -69,9 +69,18 @@ class BattOrConnectionImpl
std::unique_ptr<std::vector<char>> data);
// Pulls off the next complete message from already_read_buffer_, returning
- // its type and contents (via out parameters) and whether a complete message
- // was able to be read (via the return value).
- bool ParseMessage(BattOrMessageType* type, std::vector<char>* data);
+ // its type and contents through out parameters and any error that occurred
+ // through the return value.
+ enum ParseMessageError {
+ NONE = 0,
+ NOT_ENOUGH_BYTES = 1,
+ MISSING_START_BYTE = 2,
+ INVALID_MESSAGE_TYPE = 3,
+ TOO_MANY_START_BYTES = 4
+ };
+
+ ParseMessageError ParseMessage(BattOrMessageType* type,
+ std::vector<char>* data);
// Internal callback for when bytes are sent.
void OnBytesSent(int bytes_sent, device::serial::SendError error);
« no previous file with comments | « no previous file | tools/battor_agent/battor_connection_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698