416 lines
		
	
	
		
			12 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			416 lines
		
	
	
		
			12 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
// 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)
 | 
						||
)
 | 
						||
 | 
						||
// 平台生成的原始485指令,单片机直接发送到总线
 | 
						||
type Raw485Command struct {
 | 
						||
	state         protoimpl.MessageState `protogen:"open.v1"`
 | 
						||
	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
 | 
						||
	sizeCache     protoimpl.SizeCache
 | 
						||
}
 | 
						||
 | 
						||
func (x *Raw485Command) Reset() {
 | 
						||
	*x = Raw485Command{}
 | 
						||
	mi := &file_device_proto_msgTypes[0]
 | 
						||
	ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
 | 
						||
	ms.StoreMessageInfo(mi)
 | 
						||
}
 | 
						||
 | 
						||
func (x *Raw485Command) String() string {
 | 
						||
	return protoimpl.X.MessageStringOf(x)
 | 
						||
}
 | 
						||
 | 
						||
func (*Raw485Command) ProtoMessage() {}
 | 
						||
 | 
						||
func (x *Raw485Command) ProtoReflect() protoreflect.Message {
 | 
						||
	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)
 | 
						||
}
 | 
						||
 | 
						||
// Deprecated: Use Raw485Command.ProtoReflect.Descriptor instead.
 | 
						||
