proto
This commit is contained in:
@@ -72,7 +72,8 @@ func (MethodType) EnumDescriptor() ([]byte, []int) {
|
|||||||
// 平台生成的原始485指令,单片机直接发送到总线
|
// 平台生成的原始485指令,单片机直接发送到总线
|
||||||
type Raw485Command struct {
|
type Raw485Command struct {
|
||||||
state protoimpl.MessageState `protogen:"open.v1"`
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
CommandBytes []byte `protobuf:"bytes,1,opt,name=command_bytes,json=commandBytes,proto3" json:"command_bytes,omitempty"` // 原始485指令的字节数组
|
BusNumber int32 `protobuf:"varint,1,opt,name=bus_number,json=busNumber,proto3" json:"bus_number,omitempty"` // 总线号,用于指示单片机将指令发送到哪个总线
|
||||||
|
CommandBytes []byte `protobuf:"bytes,2,opt,name=command_bytes,json=commandBytes,proto3" json:"command_bytes,omitempty"` // 原始485指令的字节数组
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
@@ -107,6 +108,13 @@ func (*Raw485Command) Descriptor() ([]byte, []int) {
|
|||||||
return file_device_proto_rawDescGZIP(), []int{0}
|
return file_device_proto_rawDescGZIP(), []int{0}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (x *Raw485Command) GetBusNumber() int32 {
|
||||||
|
if x != nil {
|
||||||
|
return x.BusNumber
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
func (x *Raw485Command) GetCommandBytes() []byte {
|
func (x *Raw485Command) GetCommandBytes() []byte {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.CommandBytes
|
return x.CommandBytes
|
||||||
@@ -224,10 +232,11 @@ func (x *BatchCollectCommand) GetTasks() []*CollectTask {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// CollectTask
|
// CollectTask
|
||||||
// 定义了单个采集任务的“意图”。现在直接包含平台生成的原始485指令。
|
// 定义了单个采集任务的“意图”。现在直接包含平台生成的原始485指令,并带上总线号。
|
||||||
type CollectTask struct {
|
type CollectTask struct {
|
||||||
state protoimpl.MessageState `protogen:"open.v1"`
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
Command *Raw485Command `protobuf:"bytes,1,opt,name=command,proto3" json:"command,omitempty"` // 平台生成的原始485指令
|
BusNumber int32 `protobuf:"varint,1,opt,name=bus_number,json=busNumber,proto3" json:"bus_number,omitempty"` // 总线号,用于指示单片机将指令发送到哪个总线
|
||||||
|
Command *Raw485Command `protobuf:"bytes,2,opt,name=command,proto3" json:"command,omitempty"` // 平台生成的原始485指令
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
@@ -262,6 +271,13 @@ func (*CollectTask) Descriptor() ([]byte, []int) {
|
|||||||
return file_device_proto_rawDescGZIP(), []int{3}
|
return file_device_proto_rawDescGZIP(), []int{3}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (x *CollectTask) GetBusNumber() int32 {
|
||||||
|
if x != nil {
|
||||||
|
return x.BusNumber
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
func (x *CollectTask) GetCommand() *Raw485Command {
|
func (x *CollectTask) GetCommand() *Raw485Command {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.Command
|
return x.Command
|
||||||
@@ -327,17 +343,21 @@ var File_device_proto protoreflect.FileDescriptor
|
|||||||
|
|
||||||
const file_device_proto_rawDesc = "" +
|
const file_device_proto_rawDesc = "" +
|
||||||
"\n" +
|
"\n" +
|
||||||
"\fdevice.proto\x12\x06device\x1a\x19google/protobuf/any.proto\"4\n" +
|
"\fdevice.proto\x12\x06device\x1a\x19google/protobuf/any.proto\"S\n" +
|
||||||
"\rRaw485Command\x12#\n" +
|
"\rRaw485Command\x12\x1d\n" +
|
||||||
"\rcommand_bytes\x18\x01 \x01(\fR\fcommandBytes\"c\n" +
|
"\n" +
|
||||||
|
"bus_number\x18\x01 \x01(\x05R\tbusNumber\x12#\n" +
|
||||||
|
"\rcommand_bytes\x18\x02 \x01(\fR\fcommandBytes\"c\n" +
|
||||||
"\vInstruction\x12*\n" +
|
"\vInstruction\x12*\n" +
|
||||||
"\x06method\x18\x01 \x01(\x0e2\x12.device.MethodTypeR\x06method\x12(\n" +
|
"\x06method\x18\x01 \x01(\x0e2\x12.device.MethodTypeR\x06method\x12(\n" +
|
||||||
"\x04data\x18\x02 \x01(\v2\x14.google.protobuf.AnyR\x04data\"g\n" +
|
"\x04data\x18\x02 \x01(\v2\x14.google.protobuf.AnyR\x04data\"g\n" +
|
||||||
"\x13BatchCollectCommand\x12%\n" +
|
"\x13BatchCollectCommand\x12%\n" +
|
||||||
"\x0ecorrelation_id\x18\x01 \x01(\tR\rcorrelationId\x12)\n" +
|
"\x0ecorrelation_id\x18\x01 \x01(\tR\rcorrelationId\x12)\n" +
|
||||||
"\x05tasks\x18\x02 \x03(\v2\x13.device.CollectTaskR\x05tasks\">\n" +
|
"\x05tasks\x18\x02 \x03(\v2\x13.device.CollectTaskR\x05tasks\"]\n" +
|
||||||
"\vCollectTask\x12/\n" +
|
"\vCollectTask\x12\x1d\n" +
|
||||||
"\acommand\x18\x01 \x01(\v2\x15.device.Raw485CommandR\acommand\"N\n" +
|
"\n" +
|
||||||
|
"bus_number\x18\x01 \x01(\x05R\tbusNumber\x12/\n" +
|
||||||
|
"\acommand\x18\x02 \x01(\v2\x15.device.Raw485CommandR\acommand\"N\n" +
|
||||||
"\rCollectResult\x12%\n" +
|
"\rCollectResult\x12%\n" +
|
||||||
"\x0ecorrelation_id\x18\x01 \x01(\tR\rcorrelationId\x12\x16\n" +
|
"\x0ecorrelation_id\x18\x01 \x01(\tR\rcorrelationId\x12\x16\n" +
|
||||||
"\x06values\x18\x02 \x03(\x02R\x06values**\n" +
|
"\x06values\x18\x02 \x03(\x02R\x06values**\n" +
|
||||||
|
|||||||
@@ -16,7 +16,8 @@ enum MethodType {
|
|||||||
|
|
||||||
// 平台生成的原始485指令,单片机直接发送到总线
|
// 平台生成的原始485指令,单片机直接发送到总线
|
||||||
message Raw485Command {
|
message Raw485Command {
|
||||||
bytes command_bytes = 1; // 原始485指令的字节数组
|
int32 bus_number = 1; // 总线号,用于指示单片机将指令发送到哪个总线
|
||||||
|
bytes command_bytes = 2; // 原始485指令的字节数组
|
||||||
}
|
}
|
||||||
|
|
||||||
// 指令 (所有空中数据都会被包装在这里面)
|
// 指令 (所有空中数据都会被包装在这里面)
|
||||||
@@ -32,19 +33,20 @@ message Instruction {
|
|||||||
// 用于在平台内部构建一个完整的、包含所有元数据的批量采集任务。
|
// 用于在平台内部构建一个完整的、包含所有元数据的批量采集任务。
|
||||||
// 这个消息本身不会被发送到设备。
|
// 这个消息本身不会被发送到设备。
|
||||||
message BatchCollectCommand {
|
message BatchCollectCommand {
|
||||||
string correlation_id = 1; // 用于关联请求和响应的唯一ID
|
string correlation_id = 1; // 用于关联请求和响应的唯一ID
|
||||||
repeated CollectTask tasks = 2; // 采集任务列表
|
repeated CollectTask tasks = 2; // 采集任务列表
|
||||||
}
|
}
|
||||||
|
|
||||||
// CollectTask
|
// CollectTask
|
||||||
// 定义了单个采集任务的“意图”。现在直接包含平台生成的原始485指令。
|
// 定义了单个采集任务的“意图”。现在直接包含平台生成的原始485指令,并带上总线号。
|
||||||
message CollectTask {
|
message CollectTask {
|
||||||
Raw485Command command = 1; // 平台生成的原始485指令
|
int32 bus_number = 1; // 总线号,用于指示单片机将指令发送到哪个总线
|
||||||
|
Raw485Command command = 2; // 平台生成的原始485指令
|
||||||
}
|
}
|
||||||
|
|
||||||
// CollectResult
|
// CollectResult
|
||||||
// 这是设备响应的、极致精简的数据包。
|
// 这是设备响应的、极致精简的数据包。
|
||||||
message CollectResult {
|
message CollectResult {
|
||||||
string correlation_id = 1; // 从下行指令中原样返回的关联ID
|
string correlation_id = 1; // 从下行指令中原样返回的关联ID
|
||||||
repeated float values = 2; // 按预定顺序排列的采集值
|
repeated float values = 2; // 按预定顺序排列的采集值
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user