| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 EXTENSIONS_BROWSER_API_SERIAL_SERIAL_CONNECTION_H_ | 5 #ifndef EXTENSIONS_BROWSER_API_SERIAL_SERIAL_CONNECTION_H_ |
| 6 #define EXTENSIONS_BROWSER_API_SERIAL_SERIAL_CONNECTION_H_ | 6 #define EXTENSIONS_BROWSER_API_SERIAL_SERIAL_CONNECTION_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 // successfully read. | 105 // successfully read. |
| 106 bool GetControlSignals( | 106 bool GetControlSignals( |
| 107 core_api::serial::DeviceControlSignals* control_signals) const; | 107 core_api::serial::DeviceControlSignals* control_signals) const; |
| 108 | 108 |
| 109 // Sets one or more control signals (DTR and/or RTS). Returns |true| iff | 109 // Sets one or more control signals (DTR and/or RTS). Returns |true| iff |
| 110 // the signals were successfully set. Unininitialized flags in the | 110 // the signals were successfully set. Unininitialized flags in the |
| 111 // HostControlSignals structure are left unchanged. | 111 // HostControlSignals structure are left unchanged. |
| 112 bool SetControlSignals( | 112 bool SetControlSignals( |
| 113 const core_api::serial::HostControlSignals& control_signals); | 113 const core_api::serial::HostControlSignals& control_signals); |
| 114 | 114 |
| 115 // Suspend character transmission. Known as setting/sending 'Break' signal. |
| 116 bool SetBreak(); |
| 117 |
| 118 // Restore character transmission. Known as clear/stop sending 'Break' signal. |
| 119 bool ClearBreak(); |
| 120 |
| 115 // Overrides |io_handler_| for testing. | 121 // Overrides |io_handler_| for testing. |
| 116 void SetIoHandlerForTest(scoped_refptr<device::SerialIoHandler> handler); | 122 void SetIoHandlerForTest(scoped_refptr<device::SerialIoHandler> handler); |
| 117 | 123 |
| 118 static const BrowserThread::ID kThreadId = BrowserThread::IO; | 124 static const BrowserThread::ID kThreadId = BrowserThread::IO; |
| 119 | 125 |
| 120 private: | 126 private: |
| 121 friend class ApiResourceManager<SerialConnection>; | 127 friend class ApiResourceManager<SerialConnection>; |
| 122 static const char* service_name() { return "SerialConnectionManager"; } | 128 static const char* service_name() { return "SerialConnectionManager"; } |
| 123 | 129 |
| 124 // Encapsulates a cancelable, delayed timeout task. Posts a delayed | 130 // Encapsulates a cancelable, delayed timeout task. Posts a delayed |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 template <> | 214 template <> |
| 209 struct TypeConverter<device::serial::ConnectionOptionsPtr, | 215 struct TypeConverter<device::serial::ConnectionOptionsPtr, |
| 210 extensions::core_api::serial::ConnectionOptions> { | 216 extensions::core_api::serial::ConnectionOptions> { |
| 211 static device::serial::ConnectionOptionsPtr Convert( | 217 static device::serial::ConnectionOptionsPtr Convert( |
| 212 const extensions::core_api::serial::ConnectionOptions& input); | 218 const extensions::core_api::serial::ConnectionOptions& input); |
| 213 }; | 219 }; |
| 214 | 220 |
| 215 } // namespace mojo | 221 } // namespace mojo |
| 216 | 222 |
| 217 #endif // EXTENSIONS_BROWSER_API_SERIAL_SERIAL_CONNECTION_H_ | 223 #endif // EXTENSIONS_BROWSER_API_SERIAL_SERIAL_CONNECTION_H_ |
| OLD | NEW |