| 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 module device.serial; | 5 module device.serial; |
| 6 | 6 |
| 7 import "data_stream.mojom"; | |
| 8 | |
| 9 struct DeviceInfo { | 7 struct DeviceInfo { |
| 10 string path; | 8 string path; |
| 11 uint16 vendor_id; | 9 uint16 vendor_id; |
| 12 bool has_vendor_id = false; | 10 bool has_vendor_id = false; |
| 13 uint16 product_id; | 11 uint16 product_id; |
| 14 bool has_product_id = false; | 12 bool has_product_id = false; |
| 15 string? display_name; | 13 string? display_name; |
| 16 }; | 14 }; |
| 17 | 15 |
| 18 enum SendError { | 16 enum SendError { |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 bool rts; | 76 bool rts; |
| 79 bool has_rts = false; | 77 bool has_rts = false; |
| 80 }; | 78 }; |
| 81 | 79 |
| 82 struct DeviceControlSignals { | 80 struct DeviceControlSignals { |
| 83 bool dcd; | 81 bool dcd; |
| 84 bool cts; | 82 bool cts; |
| 85 bool ri; | 83 bool ri; |
| 86 bool dsr; | 84 bool dsr; |
| 87 }; | 85 }; |
| 88 | |
| 89 interface SerialService { | |
| 90 GetDevices() => (array<DeviceInfo> devices); | |
| 91 | |
| 92 // Creates a |Connection| to |path| with options specified by |options|, | |
| 93 // returning it via |connection|. Sending and receiving data over this | |
| 94 // connection is handled by |sink| and |source|, respectively. This will fail | |
| 95 // and |connection| will not be usable if |path| does not specify a valid | |
| 96 // serial device or there is an error connecting to or configuring the | |
| 97 // connection. | |
| 98 Connect(string path, | |
| 99 ConnectionOptions? options, | |
| 100 Connection& connection, | |
| 101 DataSink& sink, | |
| 102 DataSource& source, | |
| 103 DataSourceClient source_client); | |
| 104 }; | |
| 105 | |
| 106 interface Connection { | |
| 107 GetInfo() => (ConnectionInfo? info); | |
| 108 SetOptions(ConnectionOptions options) => (bool success); | |
| 109 SetControlSignals(HostControlSignals signals) => (bool success); | |
| 110 GetControlSignals() => (DeviceControlSignals? signals); | |
| 111 Flush() => (bool success); | |
| 112 }; | |
| OLD | NEW |