From 164bbdb6e4af49daa35c3a30284fc335def37459 Mon Sep 17 00:00:00 2001 From: "ethan.du" Date: Mon, 17 May 2021 15:16:01 +0800 Subject: [PATCH] bugfix ota message format --- samples/ota/ota_sample.c | 12 ++++++++---- src/ota/include/ota_config.h | 6 +++--- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/samples/ota/ota_sample.c b/samples/ota/ota_sample.c index 27ec939..51c7811 100644 --- a/samples/ota/ota_sample.c +++ b/samples/ota/ota_sample.c @@ -23,11 +23,11 @@ #include "uiot_import.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) @@ -113,7 +113,11 @@ int main(int argc, char **argv) LOG_ERROR("init OTA failed"); return FAILURE_RET; } - + + //report current version + IOT_OTA_ReportVersion(h_ota, "default", "1.0.0"); + + while(1) { IOT_MQTT_Yield(client, 5000); diff --git a/src/ota/include/ota_config.h b/src/ota/include/ota_config.h index 0698875..ee22f2a 100644 --- a/src/ota/include/ota_config.h +++ b/src/ota/include/ota_config.h @@ -32,9 +32,9 @@ extern "C" { #define REPORT_VER_TEMPLATE "{\"Method\": \"report\", \"Payload\":{\"Module\":\"%s\", \"Version\":\"%s\"}}" #define REPORT_SUCCESS_MSG_TEMPLATE "{\"Method\": \"success\", \"Payload\": {\"TaskID\": \"%s\"}}" -#define REPORT_FAIL_MSG_TEMPLATE "{\"Method\": \"fail\", \"Payload\": {\"TaskID\": %d, \"ErrMsg\":\"%s\"}}" -#define NOTIFY_MSG_TEMPLATE "{\"Method\": \"notify\", \"Payload\":{\"TaskID\":%d}}" -#define UPGRADING_MSG_TEMPLATE "{\"Method\": \"upgrading\", \"Payload\":{\"TaskID\":%d}}" +#define REPORT_FAIL_MSG_TEMPLATE "{\"Method\": \"fail\", \"Payload\": {\"TaskID\": \"%s\", \"ErrMsg\":\"%s\"}}" +#define NOTIFY_MSG_TEMPLATE "{\"Method\": \"notify\", \"Payload\":{\"TaskID\":\"%s\"}}" +#define UPGRADING_MSG_TEMPLATE "{\"Method\": \"upgrading\", \"Payload\":{\"TaskID\":\"%s\"}}" #define OTA_UPSTREAM_MSG_BUF_LEN (129) #define OTA_TOPIC_BUF_LEN (129)