OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 CHROME_BROWSER_EXTENSIONS_API_SERIAL_SERIAL_CONNECTION_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_SERIAL_SERIAL_CONNECTION_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_API_SERIAL_SERIAL_CONNECTION_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_SERIAL_SERIAL_CONNECTION_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 base::TimeDelta delay_; | 135 base::TimeDelta delay_; |
136 }; | 136 }; |
137 | 137 |
138 // Handles a receive timeout. | 138 // Handles a receive timeout. |
139 void OnReceiveTimeout(); | 139 void OnReceiveTimeout(); |
140 | 140 |
141 // Handles a send timeout. | 141 // Handles a send timeout. |
142 void OnSendTimeout(); | 142 void OnSendTimeout(); |
143 | 143 |
144 // Receives read completion notification from the |io_handler_|. | 144 // Receives read completion notification from the |io_handler_|. |
145 void OnAsyncReadComplete(const std::string& data, | 145 void OnAsyncReadComplete(const std::string& data, device::ReceiveError error); |
146 api::serial::ReceiveError error); | |
147 | 146 |
148 // Receives write completion notification from the |io_handler_|. | 147 // Receives write completion notification from the |io_handler_|. |
149 void OnAsyncWriteComplete(int bytes_sent, api::serial::SendError error); | 148 void OnAsyncWriteComplete(int bytes_sent, device::SendError error); |
150 | 149 |
151 // The pathname of the serial device. | 150 // The pathname of the serial device. |
152 std::string port_; | 151 std::string port_; |
153 | 152 |
154 // Flag indicating whether or not the connection should persist when | 153 // Flag indicating whether or not the connection should persist when |
155 // its host app is suspended. | 154 // its host app is suspended. |
156 bool persistent_; | 155 bool persistent_; |
157 | 156 |
158 // User-specified connection name. | 157 // User-specified connection name. |
159 std::string name_; | 158 std::string name_; |
(...skipping 26 matching lines...) Expand all Loading... |
186 // Write timeout closure. Reset on initialization and after every successful | 185 // Write timeout closure. Reset on initialization and after every successful |
187 // Send(). | 186 // Send(). |
188 scoped_ptr<TimeoutTask> send_timeout_task_; | 187 scoped_ptr<TimeoutTask> send_timeout_task_; |
189 | 188 |
190 // Asynchronous I/O handler. | 189 // Asynchronous I/O handler. |
191 scoped_refptr<SerialIoHandler> io_handler_; | 190 scoped_refptr<SerialIoHandler> io_handler_; |
192 }; | 191 }; |
193 | 192 |
194 } // namespace extensions | 193 } // namespace extensions |
195 | 194 |
| 195 namespace mojo { |
| 196 |
| 197 template <> |
| 198 class TypeConverter<device::HostControlSignalsPtr, |
| 199 extensions::api::serial::HostControlSignals> { |
| 200 public: |
| 201 static device::HostControlSignalsPtr ConvertFrom( |
| 202 const extensions::api::serial::HostControlSignals& input); |
| 203 }; |
| 204 |
| 205 template <> |
| 206 class TypeConverter<device::ConnectionOptionsPtr, |
| 207 extensions::api::serial::ConnectionOptions> { |
| 208 public: |
| 209 static device::ConnectionOptionsPtr ConvertFrom( |
| 210 const extensions::api::serial::ConnectionOptions& input); |
| 211 }; |
| 212 |
| 213 } // namespace mojo |
| 214 |
196 #endif // CHROME_BROWSER_EXTENSIONS_API_SERIAL_SERIAL_CONNECTION_H_ | 215 #endif // CHROME_BROWSER_EXTENSIONS_API_SERIAL_SERIAL_CONNECTION_H_ |
OLD | NEW |