| 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 [nodoc] namespace experimental.serial { | 7 [nodoc] namespace experimental.serial { |
| 8 | 8 |
| 9 callback GetPortsCallback = void (DOMString[] ports); | 9 callback GetPortsCallback = void (DOMString[] ports); |
| 10 | 10 |
| 11 dictionary OpenInfo { | 11 dictionary OpenInfo { |
| 12 // The id of the opened connection. | 12 // The id of the opened connection. |
| 13 long connectionId; | 13 long connectionId; |
| 14 }; | 14 }; |
| 15 | 15 |
| 16 callback OpenCallback = void (OpenInfo openInfo); | 16 callback OpenCallback = void (OpenInfo openInfo); |
| 17 | 17 |
| 18 callback CloseCallback = void (boolean result); | 18 callback CloseCallback = void (boolean result); |
| 19 | 19 |
| 20 dictionary ReadInfo { | 20 dictionary ReadInfo { |
| 21 // The number of bytes received, or a negative number if an error occurred. | 21 // The number of bytes received, or a negative number if an error occurred. |
| 22 long bytesRead; | 22 long bytesRead; |
| 23 | 23 |
| 24 // The data received. Warning: will probably become a blob or other | 24 // The data received. |
| 25 // appropriate binary-friendly type. | 25 ArrayBuffer data; |
| 26 // TODO(miket): [instanceOf=ArrayBuffer]object data; | |
| 27 long[] data; | |
| 28 }; | 26 }; |
| 29 | 27 |
| 30 callback ReadCallback = void (ReadInfo readInfo); | 28 callback ReadCallback = void (ReadInfo readInfo); |
| 31 | 29 |
| 32 dictionary WriteInfo { | 30 dictionary WriteInfo { |
| 33 // The number of bytes written. | 31 // The number of bytes written. |
| 34 long bytesWritten; | 32 long bytesWritten; |
| 35 }; | 33 }; |
| 36 | 34 |
| 37 callback WriteCallback = void (WriteInfo writeInfo); | 35 callback WriteCallback = void (WriteInfo writeInfo); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 59 // Reads a byte from the given connection. | 57 // Reads a byte from the given connection. |
| 60 // |connectionId| : The id of the connection. | 58 // |connectionId| : The id of the connection. |
| 61 // |callback| : Called when the byte has been read or the read blocked. | 59 // |callback| : Called when the byte has been read or the read blocked. |
| 62 static void read(long connectionId, | 60 static void read(long connectionId, |
| 63 ReadCallback callback); | 61 ReadCallback callback); |
| 64 | 62 |
| 65 // Writes a string to the given connection. | 63 // Writes a string to the given connection. |
| 66 // |connectionId| : The id of the connection. | 64 // |connectionId| : The id of the connection. |
| 67 // |data| : The string to write. | 65 // |data| : The string to write. |
| 68 // |callback| : Called when the string has been written. | 66 // |callback| : Called when the string has been written. |
| 69 // | |
| 70 // TODO(miket): [instanceOf=ArrayBuffer]object data; | |
| 71 static void write(long connectionId, | 67 static void write(long connectionId, |
| 72 long[] data, | 68 ArrayBuffer data, |
| 73 WriteCallback callback); | 69 WriteCallback callback); |
| 74 }; | 70 }; |
| 75 | 71 |
| 76 }; | 72 }; |
| OLD | NEW |