跳到主要内容

固件升级

Event

固件升级进度

Topic: thing/product/{gateway_sn}/events

Direction: up

Method: ota_progress

Data:

ColumnNameTypeconstraintDescription
result返回码int非 0 代表错误
output输出struct
»status任务状态enum_string{"canceled":"取消或终止","failed":"失败","in_progress":"执行中","ok":"执行成功","paused":"暂停","rejected":"拒绝","sent":"已下发","timeout":"超时"}
»sub_status子状态enum_stringUNKNOWN:未知,
VERIFY:开始文件校验,
VERIFY_SUCCESS:文件校验成功,
UPGRADING:升级中,
UPGRADE_SUCCESS:升级成功,
UPGRADE_FAIL:升级失败,
DOWNLOADING:下载中,
DOWNLOAD_SUCCESS:下载成功,
DOWNLOAD_FAILED:下载失败,
UPLOADING_DRONE:上传升级包到设备,
VERIFY_FAILED:校验失败;
»progress进度struct
»»percent进度百分比int{"max":"100","min":"0","step":"1","unit_name":"百分比 / %"}
»»step_key当前步骤enum_string{"download_firmware":"下载固件","upgrade_firmware":"更新固件"}

Example:

{
"bid":"8ca0ffa2-5e72-4078-8fa9-dc68216ff5d1",
"data":{
"output":{
"progress":{
"percent":0,
"step":1,
"step_key":"download_firmware"
},
"status":"failed",
"sub_status":"DOWNLOAD_FAILED"
},
"result":0
},
"tid":"74045eba-bd24-4106-b455-d3577f3cbf52",
"timestamp":1707048089244,
"method":"ota_progress"
}

Service

固件升级

Topic: thing/product/{gateway_sn}/services

Direction: down

Method: ota_create

Data:

ColumnNameTypeconstraintDescription
devices固件升级设备集合array{"size": 2, "item_type": struct}
»sn设备序列号(SN)text{"length":"10240"}
»product_version固件版本text{"length":"10240"}
»file_url固件文件下载地址text{"length":"10240"}
»md5固件文件 MD5text{"length":"10240"}
»file_size固件文件大小int
»file_name固件文件名称text
»firmware_upgrade_type固件升级类型enum_int{"2":"一致性升级","3":"普通升级"}

Example:

{
"bid":"8ca0ffa2-5e72-4078-8fa9-dc68216ff5d1",
"data":{
"devices":[
{
"file_name":"EvoNest-V1.2.0.69-20231215094829.Encrypt.uav",
"file_size":603696942,
"file_url":"http://192.168.1.1:9000/public/EvoNest-V1.2.0.69-20231215094829.Encrypt.uav",
"firmware_upgrade_type":3,
"md5":"d1c9dacec124abd350379eb44b9143e5",
"product_version":"1.2.0.69",
"sn":"NM1923221021"
}
]
},
"tid":"74045eba-bd24-4106-b455-d3577f3cbf52",
"timestamp":1654070968655,
"method":"ota_create"
}

Topic: thing/product/{gateway_sn}/services_reply

Direction: up

Method: ota_create

Data:

ColumnNameTypeconstraintDescription
result返回码int非 0 代表错误
output输出struct
»status任务状态enum_string{"canceled":"取消或终止","failed":"失败","in_progress":"执行中","ok":"执行成功","paused":"暂停","rejected":"拒绝","sent":"已下发","timeout":"超时"}

Example:

{
"bid":"149878685687484417",
"data":{
"output":{
"progress":{
"percent":0,
"step":1,
"step_key":""
},
"status":"sent",
"sub_status":""
},
"result":0
},
"tid":"5bdd5c11-469c-45d9-afce-d9ec3025f379",
"timestamp":1708573102118,
"method":"ota_create"
}