zigbee怎么接收来自网关的数据
查看文档接收消息回调有2个函数
Code: Select all
TAL_MSG_RET_E tal_zcl_specific_msg_recv_callback(TAL_ZCL_MSG_T *msg)
{
TAL_PR_TRACE("app spec msg cb: cluster 0x%02x, cmd 0x%02x\r\n", msg->cluster, msg->command);
ZIGBEE_CMD_E app_cmd_type = ZIGBEE_CMD_SINGLE;
if (msg->mode == ZG_UNICAST_MODE)
{
app_cmd_type = ZIGBEE_CMD_SINGLE;
TAL_PR_TRACE("receive single message");
}
else
{
app_cmd_type = ZIGBEE_CMD_GROUP;
TAL_PR_TRACE("receive group message");
}
TAL_PR_TRACE("app command type %d", app_cmd_type);
switch (msg->cluster)
{
case CLUSTER_ON_OFF_CLUSTER_ID:
{
//handle on/off cluster command
// app_onoff_cluster_handler(msg->command, msg->payload, msg->length, app_cmd_type);
TAL_PR_TRACE("开关回调\r\n");
}
default:
{
break;
}
}
return ZCL_MSG_RET_SUCCESS;
}
上面是我的处理代码
运行流程 编译--->原厂固件烧录--->网关添加子设备---->打开子设备---->点击开关
串口调试工具没有看到输出信息
框架:EFR32MG21A020_3.6.1
例子使用:tuyaos_demo_zg_door_sensor
配置:appconfig.json
Code: Select all
{
"firmwareInfo": {
"description": "this is a demon project",
"dev_role":"sleep_end_dev",
"image_type":"0x1602",
"manufacture_id":"0x1002",
"model_id":"TS0203",
"pid": "******",
"manufacture_name": "_TZ3000_",
"module_name":"ZSU",
"chip_id":"efr32mg21a020f768im32"
}
}