固件升级
异步返回升级进度和结果。
消息实例
{
"header": {
"msg_id": "741aec66-99b2-4d97-aaf2-63d27f53bbc5",
"parent_msg_id": "",
"timestamp": 1550107087319,
"sync": false
},
"route": {
"source": "EdgeManager",
"group": "hardware",
"operation": "update",
"resource": "websocket/install"
},
"content": {
}
}
参数说明
content消息内容描述如下:
{
"member_list": [{
"operator": "install",
"type": "firmware",
"install_method": "force | normal",
"enable_method": "now | delay",
"name": "firmware",
"https_server": {
"image": "GET https://FDAddr:port/fw.zip",
"user_name": "userName",
"password": "password"
},
"check_type": "sha256",
"check_code": "xxxxxxxxxxxxx"
}]
}
元素定义如下:
一级资源 |
二级资源 |
三级资源 |
说明 |
|---|---|---|---|
member_list |
- |
- |
含义:安装或升级参数 类型:list 取值:取值范围为1~256,目前固件升级只选取列表的第一个元素 |
- |
operator |
- |
含义:操作类型 类型:string 取值:install(安装) |
- |
type |
- |
含义:安装或升级类型 类型:string 取值:firmware |
- |
install_method |
- |
含义:安装类型 类型:string 取值:
|
- |
enable_method |
- |
含义:生效方式 类型:string 取值:
|
- |
name |
- |
含义:固件名称 类型:string 取值:1~256字节,仅支持“a-zA-Z0-9-_.”,不能包含“..” |
- |
https_server |
- |
含义:文件服务器 类型:dict |
- |
- |
image |
含义:升级文件 类型:string 取值:不超过256字节,不能包含“..”,以一串非空白字符+空格开头,然后是"https"加一串不包含特定字符(@、\n、!、\\、|、;、&、$、<、>、` 或空格)的字符串 |
- |
- |
user_name |
含义:用户名称 类型:string 取值:1~64字节,仅支持“a-zA-Z0-9-_“ |
- |
- |
password |
含义:密码 类型:string 取值:长度范围为8~64字节,复杂度由上层保证 |
- |
check_type |
- |
含义:校验码类型 类型:string 取值:sha256(当前仅支持sha256) |
- |
check_code |
- |
含义:固件校验码 类型:string 取值:空字符串或者64字节(Sha256sum生成的校验码,格式符合正则模式'^[0-9a-f]{64}$',如:7e642fa557533508b589d7fcaef922b443ff4b5df16b2ad91581bd2b3d7c1fc3) |
返回结果
{
"header":{
"msg_id":"e1d7ec35-ceac-4648-a581-056f5690d8f9",
"parent_msg_id": "",
"timestamp":1652279813323,
"sync": false
},
"route":{
"source":"hardware",
"group":"hub",
"operation":"update",
"resource":"websocket/upgrade_progress"
},
"content":"{"members": [{"operator": "install", "name": "firmware", "version": "NA", "percentage": "100", "result": "success", "reason": ""}]}"
}