固件升级

2023-07-18
暂无评分

Event

固件升级进度

Topic: thing/product/{gateway_sn}/events

Direction: up

Method: ota_progress

Data:

ColumnNameTypeconstraintDescription
result结果返回码int{}
status任务状态enum{"sent":"已下发","in_progress":"执行中","ok":"执行成功","paused":"暂停","rejected":"拒绝","failed":"失败","canceled":"取消或终止","timeout":"超时"}
progress进度struct
»percent进度百分比int{"min":"0","max":"100","unit":"%","unitName":"百分比","step":"1"}
»step_key当前步骤enum{"download_firmware":"下载固件","upgrade_firmware":"更新固件"}
»step_result步骤结果int{}非 0 代表错误

Example:

{
	"method": "ota_progress",
	"bid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
	"tid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
	"timestamp:": 1654070968655,
	"data": {
		"result": 0,
		"output": {
			"status": "in_progress",
			"progress": {
				"percent": 10,
				"step_key": "download_firmware"
			}
		}
	}
}

Service

固件升级

Topic: thing/product/{gateway_sn}/services

Direction: down

Method: ota_create

Data:

ColumnNameTypeconstraintDescription
devices固件升级设备集合array{}
»[array_item]Elements in arraystruct{}{"size": "2"}
»»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{"2":"一致性升级","3":"普通升级"}一致性升级:指飞行器某些模块的固件版本与系统匹配版本不一致,需要进行升级。常见的情况例如:飞行器与遥控器已经升级至最新版本,但替换电池时发现电池未升级,此时一致性升级将被提示。普通升级:开发者将飞行器所有模块升级至指定固件版本。

Example:

{
	"method": "ota_create",
	"timestamp:": 1654070968655,
	"bid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
	"tid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
	"data": {
		"devices": [
			{
				"sn": "drone_sn",
				"product_version": "1.00.223",
				"file_url": "https://s3.com/xxx.zip",
				"md5": "abcdefabcdefabcdef",
				"file_size": 653467234,
				"file_name": "wm245_1.00.223.zip",
				"firmware_upgrade_type": 2
			},
			{
				"sn": "dock_sn",
				"product_version": "1.00.223",
				"firmware_upgrade_type": 3
			}
		]
	}
}

Topic: thing/product/{gateway_sn}/services_reply

Direction: up

Method: ota_create

Data:

ColumnNameTypeconstraintDescription
status任务状态enum{"sent":"已下发","in_progress":"执行中","ok":"执行成功","paused":"暂停","rejected":"拒绝","failed":"失败","canceled":"取消或终止","timeout":"超时"}

Example:

{
	"method": "ota_create",
	"bid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
	"tid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
	"timestamp:": 1654070968655,
	"data": {
		"result": 0,
		"output": {
			"status": "in_progress"
		}
	}
}
若您对文档有意见或疑惑,点击可快速反馈,我们会与您联系。