【已解决】低功耗设备获取app下发dp问题
我做一个温湿度传感器,使用的sdk:ty_iot_sdk_BK7231NL_2.3.3-beta.347;需要获取APP下发的温标DP,当我调用tuya_iot_dp_low_power_query函数获取数据时,可以在串口输出数据中发现我需要的数据(LOG里面的红色字体部分),但函数是封装好的,我不知道怎么怎么引用,而我又不知道如何正确引用函数的返回参数,打印出来的返回值却很奇怪;想问红色部分的数据如何引用:
程序:
unsigned char dps_Get[1] = {9};
TY_RECV_OBJ_DP_S **obj_Get = NULL;
TY_RECV_RAW_DP_S **raw_Get = NULL;
obj_Get = (TY_RECV_OBJ_DP_S **)malloc(sizeof(TY_RECV_OBJ_DP_S));
raw_Get = (TY_RECV_RAW_DP_S )malloc(sizeof(TY_RECV_RAW_DP_S));
tuya_iot_dp_low_power_query(dps_Get, 1,obj_Get, raw_Get);
PR_NOTICE("++++++++------I want to got dpid: %d",*dps_Get);
PR_NOTICE("++++++++------I got dpid: %d",(obj_Get).dps->dpid);
PR_NOTICE("++++++++------I got data: %d",(obj_Get).dps->value.dp_enum);
PR_NOTICE("++++++++------I got dpcnt: %d",(obj_Get).dps_cnt);
free(obj_Get);
log:
[06-27 19:40:44 TUYA D][lr:0x9c1a7] TUYA_TLS Success Connect a3.tuyacn.com:443 CustomNet:TRUE Suit:TLS-PSK-WITH-AES-128-CBC-SHA256
[06-27 19:40:44 TUYA D][lr:0xc14fb] Decode Rev:{"result":["{\"9\":\"f\"}"],"t":1687866044,"success":true}
[06-27 19:40:44 TUYA D][lr:0x9c31b] TUYA_TLS Disconnect ENTER
[06-27 19:40:44 TUYA D][lr:0x9c37f] TUYA_TLS Disconnect Success
[06-27 19:40:44 TUYA N][lr:0xb9e3f] result:["{\"9\":\"f\"}"
[06-27 19:40:44 TUYA E][lr:0xb9e59] lp pack_dp err:-2
[06-27 19:40:44 TUYA N][lr:0x57c45] ++++++++------I want to got dpid: 9
[06-27 19:40:44 TUYA N][lr:0x57c51] ++++++++------I got dpid: 20
[06-27 19:40:44 TUYA N][lr:0x57c5d] ++++++++------I got data: -442503148
[06-27 19:40:44 TUYA N][lr:0x57c69] ++++++++------I got dpcnt: -442503148