161 lines
3.9 KiB
Protocol Buffer
161 lines
3.9 KiB
Protocol Buffer
syntax = "proto3";
|
|
|
|
package dinetrpc;
|
|
|
|
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
|
|
import "error.proto";
|
|
import "device.proto";
|
|
|
|
message HeaderMsg {
|
|
uint32 dinetRPC = 1 [(gogoproto.jsontag) = "dinetrpc", (gogoproto.moretags) = "msgpack:\"dinetrpc\""];
|
|
uint64 time = 2 [(gogoproto.jsontag) = "time", (gogoproto.moretags) = "msgpack:\"time\""];
|
|
string deviceUID = 3 [(gogoproto.jsontag) = "device:uid,omitempty", (gogoproto.moretags) = "msgpack:\"device:uid\""];
|
|
uint32 userID = 4 [(gogoproto.jsontag) = "user:id,omitempty", (gogoproto.moretags) = "msgpack:\"user:id\""];
|
|
uint32 projectID = 5 [(gogoproto.jsontag) = "project:id,omitempty", (gogoproto.moretags) = "msgpack:\"project:id\""];
|
|
string req = 10 [(gogoproto.jsontag) = "req", (gogoproto.moretags) = "msgpack:\"req\""];
|
|
string rep = 11 [(gogoproto.jsontag) = "rep", (gogoproto.moretags) = "msgpack:\"rep\""];
|
|
string pub = 12 [(gogoproto.jsontag) = "pub", (gogoproto.moretags) = "msgpack:\"pub\""];
|
|
uint32 id = 13 [(gogoproto.jsontag) = "id", (gogoproto.moretags) = "msgpack:\"id\""];
|
|
ClassMethod classMethod = 14;
|
|
MsgType type = 15;
|
|
Error error = 16;
|
|
}
|
|
|
|
message Value {
|
|
oneof value {
|
|
bool Bool = 1;
|
|
double Number = 2;
|
|
string String = 3;
|
|
GPSValue GPS = 4;
|
|
}
|
|
}
|
|
|
|
message GPSValue {
|
|
float latitude = 1;
|
|
float longitude = 2;
|
|
float hdop = 3;
|
|
}
|
|
|
|
enum ClassMethod {
|
|
UnknownUnknown = 0; // unknown:unknown
|
|
|
|
DeviceInfo = 9; // device:info
|
|
DevicePing = 10; // device:ping
|
|
DeviceUserData = 11; // device:user:data
|
|
DeviceData = 12; // device:data
|
|
DeviceErrors = 13; // device:errors
|
|
|
|
SensorInfo = 20; // sensor:info
|
|
SensorData = 21; // sensor:data
|
|
|
|
ConfigInfo = 31; // config:info
|
|
ConfigGet = 32; // config:get
|
|
ConfigSet = 33; // config:set
|
|
ConfigReset = 34; // config:reset
|
|
|
|
ActionInfo = 41; // action:info
|
|
ActionGet = 42; // action:get
|
|
ActionSet = 43; // action:set
|
|
|
|
ConnectionInfo = 51; // connection:info
|
|
ConnectionConnect = 52; // connection:connect
|
|
ConnectionDisconnect = 53; // connection:disconnect
|
|
}
|
|
|
|
enum MsgType {
|
|
Unknown = 0;
|
|
Request = 1;
|
|
Reply = 2;
|
|
Publish = 3;
|
|
}
|
|
|
|
message Msg {
|
|
HeaderMsg Header = 1 [(gogoproto.embed) = true, (gogoproto.jsontag) = "", (gogoproto.nullable) = true];
|
|
oneof Result {
|
|
DeviceInfoResult deviceInfoResult = 10;
|
|
DeviceDataResult deviceDataResult = 11;
|
|
|
|
SensorInfoResult sensorInfoResult = 20;
|
|
SensorDataResult sensorDataResult = 21;
|
|
|
|
ConfigInfoResult configInfoResult = 31;
|
|
|
|
ActionInfoResult actionInfoResult = 41;
|
|
|
|
ConnectionInfoResult connectionInfoResult = 51;
|
|
}
|
|
}
|
|
|
|
message ResultValueItem {
|
|
uint32 uid = 1;
|
|
Value value = 2;
|
|
uint64 time = 3;
|
|
}
|
|
|
|
message InfoResultItem {
|
|
uint32 uid = 1;
|
|
string label = 2;
|
|
string type = 3;
|
|
map<string, int32> enum = 4;
|
|
Value default = 5;
|
|
}
|
|
|
|
message SensorDataResult {
|
|
repeated ResultValueItem result = 1;
|
|
}
|
|
|
|
message SensorInfoResult {
|
|
repeated InfoResultItem result = 1;
|
|
}
|
|
|
|
message ConfigInfoResult {
|
|
repeated InfoResultItem result = 1;
|
|
}
|
|
|
|
message ActionInfoResult {
|
|
repeated InfoResultItem result = 1;
|
|
}
|
|
|
|
message ConnectionInfoResult {
|
|
repeated ConnectionInfoItem result = 1;
|
|
}
|
|
|
|
message ConnectionInfoItem {
|
|
uint32 timeout = 1;
|
|
repeated string gateways = 2;
|
|
string transport = 3;
|
|
oneof transportObj {
|
|
ConnectionInfoTransportCAN can = 10;
|
|
ConnectionInfoTransportLegacy legacy = 11;
|
|
ConnectionInfoTransportCellular cellular = 12;
|
|
ConnectionInfoTransportLoRa lora = 13;
|
|
}
|
|
}
|
|
|
|
message ConnectionInfoTransportCAN {
|
|
uint32 nodeid = 1;
|
|
}
|
|
|
|
message ConnectionInfoTransportLegacy {
|
|
uint32 database_id = 1;
|
|
string imsi = 2;
|
|
string iccid = 3;
|
|
string imei = 4;
|
|
string gprs_apn = 5;
|
|
string endpoint = 6;
|
|
}
|
|
|
|
message ConnectionInfoTransportCellular {
|
|
string operator = 1;
|
|
string imsi = 2;
|
|
string iccid = 3;
|
|
string imei = 4;
|
|
string gprs_apn = 5;
|
|
string endpoint = 6;
|
|
}
|
|
|
|
message ConnectionInfoTransportLoRa {
|
|
string dev_eui = 1;
|
|
string operator = 2;
|
|
}
|