以json格式的数据上传到AWS控制台,结果转换成 UTF-8 字符串形式显示。

fst202130609
Posts: 171
Joined: Thu Sep 23, 2021 10:03 am

以json格式的数据上传到AWS控制台,结果转换成 UTF-8 字符串形式显示。

Postby fst202130609 » Sat Nov 27, 2021 6:10 am

这怎么解决?????
#define publish_normaldata "{\"device id\":%x%x,\"Don't smoke\": \"No\"}"
char normal_data[255]={0};
esp_base_mac_addr_get(mac);
printf("device mac = %x:%x:%x:%x:%x:%x\r\n",mac[0],mac[1],mac[2],mac[3],mac[4],mac[5]);
sprintf(normal_data, publish_normaldata,mac[4],mac[5]);
sprintf(cPayload, "%s",normal_data);
paramsQOS1.payloadLen = strlen(cPayload);
00.png
aws_iot_mqtt_publish(&client, TOPICB, TOPICB_LEN, &paramsQOS1);

Who is online

Users browsing this forum: No registered users and 92 guests