如果想解析ZCL_CMD_WRITE命令,需要在下面的函数添加?
static void zclSampleThermostat_ProcessIncomingMsg( zclIncomingMsg_t *pInMsg)
{
switch ( pInMsg->zclHdr.commandID )
{
#ifdef ZCL_READ
case ZCL_CMD_READ_RSP:
zclSampleThermostat_ProcessInReadRspCmd( pInMsg );
break;
#endif
#ifdef ZCL_WRITE
case ZCL_CMD_WRITE_RSP:
zclSampleThermostat_ProcessInWriteRspCmd( pInMsg );
break;
#endif
#ifdef ZCL_REPORT
case ZCL_CMD_CONFIG_REPORT:
//zclSampleThermostat_ProcessInConfigReportCmd( pInMsg );
break;
case ZCL_CMD_CONFIG_REPORT_RSP:
//zclSampleThermostat_ProcessInConfigReportRspCmd( pInMsg );
break;
case ZCL_CMD_READ_REPORT_CFG:
//zclSampleThermostat_ProcessInReadReportCfgCmd( pInMsg );
break;
case ZCL_CMD_READ_REPORT_CFG_RSP:
//zclSampleThermostat_ProcessInReadReportCfgRspCmd( pInMsg );
break;
#endif
#ifdef ZCL_REPORT_DESTINATION_DEVICE
case ZCL_CMD_REPORT:
zclSampleThermostat_ProcessInReportCmd( pInMsg );
break;
#endif
case ZCL_CMD_DEFAULT_RSP:
zclSampleThermostat_ProcessInDefaultRspCmd( pInMsg );
break;
default:
break;
}
if ( pInMsg->attrCmd )
{
osal_mem_free( pInMsg->attrCmd );
}
}
Alvin Chen:
如果你没有注册回调函数,则会进入这个处理。
举个例之你使用zcl_SendWrite()去发送WRITE CMD,
然后会在case ZCL_CMD_WRITE 下面去处理。
one Man:
回复 Alvin Chen:
那怎样注册回调函数?
Alvin Chen:
回复 one Man:
你看genericapp例子的
// Register the ZCL General Cluster Library callback functionszclGeneral_RegisterCmdCallbacks( GENERICAPP_ENDPOINT, &zclGenericApp_CmdCallbacks );static zclGeneral_AppCallbacks_t zclGenericApp_CmdCallbacks =
{zclGenericApp_BasicResetCB,// Basic Cluster Reset commandNULL,// Identify Trigger Effect commandNULL,// On/Off cluster commandsNULL,// On/Off cluster enhanced command Off with EffectNULL,// On/Off cluster enhanced command On with Recall Global SceneNULL,// On/Off cluster enhanced command On with Timed Off
#ifdef ZCL_LEVEL_CTRLNULL,// Level Control Move to Level commandNULL,// Level Control Move commandNULL,// Level Control Step commandNULL,// Level Control Stop command
#endif
#ifdef ZCL_GROUPSNULL,// Group Response commands
#endif
#ifdef ZCL_SCENESNULL,// Scene Store Request commandNULL,// Scene Recall Request commandNULL,// Scene Response command
#endif
#ifdef ZCL_ALARMSNULL,// Alarm (Response) commands
#endif
#ifdef SE_UK_EXTNULL,// Get Event Log commandNULL,// Publish Event Log command
#endifNULL,// RSSI Location commandNULL// RSSI Location Response command
};
one Man:
回复 Alvin Chen:
这个CallBack只是针对Command的啊,我现在要用Coordinator向Router发送ZCL_CMD_WRITE命令进行写属性,Router在哪里可以解析收到的数据呢?
Alvin Chen:
回复 one Man:
跟我第一个所说的一样的,都是command处理,你看一下支持的case:
/*** Foundation Command IDs ***/
#define ZCL_CMD_READ0x00
#define ZCL_CMD_READ_RSP0x01
#define ZCL_CMD_WRITE0x02
#define ZCL_CMD_WRITE_UNDIVIDED0x03
#define ZCL_CMD_WRITE_RSP0x04
#define ZCL_CMD_WRITE_NO_RSP0x05
#define ZCL_CMD_CONFIG_REPORT0x06
#define ZCL_CMD_CONFIG_REPORT_RSP0x07
#define ZCL_CMD_READ_REPORT_CFG0x08
#define ZCL_CMD_READ_REPORT_CFG_RSP0x09
#define ZCL_CMD_REPORT0x0a
#define ZCL_CMD_DEFAULT_RSP0x0b
#define ZCL_CMD_DISCOVER_ATTRS0x0c
#define ZCL_CMD_DISCOVER_ATTRS_RSP0x0d
#define ZCL_CMD_DISCOVER_CMDS_RECEIVED0x11
#define ZCL_CMD_DISCOVER_CMDS_RECEIVED_RSP0x12
#define ZCL_CMD_DISCOVER_CMDS_GEN0x13
#define ZCL_CMD_DISCOVER_CMDS_GEN_RSP0x14
#define ZCL_CMD_DISCOVER_ATTRS_EXT0x15
#define ZCL_CMD_DISCOVER_ATTRS_EXT_RSP0x16