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

968 lines
30 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-12-03 14:06:56 +08:00
type UpdateStatusReport_Status int32
2025-11-29 17:06:09 +08:00
const (
2025-12-03 14:06:56 +08:00
UpdateStatusReport_STATUS_UNSPECIFIED UpdateStatusReport_Status = 0 // 未指定protobuf3 要求枚举从0开始
UpdateStatusReport_SUCCESS UpdateStatusReport_Status = 1 // 升级成功,新固件已运行
UpdateStatusReport_SUCCESS_ALREADY_UP_TO_DATE UpdateStatusReport_Status = 2 // 版本已是最新,未执行升级
UpdateStatusReport_FAILED_PRE_CHECK UpdateStatusReport_Status = 3 // 升级前检查失败 (例如拒绝降级、准备分区失败)
UpdateStatusReport_FAILED_MANIFEST_VERIFY UpdateStatusReport_Status = 4 // 清单文件下载或校验失败
UpdateStatusReport_FAILED_DOWNLOAD UpdateStatusReport_Status = 5 // 固件文件下载或校验失败
UpdateStatusReport_FAILED_ROLLED_BACK UpdateStatusReport_Status = 6 // 新固件启动失败,已自动回滚
UpdateStatusReport_FAILED_TIMEOUT UpdateStatusReport_Status = 7 // 平台在超时后仍未收到SUCCESS报告将任务标记为此状态 (平台推断)
2025-11-29 17:06:09 +08:00
)
2025-12-03 14:06:56 +08:00
// Enum value maps for UpdateStatusReport_Status.
2025-11-29 17:06:09 +08:00
var (
2025-12-03 14:06:56 +08:00
UpdateStatusReport_Status_name = map[int32]string{
0: "STATUS_UNSPECIFIED",
1: "SUCCESS",
2: "SUCCESS_ALREADY_UP_TO_DATE",
3: "FAILED_PRE_CHECK",
4: "FAILED_MANIFEST_VERIFY",
5: "FAILED_DOWNLOAD",
6: "FAILED_ROLLED_BACK",
7: "FAILED_TIMEOUT",
}
UpdateStatusReport_Status_value = map[string]int32{
"STATUS_UNSPECIFIED": 0,
"SUCCESS": 1,
"SUCCESS_ALREADY_UP_TO_DATE": 2,
"FAILED_PRE_CHECK": 3,
"FAILED_MANIFEST_VERIFY": 4,
"FAILED_DOWNLOAD": 5,
"FAILED_ROLLED_BACK": 6,
"FAILED_TIMEOUT": 7,
2025-11-29 17:06:09 +08:00
}
)
2025-12-03 14:06:56 +08:00
func (x UpdateStatusReport_Status) Enum() *UpdateStatusReport_Status {
p := new(UpdateStatusReport_Status)
2025-11-29 17:06:09 +08:00
*p = x
return p
}
2025-12-03 14:06:56 +08:00
func (x UpdateStatusReport_Status) String() string {
2025-11-29 17:06:09 +08:00
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
2025-12-03 14:06:56 +08:00
func (UpdateStatusReport_Status) Descriptor() protoreflect.EnumDescriptor {
2025-11-29 17:06:09 +08:00
return file_device_proto_enumTypes[0].Descriptor()
}
2025-12-03 14:06:56 +08:00
func (UpdateStatusReport_Status) Type() protoreflect.EnumType {
2025-11-29 17:06:09 +08:00
return &file_device_proto_enumTypes[0]
}
2025-12-03 14:06:56 +08:00
func (x UpdateStatusReport_Status) Number() protoreflect.EnumNumber {
2025-11-29 17:06:09 +08:00
return protoreflect.EnumNumber(x)
}
2025-12-03 14:06:56 +08:00
// Deprecated: Use UpdateStatusReport_Status.Descriptor instead.
func (UpdateStatusReport_Status) EnumDescriptor() ([]byte, []int) {
return file_device_proto_rawDescGZIP(), []int{9, 0}
2025-11-29 17:06:09 +08:00
}
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-12-03 14:06:56 +08:00
mi := &file_device_proto_msgTypes[0]
2025-09-15 23:45:15 +08:00
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-12-03 14:06:56 +08:00
mi := &file_device_proto_msgTypes[0]
2025-09-15 23:45:15 +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)
}
2025-09-29 23:54:09 +08:00
// Deprecated: Use Raw485Command.ProtoReflect.Descriptor instead.
func (*Raw485Command) Descriptor() ([]byte, []int) {
2025-12-03 14:06:56 +08:00
return file_device_proto_rawDescGZIP(), []int{0}
2025-09-15 23:45:15 +08:00
}
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
}
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-12-03 14:06:56 +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-12-03 14:06:56 +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-12-03 14:06:56 +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
}
2025-10-07 16:14:47 +08:00
// 定义了单个采集任务的“意图”。
type CollectTask struct {
state protoimpl.MessageState `protogen:"open.v1"`
2025-10-09 13:55:46 +08:00
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{}
2025-12-03 14:06:56 +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-12-03 14:06:56 +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-12-03 14:06:56 +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
}
// 这是设备响应的、极致精简的数据包。
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-12-03 14:06:56 +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-12-03 14:06:56 +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-12-03 14:06:56 +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-12-03 14:06:56 +08:00
// 平台向设备发送的Ping指令用于检查存活性。
type Ping struct {
state protoimpl.MessageState `protogen:"open.v1"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *Ping) Reset() {
*x = Ping{}
mi := &file_device_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *Ping) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Ping) ProtoMessage() {}
func (x *Ping) 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 Ping.ProtoReflect.Descriptor instead.
func (*Ping) Descriptor() ([]byte, []int) {
return file_device_proto_rawDescGZIP(), []int{4}
}
// 设备对Ping的响应或设备主动上报的心跳。
// 它包含了设备的关键状态信息。
type Pong struct {
2025-11-29 17:06:09 +08:00
state protoimpl.MessageState `protogen:"open.v1"`
2025-12-03 14:06:56 +08:00
FirmwareVersion string `protobuf:"bytes,1,opt,name=firmware_version,json=firmwareVersion,proto3" json:"firmware_version,omitempty"` // 当前固件版本
2025-11-29 17:06:09 +08:00
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
2025-12-03 14:06:56 +08:00
func (x *Pong) Reset() {
*x = Pong{}
2025-11-29 17:06:09 +08:00
mi := &file_device_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
2025-12-03 14:06:56 +08:00
func (x *Pong) String() string {
2025-11-29 17:06:09 +08:00
return protoimpl.X.MessageStringOf(x)
}
2025-12-03 14:06:56 +08:00
func (*Pong) ProtoMessage() {}
2025-11-29 17:06:09 +08:00
2025-12-03 14:06:56 +08:00
func (x *Pong) ProtoReflect() protoreflect.Message {
2025-11-29 17:06:09 +08:00
mi := &file_device_proto_msgTypes[5]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
2025-12-03 14:06:56 +08:00
// Deprecated: Use Pong.ProtoReflect.Descriptor instead.
func (*Pong) Descriptor() ([]byte, []int) {
2025-11-29 17:06:09 +08:00
return file_device_proto_rawDescGZIP(), []int{5}
}
2025-12-03 14:06:56 +08:00
func (x *Pong) GetFirmwareVersion() string {
2025-11-29 17:06:09 +08:00
if x != nil {
return x.FirmwareVersion
}
return ""
}
2025-12-03 14:06:56 +08:00
// PrepareUpdateReq: 平台发送给设备,通知设备准备开始 OTA 升级 (下行)
type PrepareUpdateReq struct {
state protoimpl.MessageState `protogen:"open.v1"`
Version string `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` // 新固件版本号
TaskId string `protobuf:"bytes,2,opt,name=task_id,json=taskId,proto3" json:"task_id,omitempty"` // 升级任务唯一ID
ManifestMd5 string `protobuf:"bytes,3,opt,name=manifest_md5,json=manifestMd5,proto3" json:"manifest_md5,omitempty"` // 清单文件的 MD5 校验和,用于设备初步校验清单文件完整性
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
2025-11-29 17:06:09 +08:00
}
2025-12-03 14:06:56 +08:00
func (x *PrepareUpdateReq) Reset() {
*x = PrepareUpdateReq{}
2025-11-29 17:06:09 +08:00
mi := &file_device_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
2025-12-03 14:06:56 +08:00
func (x *PrepareUpdateReq) String() string {
2025-11-29 17:06:09 +08:00
return protoimpl.X.MessageStringOf(x)
}
2025-12-03 14:06:56 +08:00
func (*PrepareUpdateReq) ProtoMessage() {}
2025-11-29 17:06:09 +08:00
2025-12-03 14:06:56 +08:00
func (x *PrepareUpdateReq) ProtoReflect() protoreflect.Message {
2025-11-29 17:06:09 +08:00
mi := &file_device_proto_msgTypes[6]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
2025-12-03 14:06:56 +08:00
// Deprecated: Use PrepareUpdateReq.ProtoReflect.Descriptor instead.
func (*PrepareUpdateReq) Descriptor() ([]byte, []int) {
2025-11-29 17:06:09 +08:00
return file_device_proto_rawDescGZIP(), []int{6}
}
2025-12-03 14:06:56 +08:00
func (x *PrepareUpdateReq) GetVersion() string {
2025-11-29 17:06:09 +08:00
if x != nil {
2025-12-03 14:06:56 +08:00
return x.Version
2025-11-29 17:06:09 +08:00
}
2025-12-03 14:06:56 +08:00
return ""
2025-11-29 17:06:09 +08:00
}
2025-12-03 14:06:56 +08:00
func (x *PrepareUpdateReq) GetTaskId() string {
2025-11-29 17:06:09 +08:00
if x != nil {
2025-12-03 14:06:56 +08:00
return x.TaskId
2025-11-29 17:06:09 +08:00
}
return ""
}
2025-12-03 14:06:56 +08:00
func (x *PrepareUpdateReq) GetManifestMd5() string {
if x != nil {
return x.ManifestMd5
}
return ""
2025-11-29 17:06:09 +08:00
}
2025-12-03 14:06:56 +08:00
// RequestFile: 设备向平台请求特定文件 (包括清单文件和固件文件) (上行)
type RequestFile struct {
state protoimpl.MessageState `protogen:"open.v1"`
TaskId string `protobuf:"bytes,1,opt,name=task_id,json=taskId,proto3" json:"task_id,omitempty"` // 升级任务ID
Filepath string `protobuf:"bytes,2,opt,name=filepath,proto3" json:"filepath,omitempty"` // 请求的文件路径 (例如 "/manifest.json" 或 "/main.py")
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *RequestFile) Reset() {
*x = RequestFile{}
2025-11-29 17:06:09 +08:00
mi := &file_device_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
2025-12-03 14:06:56 +08:00
func (x *RequestFile) String() string {
2025-11-29 17:06:09 +08:00
return protoimpl.X.MessageStringOf(x)
}
2025-12-03 14:06:56 +08:00
func (*RequestFile) ProtoMessage() {}
2025-11-29 17:06:09 +08:00
2025-12-03 14:06:56 +08:00
func (x *RequestFile) ProtoReflect() protoreflect.Message {
2025-11-29 17:06:09 +08:00
mi := &file_device_proto_msgTypes[7]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
2025-12-03 14:06:56 +08:00
// Deprecated: Use RequestFile.ProtoReflect.Descriptor instead.
func (*RequestFile) Descriptor() ([]byte, []int) {
2025-11-29 17:06:09 +08:00
return file_device_proto_rawDescGZIP(), []int{7}
}
2025-12-03 14:06:56 +08:00
func (x *RequestFile) GetTaskId() string {
2025-11-29 17:06:09 +08:00
if x != nil {
2025-12-03 14:06:56 +08:00
return x.TaskId
2025-11-29 17:06:09 +08:00
}
2025-12-03 14:06:56 +08:00
return ""
2025-11-29 17:06:09 +08:00
}
2025-12-03 14:06:56 +08:00
func (x *RequestFile) GetFilepath() string {
2025-11-29 17:06:09 +08:00
if x != nil {
2025-12-03 14:06:56 +08:00
return x.Filepath
2025-11-29 17:06:09 +08:00
}
2025-12-03 14:06:56 +08:00
return ""
2025-11-29 17:06:09 +08:00
}
2025-12-03 14:06:56 +08:00
// FileResponse: 平台响应设备请求,发送单个文件的完整内容 (下行)
// LoRa 传输层会自动处理分片和重组,因此应用层可以直接发送完整的单个文件内容
type FileResponse struct {
2025-11-29 17:06:09 +08:00
state protoimpl.MessageState `protogen:"open.v1"`
2025-12-03 14:06:56 +08:00
TaskId string `protobuf:"bytes,1,opt,name=task_id,json=taskId,proto3" json:"task_id,omitempty"` // 升级任务ID
Filepath string `protobuf:"bytes,2,opt,name=filepath,proto3" json:"filepath,omitempty"` // 设备上的目标路径 (例如 "/manifest.json" 或 "/main.py")
Content []byte `protobuf:"bytes,3,opt,name=content,proto3" json:"content,omitempty"` // 文件的完整内容
2025-11-29 17:06:09 +08:00
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
2025-12-03 14:06:56 +08:00
func (x *FileResponse) Reset() {
*x = FileResponse{}
2025-11-29 17:06:09 +08:00
mi := &file_device_proto_msgTypes[8]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
2025-12-03 14:06:56 +08:00
func (x *FileResponse) String() string {
2025-11-29 17:06:09 +08:00
return protoimpl.X.MessageStringOf(x)
}
2025-12-03 14:06:56 +08:00
func (*FileResponse) ProtoMessage() {}
2025-11-29 17:06:09 +08:00
2025-12-03 14:06:56 +08:00
func (x *FileResponse) ProtoReflect() protoreflect.Message {
2025-11-29 17:06:09 +08:00
mi := &file_device_proto_msgTypes[8]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
2025-12-03 14:06:56 +08:00
// Deprecated: Use FileResponse.ProtoReflect.Descriptor instead.
func (*FileResponse) Descriptor() ([]byte, []int) {
2025-11-29 17:06:09 +08:00
return file_device_proto_rawDescGZIP(), []int{8}
}
2025-12-03 14:06:56 +08:00
func (x *FileResponse) GetTaskId() string {
if x != nil {
return x.TaskId
}
return ""
}
func (x *FileResponse) GetFilepath() string {
2025-11-29 17:06:09 +08:00
if x != nil {
2025-12-03 14:06:56 +08:00
return x.Filepath
}
return ""
}
func (x *FileResponse) GetContent() []byte {
if x != nil {
return x.Content
2025-11-29 17:06:09 +08:00
}
return nil
}
2025-12-03 14:06:56 +08:00
// UpdateStatusReport: 设备向平台报告升级状态 (上行)
type UpdateStatusReport struct {
state protoimpl.MessageState `protogen:"open.v1"`
TaskId string `protobuf:"bytes,1,opt,name=task_id,json=taskId,proto3" json:"task_id,omitempty"` // 升级任务ID
CurrentVersion string `protobuf:"bytes,2,opt,name=current_version,json=currentVersion,proto3" json:"current_version,omitempty"` // 操作完成后的当前版本
Status UpdateStatusReport_Status `protobuf:"varint,3,opt,name=status,proto3,enum=device.UpdateStatusReport_Status" json:"status,omitempty"` // 升级的最终状态
ErrorMessage string `protobuf:"bytes,4,opt,name=error_message,json=errorMessage,proto3" json:"error_message,omitempty"` // 人类可读的详细错误信息
FailedFile string `protobuf:"bytes,5,opt,name=failed_file,json=failedFile,proto3" json:"failed_file,omitempty"` // 失败时关联的文件路径 (可选)
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
2025-12-03 14:06:56 +08:00
func (x *UpdateStatusReport) Reset() {
*x = UpdateStatusReport{}
mi := &file_device_proto_msgTypes[9]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
2025-12-03 14:06:56 +08:00
func (x *UpdateStatusReport) String() string {
return protoimpl.X.MessageStringOf(x)
}
2025-12-03 14:06:56 +08:00
func (*UpdateStatusReport) ProtoMessage() {}
2025-12-03 14:06:56 +08:00
func (x *UpdateStatusReport) ProtoReflect() protoreflect.Message {
mi := &file_device_proto_msgTypes[9]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
2025-12-03 14:06:56 +08:00
// Deprecated: Use UpdateStatusReport.ProtoReflect.Descriptor instead.
func (*UpdateStatusReport) Descriptor() ([]byte, []int) {
return file_device_proto_rawDescGZIP(), []int{9}
}
2025-12-03 14:06:56 +08:00
func (x *UpdateStatusReport) GetTaskId() string {
if x != nil {
return x.TaskId
}
return ""
}
2025-12-03 14:06:56 +08:00
func (x *UpdateStatusReport) GetCurrentVersion() string {
if x != nil {
return x.CurrentVersion
}
return ""
}
2025-12-03 14:06:56 +08:00
func (x *UpdateStatusReport) GetStatus() UpdateStatusReport_Status {
if x != nil {
2025-12-03 14:06:56 +08:00
return x.Status
}
2025-12-03 14:06:56 +08:00
return UpdateStatusReport_STATUS_UNSPECIFIED
}
2025-12-03 14:06:56 +08:00
func (x *UpdateStatusReport) GetErrorMessage() string {
if x != nil {
return x.ErrorMessage
}
return ""
}
2025-12-03 14:06:56 +08:00
func (x *UpdateStatusReport) GetFailedFile() string {
if x != nil {
2025-12-03 14:06:56 +08:00
return x.FailedFile
}
return ""
}
2025-11-29 17:06:09 +08:00
// Instruction 封装了所有与设备间的通信。
// 使用 oneof 来确保每个消息只有一个负载类型,这在嵌入式系统中是高效且类型安全的。
2025-10-07 16:14:47 +08:00
type Instruction struct {
state protoimpl.MessageState `protogen:"open.v1"`
// Types that are valid to be assigned to Payload:
//
// *Instruction_Raw_485Command
// *Instruction_BatchCollectCommand
// *Instruction_Ping
2025-12-03 14:06:56 +08:00
// *Instruction_PrepareUpdateReq
// *Instruction_FileResponse
2025-10-07 16:14:47 +08:00
// *Instruction_CollectResult
// *Instruction_Pong
2025-12-03 14:06:56 +08:00
// *Instruction_RequestFile
// *Instruction_UpdateStatusReport
2025-10-07 16:14:47 +08:00
Payload isInstruction_Payload `protobuf_oneof:"payload"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *Instruction) Reset() {
*x = Instruction{}
2025-12-03 14:06:56 +08:00
mi := &file_device_proto_msgTypes[10]
2025-10-07 16:14:47 +08:00
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 {
2025-12-03 14:06:56 +08:00
mi := &file_device_proto_msgTypes[10]
2025-10-07 16:14:47 +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 Instruction.ProtoReflect.Descriptor instead.
func (*Instruction) Descriptor() ([]byte, []int) {
2025-12-03 14:06:56 +08:00
return file_device_proto_rawDescGZIP(), []int{10}
2025-10-07 16:14:47 +08:00
}
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
}
2025-12-03 14:06:56 +08:00
func (x *Instruction) GetPing() *Ping {
2025-11-29 17:06:09 +08:00
if x != nil {
2025-12-03 14:06:56 +08:00
if x, ok := x.Payload.(*Instruction_Ping); ok {
return x.Ping
2025-11-29 17:06:09 +08:00
}
}
return nil
}
2025-12-03 14:06:56 +08:00
func (x *Instruction) GetPrepareUpdateReq() *PrepareUpdateReq {
2025-11-29 17:06:09 +08:00
if x != nil {
2025-12-03 14:06:56 +08:00
if x, ok := x.Payload.(*Instruction_PrepareUpdateReq); ok {
return x.PrepareUpdateReq
2025-11-29 17:06:09 +08:00
}
}
return nil
}
2025-12-03 14:06:56 +08:00
func (x *Instruction) GetFileResponse() *FileResponse {
if x != nil {
2025-12-03 14:06:56 +08:00
if x, ok := x.Payload.(*Instruction_FileResponse); ok {
return x.FileResponse
}
}
return nil
}
2025-10-07 16:14:47 +08:00
func (x *Instruction) GetCollectResult() *CollectResult {
if x != nil {
if x, ok := x.Payload.(*Instruction_CollectResult); ok {
return x.CollectResult
}
}
return nil
}
2025-12-03 14:06:56 +08:00
func (x *Instruction) GetPong() *Pong {
2025-11-29 17:06:09 +08:00
if x != nil {
2025-12-03 14:06:56 +08:00
if x, ok := x.Payload.(*Instruction_Pong); ok {
return x.Pong
2025-11-29 17:06:09 +08:00
}
}
return nil
}
2025-12-03 14:06:56 +08:00
func (x *Instruction) GetRequestFile() *RequestFile {
2025-11-29 17:06:09 +08:00
if x != nil {
2025-12-03 14:06:56 +08:00
if x, ok := x.Payload.(*Instruction_RequestFile); ok {
return x.RequestFile
2025-11-29 17:06:09 +08:00
}
}
return nil
}
2025-12-03 14:06:56 +08:00
func (x *Instruction) GetUpdateStatusReport() *UpdateStatusReport {
if x != nil {
2025-12-03 14:06:56 +08:00
if x, ok := x.Payload.(*Instruction_UpdateStatusReport); ok {
return x.UpdateStatusReport
}
}
return nil
}
2025-10-07 16:14:47 +08:00
type isInstruction_Payload interface {
isInstruction_Payload()
}
type Instruction_Raw_485Command struct {
2025-11-29 17:06:09 +08:00
// --- 下行指令 (平台 -> 设备) ---
2025-10-07 16:14:47 +08:00
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"`
}
2025-12-03 14:06:56 +08:00
type Instruction_Ping struct {
Ping *Ping `protobuf:"bytes,3,opt,name=ping,proto3,oneof"`
2025-11-29 17:06:09 +08:00
}
2025-12-03 14:06:56 +08:00
type Instruction_PrepareUpdateReq struct {
PrepareUpdateReq *PrepareUpdateReq `protobuf:"bytes,4,opt,name=prepare_update_req,json=prepareUpdateReq,proto3,oneof"`
2025-11-29 17:06:09 +08:00
}
2025-12-03 14:06:56 +08:00
type Instruction_FileResponse struct {
FileResponse *FileResponse `protobuf:"bytes,5,opt,name=file_response,json=fileResponse,proto3,oneof"`
}
2025-10-07 16:14:47 +08:00
type Instruction_CollectResult struct {
2025-11-29 17:06:09 +08:00
// --- 上行数据 (设备 -> 平台) ---
CollectResult *CollectResult `protobuf:"bytes,101,opt,name=collect_result,json=collectResult,proto3,oneof"`
}
2025-12-03 14:06:56 +08:00
type Instruction_Pong struct {
Pong *Pong `protobuf:"bytes,102,opt,name=pong,proto3,oneof"`
2025-11-29 17:06:09 +08:00
}
2025-12-03 14:06:56 +08:00
type Instruction_RequestFile struct {
RequestFile *RequestFile `protobuf:"bytes,103,opt,name=request_file,json=requestFile,proto3,oneof"`
2025-10-07 16:14:47 +08:00
}
2025-12-03 14:06:56 +08:00
type Instruction_UpdateStatusReport struct {
UpdateStatusReport *UpdateStatusReport `protobuf:"bytes,104,opt,name=update_status_report,json=updateStatusReport,proto3,oneof"`
}
2025-10-07 16:14:47 +08:00
func (*Instruction_Raw_485Command) isInstruction_Payload() {}
func (*Instruction_BatchCollectCommand) isInstruction_Payload() {}
2025-12-03 14:06:56 +08:00
func (*Instruction_Ping) isInstruction_Payload() {}
2025-11-29 17:06:09 +08:00
2025-12-03 14:06:56 +08:00
func (*Instruction_PrepareUpdateReq) isInstruction_Payload() {}
2025-11-29 17:06:09 +08:00
2025-12-03 14:06:56 +08:00
func (*Instruction_FileResponse) isInstruction_Payload() {}
2025-10-07 16:14:47 +08:00
func (*Instruction_CollectResult) isInstruction_Payload() {}
2025-12-03 14:06:56 +08:00
func (*Instruction_Pong) isInstruction_Payload() {}
2025-11-29 17:06:09 +08:00
2025-12-03 14:06:56 +08:00
func (*Instruction_RequestFile) isInstruction_Payload() {}
2025-11-29 17:06:09 +08:00
2025-12-03 14:06:56 +08:00
func (*Instruction_UpdateStatusReport) isInstruction_Payload() {}
2025-09-15 23:45:15 +08:00
var File_device_proto protoreflect.FileDescriptor
const file_device_proto_rawDesc = "" +
"\n" +
2025-12-03 14:06:56 +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-10-09 13:55:46 +08:00
"\acommand\x18\x01 \x01(\v2\x15.device.Raw485CommandR\acommand\"N\n" +
"\rCollectResult\x12%\n" +
"\x0ecorrelation_id\x18\x01 \x01(\tR\rcorrelationId\x12\x16\n" +
2025-12-03 14:06:56 +08:00
"\x06values\x18\x02 \x03(\x02R\x06values\"\x06\n" +
"\x04Ping\"1\n" +
"\x04Pong\x12)\n" +
2025-12-03 14:06:56 +08:00
"\x10firmware_version\x18\x01 \x01(\tR\x0ffirmwareVersion\"h\n" +
"\x10PrepareUpdateReq\x12\x18\n" +
"\aversion\x18\x01 \x01(\tR\aversion\x12\x17\n" +
"\atask_id\x18\x02 \x01(\tR\x06taskId\x12!\n" +
"\fmanifest_md5\x18\x03 \x01(\tR\vmanifestMd5\"B\n" +
"\vRequestFile\x12\x17\n" +
"\atask_id\x18\x01 \x01(\tR\x06taskId\x12\x1a\n" +
"\bfilepath\x18\x02 \x01(\tR\bfilepath\"]\n" +
"\fFileResponse\x12\x17\n" +
"\atask_id\x18\x01 \x01(\tR\x06taskId\x12\x1a\n" +
"\bfilepath\x18\x02 \x01(\tR\bfilepath\x12\x18\n" +
"\acontent\x18\x03 \x01(\fR\acontent\"\x9a\x03\n" +
"\x12UpdateStatusReport\x12\x17\n" +
"\atask_id\x18\x01 \x01(\tR\x06taskId\x12'\n" +
"\x0fcurrent_version\x18\x02 \x01(\tR\x0ecurrentVersion\x129\n" +
"\x06status\x18\x03 \x01(\x0e2!.device.UpdateStatusReport.StatusR\x06status\x12#\n" +
"\rerror_message\x18\x04 \x01(\tR\ferrorMessage\x12\x1f\n" +
"\vfailed_file\x18\x05 \x01(\tR\n" +
"failedFile\"\xc0\x01\n" +
"\x06Status\x12\x16\n" +
"\x12STATUS_UNSPECIFIED\x10\x00\x12\v\n" +
"\aSUCCESS\x10\x01\x12\x1e\n" +
"\x1aSUCCESS_ALREADY_UP_TO_DATE\x10\x02\x12\x14\n" +
"\x10FAILED_PRE_CHECK\x10\x03\x12\x1a\n" +
"\x16FAILED_MANIFEST_VERIFY\x10\x04\x12\x13\n" +
"\x0fFAILED_DOWNLOAD\x10\x05\x12\x16\n" +
"\x12FAILED_ROLLED_BACK\x10\x06\x12\x12\n" +
"\x0eFAILED_TIMEOUT\x10\a\"\xc5\x04\n" +
2025-10-07 16:14:47 +08:00
"\vInstruction\x12?\n" +
"\x0fraw_485_command\x18\x01 \x01(\v2\x15.device.Raw485CommandH\x00R\rraw485Command\x12Q\n" +
2025-12-03 14:06:56 +08:00
"\x15batch_collect_command\x18\x02 \x01(\v2\x1b.device.BatchCollectCommandH\x00R\x13batchCollectCommand\x12\"\n" +
"\x04ping\x18\x03 \x01(\v2\f.device.PingH\x00R\x04ping\x12H\n" +
"\x12prepare_update_req\x18\x04 \x01(\v2\x18.device.PrepareUpdateReqH\x00R\x10prepareUpdateReq\x12;\n" +
"\rfile_response\x18\x05 \x01(\v2\x14.device.FileResponseH\x00R\ffileResponse\x12>\n" +
"\x0ecollect_result\x18e \x01(\v2\x15.device.CollectResultH\x00R\rcollectResult\x12\"\n" +
"\x04pong\x18f \x01(\v2\f.device.PongH\x00R\x04pong\x128\n" +
"\frequest_file\x18g \x01(\v2\x13.device.RequestFileH\x00R\vrequestFile\x12N\n" +
"\x14update_status_report\x18h \x01(\v2\x1a.device.UpdateStatusReportH\x00R\x12updateStatusReportB\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
}
2025-11-29 17:06:09 +08:00
var file_device_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
2025-12-03 14:06:56 +08:00
var file_device_proto_msgTypes = make([]protoimpl.MessageInfo, 11)
2025-09-15 23:45:15 +08:00
var file_device_proto_goTypes = []any{
2025-12-03 14:06:56 +08:00
(UpdateStatusReport_Status)(0), // 0: device.UpdateStatusReport.Status
(*Raw485Command)(nil), // 1: device.Raw485Command
(*BatchCollectCommand)(nil), // 2: device.BatchCollectCommand
(*CollectTask)(nil), // 3: device.CollectTask
(*CollectResult)(nil), // 4: device.CollectResult
(*Ping)(nil), // 5: device.Ping
(*Pong)(nil), // 6: device.Pong
(*PrepareUpdateReq)(nil), // 7: device.PrepareUpdateReq
(*RequestFile)(nil), // 8: device.RequestFile
(*FileResponse)(nil), // 9: device.FileResponse
(*UpdateStatusReport)(nil), // 10: device.UpdateStatusReport
(*Instruction)(nil), // 11: device.Instruction
2025-09-15 23:45:15 +08:00
}
var file_device_proto_depIdxs = []int32{
2025-12-03 14:06:56 +08:00
3, // 0: device.BatchCollectCommand.tasks:type_name -> device.CollectTask
1, // 1: device.CollectTask.command:type_name -> device.Raw485Command
0, // 2: device.UpdateStatusReport.status:type_name -> device.UpdateStatusReport.Status
1, // 3: device.Instruction.raw_485_command:type_name -> device.Raw485Command
2, // 4: device.Instruction.batch_collect_command:type_name -> device.BatchCollectCommand
5, // 5: device.Instruction.ping:type_name -> device.Ping
7, // 6: device.Instruction.prepare_update_req:type_name -> device.PrepareUpdateReq
9, // 7: device.Instruction.file_response:type_name -> device.FileResponse
4, // 8: device.Instruction.collect_result:type_name -> device.CollectResult
6, // 9: device.Instruction.pong:type_name -> device.Pong
8, // 10: device.Instruction.request_file:type_name -> device.RequestFile
10, // 11: device.Instruction.update_status_report:type_name -> device.UpdateStatusReport
12, // [12:12] is the sub-list for method output_type
12, // [12:12] is the sub-list for method input_type
12, // [12:12] is the sub-list for extension type_name
12, // [12:12] is the sub-list for extension extendee
0, // [0:12] 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-12-03 14:06:56 +08:00
file_device_proto_msgTypes[10].OneofWrappers = []any{
2025-10-07 16:14:47 +08:00
(*Instruction_Raw_485Command)(nil),
(*Instruction_BatchCollectCommand)(nil),
(*Instruction_Ping)(nil),
2025-12-03 14:06:56 +08:00
(*Instruction_PrepareUpdateReq)(nil),
(*Instruction_FileResponse)(nil),
2025-10-07 16:14:47 +08:00
(*Instruction_CollectResult)(nil),
(*Instruction_Pong)(nil),
2025-12-03 14:06:56 +08:00
(*Instruction_RequestFile)(nil),
(*Instruction_UpdateStatusReport)(nil),
2025-10-07 16:14:47 +08:00
}
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-11-29 17:06:09 +08:00
NumEnums: 1,
2025-12-03 14:06:56 +08:00
NumMessages: 11,
2025-09-15 23:45:15 +08:00
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_device_proto_goTypes,
DependencyIndexes: file_device_proto_depIdxs,
2025-11-29 17:06:09 +08:00
EnumInfos: file_device_proto_enumTypes,
2025-09-15 23:45:15 +08:00
MessageInfos: file_device_proto_msgTypes,
}.Build()
File_device_proto = out.File
file_device_proto_goTypes = nil
file_device_proto_depIdxs = nil
}