func (*Raw485Command) Descriptor() ([]byte, []int) {
 | 
						||
	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 {
 | 
						||
	if x != nil {
 | 
						||
		return x.CommandBytes
 | 
						||
	}
 | 
						||
	return nil
 | 
						||
}
 | 
						||
 | 
						||
// BatchCollectCommand
 | 
						||
// 一个完整的、包含所有元数据的批量采集任务。
 | 
						||
type BatchCollectCommand struct {
 | 
						||
	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"`                                      // 采集任务列表
 | 
						||
	unknownFields protoimpl.UnknownFields
 | 
						||
	sizeCache     protoimpl.SizeCache
 | 
						||
}
 | 
						||
 | 
						||
func (x *BatchCollectCommand) Reset() {
 | 
						||
	*x = BatchCollectCommand{}
 | 
						||
	mi := &file_device_proto_msgTypes[1]
 | 
						||
	ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
 | 
						||
	ms.StoreMessageInfo(mi)
 | 
						||
}
 | 
						||
 | 
						||
func (x *BatchCollectCommand) String() string {
 | 
						||
	return protoimpl.X.MessageStringOf(x)
 | 
						||
}
 | 
						||
 | 
						||
func (*BatchCollectCommand) ProtoMessage() {}
 | 
						||
 | 
						||
func (x *BatchCollectCommand) ProtoReflect() protoreflect.Message {
 | 
						||
	mi := &file_device_proto_msgTypes[1]
 | 
						||
	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) {
 | 
						||
	return file_device_proto_rawDescGZIP(), []int{1}
 | 
						||
}
 | 
						||
 | 
						||
func (x *BatchCollectCommand) GetCorrelationId() string {
 | 
						||
	if x != nil {
 | 
						||
		return x.CorrelationId
 | 
						||
	}
 | 
						||
	return ""
 | 
						||
}
 | 
						||
 | 
						||
func (x *BatchCollectCommand) GetTasks() []*CollectTask {
 | 
						||
	if x != nil {
 | 
						||
		return x.Tasks
 | 
						||
	}
 | 
						||
	return nil
 | 
						||
}
 | 
						||
 | 
						||
// CollectTask
 | 
						||
// 定义了单个采集任务的“意图”。
 | 
						||
type CollectTask struct {
 | 
						||
	state         protoimpl.MessageState `protogen:"open.v1"`
 | 
						||
	Command       *Raw485Command         `protobuf:"bytes,1,opt,name=command,proto3" json:"command,omitempty"` // 平台生成的原始485指令
 | 
						||
	unknownFields protoimpl.UnknownFields
 | 
						||
	sizeCache     protoimpl.SizeCache
 | 
						||
}
 | 
						||
 | 
						||
func (x *CollectTask) Reset() {
 | 
						||
	*x = CollectTask{}
 | 
						||
	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 {
 | 
						||
	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) {
 | 
						||
	return file_device_proto_rawDescGZIP(), []int{2}
 | 
						||
}
 | 
						||
 | 
						||
func (x *CollectTask) GetCommand() *Raw485Command {
 | 
						||
	if x != nil {
 | 
						||
		return x.Command
 | 
						||
	}
 | 
						||
	return nil
 | 
						||
}
 | 
						||
 | 
						||
// CollectResult
 | 
						||
// 这是设备响应的、极致精简的数据包。
 | 
						||
type CollectResult struct {
 | 
						||
	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"`                           // 按预定顺序排列的采集值
 | 
						||
	unknownFields protoimpl.UnknownFields
 | 
						||
	sizeCache     protoimpl.SizeCache
 | 
						||
}
 | 
						||
 | 
						||
func (x *CollectResult) Reset() {
 | 
						||
	*x = CollectResult{}
 | 
						||
	mi := &file_device_proto_msgTypes[3]
 | 
						||
	ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
 | 
						||
	ms.StoreMessageInfo(mi)
 | 
						||
}
 | 
						||
 | 
						||
func (x *CollectResult) String() string {
 | 
						||
	return protoimpl.X.MessageStringOf(x)
 | 
						||
}
 | 
						||
 | 
						||
func (*CollectResult) ProtoMessage() {}
 | 
						||
 | 
						||
func (x *CollectResult) ProtoReflect() protoreflect.Message {
 | 
						||
	mi := &file_device_proto_msgTypes[3]
 | 
						||
	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) {
 | 
						||
	return file_device_proto_rawDescGZIP(), []int{3}
 | 
						||
}
 | 
						||
 | 
						||
func (x *CollectResult) GetCorrelationId() string {
 | 
						||
	if x != nil {
 | 
						||
		return x.CorrelationId
 | 
						||
	}
 | 
						||
	return ""
 | 
						||
}
 | 
						||
 | 
						||
func (x *CollectResult) GetValues() []float32 {
 | 
						||
	if x != nil {
 | 
						||
		return x.Values
 | 
						||
	}
 | 
						||
	return nil
 | 
						||
}
 | 
						||
 | 
						||
// 指令 (所有从平台下发到设备的数据都应该被包装在这里面)
 | 
						||
// 使用 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() {}
 | 
						||
 | 
						||
var File_device_proto protoreflect.FileDescriptor
 | 
						||
 | 
						||
const file_device_proto_rawDesc = "" +
 | 
						||
	"\n" +
 | 
						||
	"\fdevice.proto\x12\x06device\"S\n" +
 | 
						||
	"\rRaw485Command\x12\x1d\n" +
 | 
						||
	"\n" +
 | 
						||
	"bus_number\x18\x01 \x01(\x05R\tbusNumber\x12#\n" +
 | 
						||
	"\rcommand_bytes\x18\x02 \x01(\fR\fcommandBytes\"g\n" +
 | 
						||
	"\x13BatchCollectCommand\x12%\n" +
 | 
						||
	"\x0ecorrelation_id\x18\x01 \x01(\tR\rcorrelationId\x12)\n" +
 | 
						||
	"\x05tasks\x18\x02 \x03(\v2\x13.device.CollectTaskR\x05tasks\">\n" +
 | 
						||
	"\vCollectTask\x12/\n" +
 | 
						||
	"\acommand\x18\x01 \x01(\v2\x15.device.Raw485CommandR\acommand\"N\n" +
 | 
						||
	"\rCollectResult\x12%\n" +
 | 
						||
	"\x0ecorrelation_id\x18\x01 \x01(\tR\rcorrelationId\x12\x16\n" +
 | 
						||
	"\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"
 | 
						||
 | 
						||
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)
 | 
						||
var file_device_proto_goTypes = []any{
 | 
						||
	(*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
 | 
						||
}
 | 
						||
var file_device_proto_depIdxs = []int32{
 | 
						||
	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
 | 
						||
}
 | 
						||
 | 
						||
func init() { file_device_proto_init() }
 | 
						||
func file_device_proto_init() {
 | 
						||
	if File_device_proto != nil {
 | 
						||
		return
 | 
						||
	}
 | 
						||
	file_device_proto_msgTypes[4].OneofWrappers = []any{
 | 
						||
		(*Instruction_Raw_485Command)(nil),
 | 
						||
		(*Instruction_BatchCollectCommand)(nil),
 | 
						||
		(*Instruction_CollectResult)(nil),
 | 
						||
	}
 | 
						||
	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)),
 | 
						||
			NumEnums:      0,
 | 
						||
			NumMessages:   5,
 | 
						||
			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
 | 
						||
}
 |