OTA_Solution
功能概述
此应用程序是使用 WM IoT SDK
进行设备空中(OTA)固件升级功能的参考解决方案。它演示了设备如何通过 Wi-Fi 连接到网络,并使用 MQTT 协议与服务器通信以执行 OTA 固件升级。它包括 Wi-Fi 初始化、网络时间同步、固件版本报告、OTA 命令接收与解析、固件下载、签名验证、升级状态实时报告以及错误处理等功能。此外,还提供了周期性检查更新和丰富的日志记录,确保了整个 OTA 升级过程的透明度和可靠性。
OTA 架构
OTA_Solution 总体流程
1. 推送升级流程
2. 定期检测升级流程
OTA MQTTS 载荷
1. 设备上报固件版本(设备发送消息): topic:wm_iot/${mac_addr}/ota/firmware/report
topic:wm_iot/${mac_addr}/ota/firmware/report // mac_addr: station MAC地址。
{
"msg_sequence": 0, // 0-2^32,请求和响应消息通过该值建立应答关系。
"time": 1626197189638, // 消息发送时的 Unix 时间戳,10 位秒级或 13 位毫秒级。
"data": { // 设备固件版本信息。
"type": "INIT", // 业务类型。INIT:固件版本初始化; UPDATE:固件升级完成版本更新
"version": "1.1.6", // 版本号采用 MAJOR.MINOR.PATCH 点分表示,范围支持 0.0.0 到 99.99.99。例如:1.0.0。
"build_time": "May 24 2024 10:33:41" // 固件编译的时间
}
}
2. 云端下发 OTA 升级(设备接收消息): topic:wm_iot/${mac_addr}/ota/update
topic:wm_iot/${mac_addr}/ota/update // mac_addr: station MAC地址。
{
"msg_sequence": 0, // 0-2^32,请求和响应消息通过该值建立应答关系。
"time": 1626197189638, // 消息发送时的 Unix 时间戳,10 位秒级或 13 位毫秒级。
"data": { // OTA 升级信息。
"version": "1.3.13", // 版本号采用 MAJOR.MINOR.PATCH 点分表示,范围支持 0.0.0 到 99.99.99。例如:1.0.0。
"http_url": "http://xxx.com/firmware/bin/xxx_ota.img", // 固件 URL 地址。
"https_url": "https://xxx.com/firmware/bin/xxx_ota.img", // HTTPS 固件 URL 代理地址。
"size": 1306707, // 单位为字节。
"sig-sha256-ecdsa": "MEQCIGDnxeN5XkZPhf+lgf/OGFrJ/8hZ4nShkqpG7bpGS7y/AiAVEp9+hR9RYJH3TWQfl9a/iwMa5engJ8alCpkJNkZaDg==", // 先对固件进行SHA256摘要计算,然后在进行ECDSA签名
"upgrade_delay": 0 // 用于自动升级向设备指定升级时间,为 0 或者小于当前时间表示立即执行。
}
}
3. 设备获取固件升级(设备发送消息): topic:wm_iot/${mac_addr}/ota/get
topic:wm_iot/${mac_addr}/ota/get // mac_addr: station MAC地址。
{
"msg_sequence": 0, // 0-2^32,请求和响应消息通过该值建立应答关系。
"time": 1626197189638, // 消息发送时的 Unix 时间戳,10 位秒级或 13 位毫秒级。
"data": {} // 获取 OTA 参数。
}
4. 设备获取固件升级(设备接收消息): topic:wm_iot/${mac_addr}/ota/response
topic:wm_iot/${mac_addr}/ota/response // mac_addr: station MAC地址。
{
"msg_sequence": 0, // 0-2^32,请求和响应消息通过该值建立应答关系。
"time": 1626197189638, // 消息发送时的 Unix 时间戳,10 位秒级或 13 位毫秒级。
"data": { // OTA 升级信息。
"version": "1.3.13", // 版本号采用 MAJOR.MINOR.PATCH 点分表示,范围支持 0.0.0 到 99.99.99。例如:1.0.0。
"http_url": "http://xxx.com/firmware/bin/xxx_ota.img", // 固件 URL 地址。
"https_url": "https://xxx.com/firmware/bin/xxx_ota.img", // HTTPS 固件 URL 代理地址。
"size": 1306707, // 单位为字节。
"sig-sha256-ecdsa": "MEQCIGDnxeN5XkZPhf+lgf/OGFrJ/8hZ4nShkqpG7bpGS7y/AiAVEp9+hR9RYJH3TWQfl9a/iwMa5engJ8alCpkJNkZaDg==", // 先对固件进行SHA256摘要计算,然后在进行ECDSA签名
"upgrade_delay": 0 // 用于自动升级向设备指定升级时间,为 0 或者小于当前时间表示立即执行。
}
}
5.上报升级状态或进度(设备接收消息): topic:wm_iot/${mac_addr}/ota/progress/report
topic:wm_iot/${mac_addr}/ota/progress/report // mac_addr: station MAC地址。
上报升级进度:
{
"msg_sequence": 0, // 0-2^32,请求和响应消息通过该值建立应答关系。
"time": 1626197189638, // 消息发送时的 Unix 时间戳,10 位秒级或 13 位毫秒级。
"data": {
"progress": 98 // 升级中才需要上报升级进度,故升级进度字段只要大于等于 0,则表示升级中状态。取值范围:0-100。
}
}
上报升级异常状态:
{
"msg_sequence": 0, // 0-2^32,请求和响应消息通过该值建立应答关系。
"time": 1626197189638, // 消息发送时的 Unix 时间戳,10 位秒级或 13 位毫秒级。
"data": {
"errorCode": -100001, // 若升级异常则必须传 errorCode 字段。 固件升级异常码如下:见 WM_ERR_OTA_XXX
"errorMsg":"下载失败,FLASH 空间不足" // 如果发生异常,此字段可承载错误信息,长度不超过 20 个字符。
}
}
6.升级成功上报设备固件版本(设备发送消息): topic:wm_iot/${mac_addr}/ota/firmware/report
topic:wm_iot/${mac_addr}/ota/firmware/report // mac_addr: station MAC地址。
{
"msg_sequence": 0, // 0-2^32,请求和响应消息通过该值建立应答关系。
"time": 1626197189638, // 消息发送时的 Unix 时间戳,10 位秒级或 13 位毫秒级。
"data": { // 设备固件版本信息。
"type": "UPDATE", // 业务类型。INIT:固件版本初始化; UPDATE:固件升级完成版本更新
"version": "1.1.6", // 版本号采用 MAJOR.MINOR.PATCH 点分表示,范围支持 0.0.0 到 99.99.99。例如:1.0.0。
"build_time": "May 24 2024 10:33:41" // 固件编译的时间
}
}
环境要求
请自行搭建 OTA 服务器,可联系原厂提供相关 python 脚本用于测试
通过
wm.py menuconfig
或wm.py guiconfig
配置EXPLLE_WIFI_SSID
,EXPLLE_WIFI_PASSWORD
和MQTTS_BROKER_URI
编译和烧录
示例位置:examples\ota\ota_solution
编译、烧录等操作请参考:快速入门
运行结果
成功运行将输出如下日志
D/main [0.000] boot reason 0
D/main [0.004] heap size 266776(260.52KB)
D/fls [0.010] flash size 0x200000(2MB)
D/ptb [0.014] partition table base 0x800e000
D/ft [0.018] ft_0 base 8000000, ft_1 base 8001000
D/ft [0.024] ft init 1
E/nvs [0.028] use new hash entry num=53
I/ota_http [0.034] 0.3.0 build at Jun 13 2024 14:37:14
D/wifi [2.100] distribution event 1
D/wifi [2.106] sta connected E0-F4-42-A1-95-E8 channel 11 authmode 3
D/wifi [9.040] distribution event 0
D/wifi [9.044] sta got ip 10.17.1.111
I/example [19.098] Now datetime: 2024-6-13 15:6:40
D/mqtt [19.102] uri: ssl://10.17.1.110:8883
D/mqtt [19.108] mqtt_config mode: 3
D/mqtt [19.114] mode: MQTT_AUTH_MODE_MUTUAL_AUTH
D/mqtt [19.118] ======================================
D/mqtt [19.124] Trace Output
D/mqtt [19.128] se Paho Synchronous MQTT C Client Library
D/mqtt [19.134] se Paho Synchronous MQTT C Client Library
D/mqtt [19.140] 10
D/mqtt [19.144] ======================================
D/mqtt [19.250] connect out: rc=119
D/mqtt [19.254] wait connect, timeout: 29896
D/mqtt [19.454] wait end
E/mqtt [19.456] client W800_32AF70, packet_type 1, timeout 29896, pack 0x0
> Seeding the random number generator...
ok
> Loading the CA root certificate ...
ok
> Loading the client cert. and key...
ok (key type: RSA)
> Setting up the SSL/TLS structure...
ok
> Performing the SSL/TLS handshake...
ok
SSLSocket_putdatas: mbedtls_ssl_write rc 27, iov_len 27
D/mqtt [20.848] wait connect ack, timeout: 28308
D/mqtt [20.854] wait end
E/mqtt [20.858] client W800_32AF70, packet_type 2, timeout 28308, pack 0x0
D/mqtt [20.866] MQTTClient connected!
I/example [20.870] MQTTS connected
D/mqtt [20.874] mqtt client publish, topic /wm_iot/286DCE32AF7/ota/firmware/report
SSLSocket_putdatas: mbedtls_ssl_write rc 178, iov_len 178
D/mqtt [20.890] mqtt client publish, token: 1
I/example [20.896] Publish ota firmware report, msg_id=1, payload:
{
"msg_sequence": 0,
"time": 20872,
"data": {
"type": "INIT",
"version": "0.3.0",
"build_time": "Jun 13 2024 15:02:41"
}
}
D/mqtt [20.914] mqtt client subscribe, topic /wm_iot/286DCE32AF7/ota/update, qos 1
SSLSocket_putdatas: mbedtls_ssl_write rc 37, iov_len 37
D/mqtt [20.932] wait sub ack, timeout: 10000
D/mqtt [20.940] Message with token value 1 delivery confirmed
D/mqtt [20.948] wait end
E/mqtt [20.950] client W800_32AF70, packet_type 9, timeout 10000, pack 0x0
I/example [20.958] Subscribe ota update, msg_id=2
D/mqtt [20.964] mqtt client subscribe, topic /wm_iot/286DCE32AF7/ota/response, qos 1
SSLSocket_putdatas: mbedtls_ssl_write rc 39, iov_len 39
D/mqtt [20.980] wait sub ack, timeout: 10000
D/mqtt [20.986] wait end
E/mqtt [20.990] client W800_32AF70, packet_type 9, timeout 10000, pack 0x0
I/example [20.996] Subscribe ota response, msg_id=3
I/example [21.002] MQTTS published, msg_id=1
D/mqtt [81.004] mqtt client publish, topic /wm_iot/286DCE32AF7/ota/get
SSLSocket_putdatas: mbedtls_ssl_write rc 86, iov_len 86
D/mqtt [81.018] mqtt client publish, token: 4
I/example [81.022] Publish ota get, msg_id=4, payload:
{
"msg_sequence": 3,
"time": 81002,
"data": {
}
}
D/mqtt [81.036] Message with token value 4 delivery confirmed
I/example [81.042] MQTTS published, msg_id=4
SSLSocket_putdatas: mbedtls_ssl_write rc 4, iov_len 4
D/mqtt [105.542] Message arrived, topic [/wm_iot/286DCE32AF7/ota/update], payload [{"msg_sequence": 0, "time": 1718262549281, "data": {"version": "0.3.1", "http_url": "http://10.17.1.110:8090/firmware/ota_solution_ota.img", "https_url": "https://10.17.1.110:8083/firmware/ota_solution_ota.img", "size": 342012, "sig-sha256-ecdsa": "MEUCIQCk+nEoZFZTjYs7teOIDX0HKUv4/8kRJtailqBlqHfDTQIgdr+8SCrvUu6Gvg8rHcv+ewH3JNIenGOc7zYz9KuUPvE=", "upgrade_delay": 1000}}]
I/example [105.584] MQTT recved data:
I/example [105.588] Topic(0):/wm_iot/286DCE32AF7/ota/update
I/example [105.594] Payload(371):
{"msg_sequence": 0, "time": 1718262549281, "data": {"version": "0.3.1", "http_url": "http://10.17.1.110:8090/firmware/ota_solution_ota.img", "https_url": "https://10.17.1.110:8083/firmware/ota_solution_ota.img", "size": 342012, "sig-sha256-ecdsa": "MEUCIQCk+nEoZFZTjYs7teOIDX0HKUv4/8kRJtailqBlqHfDTQIgdr+8SCrvUu6Gvg8rHcv+ewH3JNIenGOc7zYz9KuUPvE=", "upgrade_delay": 1000}}
I/example [105.634] Version: 0.3.1
I/example [105.636] HTTP URL: http://10.17.1.110:8090/firmware/ota_solution_ota.img
I/example [105.644] HTTPS URL: https://10.17.1.110:8083/firmware/ota_solution_ota.img
I/example [105.654] Size: 342012
I/example [105.656] Signature: MEUCIQCk+nEoZFZTjYs7teOIDX0HKUv4/8kRJtailqBlqHfDTQIgdr+8SCrvUu6Gvg8rHcv+ewH3JNIenGOc7zYz9KuUPvE=
I/example [105.668] Upgrade Delay: 1000
D/ota_ops [105.674] ota partition offset=0x0000f000,size=0x122a00
D/ota_ops [105.680] app_ota partition offset=0x00131a00,size=0xae600
D/example [106.040] OTA progress:0-0%.
D/example [106.044] OTA progress:1-0%.
I/NO_TAG [106.048] pHTTPSession->HttpConnection.HttpSocket=2
. Seeding the random number generator... ok
. Loading the CA root certificate ... ok (0 skipped)
. Connecting to tcp... ok
. Setting up the SSL/TLS structure... ok
. Performing the SSL/TLS handshake... ok
D/ota_http [106.664] WM_HTTP_EVENT_CONNECTED
D/ota_http [106.674] WM_HTTP_EVENT_HEADER_SENTED
D/ota_http [106.758] WM_HTTP_EVENT_RECV_HEADER
D/example [106.764] OTA progress:3-0%.
D/example [106.768] OTA progress:4-0%.
D/mqtt [106.772] mqtt client publish, topic /wm_iot/286DCE32AF7/ota/progress/report
SSLSocket_putdatas: mbedtls_ssl_write rc 115, iov_len 115
D/mqtt [106.790] mqtt clientD/mqtt publish, token: 5
I/ [106.796] Message witexample [106.79h token value 5 deliver8] Publish ota progressy confirmed
I/example [106.806] MQTTS published, msg_id=5
report, msg_id=5, payload:
{
"msg_sequence": 4,
"time": 106770,
"data": {
"progress": 0
}
}
D/ota_ops [106.916] magic_no: A0FFFF9F
D/ota_ops [106.920] img_attr: 00100001
D/ota_ops [106.924] img_addr: 0800F400
D/ota_ops [106.928] img_len: 000537BC
D/ota_ops [106.932] img_header_addr: 0800F000
D/ota_ops [106.938] upgrade_img_addr: 08131A00
D/ota_ops [106.942] org_checksum: 8607BCD4
D/ota_ops [106.946] upd_no: 00000000
D/ota_ops [106.950] ver: 0.3.0
D/ota_ops [106.954] _reserved0: 00000000
D/ota_ops [106.958] _reserved1: 00000000
D/ota_ops [106.962] next: 00000000
D/ota_ops [106.966] hd_checksum: C9F2066F
W/ota_ops [106.972] ota version error
.D/example [106.994] OTA progress:4-1%.
.D/example [107.020] OTA progress:4-2%.
.D/example [107.046] OTA progress:4-3%.
.D/example [107.072] OTA progress:4-4%.
.D/example [107.184] OTA progress:4-5%.
.D/example [107.208] OTA progress:4-7%.
.D/example [107.236] OTA progress:4-8%.
.D/example [107.262] OTA progress:4-9%.
.D/example [107.376] OTA progress:4-10%.
D/mqtt [107.380] mqtt client publish, topic /wm_iot/286DCE32AF7/ota/progress/report
SSLSocket_putdatas: mbedtls_ssl_write rc 116, iov_len 116
D/mqtt [107.398] mqttD/mqtt client publish, token [107.404] Message wit: 6
I/example h token value 6 deliver[107.410] Publish ota py confirmed
I/example [107.414] MQTTS published, msg_id=6
rogress report, msg_id=6, payload:
{
"msg_sequence": 5,
"time": 107378,
"data": {
"progress": 10
}
}
.D/example [107.450] OTA progress:4-11%.
.D/example [107.476] OTA progress:4-13%.
.D/example [107.502] OTA progress:4-14%.
.D/example [107.616] OTA progress:4-15%.
.D/example [107.642] OTA progress:4-16%.
.D/example [107.668] OTA progress:4-17%.
.D/example [107.692] OTA progress:4-19%.
.D/example [107.806] OTA progress:4-20%.
D/mqtt [107.810] mqtt client publish, topic /wm_iot/286DCE32AF7/ota/progress/report
SSLSocket_putdatas: mbedtls_ssl_write rc 116, iov_len 116
D/mqtt [107.826] mqtt client publish, token: 7
I/example [D/mqtt 107.832] Publish ota pr [107.838] Message withogress report, msg_id=7 token value 7 delivery, payload:
{
"msg_s confirmed
I/example [107.848] MQTTS published, msg_id=7
equence": 6,
"time": 107808,
"data": {
"progress": 20
}
}
.D/example [107.880] OTA progress:4-21%.
.D/example [107.906] OTA progress:4-22%.
.D/example [107.930] OTA progress:4-23%.
.D/example [108.046] OTA progress:4-25%.
.D/example [108.070] OTA progress:4-26%.
.D/example [108.096] OTA progress:4-27%.
.D/example [108.122] OTA progress:4-28%.
.D/example [108.264] OTA progress:4-29%.
.D/example [108.288] OTA progress:4-31%.
.D/example [108.314] OTA progress:4-32%.
.D/example [108.340] OTA progress:4-33%.
.D/example [108.456] OTA progress:4-34%.
.D/example [108.482] OTA progress:4-35%.
.D/example [108.506] OTA progress:4-37%.
.D/example [108.532] OTA progress:4-38%.
.D/example [108.654] OTA progress:4-39%.
.D/example [108.680] OTA progress:4-40%.
D/mqtt [108.686] mqtt client publish, topic /wm_iot/286DCE32AF7/ota/progress/report
SSLSocket_putdatas: mbedtls_ssl_write rc 116, iov_len 116
D/mqtt [108.702] mqtt client publishD/mqtt , token: 8
I/example [108.710] Message wi [108.712] Publisth token value 8 deliveh ota progress report, ry confirmed
I/example [108.720] MQTTS published, msg_id=8
msg_id=8, payload:
{
"msg_sequence": 7,
"time": 108684,
"data": {
"progress": 40
}
}
.D/example [108.756] OTA progress:4-41%.
.D/example [108.782] OTA progress:4-43%.
.D/example [108.898] OTA progress:4-44%.
.D/example [108.924] OTA progress:4-45%.
.D/example [108.950] OTA progress:4-46%.
.D/example [108.976] OTA progress:4-47%.
.D/example [109.090] OTA progress:4-49%.
.D/example [109.116] OTA progress:4-50%.
D/mqtt [109.120] mqtt client publish, topic /wm_iot/286DCE32AF7/ota/progress/report
SSLSocket_putdatas: mbedtls_ssl_write rc 116, iov_len 116
D/mqtt [109.138] mqtt D/mqtt client publish, token: [109.144] Message wit9
I/example [1h token value 9 deliver09.146] Publish ota proy confirmed
I/example [109.154] MQTTS published, msg_id=9
gress report, msg_id=9, payload:
{
"msg_sequence": 8,
"time": 109118,
"data": {
"progress": 50
}
}
.D/example [109.190] OTA progress:4-51%.
.D/example [109.216] OTA progress:4-52%.
.D/example [109.332] OTA progress:4-53%.
.D/example [109.356] OTA progress:4-55%.
.D/example [109.384] OTA progress:4-56%.
.D/example [109.408] OTA progress:4-57%.
.D/example [109.524] OTA progress:4-58%.
.D/example [109.550] OTA progress:4-59%.
.D/example [109.576] OTA progress:4-61%.
.D/example [109.602] OTA progress:4-62%.
.D/example [109.714] OTA progress:4-63%.
.D/example [109.740] OTA progress:4-64%.
.D/example [109.766] OTA progress:4-65%.
.D/example [109.792] OTA progress:4-67%.
.D/example [109.904] OTA progress:4-68%.
.D/example [109.928] OTA progress:4-69%.
.D/example [109.954] OTA progress:4-70%.
D/mqtt [109.960] mqtt client publish, topic /wm_iot/286DCE32AF7/ota/progress/report
SSLSocket_putdatas: mbedtls_ssl_write rc 116, iov_len 116
D/mqtt [109.976D/mqtt ] mqtt client publish, [109.982] tokenMessage with token valu: 10
I/example e 10 delivery confirmed [109.990] Publish ota
I/example [109.992] MQTTS published, msg_id=10
progress report, msg_id=10, payload:
{
"msg_sequence": 9,
"time": 109956,
"data": {
"progress": 70
}
}
.D/example [110.030] OTA progress:4-71%.
.D/example [110.142] OTA progress:4-73%.
.D/example [110.168] OTA progress:4-74%.
.D/example [110.194] OTA progress:4-75%.
.D/example [110.220] OTA progress:4-76%.
.D/example [110.340] OTA progress:4-77%.
.D/example [110.366] OTA progress:4-79%.
.D/example [110.390] OTA progress:4-80%.
D/mqtt [110.396] mqtt client publish, topic /wm_iot/286DCE32AF7/ota/progress/report
SSLSocket_putdatas: mbedtls_ssl_write rc 117, iov_len 117
D/mqtt [110.412] mqtt client publish, token: 11D/mqtt
I/example [11 [110.422] Message wi0.422] Publish ota progth token value 11 delivress report, msg_id=11,ery confirmed
I/example [110.432] MQTTS published, msg_id=11
payload:
{
"msg_sequence": 10,
"time": 110394,
"data": {
"progress": 80
}
}
.D/example [110.466] OTA progress:4-81%.
.D/example [110.588] OTA progress:4-82%.
.D/example [110.614] OTA progress:4-83%.
.D/example [110.640] OTA progress:4-85%.
.D/example [110.664] OTA progress:4-86%.
.D/example [110.776] OTA progress:4-87%.
.D/example [110.802] OTA progress:4-88%.
.D/example [110.828] OTA progress:4-89%.
.D/example [110.854] OTA progress:4-91%.
.D/example [110.966] OTA progress:4-92%.
.D/example [110.992] OTA progress:4-93%.
.D/example [111.018] OTA progress:4-94%.
.D/example [111.044] OTA progress:4-95%.
.D/example [111.146] OTA progress:4-97%.
.D/example [111.172] OTA progress:4-98%.
.D/example [111.198] OTA progress:4-99%.
.D/example [111.212] OTA progress:4-100%.
D/mqtt [111.218] mqtt client publish, topic /wm_iot/286DCE32AF7/ota/progress/report
SSLSocket_putdatas: mbedtls_ssl_write rc 118, iov_len 118
D/mqtt [111.234] mqtt client publiD/mqtt sh, token: 12
I/exampl [111.242] Message wite [111.244] Pubh token value 12 delivelish ota progrery confirmed
I/example [111.252] MQTTS published, msg_id=12
ss report, msg_id=12, payload:
{
"msg_sequence": 11,
"time": 111216,
"data": {
"progress": 100
}
}
.
D/example [111.268] OTA progress:6-100%.
I/example [111.470] SHA-256 ECDSA signature verification successful.
I/ota_ops [111.600] ota reboot, please wait for the restart...
D/main [0.000] boot reason 4
D/main [0.004] heap size 266776(260.52KB)
D/fls [0.010] flash size 0x200000(2MB)
D/ptb [0.014] partition table base 0x800e000
D/ft [0.018] ft_0 base 8000000, ft_1 base 8001000
D/ft [0.024] ft init 1
E/nvs [0.028] use new hash entry num=53
I/ota_http [0.034] 0.3.0 build at Jun 13 2024 14:37:14
D/wifi [1.978] distribution event 1
D/wifi [1.982] sta connected E0-F4-42-A1-95-E8 channel 11 authmode 3
D/wifi [3.040] distribution event 0
D/wifi [3.044] sta got ip 10.17.1.111
I/example [13.098] Now datetime: 2024-6-13 15:8:48
D/mqtt [13.104] uri: ssl://10.17.1.110:8883
D/mqtt [13.110] mqtt_config mode: 3
D/mqtt [13.114] mode: MQTT_AUTH_MODE_MUTUAL_AUTH
D/mqtt [13.120] ======================================
D/mqtt [13.126] Trace Output
D/mqtt [13.130] se Paho Synchronous MQTT C Client Library
D/mqtt [13.136] se Paho Synchronous MQTT C Client Library
D/mqtt [13.142] 10
D/mqtt [13.144] ======================================
D/mqtt [13.252] connect out: rc=119
D/mqtt [13.258] wait connect, timeout: 29894
D/mqtt [13.458] wait end
E/mqtt [13.460] client W800_32AF70, packet_type 1, timeout 29894, pack 0x0
> Seeding the random number generator...
ok
> Loading the CA root certificate ...
ok
> Loading the client cert. and key...
ok (key type: RSA)
> Setting up the SSL/TLS structure...
ok
> Performing the SSL/TLS handshake...
ok
SSLSocket_putdatas: mbedtls_ssl_write rc 27, iov_len 27
D/mqtt [14.816] wait connect ack, timeout: 28342
D/mqtt [14.820] wait end
E/mqtt [14.824] client W800_32AF70, packet_type 2, timeout 28342, pack 0x0
D/mqtt [14.832] MQTTClient connected!
I/example [14.836] MQTTS connected
D/mqtt [14.840] mqtt client publish, topic /wm_iot/286DCE32AF7/ota/firmware/report
SSLSocket_putdatas: mbedtls_ssl_write rc 180, iov_len 180
D/mqtt [14.858] mqtt client publish, token: 1
I/example [14.862] Publish ota firmware report, msg_id=1, payload:
{
"msg_sequence": 0,
"time": 14838,
"data": {
"type": "UPDATE",
"version": "0.3.0",
"build_time": "Jun 13 2024 15:02:41"
}
}
D/mqtt [15.000] mqtt client subscribe, topic /wm_iot/286DCE32AF7/ota/update, qos 1
SSLSocket_putdatas: mbedtls_ssl_write rc 37, iov_len 37
D/mqtt [15.016] wait sub ack, timeout: 10000
D/mqtt [15.022] Message with token value 1 delivery confirmed
D/mqtt [15.030] wait end
E/mqtt [15.034] client W800_32AF70, packet_type 9, timeout 10000, pack 0x0
I/example [15.042] Subscribe ota update, msg_id=2
D/mqtt [15.048] mqtt client subscribe, topic /wm_iot/286DCE32AF7/ota/response, qos 1
SSLSocket_putdatas: mbedtls_ssl_write rc 39, iov_len 39
D/mqtt [15.064] wait sub ack, timeout: 10000
D/mqtt [15.070] wait end
E/mqtt [15.072] client W800_32AF70, packet_type 9, timeout 10000, pack 0x0
I/example [15.082] Subscribe ota response, msg_id=3
I/example [15.086] MQTTS published, msg_id=1