summaryrefslogtreecommitdiffstats
path: root/device/serial/serial.mojom
blob: 0c4f1003312479044fd0a96153782155c36258aa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

module device.serial {

struct DeviceInfo {
  string path;
  uint16 vendor_id;
  bool has_vendor_id = false;
  uint16 product_id;
  bool has_product_id = false;
  string display_name;
};

enum SendError {
  NONE,
  DISCONNECTED,
  PENDING,
  TIMEOUT,
  SYSTEM_ERROR,
};

enum ReceiveError {
  NONE,
  DISCONNECTED,
  TIMEOUT,
  DEVICE_LOST,
  SYSTEM_ERROR,
};

enum DataBits {
  NONE,
  SEVEN,
  EIGHT,
};

enum ParityBit {
  NONE,
  NO,
  ODD,
  EVEN,
};

enum StopBits {
  NONE,
  ONE,
  TWO,
};

struct ConnectionOptions {
  uint32 bitrate = 0;
  DataBits data_bits = NONE;
  ParityBit parity_bit = NONE;
  StopBits stop_bits = NONE;
  bool cts_flow_control;
  bool has_cts_flow_control = false;
};

struct ConnectionInfo {
  uint32 bitrate = 0;
  DataBits data_bits = NONE;
  ParityBit parity_bit = NONE;
  StopBits stop_bits = NONE;
  bool cts_flow_control;
};

struct HostControlSignals {
  bool dtr;
  bool has_dtr = false;
  bool rts;
  bool has_rts = false;
};

struct DeviceControlSignals {
  bool dcd;
  bool cts;
  bool ri;
  bool dsr;
};

interface SerialService {
  GetDevices() => (DeviceInfo[] devices);
};

}