| 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 | 66 |
| 67 void set_send_timeout(int send_timeout); | 67 void set_send_timeout(int send_timeout); |
| 68 int send_timeout() const { return send_timeout_; } | 68 int send_timeout() const { return send_timeout_; } |
| 69 | 69 |
| 70 void set_paused(bool paused); | 70 void set_paused(bool paused); |
| 71 bool paused() const { return paused_; } | 71 bool paused() const { return paused_; } |
| 72 | 72 |
| 73 // Initiates an asynchronous Open of the device. It is the caller's | 73 // Initiates an asynchronous Open of the device. It is the caller's |
| 74 // responsibility to ensure that this SerialConnection stays alive | 74 // responsibility to ensure that this SerialConnection stays alive |
| 75 // until |callback| is run. | 75 // until |callback| is run. |
| 76 void Open(const OpenCompleteCallback& callback); | 76 void Open(const core_api::serial::ConnectionOptions& options, |
| 77 const OpenCompleteCallback& callback); |
| 77 | 78 |
| 78 // Begins an asynchronous receive operation. Calling this while a Receive | 79 // Begins an asynchronous receive operation. Calling this while a Receive |
| 79 // is already pending is a no-op and returns |false| without calling | 80 // is already pending is a no-op and returns |false| without calling |
| 80 // |callback|. | 81 // |callback|. |
| 81 bool Receive(const ReceiveCompleteCallback& callback); | 82 bool Receive(const ReceiveCompleteCallback& callback); |
| 82 | 83 |
| 83 // Begins an asynchronous send operation. Calling this while a Send | 84 // Begins an asynchronous send operation. Calling this while a Send |
| 84 // is already pending is a no-op and returns |false| without calling | 85 // is already pending is a no-op and returns |false| without calling |
| 85 // |callback|. | 86 // |callback|. |
| 86 bool Send(const std::vector<char>& data, | 87 bool Send(const std::vector<char>& data, |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 template <> | 208 template <> |
| 208 struct TypeConverter<device::serial::ConnectionOptionsPtr, | 209 struct TypeConverter<device::serial::ConnectionOptionsPtr, |
| 209 extensions::core_api::serial::ConnectionOptions> { | 210 extensions::core_api::serial::ConnectionOptions> { |
| 210 static device::serial::ConnectionOptionsPtr Convert( | 211 static device::serial::ConnectionOptionsPtr Convert( |
| 211 const extensions::core_api::serial::ConnectionOptions& input); | 212 const extensions::core_api::serial::ConnectionOptions& input); |
| 212 }; | 213 }; |
| 213 | 214 |
| 214 } // namespace mojo | 215 } // namespace mojo |
| 215 | 216 |
| 216 #endif // EXTENSIONS_BROWSER_API_SERIAL_SERIAL_CONNECTION_H_ | 217 #endif // EXTENSIONS_BROWSER_API_SERIAL_SERIAL_CONNECTION_H_ |
| OLD | NEW |