-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDeviceService.proto
92 lines (80 loc) · 1.7 KB
/
DeviceService.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
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
87
88
89
90
91
92
syntax = "proto3";
package IoT;
import "google/protobuf/empty.proto";
service DeviceService {
rpc GetDeviceInformation (google.protobuf.Empty) returns (DeviceInfo);
rpc ReadOutput (OutputReadRequest) returns (OutputValue);
rpc ReadOutputStream (OutputReadRequest) returns (stream OutputValue);
}
enum DeviceHealthCheck {
NONE = 0;
PULL = 1;
STREAM = 2;
BOTH = 3;
}
message OutputTypes {
message Digital {}
message Analog {
int32 min_value = 1;
int32 max_value = 2;
}
}
message InputTypes {
message Digital {}
message Analog {
int32 min_value = 1;
int32 max_value = 2;
}
}
message OutputReadRequest {
uint32 index = 1;
}
message OutputValue {
message DigitalValue {
bool value = 1;
}
message AnalogValue {
int32 value = 2;
}
oneof Value {
DigitalValue digital = 1;
AnalogValue analog = 2;
}
}
message DeviceInfo {
string id = 1;
DeviceHealthCheck health_check = 2;
optional string name = 3;
enum OutputMode {
UNREDEABLE = 0;
READ = 1; // gRPC method invoke
READ_STREAM = 2; // gRPC stream
PUSH_TO_BUS = 3; // Set PUSH endpoint/queue
}
enum InputMode {
UNCOMMANDABLE = 0;
SELF_PULL = 1; // read commands from queue
WRITE_STREAM = 2; // input stream
INVOKE = 3; // gRPC method invoke
}
message DeviceOutput {
uint32 index = 1;
optional string name = 2;
repeated OutputMode modes = 3;
oneof output_type {
OutputTypes.Digital digital = 101;
OutputTypes.Analog analog = 102;
}
}
repeated DeviceOutput outputs = 4;
message DeviceInput {
uint32 index = 1;
optional string name = 2;
repeated InputMode modes = 3;
oneof input_type {
InputTypes.Digital digital = 101;
InputTypes.Analog analog = 102;
}
}
repeated DeviceInput inputs = 5;
}