ota升级超时检查任务

This commit is contained in:
2025-12-03 17:34:38 +08:00
parent a1deb0011b
commit 9d9b5f801f
9 changed files with 267 additions and 18 deletions

View File

@@ -374,12 +374,14 @@ func (x *Pong) GetFirmwareVersion() string {
// PrepareUpdateReq: 平台发送给设备,通知设备准备开始 OTA 升级 (下行)
type PrepareUpdateReq struct {
state protoimpl.MessageState `protogen:"open.v1"`
Version string `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` // 新固件版本号
TaskId uint32 `protobuf:"varint,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
state protoimpl.MessageState `protogen:"open.v1"`
Version string `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` // 新固件版本号
TaskId uint32 `protobuf:"varint,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 校验和,用于设备初步校验清单文件完整性
RetryCount uint32 `protobuf:"varint,4,opt,name=retry_count,json=retryCount,proto3" json:"retry_count,omitempty"` // 建议的重试次数
RequestTimeoutSeconds uint32 `protobuf:"varint,5,opt,name=request_timeout_seconds,json=requestTimeoutSeconds,proto3" json:"request_timeout_seconds,omitempty"` // 建议的单次请求超时时间
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *PrepareUpdateReq) Reset() {
@@ -433,6 +435,20 @@ func (x *PrepareUpdateReq) GetManifestMd5() string {
return ""
}
func (x *PrepareUpdateReq) GetRetryCount() uint32 {
if x != nil {
return x.RetryCount
}
return 0
}
func (x *PrepareUpdateReq) GetRequestTimeoutSeconds() uint32 {
if x != nil {
return x.RequestTimeoutSeconds
}
return 0
}
// RequestFile: 设备向平台请求特定文件 (包括清单文件和固件文件) (上行)
type RequestFile struct {
state protoimpl.MessageState `protogen:"open.v1"`
@@ -842,11 +858,14 @@ const file_device_proto_rawDesc = "" +
"\x06values\x18\x02 \x03(\x02R\x06values\"\x06\n" +
"\x04Ping\"1\n" +
"\x04Pong\x12)\n" +
"\x10firmware_version\x18\x01 \x01(\tR\x0ffirmwareVersion\"h\n" +
"\x10firmware_version\x18\x01 \x01(\tR\x0ffirmwareVersion\"\xc1\x01\n" +
"\x10PrepareUpdateReq\x12\x18\n" +
"\aversion\x18\x01 \x01(\tR\aversion\x12\x17\n" +
"\atask_id\x18\x02 \x01(\rR\x06taskId\x12!\n" +
"\fmanifest_md5\x18\x03 \x01(\tR\vmanifestMd5\"B\n" +
"\fmanifest_md5\x18\x03 \x01(\tR\vmanifestMd5\x12\x1f\n" +
"\vretry_count\x18\x04 \x01(\rR\n" +
"retryCount\x126\n" +
"\x17request_timeout_seconds\x18\x05 \x01(\rR\x15requestTimeoutSeconds\"B\n" +
"\vRequestFile\x12\x17\n" +
"\atask_id\x18\x01 \x01(\rR\x06taskId\x12\x1a\n" +
"\bfilepath\x18\x02 \x01(\tR\bfilepath\"]\n" +

View File

@@ -48,6 +48,8 @@ message PrepareUpdateReq {
string version = 1; // 新固件版本号
uint32 task_id = 2; // 升级任务唯一ID
string manifest_md5 = 3; // 清单文件的 MD5 校验和,用于设备初步校验清单文件完整性
uint32 retry_count = 4; // 建议的重试次数
uint32 request_timeout_seconds = 5; // 建议的单次请求超时时间
}
// RequestFile: 设备向平台请求特定文件 (包括清单文件和固件文件) (上行)