OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 // 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 callback GetPortsCallback = void (DOMString[] ports); | 9 callback GetPortsCallback = void (DOMString[] ports); |
10 | 10 |
| 11 enum DataBit { sevenbit, eightbit }; |
| 12 enum ParityBit { noparity, oddparity, evenparity }; |
| 13 enum StopBit { onestopbit, twostopbit }; |
| 14 |
11 dictionary OpenOptions { | 15 dictionary OpenOptions { |
12 // The requested bitrate of the connection to be opened. For compatibility | 16 // The requested bitrate of the connection to be opened. For compatibility |
13 // with the widest range of hardware, this number should match one of | 17 // with the widest range of hardware, this number should match one of |
14 // commonly-available bitrates, such as 110, 300, 1200, 2400, 4800, 9600, | 18 // commonly-available bitrates, such as 110, 300, 1200, 2400, 4800, 9600, |
15 // 14400, 19200, 38400, 57600, 115200. There is no guarantee, of course, | 19 // 14400, 19200, 38400, 57600, 115200. There is no guarantee, of course, |
16 // that the device connected to the serial port will support the requested | 20 // that the device connected to the serial port will support the requested |
17 // bitrate, even if the port itself supports that bitrate. | 21 // bitrate, even if the port itself supports that bitrate. <code>9600</code> |
18 long bitrate; | 22 // will be passed by default. |
| 23 long? bitrate; |
| 24 // <code>"eightbit"</code> will be passed by default. |
| 25 DataBit? dataBit; |
| 26 // <code>"noparity"</code> will be passed by default. |
| 27 ParityBit? parityBit; |
| 28 // <code>"onestopbit"</code> will be passed by default. |
| 29 StopBit? stopBit; |
19 }; | 30 }; |
20 | 31 |
21 dictionary OpenInfo { | 32 dictionary OpenInfo { |
22 // The id of the opened connection. | 33 // The id of the opened connection. |
23 long connectionId; | 34 long connectionId; |
24 }; | 35 }; |
25 | 36 |
26 callback OpenCallback = void (OpenInfo openInfo); | 37 callback OpenCallback = void (OpenInfo openInfo); |
27 | 38 |
28 // Returns true if operation was successful. | 39 // Returns true if operation was successful. |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 | 137 |
127 static void getControlSignals(long connectionId, | 138 static void getControlSignals(long connectionId, |
128 GetControlSignalsCallback callback); | 139 GetControlSignalsCallback callback); |
129 | 140 |
130 static void setControlSignals(long connectionId, | 141 static void setControlSignals(long connectionId, |
131 ControlSignalOptions options, | 142 ControlSignalOptions options, |
132 SetControlSignalsCallback callback); | 143 SetControlSignalsCallback callback); |
133 }; | 144 }; |
134 | 145 |
135 }; | 146 }; |
OLD | NEW |