Re: 请问上报的dp数据长度超过64byte的时候该怎么上传? 分包?如何分?
分包相关函数可参考:
include/component/tal_zigbee/src/file_transfer/include/tal_zigbee_file_transfer.h
分包相关函数可参考:
include/component/tal_zigbee/src/file_transfer/include/tal_zigbee_file_transfer.h
OPERATE_RET tuya_init_second(VOID_T)
{
switch_control.dev_mode = IDEL_MODE;
dev_config_set(); // Device Configuration
app_dev_zigbee_init();
tal_inner_get_file_transfer_func_enable();
{
tal_zigbee_file_transfer_init(1);
tal_zigbee_file_transfer_config(TRUE, TRUE, TRUE, TRUE, TRUE);
}
// tal_zigbee_file_transfer_config(0, 1, 0, 3000, 3000);
ONOFF_FUNCTION_T onoff_function;
onoff_function.endpoint_nums = CHANNEL_NUMS;
onoff_function.endpoint_id = ep_value;
tbl_onoff_function_module_init(&onoff_function);
TAL_PR_DEBUG("/***1.0.0 second init***/\r\n");
return OPRT_OK;
}
这么调用,直接死机了。大佬,可不可以直接发个例程参考一下
tuya_init_second中无法继续运行,可能是由于SDK本身heap资源不足,分包初始化会需要malloc 2k左右资源,可以尝试:
1.分包初始化函数可以放到tuya_init_last函数中。
2.可以尝试调低分包malloc资源大小,UINT16_T tal_zigbee_start_notify_buffer_size(UINT16_T addr,start_notification_pdu_t pdu)
{
return 1024;
}
3.可以增加本身SDK malloc资源,通过:
#define APP_HEAP_SIZE 12*1024
STATIC UINT8_T gs_heap[APP_HEAP_SIZE];
VOID_T tkl_memory_cfg(UINT8_T **out_buff, UINT32_T *out_buff_len)
{
*out_buff = gs_heap;
*out_buff_len = APP_HEAP_SIZE;
}
这样子会卡死复位(如图)
您好,
当前是在初始化时卡死复位还是发送中?
您好,是卡死在初始化
你好,
这个问题是由于SDK会check是否已经注册了cluster和attribute造成的。
BOOL_T tal_inner_file_transfer_check_cluster_register(void)
{
return FALSE;
}
可通过此虚函数跳过。
已经不卡死了,但是还是没成功上报
bool_t file_send_transfer_end_callback(UINT16_T addr, UINT32_T file_id, bool_t result, UINT8_T *buf, UINT16_T len)
{
TAL_PR_NOTICE("file_id %x send result:%x buf ptr:%x\r\n", file_id, result, buf);
if (buf)
{
tal_free(buf);
buf = NULL;
}
//__inner_file_send_buf = NULL;
return true;
}
上面回调打印result ==0 是发送成功?
file_id 6 send result:0 buf ptr:84fb00
您好:
result为0时发送失败,result为1发送成功。
可以提供下发送接口函数。
这里是调用:
tal_zigbee_start_send_multiple_packet_handle(0x0000, CLUSTER_PRIVATE_TUYA_CLUSTER_ID, 1, 0, data_len, data, data_len, &tts_file);
data_len=68
data是下面的数据
multiple_packet 68:
00 2b d1 00 00 3e 00 0a 01 00 03 60 03 9c 00 01 00 01 03 00 03 60 03 9c 00 02 00 02 05 00 03 60 03 9c 00 02 00 01 07 00 03 60 03 9c 00 02 00 02 09 00 03 60 03 9c 00 01 00 01 0b 00 04 48 04 84 00 01 00 02