/********************************************************************* * @fn zclSampleSw_Init * * @brief Initialization function for the zclGeneral layer. * * @param none * * @return none */ void zclSampleSw_Init( byte task_id ) { zclSampleSw_TaskID = task_id; #ifdef ZCL_ON_OFF // Set destination address to indirect zclSampleSw_DstAddr.addrMode = (afAddrMode_t)AddrNotPresent; zclSampleSw_DstAddr.endPoint = 0; zclSampleSw_DstAddr.addr.shortAddr = 0; #endif // This app is part of the Home Automation Profile zclHA_Init( &zclSampleSw_SimpleDesc ); // Register the ZCL General Cluster Library callback functions zclGeneral_RegisterCmdCallbacks( SAMPLESW_ENDPOINT, &zclSampleSw_CmdCallbacks ); // Register the application's attribute list zcl_registerAttrList( SAMPLESW_ENDPOINT, SAMPLESW_MAX_ATTRIBUTES, zclSampleSw_Attrs ); // Register the Application to receive the unprocessed Foundation command/response messages zcl_registerForMsg( zclSampleSw_TaskID ); #ifdef ZCL_EZMODE // Register EZ-Mode zcl_RegisterEZMode( &zclSampleSw_RegisterEZModeData ); // Register with the ZDO to receive Match Descriptor Responses ZDO_RegisterForZDOMsg(task_id, Match_Desc_rsp); #endif // Register for all key events - This app will handle all key events RegisterForKeys( zclSampleSw_TaskID ); // Register for a test endpoint afRegister( &sampleSw_TestEp ); ZDO_RegisterForZDOMsg( zclSampleSw_TaskID, End_Device_Bind_rsp ); ZDO_RegisterForZDOMsg( zclSampleSw_TaskID, Match_Desc_rsp ); #ifdef LCD_SUPPORTED HalLcdWriteString ( (char *)sDeviceName, HAL_LCD_LINE_3 ); #endif #if defined (OTA_CLIENT) && (OTA_CLIENT == TRUE) // Register for callback events from the ZCL OTA zclOTA_Register(zclSampleSw_TaskID); #endif }
/********************************************************************* * @fn zclSampleTemperatureSensor_Init * * @brief Initialization function for the zclGeneral layer. * * @param none * * @return none */ void zclSampleTemperatureSensor_Init( byte task_id ) { zclSampleTemperatureSensor_TaskID = task_id; // Set destination address to indirect zclSampleTemperatureSensor_DstAddr.addrMode = (afAddrMode_t)AddrNotPresent; zclSampleTemperatureSensor_DstAddr.endPoint = 0; zclSampleTemperatureSensor_DstAddr.addr.shortAddr = 0; // This app is part of the Home Automation Profile zclHA_Init( &zclSampleTemperatureSensor_SimpleDesc ); // Register the ZCL General Cluster Library callback functions zclGeneral_RegisterCmdCallbacks( SAMPLETEMPERATURESENSOR_ENDPOINT, &zclSampleTemperatureSensor_CmdCallbacks ); // Register the application's attribute list zcl_registerAttrList( SAMPLETEMPERATURESENSOR_ENDPOINT, SAMPLETEMPERATURESENSOR_MAX_ATTRIBUTES, zclSampleTemperatureSensor_Attrs ); // Register the Application to receive the unprocessed Foundation command/response messages zcl_registerForMsg( zclSampleTemperatureSensor_TaskID ); #ifdef ZCL_EZMODE // Register EZ-Mode zcl_RegisterEZMode( &zclSampleTemperatureSensor_RegisterEZModeData ); // Register with the ZDO to receive Match Descriptor Responses ZDO_RegisterForZDOMsg(task_id, Match_Desc_rsp); #endif // Register for all key events - This app will handle all key events RegisterForKeys( zclSampleTemperatureSensor_TaskID ); // Register for a test endpoint afRegister( &sampleTemperatureSensor_TestEp ); #ifdef LCD_SUPPORTED // display the device name HalLcdWriteString( (char *)sDeviceName, HAL_LCD_LINE_3 ); #endif }