541 lines
13 KiB
Protocol Buffer
Raw Normal View History

2019-10-28 12:13:01 +02:00
/**
2022-01-17 14:07:46 +02:00
* Copyright © 2016-2022 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";
option java_package = "org.thingsboard.server.gen.edge.v1";
2019-10-29 19:21:53 +02:00
option java_multiple_files = true;
2019-10-28 12:13:01 +02:00
option java_outer_classname = "EdgeProtos";
2020-06-16 16:49:27 +03:00
import "queue.proto";
2019-10-28 12:13:01 +02:00
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
}
enum EdgeVersion {
V_3_3_0 = 0;
V_3_3_3 = 1;
V_3_4_0 = 2;
}
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;
2020-08-18 17:52:11 +03:00
DownlinkResponseMsg downlinkResponseMsg = 4;
SyncRequestMsg syncRequestMsg = 5;
2019-10-28 12:13:01 +02:00
}
2019-10-29 19:21:53 +02:00
message ResponseMsg {
ConnectResponseMsg connectResponseMsg = 1;
UplinkResponseMsg uplinkResponseMsg = 2;
2020-08-18 17:52:11 +03:00
DownlinkMsg downlinkMsg = 3;
2020-09-25 17:29:33 +03:00
EdgeUpdateMsg edgeUpdateMsg = 4;
2019-10-29 19:21:53 +02:00
}
enum RequestMsgType {
CONNECT_RPC_MESSAGE = 0;
UPLINK_RPC_MESSAGE = 1;
SYNC_REQUEST_RPC_MESSAGE = 2;
2019-10-29 19:21:53 +02:00
}
2020-09-25 17:29:33 +03:00
message EdgeUpdateMsg {
EdgeConfiguration configuration = 1;
}
2019-10-29 19:21:53 +02:00
message ConnectRequestMsg {
string edgeRoutingKey = 1;
string edgeSecret = 2;
EdgeVersion edgeVersion = 3;
2019-10-29 19:21:53 +02:00
}
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;
EdgeConfiguration configuration = 3;
2019-10-28 12:13:01 +02:00
}
message SyncRequestMsg {
bool syncRequired = 1;
}
message SyncCompletedMsg {
}
message EdgeConfiguration {
int64 edgeIdMSB = 1;
int64 edgeIdLSB = 2;
int64 tenantIdMSB = 3;
int64 tenantIdLSB = 4;
2020-12-13 19:28:05 +02:00
int64 customerIdMSB = 5;
int64 customerIdLSB = 6;
string name = 7;
string type = 8;
string routingKey = 9;
string secret = 10;
string additionalInfo = 11;
string cloudType = 12;
2019-10-29 19:21:53 +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;
ENTITY_MERGE_RPC_MESSAGE = 5;
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 {
2020-06-18 13:30:45 +03:00
int64 entityIdMSB = 1;
int64 entityIdLSB = 2;
string entityType = 3;
2020-06-16 16:49:27 +03:00
transport.PostTelemetryMsg postTelemetryMsg = 4;
transport.PostAttributeMsg postAttributesMsg = 5;
2020-10-01 16:00:06 +03:00
transport.PostAttributeMsg attributesUpdatedMsg = 6;
string postAttributeScope = 7;
AttributeDeleteMsg attributeDeleteMsg = 8;
}
message AttributeDeleteMsg {
string scope = 1;
repeated string attributeNames = 2;
}
message RuleChainUpdateMsg {
UpdateMsgType msgType = 1;
int64 idMSB = 2;
int64 idLSB = 3;
string name = 4;
optional int64 firstRuleNodeIdMSB = 5;
optional 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;
2020-06-11 20:28:06 +03:00
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;
}
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;
optional int64 customerIdMSB = 4;
optional int64 customerIdLSB = 5;
string title = 6;
string configuration = 7;
optional string assignedCustomers = 8;
}
message DeviceUpdateMsg {
UpdateMsgType msgType = 1;
2020-06-10 15:34:10 +03:00
int64 idMSB = 2;
int64 idLSB = 3;
optional int64 customerIdMSB = 4;
optional int64 customerIdLSB = 5;
optional int64 deviceProfileIdMSB = 6;
optional int64 deviceProfileIdLSB = 7;
string name = 8;
string type = 9;
optional string label = 10;
optional string additionalInfo = 11;
optional string conflictName = 12;
2022-08-04 14:13:53 +03:00
optional int64 firmwareIdMSB = 13;
optional int64 firmwareIdLSB = 14;
optional bytes deviceDataBytes = 15;
}
message DeviceProfileUpdateMsg {
UpdateMsgType msgType = 1;
int64 idMSB = 2;
int64 idLSB = 3;
string name = 4;
optional string description = 5;
bool default = 6;
string type = 7;
optional string transportType = 8;
optional string provisionType = 9;
int64 defaultRuleChainIdMSB = 10;
int64 defaultRuleChainIdLSB = 11;
string defaultQueueName = 12;
bytes profileDataBytes = 13;
optional string provisionDeviceKey = 14;
optional bytes image = 15;
2022-08-04 14:13:53 +03:00
optional int64 firmwareIdMSB = 16;
optional int64 firmwareIdLSB = 17;
}
message DeviceCredentialsUpdateMsg {
int64 deviceIdMSB = 1;
int64 deviceIdLSB = 2;
string credentialsType = 3;
string credentialsId = 4;
optional string credentialsValue = 5;
}
message AssetUpdateMsg {
UpdateMsgType msgType = 1;
2020-06-10 15:34:10 +03:00
int64 idMSB = 2;
int64 idLSB = 3;
optional int64 customerIdMSB = 4;
optional int64 customerIdLSB = 5;
string name = 6;
string type = 7;
optional string label = 8;
optional string additionalInfo = 9;
}
message EntityViewUpdateMsg {
UpdateMsgType msgType = 1;
2020-06-10 15:34:10 +03:00
int64 idMSB = 2;
int64 idLSB = 3;
optional int64 customerIdMSB = 4;
optional int64 customerIdLSB = 5;
string name = 6;
string type = 7;
int64 entityIdMSB = 8;
int64 entityIdLSB = 9;
EdgeEntityType entityType = 10;
optional string additionalInfo = 11;
}
2019-11-18 19:37:16 +02:00
message AlarmUpdateMsg {
UpdateMsgType msgType = 1;
2021-08-04 09:45:16 +03:00
int64 idMSB = 2;
int64 idLSB = 3;
string name = 4;
string type = 5;
string originatorType = 6;
string originatorName = 7;
string severity = 8;
string status = 9;
int64 startTs = 10;
int64 endTs = 11;
int64 ackTs = 12;
int64 clearTs = 13;
string details = 14;
bool propagate = 15;
bool propagateToOwner = 16;
bool propagateToTenant = 17;
2019-11-18 19:37:16 +02:00
}
2019-12-11 11:02:25 +02:00
message CustomerUpdateMsg {
UpdateMsgType msgType = 1;
int64 idMSB = 2;
int64 idLSB = 3;
string title = 4;
optional string country = 5;
optional string state = 6;
optional string city = 7;
optional string address = 8;
optional string address2 = 9;
optional string zip = 10;
optional string phone = 11;
optional string email = 12;
optional string additionalInfo = 13;
2019-12-11 11:02:25 +02: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;
optional 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;
optional int64 customerIdMSB = 4;
optional int64 customerIdLSB = 5;
string email = 6;
string authority = 7;
optional string firstName = 8;
optional string lastName = 9;
optional string additionalInfo = 10;
}
2020-07-30 18:58:04 +03:00
message WidgetsBundleUpdateMsg {
UpdateMsgType msgType = 1;
int64 idMSB = 2;
int64 idLSB = 3;
string title = 4;
string alias = 5;
optional bytes image = 6;
2020-08-04 14:26:06 +03:00
bool isSystem = 7;
optional string description = 8;
2020-07-30 18:58:04 +03:00
}
2020-07-31 15:53:22 +03:00
message WidgetTypeUpdateMsg {
UpdateMsgType msgType = 1;
int64 idMSB = 2;
int64 idLSB = 3;
optional string bundleAlias = 4;
optional string alias = 5;
optional string name = 6;
optional string descriptorJson = 7;
2020-08-04 14:26:06 +03:00
bool isSystem = 8;
optional string image = 9;
optional string description = 10;
2020-07-31 15:53:22 +03:00
}
2020-08-14 13:52:40 +03:00
message AdminSettingsUpdateMsg {
2020-08-20 14:45:32 +03:00
bool isSystem = 1;
string key = 2;
string jsonValue = 3;
2020-08-14 13:52:40 +03:00
}
message UserCredentialsUpdateMsg {
int64 userIdMSB = 1;
int64 userIdLSB = 2;
bool enabled = 3;
string password = 4;
2019-12-11 11:02:25 +02:00
}
message RuleChainMetadataRequestMsg {
int64 ruleChainIdMSB = 1;
int64 ruleChainIdLSB = 2;
}
message AttributesRequestMsg {
int64 entityIdMSB = 1;
int64 entityIdLSB = 2;
string entityType = 3;
string scope = 4;
}
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;
}
message DeviceProfileDevicesRequestMsg {
int64 deviceProfileIdMSB = 1;
int64 deviceProfileIdLSB = 2;
}
message WidgetBundleTypesRequestMsg {
int64 widgetBundleIdMSB = 1;
int64 widgetBundleIdLSB = 2;
}
message EntityViewsRequestMsg {
int64 entityIdMSB = 1;
int64 entityIdLSB = 2;
string entityType = 3;
}
message DeviceRpcCallMsg {
int64 deviceIdMSB = 1;
int64 deviceIdLSB = 2;
2020-12-01 18:58:58 +02:00
int64 requestUuidMSB = 3;
int64 requestUuidLSB = 4;
int32 requestId = 5;
int64 expirationTime = 6;
bool oneway = 7;
RpcRequestMsg requestMsg = 8;
RpcResponseMsg responseMsg = 9;
}
message RpcRequestMsg {
string method = 1;
string params = 2;
}
message RpcResponseMsg {
string response = 1;
string error = 2;
}
2020-05-22 18:52:44 +03:00
enum EdgeEntityType {
2020-06-11 20:28:06 +03:00
DEVICE = 0;
ASSET = 1;
}
message OtaPackageUpdateMsg {
UpdateMsgType msgType = 1;
int64 idMSB = 2;
int64 idLSB = 3;
int64 deviceProfileIdMSB = 4;
int64 deviceProfileIdLSB = 5;
string type = 6;
string title = 7;
string version = 8;
string tag = 9;
optional string url = 10;
optional string fileName = 11;
optional string contentType = 12;
optional string checksumAlgorithm = 13;
optional string checksum = 14;
optional int64 dataSize = 15;
optional bytes data = 16;
optional string additionalInfo = 17;
}
message QueueUpdateMsg {
UpdateMsgType msgType = 1;
int64 idMSB = 2;
int64 idLSB = 3;
2022-06-29 17:21:35 +03:00
int64 tenantIdMSB = 4;
int64 tenantIdLSB = 5;
string name = 6;
string topic = 7;
int32 pollInterval = 8;
int32 partitions = 9;
bool consumerPerPartition = 10;
int64 packProcessingTimeout = 11;
SubmitStrategyProto submitStrategy = 12;
ProcessingStrategyProto processingStrategy = 13;
}
message SubmitStrategyProto {
string type = 1;
int32 batchSize = 2;
}
message ProcessingStrategyProto {
string type = 1;
int32 retries = 2;
double failurePercentage = 3;
int64 pauseBetweenRetries = 4;
int64 maxPauseBetweenRetries = 5;
}
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;
repeated DeviceCredentialsUpdateMsg deviceCredentialsUpdateMsg = 4;
repeated AlarmUpdateMsg alarmUpdateMsg = 5;
2020-08-18 15:46:49 +03:00
repeated RelationUpdateMsg relationUpdateMsg = 6;
repeated RuleChainMetadataRequestMsg ruleChainMetadataRequestMsg = 7;
repeated AttributesRequestMsg attributesRequestMsg = 8;
repeated RelationRequestMsg relationRequestMsg = 9;
repeated UserCredentialsRequestMsg userCredentialsRequestMsg = 10;
repeated DeviceCredentialsRequestMsg deviceCredentialsRequestMsg = 11;
repeated DeviceRpcCallMsg deviceRpcCallMsg = 12;
repeated DeviceProfileDevicesRequestMsg deviceProfileDevicesRequestMsg = 13;
repeated WidgetBundleTypesRequestMsg widgetBundleTypesRequestMsg = 14;
repeated EntityViewsRequestMsg entityViewsRequestMsg = 15;
2019-10-29 19:21:53 +02:00
}
message UplinkResponseMsg {
bool success = 1;
string errorMsg = 2;
int32 uplinkMsgId = 3;
2019-10-29 19:21:53 +02:00
}
2020-08-18 17:52:11 +03:00
message DownlinkResponseMsg {
bool success = 1;
string errorMsg = 2;
int32 downlinkMsgId = 3;
2020-08-18 17:52:11 +03:00
}
2019-10-29 19:21:53 +02:00
message DownlinkMsg {
int32 downlinkMsgId = 1;
SyncCompletedMsg syncCompletedMsg = 2;
repeated EntityDataProto entityData = 3;
repeated DeviceCredentialsRequestMsg deviceCredentialsRequestMsg = 4;
repeated DeviceUpdateMsg deviceUpdateMsg = 5;
repeated DeviceProfileUpdateMsg deviceProfileUpdateMsg = 6;
repeated DeviceCredentialsUpdateMsg deviceCredentialsUpdateMsg = 7;
repeated RuleChainUpdateMsg ruleChainUpdateMsg = 8;
repeated RuleChainMetadataUpdateMsg ruleChainMetadataUpdateMsg = 9;
repeated DashboardUpdateMsg dashboardUpdateMsg = 10;
repeated AssetUpdateMsg assetUpdateMsg = 11;
repeated EntityViewUpdateMsg entityViewUpdateMsg = 12;
repeated AlarmUpdateMsg alarmUpdateMsg = 13;
repeated UserUpdateMsg userUpdateMsg = 14;
repeated UserCredentialsUpdateMsg userCredentialsUpdateMsg = 15;
repeated CustomerUpdateMsg customerUpdateMsg = 16;
repeated RelationUpdateMsg relationUpdateMsg = 17;
repeated WidgetsBundleUpdateMsg widgetsBundleUpdateMsg = 18;
repeated WidgetTypeUpdateMsg widgetTypeUpdateMsg = 19;
repeated AdminSettingsUpdateMsg adminSettingsUpdateMsg = 20;
repeated DeviceRpcCallMsg deviceRpcCallMsg = 21;
repeated OtaPackageUpdateMsg otaPackageUpdateMsg = 22;
repeated QueueUpdateMsg queueUpdateMsg = 23;
EdgeConfiguration edgeConfiguration = 24;
2019-10-29 19:21:53 +02:00
}