/********************************************************************* * @fn rangeext_Init * * @brief Initialization function for the ZCL App Application. * * @param uint8 task_id - range extender task id * * @return none */ void rangeext_Init( uint8 task_id ) { rangeExtTaskID = task_id; // setup ESP destination address ESPAddr.addrMode = (afAddrMode_t)Addr16Bit; ESPAddr.endPoint = RANGEEXT_ENDPOINT; ESPAddr.addr.shortAddr = 0; // register SE endpoint zclSE_Init( &rangeExtSimpleDesc ); // Register the ZCL General Cluster Library callback functions zclGeneral_RegisterCmdCallbacks( RANGEEXT_ENDPOINT, &rangeext_GenCmdCallbacks ); // Register the application's attribute list zcl_registerAttrList( RANGEEXT_ENDPOINT, RANGEEXT_MAX_ATTRIBUTES, rangeExtAttrs ); // Register the application's cluster option list zcl_registerClusterOptionList( RANGEEXT_ENDPOINT, RANGEEXT_MAX_OPTIONS, rangeExtOptions ); // Register the application's attribute data validation callback function zcl_registerValidateAttrData( rangeext_ValidateAttrDataCB ); // Register the Application to receive the unprocessed Foundation command/response messages zcl_registerForMsg( rangeExtTaskID ); // Register for all key events - This app will handle all key events RegisterForKeys( rangeExtTaskID ); // Register with the ZDO to receive Match Descriptor Responses ZDO_RegisterForZDOMsg(task_id, Match_Desc_rsp); }
/********************************************************************* * @fn zclCCServer_Init * * @brief Initialization function for the ZCL Commissioing Cluster * Server Application. * * @param task_id - task id * * @return none */ void zclCCServer_Init( uint8 task_id ) { zclCCServer_TaskID = task_id; leaveInitiated = FALSE; // This app is part of the Home Automation Profile zba_Init( &zclCCServer_SimpleDesc ); // Register the ZCL Commissioning Cluster Library callback functions zclCC_RegisterCmdCallbacks( CCSERVER_ENDPOINT, &zclCCServer_CmdCallbacks ); // Register the application's attribute list zcl_registerAttrList( CCSERVER_ENDPOINT, CCSERVER_MAX_ATTRIBUTES, zclCCServer_Attrs ); // Register the application's attribute data validation callback function zcl_registerValidateAttrData( zclCCServer_ValidateAttrDataCB ); // Register the application's callback function to read/write attribute data zcl_registerReadWriteCB( CCSERVER_ENDPOINT, zclCCServer_ReadWriteCB, zclCCServer_AuthorizeCB ); // Register for Initiator to receive Leave Confirm ZDO_RegisterForZdoCB( ZDO_LEAVE_CNF_CBID, zclCCServer_ZdoLeaveCnfCB ); // Register for all key events - This app will handle all key events RegisterForKeys( zclCCServer_TaskID ); // Initialize ZBA Startup Attributes Set (SAS) zclCCServer_InitStartupParameters( TRUE ); // See if the device is factory new if ( !ZDApp_DeviceConfigured() ) { osal_nv_item_init( ZCD_NV_NWKMGR_ADDR, sizeof( zclCCServer_NwkManagerAddr ), (void *)&zclCCServer_NwkManagerAddr ); // On startup, attempt to join the network specified by the startup SAS // on all channels at least once // ZBA Default Settings with the default ZBA Key Material and ZBA EPID if ( nullExtendedPANID( zgApsUseExtendedPANID ) ) { osal_cpyExtAddr( zgApsUseExtendedPANID, zbaGlobalCommissioningEPID ); } // Default Network Key and Pre-configured Link Key should already be set } }
/********************************************************************* * @fn ipd_Init * * @brief Initialization function for the ZCL App Application. * * @param uint8 task_id - ipd task id * * @return none */ void ipd_Init( uint8 task_id ) { ipdTaskID = task_id; ipdTransID = 0; // Device hardware initialization can be added here or in main() (Zmain.c). // If the hardware is application specific - add it here. // If the hardware is other parts of the device add it in main(). // setup ESP destination address ESPAddr.addrMode = (afAddrMode_t)Addr16Bit; ESPAddr.endPoint = IPD_ENDPOINT; ESPAddr.addr.shortAddr = 0; // Register for SE endpoint zclSE_Init( &ipdSimpleDesc ); // Register the ZCL General Cluster Library callback functions zclGeneral_RegisterCmdCallbacks( IPD_ENDPOINT, &ipd_GenCmdCallbacks ); // Register the ZCL SE Cluster Library callback functions zclSE_RegisterCmdCallbacks( IPD_ENDPOINT, &ipd_SECmdCallbacks ); // Register the application's attribute list zcl_registerAttrList( IPD_ENDPOINT, IPD_MAX_ATTRIBUTES, ipdAttrs ); // Register the application's cluster option list zcl_registerClusterOptionList( IPD_ENDPOINT, IPD_MAX_OPTIONS, ipdOptions ); // Register the application's attribute data validation callback function zcl_registerValidateAttrData( ipd_ValidateAttrDataCB ); // Register the Application to receive the unprocessed Foundation command/response messages zcl_registerForMsg( ipdTaskID ); // Register for all key events - This app will handle all key events RegisterForKeys( ipdTaskID ); #if defined ( INTER_PAN ) // Register with Stub APS StubAPS_RegisterApp( &ipdEp ); #endif // Start the timer to sync IPD timer with the osal timer osal_start_timerEx( ipdTaskID, IPD_UPDATE_TIME_EVT, IPD_UPDATE_TIME_PERIOD ); }
/********************************************************************* * @fn loadcontrol_Init * * @brief Initialization function for the ZCL App Application. * * @param uint8 task_id - load control task id * * @return none */ void loadcontrol_Init( uint8 task_id ) { loadControlTaskID = task_id; // setup destination address for ESP ESPAddr.addrMode = (afAddrMode_t)Addr16Bit; ESPAddr.endPoint = LOADCONTROL_ENDPOINT; ESPAddr.addr.shortAddr = 0; // register for SE endpoint zclSE_Init( &loadControlSimpleDesc ); // Register the ZCL General Cluster Library callback functions zclGeneral_RegisterCmdCallbacks( LOADCONTROL_ENDPOINT, &loadcontrol_GenCmdCallbacks ); // Register the ZCL SE Cluster Library callback functions zclSE_RegisterCmdCallbacks( LOADCONTROL_ENDPOINT, &loadcontrol_SECmdCallbacks ); // Register the application's attribute list zcl_registerAttrList( LOADCONTROL_ENDPOINT, LOADCONTROL_MAX_ATTRIBUTES, loadControlAttrs ); // Register the application's cluster option list zcl_registerClusterOptionList( LOADCONTROL_ENDPOINT, LOADCONTROL_MAX_OPTIONS, loadControlOptions ); // Register the application's attribute data validation callback function zcl_registerValidateAttrData( loadcontrol_ValidateAttrDataCB ); // Register the Application to receive the unprocessed Foundation command/response messages zcl_registerForMsg( loadControlTaskID ); // Register for all key events - This app will handle all key events RegisterForKeys( loadControlTaskID ); // Register with the ZDO to receive Match Descriptor Responses ZDO_RegisterForZDOMsg(task_id, Match_Desc_rsp); // Start the timer to sync LoadControl timer with the osal timer osal_start_timerEx( loadControlTaskID, LOADCONTROL_UPDATE_TIME_EVT, LOADCONTROL_UPDATE_TIME_PERIOD ); }