2019-10-28 12:13:01 +02:00
|
|
|
/**
|
2020-03-17 18:43:22 +02:00
|
|
|
* Copyright © 2016-2020 The Thingsboard Authors
|
2019-10-28 12:13:01 +02:00
|
|
|
*
|
|
|
|
|
* 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";
|
|
|
|
|
|
2019-10-29 19:21:53 +02:00
|
|
|
option java_package = "org.thingsboard.server.gen.edge";
|
|
|
|
|
option java_multiple_files = true;
|
2019-10-28 12:13:01 +02:00
|
|
|
option java_outer_classname = "EdgeProtos";
|
|
|
|
|
|
|
|
|
|
package edge;
|
|
|
|
|
|
2019-10-29 19:21:53 +02:00
|
|
|
// Interface exported by the ThingsBoard Edge Transport.
|
2019-10-28 12:13:01 +02:00
|
|
|
service EdgeRpcService {
|
|
|
|
|
|
2019-10-29 19:21:53 +02:00
|
|
|
rpc handleMsgs(stream RequestMsg) returns (stream ResponseMsg) {}
|
2019-10-28 12:13:01 +02:00
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Data Structures;
|
|
|
|
|
*/
|
2019-10-29 19:21:53 +02:00
|
|
|
message RequestMsg {
|
|
|
|
|
RequestMsgType msgType = 1;
|
|
|
|
|
ConnectRequestMsg connectRequestMsg = 2;
|
2019-11-18 19:37:16 +02:00
|
|
|
UplinkMsg uplinkMsg = 3;
|
2019-10-28 12:13:01 +02:00
|
|
|
}
|
|
|
|
|
|
2019-10-29 19:21:53 +02:00
|
|
|
message ResponseMsg {
|
2019-11-07 15:06:04 +02:00
|
|
|
ConnectResponseMsg connectResponseMsg = 1;
|
|
|
|
|
UplinkResponseMsg uplinkResponseMsg = 2;
|
2019-11-18 19:37:16 +02:00
|
|
|
EntityUpdateMsg entityUpdateMsg = 3;
|
|
|
|
|
DownlinkMsg downlinkMsg = 4;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
message EntityUpdateMsg {
|
|
|
|
|
DeviceUpdateMsg deviceUpdateMsg = 1;
|
|
|
|
|
RuleChainUpdateMsg ruleChainUpdateMsg = 2;
|
|
|
|
|
RuleChainMetadataUpdateMsg ruleChainMetadataUpdateMsg = 3;
|
|
|
|
|
DashboardUpdateMsg dashboardUpdateMsg = 4;
|
|
|
|
|
AssetUpdateMsg assetUpdateMsg = 5;
|
|
|
|
|
EntityViewUpdateMsg entityViewUpdateMsg = 6;
|
|
|
|
|
AlarmUpdateMsg alarmUpdateMsg = 7;
|
2019-12-11 11:02:25 +02:00
|
|
|
UserUpdateMsg userUpdateMsg = 8;
|
|
|
|
|
CustomerUpdateMsg customerUpdateMsg = 9;
|
2020-06-11 19:25:31 +03:00
|
|
|
RelationUpdateMsg relationUpdateMsg = 10;
|
2019-10-29 19:21:53 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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;
|
2019-10-28 12:13:01 +02:00
|
|
|
}
|
|
|
|
|
|
2019-10-29 19:21:53 +02:00
|
|
|
message ConnectResponseMsg {
|
|
|
|
|
ConnectResponseCode responseCode = 1;
|
|
|
|
|
string errorMsg = 2;
|
2019-11-07 15:06:04 +02:00
|
|
|
EdgeConfiguration configuration = 3;
|
2019-10-28 12:13:01 +02:00
|
|
|
}
|
|
|
|
|
|
2019-11-07 15:06:04 +02:00
|
|
|
message EdgeConfiguration {
|
2019-10-29 19:21:53 +02:00
|
|
|
int64 tenantIdMSB = 1;
|
|
|
|
|
int64 tenantIdLSB = 2;
|
2020-03-13 19:16:36 +02:00
|
|
|
string name = 3;
|
|
|
|
|
string routingKey = 4;
|
|
|
|
|
string type = 5;
|
|
|
|
|
string cloudType = 6;
|
2019-10-29 19:21:53 +02:00
|
|
|
}
|
|
|
|
|
|
2019-11-07 15:06:04 +02:00
|
|
|
enum UpdateMsgType {
|
|
|
|
|
ENTITY_CREATED_RPC_MESSAGE = 0;
|
|
|
|
|
ENTITY_UPDATED_RPC_MESSAGE = 1;
|
|
|
|
|
ENTITY_DELETED_RPC_MESSAGE = 2;
|
2019-11-18 19:37:16 +02:00
|
|
|
ALARM_ACK_RPC_MESSAGE = 3;
|
2019-11-19 19:43:27 +02:00
|
|
|
ALARM_CLEAR_RPC_MESSAGE = 4;
|
2019-11-18 19:37:16 +02:00
|
|
|
RULE_CHAIN_CUSTOM_MESSAGE = 5;
|
2020-06-10 19:07:16 +03:00
|
|
|
DEVICE_CONFLICT_RPC_MESSAGE = 6;
|
2019-10-28 12:13:01 +02:00
|
|
|
}
|
2019-10-29 19:21:53 +02:00
|
|
|
|
2019-11-15 18:38:14 +02:00
|
|
|
message EntityDataProto {
|
|
|
|
|
string entityName = 1;
|
2020-06-10 19:07:16 +03:00
|
|
|
int64 entityIdMSB = 2;
|
|
|
|
|
int64 entityIdLSB = 3;
|
|
|
|
|
bytes tbMsg = 4;
|
2019-11-07 15:06:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
2019-11-11 17:19:29 +02:00
|
|
|
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 {
|
2020-02-06 19:29:49 +02:00
|
|
|
int64 idMSB = 1;
|
|
|
|
|
int64 idLSB = 2;
|
|
|
|
|
string type = 3;
|
|
|
|
|
string name = 4;
|
|
|
|
|
bool debugMode = 5;
|
|
|
|
|
string configuration = 6;
|
|
|
|
|
string additionalInfo = 7;
|
2019-11-11 17:19:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
2019-11-07 15:06:04 +02:00
|
|
|
message DashboardUpdateMsg {
|
|
|
|
|
UpdateMsgType msgType = 1;
|
|
|
|
|
int64 idMSB = 2;
|
|
|
|
|
int64 idLSB = 3;
|
2019-12-11 11:02:25 +02:00
|
|
|
string title = 4;
|
|
|
|
|
string configuration = 5;
|
2019-11-07 15:06:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
message DeviceUpdateMsg {
|
|
|
|
|
UpdateMsgType msgType = 1;
|
2020-06-10 15:34:10 +03:00
|
|
|
int64 idMSB = 2;
|
|
|
|
|
int64 idLSB = 3;
|
|
|
|
|
string name = 4;
|
|
|
|
|
string type = 5;
|
|
|
|
|
string label = 6;
|
|
|
|
|
string credentialsType = 7;
|
|
|
|
|
string credentialsId = 8;
|
|
|
|
|
string credentialsValue = 9;
|
2019-11-07 15:06:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
message AssetUpdateMsg {
|
|
|
|
|
UpdateMsgType msgType = 1;
|
2020-06-10 15:34:10 +03:00
|
|
|
int64 idMSB = 2;
|
|
|
|
|
int64 idLSB = 3;
|
|
|
|
|
string name = 4;
|
|
|
|
|
string type = 5;
|
|
|
|
|
string label = 6;
|
2019-11-07 15:06:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
message EntityViewUpdateMsg {
|
|
|
|
|
UpdateMsgType msgType = 1;
|
2020-06-10 15:34:10 +03:00
|
|
|
int64 idMSB = 2;
|
|
|
|
|
int64 idLSB = 3;
|
|
|
|
|
string name = 4;
|
|
|
|
|
string type = 5;
|
|
|
|
|
int64 entityIdMSB = 6;
|
|
|
|
|
int64 entityIdLSB = 7;
|
|
|
|
|
EdgeEntityType entityType = 8;
|
2019-11-07 15:06:04 +02:00
|
|
|
}
|
|
|
|
|
|
2019-11-18 19:37:16 +02:00
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
2019-12-11 11:02:25 +02:00
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
2020-06-11 19:25:31 +03:00
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
2019-12-11 11:02:25 +02:00
|
|
|
message UserUpdateMsg {
|
|
|
|
|
UpdateMsgType msgType = 1;
|
2020-06-10 15:34:10 +03:00
|
|
|
int64 idMSB = 2;
|
|
|
|
|
int64 idLSB = 3;
|
|
|
|
|
string email = 4;
|
|
|
|
|
string authority = 5;
|
|
|
|
|
string firstName = 6;
|
|
|
|
|
string lastName = 7;
|
|
|
|
|
string additionalInfo = 8;
|
|
|
|
|
bool enabled = 9;
|
|
|
|
|
string password = 10;
|
2019-12-11 11:02:25 +02:00
|
|
|
}
|
|
|
|
|
|
2020-03-17 18:56:46 +02:00
|
|
|
message RuleChainMetadataRequestMsg {
|
|
|
|
|
int64 ruleChainIdMSB = 1;
|
|
|
|
|
int64 ruleChainIdLSB = 2;
|
|
|
|
|
}
|
|
|
|
|
|
2020-05-22 18:52:44 +03:00
|
|
|
enum EdgeEntityType {
|
2019-11-07 15:06:04 +02:00
|
|
|
DEVICE = 0;
|
|
|
|
|
ASSET = 1;
|
|
|
|
|
}
|
|
|
|
|
|
2019-10-29 19:21:53 +02:00
|
|
|
/**
|
|
|
|
|
* Main Messages;
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
message UplinkMsg {
|
|
|
|
|
int32 uplinkMsgId = 1;
|
2019-11-15 18:38:14 +02:00
|
|
|
repeated EntityDataProto entityData = 2;
|
2019-11-18 19:37:16 +02:00
|
|
|
repeated DeviceUpdateMsg deviceUpdateMsg = 3;
|
2020-03-13 19:16:36 +02:00
|
|
|
repeated AlarmUpdateMsg alarmUpdateMsg = 4;
|
2020-03-17 18:56:46 +02:00
|
|
|
repeated RuleChainMetadataRequestMsg ruleChainMetadataRequestMsg = 5;
|
2019-10-29 19:21:53 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
message UplinkResponseMsg {
|
|
|
|
|
bool success = 1;
|
|
|
|
|
string errorMsg = 2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
message DownlinkMsg {
|
2019-11-07 15:06:04 +02:00
|
|
|
int32 downlinkMsgId = 1;
|
2019-11-15 18:38:14 +02:00
|
|
|
repeated EntityDataProto entityData = 2;
|
2019-10-29 19:21:53 +02:00
|
|
|
}
|
2019-11-07 15:06:04 +02:00
|
|
|
|