bugfix ota message format

This commit is contained in:
ethan.du 2021-05-17 15:16:01 +08:00
parent fdd5dc370a
commit 164bbdb6e4
2 changed files with 11 additions and 7 deletions

View File

@ -23,11 +23,11 @@
#include "uiot_import.h" #include "uiot_import.h"
#include "uiot_export_ota.h" #include "uiot_export_ota.h"
#define UIOT_MY_PRODUCT_SN "productSN" #define UIOT_MY_PRODUCT_SN "PRODUCT_SN"
#define UIOT_MY_DEVICE_SN "deviceSN" #define UIOT_MY_DEVICE_SN "DEVICE_SN"
#define UIOT_MY_DEVICE_SECRET "device_secret" #define UIOT_MY_DEVICE_SECRET "DEVICE_SECRET"
#define OTA_BUF_LEN (1024) #define OTA_BUF_LEN (1024)
@ -114,6 +114,10 @@ int main(int argc, char **argv)
return FAILURE_RET; return FAILURE_RET;
} }
//report current version
IOT_OTA_ReportVersion(h_ota, "default", "1.0.0");
while(1) while(1)
{ {
IOT_MQTT_Yield(client, 5000); IOT_MQTT_Yield(client, 5000);

View File

@ -32,9 +32,9 @@ extern "C" {
#define REPORT_VER_TEMPLATE "{\"Method\": \"report\", \"Payload\":{\"Module\":\"%s\", \"Version\":\"%s\"}}" #define REPORT_VER_TEMPLATE "{\"Method\": \"report\", \"Payload\":{\"Module\":\"%s\", \"Version\":\"%s\"}}"
#define REPORT_SUCCESS_MSG_TEMPLATE "{\"Method\": \"success\", \"Payload\": {\"TaskID\": \"%s\"}}" #define REPORT_SUCCESS_MSG_TEMPLATE "{\"Method\": \"success\", \"Payload\": {\"TaskID\": \"%s\"}}"
#define REPORT_FAIL_MSG_TEMPLATE "{\"Method\": \"fail\", \"Payload\": {\"TaskID\": %d, \"ErrMsg\":\"%s\"}}" #define REPORT_FAIL_MSG_TEMPLATE "{\"Method\": \"fail\", \"Payload\": {\"TaskID\": \"%s\", \"ErrMsg\":\"%s\"}}"
#define NOTIFY_MSG_TEMPLATE "{\"Method\": \"notify\", \"Payload\":{\"TaskID\":%d}}" #define NOTIFY_MSG_TEMPLATE "{\"Method\": \"notify\", \"Payload\":{\"TaskID\":\"%s\"}}"
#define UPGRADING_MSG_TEMPLATE "{\"Method\": \"upgrading\", \"Payload\":{\"TaskID\":%d}}" #define UPGRADING_MSG_TEMPLATE "{\"Method\": \"upgrading\", \"Payload\":{\"TaskID\":\"%s\"}}"
#define OTA_UPSTREAM_MSG_BUF_LEN (129) #define OTA_UPSTREAM_MSG_BUF_LEN (129)
#define OTA_TOPIC_BUF_LEN (129) #define OTA_TOPIC_BUF_LEN (129)