开发者社区> 问答> 正文

/sys/a1LfJCTvtu9deviceNamething/event/property/post

通过mqtt-example.c的程序
#define TOPIC_PROPERTY        "/sys/"PRODUCT_KEY"/"DEVICE_NAME"/thing/event/property/post"
pub消息,但是在设备的“运行状态”看不到任何变化。

  msg_len = snprintf(msg_pub, sizeof(msg_pub), "{\"identifier\":\"temperature\", \"identifier\":\"%d\"}", tmpcnt++);
        if (msg_len < 0) {
            EXAMPLE_TRACE("Error occur! Exit program");
            rc = -1;
            break;
        }


        memset(msg_pub, 0x0, 128);
        memset(&topic_msg, 0x0, sizeof(iotx_mqtt_topic_info_t));
        topic_msg.qos = IOTX_MQTT_QOS1;
        topic_msg.retain = 0;
        topic_msg.dup = 0;
        topic_msg.payload = (void *)msg_pub;
        topic_msg.payload_len = strlen(msg_pub);
        topic_msg.payload = (void *)msg_pub;
        topic_msg.payload_len = msg_len;


        rc = IOT_MQTT_Publish(pclient, TOPIC_PROPERTY, &topic_msg);
        if (rc < 0) {
            EXAMPLE_TRACE("error occur when publish");
            rc = -1;
            break;
        }
        EXAMPLE_TRACE("packet-id=%u, publish topic msg=%s", (uint32_t)rc, msg_pub);




请高手指点,弄了好多次了,都不行。不知为什么

展开
收起
ncbtek 2018-09-13 20:38:42 3016 0
0 条回答
写回答
取消 提交回答
问答分类:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
AutoAlerts-From Data to Action 立即下载
OPEN SOURCE IN A DATA-DRIVEN WORLD 立即下载
Custom applicationgs 立即下载