Files
pig-farm-controller/internal/domain/device/proto/device.pb.go

416 lines
12 KiB
Go
Raw Normal View History

2025-09-15 23:45:15 +08:00
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.9
// protoc v6.32.1
// source: device.proto
package proto
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
unsafe "unsafe"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
2025-09-29 23:54:09 +08:00
// 平台生成的原始485指令单片机直接发送到总线
type Raw485Command struct {
2025-09-15 23:45:15 +08:00
state protoimpl.MessageState `protogen:"open.v1"`
2025-09-30 00:01:51 +08:00
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指令的字节数组
2025-09-15 23:45:15 +08:00
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
2025-09-29 23:54:09 +08:00
func (x *Raw485Command) Reset() {
*x = Raw485Command{}
2025-09-15 23:45:15 +08:00
mi := &file_device_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
2025-09-29 23:54:09 +08:00
func (x *Raw485Command) String() string {
2025-09-15 23:45:15 +08:00
return protoimpl.X.MessageStringOf(x)
}
2025-09-29 23:54:09 +08:00
func (*Raw485Command) ProtoMessage() {}
2025-09-15 23:45:15 +08:00
2025-09-29 23:54:09 +08:00
func (x *Raw485Command) ProtoReflect() protoreflect.Message {
2025-09-15 23:45:15 +08:00
mi := &file_device_proto_msgTypes[0]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
2025-09-29 23:54:09 +08:00
// Deprecated: Use Raw485Command.ProtoReflect.Descriptor instead.
func (*Raw485Command) Descriptor() ([]byte, []int) {
2025-09-15 23:45:15 +08:00
return file_device_proto_rawDescGZIP(), []int{0}
}
2025-09-30 00:01:51 +08:00
func (x *Raw485Command) GetBusNumber() int32 {
if x != nil {
return x.BusNumber
}
return 0
}
2025-09-29 23:54:09 +08:00
func (x *Raw485Command) GetCommandBytes() []byte {
2025-09-15 23:45:15 +08:00
if x != nil {
2025-09-29 23:54:09 +08:00
return x.CommandBytes
2025-09-15 23:45:15 +08:00
}
return nil
}
// BatchCollectCommand
2025-10-07 16:14:47 +08:00
// 一个完整的、包含所有元数据的批量采集任务。
type BatchCollectCommand struct {
2025-09-25 20:16:07 +08:00
state protoimpl.MessageState `protogen:"open.v1"`
CorrelationId string `protobuf:"bytes,1,opt,name=correlation_id,json=correlationId,proto3" json:"correlation_id,omitempty"` // 用于关联请求和响应的唯一ID
Tasks []*CollectTask `protobuf:"bytes,2,rep,name=tasks,proto3" json:"tasks,omitempty"` // 采集任务列表
2025-09-25 20:16:07 +08:00
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *BatchCollectCommand) Reset() {
*x = BatchCollectCommand{}
2025-10-07 16:14:47 +08:00
mi := &file_device_proto_msgTypes[1]
2025-09-25 20:16:07 +08:00
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *BatchCollectCommand) String() string {
2025-09-25 20:16:07 +08:00
return protoimpl.X.MessageStringOf(x)
}
func (*BatchCollectCommand) ProtoMessage() {}
2025-09-25 20:16:07 +08:00
func (x *BatchCollectCommand) ProtoReflect() protoreflect.Message {
2025-10-07 16:14:47 +08:00
mi := &file_device_proto_msgTypes[1]
2025-09-25 20:16:07 +08:00
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use BatchCollectCommand.ProtoReflect.Descriptor instead.
func (*BatchCollectCommand) Descriptor() ([]byte, []int) {
2025-10-07 16:14:47 +08:00
return file_device_proto_rawDescGZIP(), []int{1}
2025-09-25 20:16:07 +08:00
}
func (x *BatchCollectCommand) GetCorrelationId() string {
2025-09-25 20:16:07 +08:00
if x != nil {
return x.CorrelationId
2025-09-25 20:16:07 +08:00
}
return ""
2025-09-25 20:16:07 +08:00
}
func (x *BatchCollectCommand) GetTasks() []*CollectTask {
2025-09-25 20:16:07 +08:00
if x != nil {
return x.Tasks
}
return nil
}
// CollectTask
2025-10-07 16:14:47 +08:00
// 定义了单个采集任务的“意图”。
type CollectTask struct {
state protoimpl.MessageState `protogen:"open.v1"`
2025-09-30 00:07:16 +08:00
Command *Raw485Command `protobuf:"bytes,2,opt,name=command,proto3" json:"command,omitempty"` // 平台生成的原始485指令
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *CollectTask) Reset() {
*x = CollectTask{}
2025-10-07 16:14:47 +08:00
mi := &file_device_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *CollectTask) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*CollectTask) ProtoMessage() {}
func (x *CollectTask) ProtoReflect() protoreflect.Message {
2025-10-07 16:14:47 +08:00
mi := &file_device_proto_msgTypes[2]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use CollectTask.ProtoReflect.Descriptor instead.
func (*CollectTask) Descriptor() ([]byte, []int) {
2025-10-07 16:14:47 +08:00
return file_device_proto_rawDescGZIP(), []int{2}
}
2025-09-29 23:54:09 +08:00
func (x *CollectTask) GetCommand() *Raw485Command {
if x != nil {
2025-09-29 23:54:09 +08:00
return x.Command
}
2025-09-29 23:54:09 +08:00
return nil
2025-09-25 20:16:07 +08:00
}
// CollectResult
// 这是设备响应的、极致精简的数据包。
type CollectResult struct {
2025-09-26 15:26:21 +08:00
state protoimpl.MessageState `protogen:"open.v1"`
CorrelationId string `protobuf:"bytes,1,opt,name=correlation_id,json=correlationId,proto3" json:"correlation_id,omitempty"` // 从下行指令中原样返回的关联ID
Values []float32 `protobuf:"fixed32,2,rep,packed,name=values,proto3" json:"values,omitempty"` // 按预定顺序排列的采集值
2025-09-26 15:26:21 +08:00
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *CollectResult) Reset() {
*x = CollectResult{}
2025-10-07 16:14:47 +08:00
mi := &file_device_proto_msgTypes[3]
2025-09-26 15:26:21 +08:00
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *CollectResult) String() string {
2025-09-26 15:26:21 +08:00
return protoimpl.X.MessageStringOf(x)
}
func (*CollectResult) ProtoMessage() {}
2025-09-26 15:26:21 +08:00
func (x *CollectResult) ProtoReflect() protoreflect.Message {
2025-10-07 16:14:47 +08:00
mi := &file_device_proto_msgTypes[3]
2025-09-26 15:26:21 +08:00
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use CollectResult.ProtoReflect.Descriptor instead.
func (*CollectResult) Descriptor() ([]byte, []int) {
2025-10-07 16:14:47 +08:00
return file_device_proto_rawDescGZIP(), []int{3}
}
func (x *CollectResult) GetCorrelationId() string {
if x != nil {
return x.CorrelationId
}
return ""
2025-09-26 15:26:21 +08:00
}
func (x *CollectResult) GetValues() []float32 {
2025-09-26 15:26:21 +08:00
if x != nil {
return x.Values
2025-09-26 15:26:21 +08:00
}
return nil
}
2025-10-07 16:14:47 +08:00
// 指令 (所有从平台下发到设备的数据都应该被包装在这里面)
// 使用 oneof 来替代 google.protobuf.Any这是嵌入式环境下的标准做法。
// 它高效、类型安全,且只解码一次。
type Instruction struct {
state protoimpl.MessageState `protogen:"open.v1"`
// Types that are valid to be assigned to Payload:
//
// *Instruction_Raw_485Command
// *Instruction_BatchCollectCommand
// *Instruction_CollectResult
Payload isInstruction_Payload `protobuf_oneof:"payload"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *Instruction) Reset() {
*x = Instruction{}
mi := &file_device_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *Instruction) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Instruction) ProtoMessage() {}
func (x *Instruction) ProtoReflect() protoreflect.Message {
mi := &file_device_proto_msgTypes[4]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Instruction.ProtoReflect.Descriptor instead.
func (*Instruction) Descriptor() ([]byte, []int) {
return file_device_proto_rawDescGZIP(), []int{4}
}
func (x *Instruction) GetPayload() isInstruction_Payload {
if x != nil {
return x.Payload
}
return nil
}
func (x *Instruction) GetRaw_485Command() *Raw485Command {
if x != nil {
if x, ok := x.Payload.(*Instruction_Raw_485Command); ok {
return x.Raw_485Command
}
}
return nil
}
func (x *Instruction) GetBatchCollectCommand() *BatchCollectCommand {
if x != nil {
if x, ok := x.Payload.(*Instruction_BatchCollectCommand); ok {
return x.BatchCollectCommand
}
}
return nil
}
func (x *Instruction) GetCollectResult() *CollectResult {
if x != nil {
if x, ok := x.Payload.(*Instruction_CollectResult); ok {
return x.CollectResult
}
}
return nil
}
type isInstruction_Payload interface {
isInstruction_Payload()
}
type Instruction_Raw_485Command struct {
Raw_485Command *Raw485Command `protobuf:"bytes,1,opt,name=raw_485_command,json=raw485Command,proto3,oneof"`
}
type Instruction_BatchCollectCommand struct {
BatchCollectCommand *BatchCollectCommand `protobuf:"bytes,2,opt,name=batch_collect_command,json=batchCollectCommand,proto3,oneof"`
}
type Instruction_CollectResult struct {
CollectResult *CollectResult `protobuf:"bytes,3,opt,name=collect_result,json=collectResult,proto3,oneof"` // ADDED用于上行数据
}
func (*Instruction_Raw_485Command) isInstruction_Payload() {}
func (*Instruction_BatchCollectCommand) isInstruction_Payload() {}
func (*Instruction_CollectResult) isInstruction_Payload() {}
2025-09-15 23:45:15 +08:00
var File_device_proto protoreflect.FileDescriptor
const file_device_proto_rawDesc = "" +
"\n" +
2025-10-07 16:14:47 +08:00
"\fdevice.proto\x12\x06device\"S\n" +
2025-09-30 00:01:51 +08:00
"\rRaw485Command\x12\x1d\n" +
"\n" +
"bus_number\x18\x01 \x01(\x05R\tbusNumber\x12#\n" +
2025-10-07 16:14:47 +08:00
"\rcommand_bytes\x18\x02 \x01(\fR\fcommandBytes\"g\n" +
"\x13BatchCollectCommand\x12%\n" +
"\x0ecorrelation_id\x18\x01 \x01(\tR\rcorrelationId\x12)\n" +
2025-09-30 00:07:16 +08:00
"\x05tasks\x18\x02 \x03(\v2\x13.device.CollectTaskR\x05tasks\">\n" +
"\vCollectTask\x12/\n" +
2025-09-30 00:01:51 +08:00
"\acommand\x18\x02 \x01(\v2\x15.device.Raw485CommandR\acommand\"N\n" +
"\rCollectResult\x12%\n" +
"\x0ecorrelation_id\x18\x01 \x01(\tR\rcorrelationId\x12\x16\n" +
2025-10-07 16:14:47 +08:00
"\x06values\x18\x02 \x03(\x02R\x06values\"\xec\x01\n" +
"\vInstruction\x12?\n" +
"\x0fraw_485_command\x18\x01 \x01(\v2\x15.device.Raw485CommandH\x00R\rraw485Command\x12Q\n" +
"\x15batch_collect_command\x18\x02 \x01(\v2\x1b.device.BatchCollectCommandH\x00R\x13batchCollectCommand\x12>\n" +
"\x0ecollect_result\x18\x03 \x01(\v2\x15.device.CollectResultH\x00R\rcollectResultB\t\n" +
"\apayloadB\x1eZ\x1cinternal/domain/device/protob\x06proto3"
2025-09-15 23:45:15 +08:00
var (
file_device_proto_rawDescOnce sync.Once
file_device_proto_rawDescData []byte
)
func file_device_proto_rawDescGZIP() []byte {
file_device_proto_rawDescOnce.Do(func() {
file_device_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_device_proto_rawDesc), len(file_device_proto_rawDesc)))
})
return file_device_proto_rawDescData
}
var file_device_proto_msgTypes = make([]protoimpl.MessageInfo, 5)
2025-09-15 23:45:15 +08:00
var file_device_proto_goTypes = []any{
2025-10-07 16:14:47 +08:00
(*Raw485Command)(nil), // 0: device.Raw485Command
(*BatchCollectCommand)(nil), // 1: device.BatchCollectCommand
(*CollectTask)(nil), // 2: device.CollectTask
(*CollectResult)(nil), // 3: device.CollectResult
(*Instruction)(nil), // 4: device.Instruction
2025-09-15 23:45:15 +08:00
}
var file_device_proto_depIdxs = []int32{
2025-10-07 16:14:47 +08:00
2, // 0: device.BatchCollectCommand.tasks:type_name -> device.CollectTask
0, // 1: device.CollectTask.command:type_name -> device.Raw485Command
0, // 2: device.Instruction.raw_485_command:type_name -> device.Raw485Command
1, // 3: device.Instruction.batch_collect_command:type_name -> device.BatchCollectCommand
3, // 4: device.Instruction.collect_result:type_name -> device.CollectResult
5, // [5:5] is the sub-list for method output_type
5, // [5:5] is the sub-list for method input_type
5, // [5:5] is the sub-list for extension type_name
5, // [5:5] is the sub-list for extension extendee
0, // [0:5] is the sub-list for field type_name
2025-09-15 23:45:15 +08:00
}
func init() { file_device_proto_init() }
func file_device_proto_init() {
if File_device_proto != nil {
return
}
2025-10-07 16:14:47 +08:00
file_device_proto_msgTypes[4].OneofWrappers = []any{
(*Instruction_Raw_485Command)(nil),
(*Instruction_BatchCollectCommand)(nil),
(*Instruction_CollectResult)(nil),
}
2025-09-15 23:45:15 +08:00
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_device_proto_rawDesc), len(file_device_proto_rawDesc)),
2025-10-07 16:14:47 +08:00
NumEnums: 0,
NumMessages: 5,
2025-09-15 23:45:15 +08:00
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_device_proto_goTypes,
DependencyIndexes: file_device_proto_depIdxs,
MessageInfos: file_device_proto_msgTypes,
}.Build()
File_device_proto = out.File
file_device_proto_goTypes = nil
file_device_proto_depIdxs = nil
}