| 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 // Use the <code>chrome.serial</code> API to read from and write to a device | 5 // Use the <code>chrome.serial</code> API to read from and write to a device |
| 6 // connected to a serial port. | 6 // connected to a serial port. |
| 7 namespace serial { | 7 namespace serial { |
| 8 | 8 |
| 9 dictionary DeviceInfo { | 9 dictionary DeviceInfo { |
| 10 // The device's system path. This should be passed as the <code>path</code> | 10 // The device's system path. This should be passed as the <code>path</code> |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 long bytesSent; | 164 long bytesSent; |
| 165 | 165 |
| 166 // An error code if an error occurred. | 166 // An error code if an error occurred. |
| 167 SendError? error; | 167 SendError? error; |
| 168 }; | 168 }; |
| 169 | 169 |
| 170 callback SendCallback = void (SendInfo sendInfo); | 170 callback SendCallback = void (SendInfo sendInfo); |
| 171 | 171 |
| 172 callback FlushCallback = void (boolean result); | 172 callback FlushCallback = void (boolean result); |
| 173 | 173 |
| 174 callback SetBreakCallback = void (boolean result); |
| 175 |
| 176 callback ClearBreakCallback = void (boolean result); |
| 177 |
| 174 // The set of control signals which may be sent to a connected serial device | 178 // The set of control signals which may be sent to a connected serial device |
| 175 // using <code>setControlSignals</code>. Note that support for these signals | 179 // using <code>setControlSignals</code>. Note that support for these signals |
| 176 // is device-dependent. | 180 // is device-dependent. |
| 177 dictionary HostControlSignals { | 181 dictionary HostControlSignals { |
| 178 // DTR (Data Terminal Ready). | 182 // DTR (Data Terminal Ready). |
| 179 boolean? dtr; | 183 boolean? dtr; |
| 180 | 184 |
| 181 // RTS (Request To Send). | 185 // RTS (Request To Send). |
| 182 boolean? rts; | 186 boolean? rts; |
| 183 }; | 187 }; |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 static void getControlSignals(long connectionId, | 304 static void getControlSignals(long connectionId, |
| 301 GetControlSignalsCallback callback); | 305 GetControlSignalsCallback callback); |
| 302 | 306 |
| 303 // Sets the state of control signals on a given connection. | 307 // Sets the state of control signals on a given connection. |
| 304 // |connectionId| : The id of the connection. | 308 // |connectionId| : The id of the connection. |
| 305 // |signals| : The set of signal changes to send to the device. | 309 // |signals| : The set of signal changes to send to the device. |
| 306 // |callback| : Called once the control signals have been set. | 310 // |callback| : Called once the control signals have been set. |
| 307 static void setControlSignals(long connectionId, | 311 static void setControlSignals(long connectionId, |
| 308 HostControlSignals signals, | 312 HostControlSignals signals, |
| 309 SetControlSignalsCallback callback); | 313 SetControlSignalsCallback callback); |
| 314 |
| 315 // Suspends character transmission on a given connection and places the |
| 316 // transmission line in a break state until the clearBreak is called. |
| 317 // |connectionId| : The id of the connection. |
| 318 static void setBreak(long connectionId, SetBreakCallback callback); |
| 319 |
| 320 // Restore character transmission on a given connection and place the |
| 321 // transmission line in a nonbreak state. |
| 322 // |connectionId| : The id of the connection. |
| 323 static void clearBreak(long connectionId, ClearBreakCallback callback); |
| 310 }; | 324 }; |
| 311 | 325 |
| 312 interface Events { | 326 interface Events { |
| 313 // Event raised when data has been read from the connection. | 327 // Event raised when data has been read from the connection. |
| 314 // |info| : Event data. | 328 // |info| : Event data. |
| 315 static void onReceive(ReceiveInfo info); | 329 static void onReceive(ReceiveInfo info); |
| 316 | 330 |
| 317 // Event raised when an error occurred while the runtime was waiting for | 331 // Event raised when an error occurred while the runtime was waiting for |
| 318 // data on the serial port. Once this event is raised, the connection may be | 332 // data on the serial port. Once this event is raised, the connection may be |
| 319 // set to <code>paused</code>. A <code>"timeout"</code> error does not pause | 333 // set to <code>paused</code>. A <code>"timeout"</code> error does not pause |
| 320 // the connection. | 334 // the connection. |
| 321 static void onReceiveError(ReceiveErrorInfo info); | 335 static void onReceiveError(ReceiveErrorInfo info); |
| 322 }; | 336 }; |
| 323 }; | 337 }; |
| OLD | NEW |