TI中文支持网
TI专业的中文技术问题搜集分享网站

关于cc2538例程中 注册回掉函数的理解

            大家好,注册这个端点的回掉表:zclSampleLight_CmdCallbacks,想知道会调表中的函数在哪里调用呢??

     // Register the ZCL General Cluster Library callback functions
     zclGeneral_RegisterCmdCallbacks( SAMPLELIGHT_ENDPOINT, &zclSampleLight_CmdCallbacks );

  

VV:

zclSampleLight_CmdCallbacks函数相当于把一些函数给了下面的结构体中的。你只要搜索下下面结构体中的在哪里被调用到就可以了。

举个例子

pfnOnOff这个命令,就在下面的函数被调用到了

static ZStatus_t zclGeneral_ProcessInOnOff( zclIncoming_t *pInMsg, zclGeneral_AppCallbacks_t *pCBs ){ ZStatus_t stat = ZSuccess;

if ( zcl_ServerCmd( pInMsg->hdr.fc.direction ) ) { switch ( pInMsg->hdr.commandID ) { case COMMAND_OFF: case COMMAND_ON: case COMMAND_TOGGLE: if ( pCBs->pfnOnOff ) { pCBs->pfnOnOff( pInMsg->hdr.commandID ); } break;

typedef struct{ zclGCB_BasicReset_t pfnBasicReset; // Basic Cluster Reset command zclGCB_Identify_t pfnIdentify; // Identify command#ifdef ZCL_EZMODE zclGCB_IdentifyEZModeInvoke_t pfnIdentifyEZModeInvoke; // Identify EZ-Mode Invoke command zclGCB_IdentifyUpdateCommState_t pfnIdentifyUpdateCommState; // Identify Update Commission State command#endif zclGCB_IdentifyTriggerEffect_t pfnIdentifyTriggerEffect; // Identify Trigger Effect command zclGCB_IdentifyQueryRsp_t pfnIdentifyQueryRsp; // Identify Query Response command zclGCB_OnOff_t pfnOnOff; // On/Off cluster commands zclGCB_OnOff_OffWithEffect_t pfnOnOff_OffWithEffect; // On/Off cluster enhanced command Off with Effect zclGCB_OnOff_OnWithRecallGlobalScene_t pfnOnOff_OnWithRecallGlobalScene; // On/Off cluster enhanced command On with Recall Global Scene zclGCB_OnOff_OnWithTimedOff_t pfnOnOff_OnWithTimedOff; // On/Off cluster enhanced command On with Timed Off#ifdef ZCL_LEVEL_CTRL zclGCB_LevelControlMoveToLevel_t pfnLevelControlMoveToLevel; // Level Control Move to Level command zclGCB_LevelControlMove_t pfnLevelControlMove; // Level Control Move command zclGCB_LevelControlStep_t pfnLevelControlStep; // Level Control Step command zclGCB_LevelControlStop_t pfnLevelControlStop; // Level Control Stop command#endif#ifdef ZCL_GROUPS zclGCB_GroupRsp_t pfnGroupRsp; // Group Response commands#endif#ifdef ZCL_SCENES zclGCB_SceneStoreReq_t pfnSceneStoreReq; // Scene Store Request command zclGCB_SceneRecallReq_t pfnSceneRecallReq; // Scene Recall Request command zclGCB_SceneRsp_t pfnSceneRsp; // Scene Response command#endif#ifdef ZCL_ALARMS zclGCB_Alarm_t pfnAlarm; // Alarm (Response) commands#endif#ifdef SE_UK_EXT zclGCB_GetEventLog_t pfnGetEventLog; // Get Event Log command zclGCB_PublishEventLog_t pfnPublishEventLog; // Publish Event Log command#endif zclGCB_Location_t pfnLocation; // RSSI Location command zclGCB_LocationRsp_t pfnLocationRsp; // RSSI Location Response command} zclGeneral_AppCallbacks_t;

赞(0)
未经允许不得转载:TI中文支持网 » 关于cc2538例程中 注册回掉函数的理解
分享到: 更多 (0)