-
Notifications
You must be signed in to change notification settings - Fork 1
/
api.proto
137 lines (110 loc) · 2.95 KB
/
api.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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
syntax = "proto3";
import "common.proto";
package telegraph.api;
// to be converted to json
// for both the javascript/c++ server/client code
message ParamsEntry {
string key = 1;
Params value = 2;
}
message ParamsMap {
repeated ParamsEntry entries = 1;
}
message ParamsList {
repeated Params elements = 1;
}
// json-like structure, as a protobuffer
// if all are unset, equivalent to null
message Params {
oneof content {
Node tree = 1;
string uuid = 2;
bool b = 3;
float number = 4;
string str = 5;
ParamsMap object = 6;
ParamsList array = 7;
Empty none = 8;
}
}
message Context {
string uuid = 1;
bool headless = 2;
string name = 3;
string type = 4;
Params params = 5;
}
// creation options
message Create {
string name = 1;
string type = 2;
Params params = 3;
}
message Request {
string uuid = 1;
Params params = 2;
}
message Namespace {
repeated Context contexts = 1;
}
// tree operations
message Subscription {
string uuid = 1; // context uuid
repeated string variable = 2;
float debounce = 3;
float refresh = 4;
float timeout = 5;
}
message Call {
string uuid = 1; // context uuid
repeated string action = 2; // path to action, specified the children indices
Value value = 3;
float timeout = 4;
}
message DataWrite {
string uuid = 1; // context uuid
repeated string path = 2;
repeated Datapoint data = 3;
}
message DataQuery {
string uuid = 1;
repeated string path = 2;
}
message DataPacket {
repeated Datapoint data = 1;
}
message Packet {
sint32 req_id = 1;
oneof payload {
float cancel = 2; // timeout for sub cancel response from board, ignored for queries
string error = 3;
bool success = 4;
// every server/client can only have a
// single associated namespace uuid that cannot change
// this can also be used as a heartbeat packet since it has no sideaffects
Empty query_ns = 5;
Namespace ns = 6;
Context added = 7;
string removed = 8;
Create create = 9;
string created = 10; // uuid of created context
string destroy = 11;
Request request = 12;
Params request_update = 13;
// tree operations:
string fetch_tree = 14; // context uuid to fetch tree
Node fetched_tree = 15; // response to a context fetch
Subscription sub_change = 16;
Empty sub_poll = 17;
Empty sub_reset = 18;
Type sub_type = 19;
Datapoint sub_update = 20; // keep receiving until the original request id is cancelled
Call call_action = 21;
Datapoint call_return = 22;
// archive operations:
DataWrite data_write = 23;
DataQuery data_query = 24;
DataPacket archive_data = 25; // initial response to a query
DataPacket archive_update = 26; // any archive updates
}
}