【已解决】TLSR8258 zigbee sdk 上报自定义DP失败

Zigbee 子设备开发


Post Reply
梁修道
Posts: 41

基于temp_hum_lcd_sensor例程开发

  1. 已经在package.json中将设备模型改为TZ3210
  2. 设备端可以正常从dev_msg_recv_callback收到自定义DP(101)的下发数据
    问题:自定义数据上报失败,导致面板不更新

上报代码如下:

//调用

Code: Select all

dev_report_private_temp_unit(ep, temp_scale);

//定义

Code: Select all

void dev_report_private_msg(uint8_t ep, uint8_t len, uint8_t *data, uint8_t command_id, SEND_QOS_T qos) {
    dev_send_data_t send_data;
    memset(&send_data, 0, sizeof(dev_send_data_t));
    send_data.zcl_id = 0;
    send_data.qos = qos;
    send_data.commmand_type = ZCL_COMMAND_CLUSTER_SPEC_CMD;
    send_data.direction = ZCL_DATA_DIRECTION_SERVER_TO_CLIENT;
    send_data.command_id = command_id;
    send_data.addr.mode = SEND_MODE_GW;
    send_data.addr.type.gw.cluster_id = CLUSTER_PRIVATE_TUYA_CLUSTER_ID;
    send_data.addr.type.gw.src_ep = ep;
    send_data.delay_time = 0;
    send_data.random_time = 0;
    send_data.data.private.len = len;
    memcpy((send_data.data.private.data), data, len);
    dev_zigbee_send_data(&send_data, NULL, 2000);
}

void dev_report_private_temp_unit(uint8_t endpoint, uint8_t unit)
{
	 const uint8_t t_msg_len = 7;
	 uint8_t *data = NULL;

 if (0xFFFF == sequence_num)
 {
	 sequence_num = 0;
 }
 else
 {
	 sequence_num ++;
 }
 data = malloc(t_msg_len * sizeof(uint8_t));
 if (data)
 {
	  memset(data, 0x00, t_msg_len);
	  data[0] = (uint8_t)(sequence_num >> 8);
	  data[1] = (uint8_t)(sequence_num);
	  data[2] = 101;
	  data[3] = 4; //DT_ENUM = 4
	  data[4] = 0;
	  data[5] = 0x01;
	  data[6] = unit;
	  //TY_MODULE_DATA_REPORT_CMD 0x06
	  dev_report_private_msg(endpoint, t_msg_len, data, 0x06, QOS_1);
	  free(data);
 }
}

麻烦看下哪里有问题 谢谢

iot_man
Posts: 66

Re: TLSR8258 zigbee sdk 上报自定义DP失败

viewtopic.php?t=386 同样的问题

Post Reply