研究1:--平台反应我的数据
手机APP
/sys/a1acEbm1TOa/AgainAos/thing/service/property/set{"method":"thing.service.property.set","id":"390141300","params":{"LightSwitch":0},"version":"1.0.0"}
于是猜测我要上报
/sys/a1acEbm1TOa/AgainAos/thing/event/property/post
char *payload2 = "{\"params\":{\"LightSwitch\":0}}";
char topic2[]={"/sys/a1acEbm1TOa/AgainAos/thing/event/property/post"};
IOT_MQTT_Publish_Simple(0, topic2, IOTX_MQTT_QOS0, payload2, strlen(payload2));
卧槽!居然成功了!
研究2--保证设备一直在线
while(1)
{
if(0==example_publish(pclient))//可以
//if(0==Switch_publish(pclient))//不行
printf("LED-OK\r\n");
else
printf("LED-FAIL\r\n");
一直发布消息即可
研究3--->需要规划一下任务了 官方的代码后面没有处理publish只是处理了connect 我需要自己去tcpread