Fix lint new api error in SystemMessageHandler.
[chromium-blink-merge.git] / device / serial / serial.mojom
blob27f3258660b32fcef549e4194372a8b0385daf95
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
3 // found in the LICENSE file.
5 module device.serial;
7 import "data_stream.mojom";
9 struct DeviceInfo {
10   string path;
11   uint16 vendor_id;
12   bool has_vendor_id = false;
13   uint16 product_id;
14   bool has_product_id = false;
15   string? display_name;
18 enum SendError {
19   NONE,
20   DISCONNECTED,
21   PENDING,
22   TIMEOUT,
23   SYSTEM_ERROR,
26 enum ReceiveError {
27   NONE,
28   DISCONNECTED,
29   TIMEOUT,
30   DEVICE_LOST,
31   BREAK,
32   FRAME_ERROR,
33   OVERRUN,
34   BUFFER_OVERFLOW,
35   PARITY_ERROR,
36   SYSTEM_ERROR,
39 enum DataBits {
40   NONE,
41   SEVEN,
42   EIGHT,
45 enum ParityBit {
46   NONE,
47   NO,
48   ODD,
49   EVEN,
52 enum StopBits {
53   NONE,
54   ONE,
55   TWO,
58 struct ConnectionOptions {
59   uint32 bitrate = 0;
60   DataBits data_bits = NONE;
61   ParityBit parity_bit = NONE;
62   StopBits stop_bits = NONE;
63   bool cts_flow_control;
64   bool has_cts_flow_control = false;
67 struct ConnectionInfo {
68   uint32 bitrate = 0;
69   DataBits data_bits = NONE;
70   ParityBit parity_bit = NONE;
71   StopBits stop_bits = NONE;
72   bool cts_flow_control;
75 struct HostControlSignals {
76   bool dtr;
77   bool has_dtr = false;
78   bool rts;
79   bool has_rts = false;
82 struct DeviceControlSignals {
83   bool dcd;
84   bool cts;
85   bool ri;
86   bool dsr;
89 interface SerialService {
90   GetDevices() => (array<DeviceInfo> devices);
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);
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);