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 // File-level comment to appease parser. Eventually this will not be necessary. | 5 // File-level comment to appease parser. Eventually this will not be necessary. |
6 | 6 |
7 namespace experimental.serial { | 7 namespace experimental.serial { |
8 | 8 |
9 callback GetPortsCallback = void (DOMString[] ports); | 9 callback GetPortsCallback = void (DOMString[] ports); |
10 | 10 |
(...skipping 12 matching lines...) Expand all Loading... |
23 long connectionId; | 23 long connectionId; |
24 }; | 24 }; |
25 | 25 |
26 callback OpenCallback = void (OpenInfo openInfo); | 26 callback OpenCallback = void (OpenInfo openInfo); |
27 | 27 |
28 // Returns true if operation was successful. | 28 // Returns true if operation was successful. |
29 callback CloseCallback = void (boolean result); | 29 callback CloseCallback = void (boolean result); |
30 | 30 |
31 dictionary ReadInfo { | 31 dictionary ReadInfo { |
32 // The number of bytes received, or a negative number if an error occurred. | 32 // The number of bytes received, or a negative number if an error occurred. |
| 33 // This number will be smaller than the number of bytes requested in the |
| 34 // original read call if the call would need to block to read that number |
| 35 // of bytes. |
33 long bytesRead; | 36 long bytesRead; |
34 | 37 |
35 // The data received. | 38 // The data received. |
36 ArrayBuffer data; | 39 ArrayBuffer data; |
37 }; | 40 }; |
38 | 41 |
39 callback ReadCallback = void (ReadInfo readInfo); | 42 callback ReadCallback = void (ReadInfo readInfo); |
40 | 43 |
41 dictionary WriteInfo { | 44 dictionary WriteInfo { |
42 // The number of bytes written. | 45 // The number of bytes written. |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 OpenCallback callback); | 96 OpenCallback callback); |
94 | 97 |
95 // Closes an open connection. | 98 // Closes an open connection. |
96 // |connectionId| : The id of the opened connection. | 99 // |connectionId| : The id of the opened connection. |
97 // |callback| : Called when the connection has been closed. | 100 // |callback| : Called when the connection has been closed. |
98 static void close(long connectionId, | 101 static void close(long connectionId, |
99 CloseCallback callback); | 102 CloseCallback callback); |
100 | 103 |
101 // Reads a byte from the given connection. | 104 // Reads a byte from the given connection. |
102 // |connectionId| : The id of the connection. | 105 // |connectionId| : The id of the connection. |
103 // |callback| : Called when the byte has been read or the read blocked. | 106 // |bytesToRead| : The number of bytes to read. |
| 107 // |callback| : Called when all the requested bytes have been read or |
| 108 // when the read blocks. |
104 static void read(long connectionId, | 109 static void read(long connectionId, |
| 110 long bytesToRead, |
105 ReadCallback callback); | 111 ReadCallback callback); |
106 | 112 |
107 // Writes a string to the given connection. | 113 // Writes a string to the given connection. |
108 // |connectionId| : The id of the connection. | 114 // |connectionId| : The id of the connection. |
109 // |data| : The string to write. | 115 // |data| : The string to write. |
110 // |callback| : Called when the string has been written. | 116 // |callback| : Called when the string has been written. |
111 static void write(long connectionId, | 117 static void write(long connectionId, |
112 ArrayBuffer data, | 118 ArrayBuffer data, |
113 WriteCallback callback); | 119 WriteCallback callback); |
114 | 120 |
115 // Flushes all bytes in the given connection's input and output buffers. | 121 // Flushes all bytes in the given connection's input and output buffers. |
116 // |connectionId| : The id of the connection. | 122 // |connectionId| : The id of the connection. |
117 // |callback| : Called when the flush is complete. | 123 // |callback| : Called when the flush is complete. |
118 static void flush(long connectionId, | 124 static void flush(long connectionId, |
119 FlushCallback callback); | 125 FlushCallback callback); |
120 | 126 |
121 static void getControlSignals(long connectionId, | 127 static void getControlSignals(long connectionId, |
122 GetControlSignalsCallback callback); | 128 GetControlSignalsCallback callback); |
123 | 129 |
124 static void setControlSignals(long connectionId, | 130 static void setControlSignals(long connectionId, |
125 ControlSignalOptions options, | 131 ControlSignalOptions options, |
126 SetControlSignalsCallback callback); | 132 SetControlSignalsCallback callback); |
127 }; | 133 }; |
128 | 134 |
129 }; | 135 }; |
OLD | NEW |