OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef TOOLS_BATTOR_AGENT_BATTOR_CONNECTION_IMPL_H_ | 5 #ifndef TOOLS_BATTOR_AGENT_BATTOR_CONNECTION_IMPL_H_ |
6 #define TOOLS_BATTOR_AGENT_BATTOR_CONNECTION_IMPL_H_ | 6 #define TOOLS_BATTOR_AGENT_BATTOR_CONNECTION_IMPL_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/callback_forward.h" | 10 #include "base/callback_forward.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 // Reads the specified number of additional bytes and adds them to the pending | 58 // Reads the specified number of additional bytes and adds them to the pending |
59 // read buffer. | 59 // read buffer. |
60 void BeginReadBytes(size_t bytes_to_read); | 60 void BeginReadBytes(size_t bytes_to_read); |
61 | 61 |
62 // Internal callback for when bytes are read. This method may trigger | 62 // Internal callback for when bytes are read. This method may trigger |
63 // additional reads if any newly read bytes are escape bytes. | 63 // additional reads if any newly read bytes are escape bytes. |
64 void OnBytesRead(int bytes_read, device::serial::ReceiveError error); | 64 void OnBytesRead(int bytes_read, device::serial::ReceiveError error); |
65 | 65 |
66 void EndReadBytes(bool success, | 66 void EndReadBytes(bool success, |
67 BattOrMessageType type, | 67 BattOrMessageType type, |
68 scoped_ptr<std::vector<char>> data); | 68 std::unique_ptr<std::vector<char>> data); |
69 | 69 |
70 // Pulls off the next complete message from already_read_buffer_, returning | 70 // Pulls off the next complete message from already_read_buffer_, returning |
71 // its type and contents (via out parameters) and whether a complete message | 71 // its type and contents (via out parameters) and whether a complete message |
72 // was able to be read (via the return value). | 72 // was able to be read (via the return value). |
73 bool ParseMessage(BattOrMessageType* type, std::vector<char>* data); | 73 bool ParseMessage(BattOrMessageType* type, std::vector<char>* data); |
74 | 74 |
75 // Internal callback for when bytes are sent. | 75 // Internal callback for when bytes are sent. |
76 void OnBytesSent(int bytes_sent, device::serial::SendError error); | 76 void OnBytesSent(int bytes_sent, device::serial::SendError error); |
77 | 77 |
78 // The path of the BattOr. | 78 // The path of the BattOr. |
(...skipping 13 matching lines...) Expand all Loading... |
92 // Threads needed for serial communication. | 92 // Threads needed for serial communication. |
93 scoped_refptr<base::SingleThreadTaskRunner> file_thread_task_runner_; | 93 scoped_refptr<base::SingleThreadTaskRunner> file_thread_task_runner_; |
94 scoped_refptr<base::SingleThreadTaskRunner> ui_thread_task_runner_; | 94 scoped_refptr<base::SingleThreadTaskRunner> ui_thread_task_runner_; |
95 | 95 |
96 DISALLOW_COPY_AND_ASSIGN(BattOrConnectionImpl); | 96 DISALLOW_COPY_AND_ASSIGN(BattOrConnectionImpl); |
97 }; | 97 }; |
98 | 98 |
99 } // namespace battor | 99 } // namespace battor |
100 | 100 |
101 #endif // TOOLS_BATTOR_AGENT_BATTOR_CONNECTION_IMPL_H_ | 101 #endif // TOOLS_BATTOR_AGENT_BATTOR_CONNECTION_IMPL_H_ |
OLD | NEW |