modify var name

This commit is contained in:
ethan.du 2021-02-20 11:34:50 +08:00
parent fa91c0bc2c
commit c7f306ab72
2 changed files with 16 additions and 16 deletions

View File

@ -21,14 +21,14 @@
#include "uiot_import.h"
#include "lite-utils.h"
/* 产品序列号, 与云端同步设备状态时需要 */
#define UIOT_MY_PRODUCT_SN "PRODUCT_SN"
#define IOT_MY_PRODUCT_SN "PRODUCT_SN"
/*
, ,
*/
#define UIOT_MY_DEVICE_SN "DEVICE_SN"
#define IOT_MY_DEVICE_SN "DEVICE_SN"
#define UIOT_MY_PRODUCT_SECRET "PRODUCT_SECRET"
#define IOT_MY_PRODUCT_SECRET "PRODUCT_SECRET"
#define MAX_SIZE_OF_TOPIC_CONTENT 100
MQTTInitParams init_params = DEFAULT_MQTT_INIT_PARAMS;
@ -50,7 +50,7 @@ static int _publish_msg(void *client)
{
char topicName[128] = {0};
int num = 18;
HAL_Snprintf(topicName, 128, "/%s/%s/upload", UIOT_MY_PRODUCT_SN, UIOT_MY_DEVICE_SN);
HAL_Snprintf(topicName, 128, "/%s/%s/upload", IOT_MY_PRODUCT_SN, IOT_MY_DEVICE_SN);
PublishParams pub_params = DEFAULT_PUB_PARAMS;
@ -67,7 +67,7 @@ static int _publish_msg(void *client)
static int _register_subscribe_topics(void *client)
{
static char topic_name[128] = {0};
HAL_Snprintf(topic_name, 128, "/%s/%s/set", UIOT_MY_PRODUCT_SN, UIOT_MY_DEVICE_SN);
HAL_Snprintf(topic_name, 128, "/%s/%s/set", IOT_MY_PRODUCT_SN, IOT_MY_DEVICE_SN);
SubscribeParams sub_params = DEFAULT_SUB_PARAMS;
sub_params.on_message_handler = on_message_callback;
@ -83,9 +83,9 @@ static int _register_subscribe_topics(void *client)
*/
static int _setup_connect_init_params(MQTTInitParams* initParams)
{
initParams->device_sn = (char *)UIOT_MY_DEVICE_SN;
initParams->product_sn = (char *)UIOT_MY_PRODUCT_SN;
initParams->product_secret = (char *)UIOT_MY_PRODUCT_SECRET;
initParams->device_sn = (char *)IOT_MY_DEVICE_SN;
initParams->product_sn = (char *)IOT_MY_PRODUCT_SN;
initParams->product_secret = (char *)IOT_MY_PRODUCT_SECRET;
initParams->command_timeout = UIOT_MQTT_COMMAND_TIMEOUT;
initParams->keep_alive_interval = UIOT_MQTT_KEEP_ALIVE_INTERNAL;

View File

@ -24,11 +24,11 @@
#include "uiot_export.h"
#include "uiot_import.h"
#define UIOT_MY_PRODUCT_SN "PRODUCT_SN"
#define IOT_MY_PRODUCT_SN "PRODUCT_SN"
#define UIOT_MY_DEVICE_SN "DEVICE_SN"
#define IOT_MY_DEVICE_SN "DEVICE_SN"
#define UIOT_MY_DEVICE_SECRET "DEVICE_SECRET"
#define IOT_MY_DEVICE_SECRET "DEVICE_SECRET"
#define MAX_SIZE_OF_TOPIC_CONTENT 100
@ -130,9 +130,9 @@ static void on_message_callback(void *pClient, MQTTMessage *message, void *userD
*/
static int _setup_connect_init_params(MQTTInitParams* initParams)
{
initParams->device_sn = UIOT_MY_DEVICE_SN;
initParams->product_sn = UIOT_MY_PRODUCT_SN;
initParams->device_secret = UIOT_MY_DEVICE_SECRET;
initParams->device_sn = IOT_MY_DEVICE_SN;
initParams->product_sn = IOT_MY_PRODUCT_SN;
initParams->device_secret = IOT_MY_DEVICE_SECRET;
initParams->command_timeout = UIOT_MQTT_COMMAND_TIMEOUT;
initParams->keep_alive_interval = UIOT_MQTT_KEEP_ALIVE_INTERNAL;
@ -155,7 +155,7 @@ static int _setup_connect_init_params(MQTTInitParams* initParams)
static int _publish_msg(void *client)
{
char topicName[128] = {0};
HAL_Snprintf(topicName, 128, "/%s/%s/upload", UIOT_MY_PRODUCT_SN, UIOT_MY_DEVICE_SN);
HAL_Snprintf(topicName, 128, "/%s/%s/upload", IOT_MY_PRODUCT_SN, IOT_MY_DEVICE_SN);
PublishParams pub_params = DEFAULT_PUB_PARAMS;
pub_params.qos = QOS1;
@ -182,7 +182,7 @@ static int _publish_msg(void *client)
static int _register_subscribe_topics(void *client)
{
static char topic_name[128] = {0};
int size = HAL_Snprintf(topic_name, sizeof(topic_name), "/%s/%s/set", UIOT_MY_PRODUCT_SN, UIOT_MY_DEVICE_SN);
int size = HAL_Snprintf(topic_name, sizeof(topic_name), "/%s/%s/set", IOT_MY_PRODUCT_SN, IOT_MY_DEVICE_SN);
if (size < 0 || size > sizeof(topic_name) - 1)
{
HAL_Printf("topic content length not enough! content size:%d buf size:%d\n", size, (int)sizeof(topic_name));