edge.proto
7.26 KB
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
/**
* Copyright © 2016-2020 The Thingsboard Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
syntax = "proto3";
option java_package = "org.thingsboard.server.gen.edge";
option java_multiple_files = true;
option java_outer_classname = "EdgeProtos";
import "queue.proto";
package edge;
// Interface exported by the ThingsBoard Edge Transport.
service EdgeRpcService {
rpc handleMsgs(stream RequestMsg) returns (stream ResponseMsg) {}
}
/**
* Data Structures;
*/
message RequestMsg {
RequestMsgType msgType = 1;
ConnectRequestMsg connectRequestMsg = 2;
UplinkMsg uplinkMsg = 3;
}
message ResponseMsg {
ConnectResponseMsg connectResponseMsg = 1;
UplinkResponseMsg uplinkResponseMsg = 2;
EntityUpdateMsg entityUpdateMsg = 3;
DownlinkMsg downlinkMsg = 4;
}
message EntityUpdateMsg {
DeviceUpdateMsg deviceUpdateMsg = 1;
DeviceCredentialsUpdateMsg deviceCredentialsUpdateMsg = 2;
RuleChainUpdateMsg ruleChainUpdateMsg = 3;
RuleChainMetadataUpdateMsg ruleChainMetadataUpdateMsg = 4;
DashboardUpdateMsg dashboardUpdateMsg = 5;
AssetUpdateMsg assetUpdateMsg = 6;
EntityViewUpdateMsg entityViewUpdateMsg = 7;
AlarmUpdateMsg alarmUpdateMsg = 8;
UserUpdateMsg userUpdateMsg = 9;
UserCredentialsUpdateMsg userCredentialsUpdateMsg = 10;
CustomerUpdateMsg customerUpdateMsg = 11;
RelationUpdateMsg relationUpdateMsg = 12;
}
enum RequestMsgType {
CONNECT_RPC_MESSAGE = 0;
UPLINK_RPC_MESSAGE = 1;
}
message ConnectRequestMsg {
string edgeRoutingKey = 1;
string edgeSecret = 2;
}
enum ConnectResponseCode {
ACCEPTED = 0;
BAD_CREDENTIALS = 1;
SERVER_UNAVAILABLE = 2;
}
message ConnectResponseMsg {
ConnectResponseCode responseCode = 1;
string errorMsg = 2;
EdgeConfiguration configuration = 3;
}
message EdgeConfiguration {
int64 tenantIdMSB = 1;
int64 tenantIdLSB = 2;
string name = 3;
string routingKey = 4;
string type = 5;
string cloudType = 6;
}
enum UpdateMsgType {
ENTITY_CREATED_RPC_MESSAGE = 0;
ENTITY_UPDATED_RPC_MESSAGE = 1;
ENTITY_DELETED_RPC_MESSAGE = 2;
ALARM_ACK_RPC_MESSAGE = 3;
ALARM_CLEAR_RPC_MESSAGE = 4;
DEVICE_CONFLICT_RPC_MESSAGE = 5;
}
message EntityDataProto {
int64 entityIdMSB = 1;
int64 entityIdLSB = 2;
string entityType = 3;
transport.PostTelemetryMsg postTelemetryMsg = 4;
transport.PostAttributeMsg postAttributesMsg = 5;
// transport.ToDeviceRpcRequestMsg ???
}
message RuleChainUpdateMsg {
UpdateMsgType msgType = 1;
int64 idMSB = 2;
int64 idLSB = 3;
string name = 4;
int64 firstRuleNodeIdMSB = 5;
int64 firstRuleNodeIdLSB = 6;
bool root = 7;
bool debugMode = 8;
string configuration = 9;
}
message RuleChainMetadataUpdateMsg {
UpdateMsgType msgType = 1;
int64 ruleChainIdMSB = 2;
int64 ruleChainIdLSB = 3;
int32 firstNodeIndex = 4;
repeated RuleNodeProto nodes = 5;
repeated NodeConnectionInfoProto connections = 6;
repeated RuleChainConnectionInfoProto ruleChainConnections = 7;
}
message RuleNodeProto {
int64 idMSB = 1;
int64 idLSB = 2;
string type = 3;
string name = 4;
bool debugMode = 5;
string configuration = 6;
string additionalInfo = 7;
}
message NodeConnectionInfoProto {
int32 fromIndex = 1;
int32 toIndex = 2;
string type = 3;
}
message RuleChainConnectionInfoProto {
int32 fromIndex = 1;
int64 targetRuleChainIdMSB = 2;
int64 targetRuleChainIdLSB = 3;
string type = 4;
string additionalInfo = 5;
}
message DashboardUpdateMsg {
UpdateMsgType msgType = 1;
int64 idMSB = 2;
int64 idLSB = 3;
string title = 4;
string configuration = 5;
}
message DeviceUpdateMsg {
UpdateMsgType msgType = 1;
int64 idMSB = 2;
int64 idLSB = 3;
string name = 4;
string type = 5;
string label = 6;
}
message DeviceCredentialsUpdateMsg {
int64 deviceIdMSB = 1;
int64 deviceIdLSB = 2;
string credentialsType = 3;
string credentialsId = 4;
string credentialsValue = 5;
}
message AssetUpdateMsg {
UpdateMsgType msgType = 1;
int64 idMSB = 2;
int64 idLSB = 3;
string name = 4;
string type = 5;
string label = 6;
}
message EntityViewUpdateMsg {
UpdateMsgType msgType = 1;
int64 idMSB = 2;
int64 idLSB = 3;
string name = 4;
string type = 5;
int64 entityIdMSB = 6;
int64 entityIdLSB = 7;
EdgeEntityType entityType = 8;
}
message AlarmUpdateMsg {
UpdateMsgType msgType = 1;
string name = 2;
string type = 3;
string originatorType = 4;
string originatorName = 5;
string severity = 6;
string status = 7;
int64 startTs = 8;
int64 endTs = 9;
int64 ackTs = 10;
int64 clearTs = 11;
string details = 12;
bool propagate = 13;
}
message CustomerUpdateMsg {
UpdateMsgType msgType = 1;
int64 idMSB = 2;
int64 idLSB = 3;
string title = 4;
string country = 5;
string state = 6;
string city = 7;
string address = 8;
string address2 = 9;
string zip = 10;
string phone = 11;
string email = 12;
string additionalInfo = 13;
}
message RelationUpdateMsg {
UpdateMsgType msgType = 1;
int64 fromIdMSB = 2;
int64 fromIdLSB = 3;
string fromEntityType = 4;
int64 toIdMSB = 5;
int64 toIdLSB = 6;
string toEntityType = 7;
string type = 8;
string typeGroup = 9;
string additionalInfo = 10;
}
message UserUpdateMsg {
UpdateMsgType msgType = 1;
int64 idMSB = 2;
int64 idLSB = 3;
string email = 4;
string authority = 5;
string firstName = 6;
string lastName = 7;
string additionalInfo = 8;
}
message UserCredentialsUpdateMsg {
int64 userIdMSB = 1;
int64 userIdLSB = 2;
bool enabled = 3;
string password = 4;
}
message RuleChainMetadataRequestMsg {
int64 ruleChainIdMSB = 1;
int64 ruleChainIdLSB = 2;
}
message AttributesRequestMsg {
int64 entityIdMSB = 1;
int64 entityIdLSB = 2;
string entityType = 3;
}
message RelationRequestMsg {
int64 entityIdMSB = 1;
int64 entityIdLSB = 2;
string entityType = 3;
}
message UserCredentialsRequestMsg {
int64 userIdMSB = 1;
int64 userIdLSB = 2;
}
message DeviceCredentialsRequestMsg {
int64 deviceIdMSB = 1;
int64 deviceIdLSB = 2;
}
enum EdgeEntityType {
DEVICE = 0;
ASSET = 1;
}
/**
* Main Messages;
*/
message UplinkMsg {
int32 uplinkMsgId = 1;
repeated EntityDataProto entityData = 2;
repeated DeviceUpdateMsg deviceUpdateMsg = 3;
repeated DeviceCredentialsUpdateMsg deviceCredentialsUpdateMsg = 4;
repeated AlarmUpdateMsg alarmUpdateMsg = 5;
repeated RuleChainMetadataRequestMsg ruleChainMetadataRequestMsg = 6;
repeated AttributesRequestMsg attributesRequestMsg = 7;
repeated RelationRequestMsg relationRequestMsg = 8;
repeated UserCredentialsRequestMsg userCredentialsRequestMsg = 9;
repeated DeviceCredentialsRequestMsg deviceCredentialsRequestMsg = 10;
}
message UplinkResponseMsg {
bool success = 1;
string errorMsg = 2;
}
message DownlinkMsg {
int32 downlinkMsgId = 1;
repeated EntityDataProto entityData = 2;
repeated DeviceCredentialsRequestMsg deviceCredentialsRequestMsg = 3;
}