Page 1 of 1

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

Posted: Sat Nov 27, 2021 6:10 am
by fst202130609
这怎么解决?????
#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);