-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserial.proto
61 lines (54 loc) · 1.39 KB
/
serial.proto
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
syntax = "proto3";
package lebai.serial;
import "google/protobuf/empty.proto";
message SetSerialTimeoutRequest {
string device = 1;
// 超时时间,默认800ms,特殊地0为不超时
uint32 timeout = 11;
}
message SetSerialBaudRateRequest {
string device = 1;
// 波特率,默认115200
uint32 baud_rate = 11 [json_name = "baud_rate"];
}
enum Parity {
// No parity bit.
None = 0;
// Parity bit sets odd number of 1 bits.
Odd = 1;
// Parity bit sets even number of 1 bits.
Even = 2;
}
message SetSerialParityRequest {
string device = 1;
// 校验位
Parity parity = 11;
}
message WriteSerialRequest {
string device = 1;
// u8数组
repeated uint32 data = 11;
}
message ReadSerialRequest {
string device = 1;
// 单次接收的最大缓冲长度
uint32 len = 11;
}
message ReadSerialResponse {
// u8数组
repeated uint32 data = 11;
}
// 串口相关服务
service SerialService {
// 设置超时时间
rpc SetSerialTimeout(SetSerialTimeoutRequest) returns (google.protobuf.Empty);
// 设置波特率
rpc SetSerialBaudRate(SetSerialBaudRateRequest)
returns (google.protobuf.Empty);
// 设置校验位
rpc SetSerialParity(SetSerialParityRequest) returns (google.protobuf.Empty);
// 发送数据
rpc WriteSerial(WriteSerialRequest) returns (google.protobuf.Empty);
// 读取数据
rpc ReadSerial(ReadSerialRequest) returns (ReadSerialResponse);
}