bugfix sample topic

This commit is contained in:
ethan.du 2021-01-22 15:01:16 +08:00
parent adf5ccec18
commit 18addb2c16
2 changed files with 4 additions and 4 deletions

View File

@ -50,7 +50,7 @@ static int _publish_msg(void *client)
{
char topicName[128] = {0};
int num = 18;
HAL_Snprintf(topicName, 128, "/%s/%s/upload/event", UIOT_MY_PRODUCT_SN, UIOT_MY_DEVICE_SN);
HAL_Snprintf(topicName, 128, "/%s/%s/upload", UIOT_MY_PRODUCT_SN, UIOT_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/upload/event", UIOT_MY_PRODUCT_SN, UIOT_MY_DEVICE_SN);
HAL_Snprintf(topic_name, 128, "/%s/%s/set", UIOT_MY_PRODUCT_SN, UIOT_MY_DEVICE_SN);
SubscribeParams sub_params = DEFAULT_SUB_PARAMS;
sub_params.on_message_handler = on_message_callback;

View File

@ -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/event", UIOT_MY_PRODUCT_SN, UIOT_MY_DEVICE_SN);
HAL_Snprintf(topicName, 128, "/%s/%s/upload", UIOT_MY_PRODUCT_SN, UIOT_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/upload/event", UIOT_MY_PRODUCT_SN, UIOT_MY_DEVICE_SN);
int size = HAL_Snprintf(topic_name, sizeof(topic_name), "/%s/%s/set", UIOT_MY_PRODUCT_SN, UIOT_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));