/*********************************************************************
 * @fn          zclHomelink_Init
 *
 * @brief       Initialization function for the zclGeneral layer.
 *
 * @param       none
 *
 * @return      none
 */
void zclHomelink_Init( byte task_id )
{
  zclHomelink_UARTInit();

  zclHomelink_TaskID = task_id;

  // Set destination address to indirect for bindings
  zclHomelink_BindDstAddr.addrMode = (afAddrMode_t)AddrNotPresent;
  zclHomelink_BindDstAddr.endPoint = 0;
  zclHomelink_BindDstAddr.addr.shortAddr = 0;

  // This app is part of the Home Automation Profile
  zclHA_Init( &zclHomelink_SimpleDesc[0] );
  zclHA_Init( &zclHomelink_SimpleDesc[1] );
  zclHA_Init( &zclHomelink_SimpleDesc[2] );

  // Register the ZCL General Cluster Library callback functions
  zclGeneral_RegisterCmdCallbacks( ENDPOINT, &zclHomelink_CmdCallbacks );
  zclGeneral_RegisterCmdCallbacks( ENDPOINT+1, &zclHomelink_CmdCallbacks );
  zclGeneral_RegisterCmdCallbacks( ENDPOINT+2, &zclHomelink_CmdCallbacks );

  // Register the application's attribute list
  zcl_registerAttrList( ENDPOINT, SAMPLESW_MAX_ATTRIBUTES, zclHomelink_Attrs );
  zcl_registerAttrList( ENDPOINT+1, SAMPLESW_MAX_ATTRIBUTES, zclHomelink_Attrs );
  zcl_registerAttrList( ENDPOINT+2, SAMPLESW_MAX_ATTRIBUTES, zclHomelink_Attrs );

  // Register the Application to receive the unprocessed Foundation command/response messages
  zcl_registerForMsg( zclHomelink_TaskID );

  // Register for all key events - This app will handle all key events
  RegisterForKeys( zclHomelink_TaskID );

  ZDO_RegisterForZDOMsg( zclHomelink_TaskID, End_Device_Bind_rsp );
  ZDO_RegisterForZDOMsg( zclHomelink_TaskID, Match_Desc_rsp );
}
Example #2
0
/*********************************************************************
 * @fn          zllSampleLight_Init
 *
 * @brief       Initialization function for the Sample Light App Task.
 *
 * @param       task_id
 *
 * @return      none
 */
void zllSampleLight_Init( byte task_id )
{
  zllSampleLight_TaskID = task_id;

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

#ifdef ZLL_HW_LED_LAMP
  HalTimer1Init(0);
#endif //ZLL_HW_LED_LAMP

  zllEffects_Init(zllSampleLight_TaskID, zllSampleLight_OnOffCB);

#ifdef ZCL_LEVEL_CTRL
  zclLevel_init(zllSampleLight_TaskID, zllSampleLight_OnOffCB);
#else
  #ifdef ZLL_HW_LED_LAMP
    halTimer1SetChannelDuty (WHITE_LED, PWM_FULL_DUTY_CYCLE); //initialize on/off LED to full power
  #endif
#endif //ZCL_LEVEL_CTRL

#ifdef ZCL_COLOR_CTRL
  // Register the ZCL Lighting Cluster Library callback functions
  zclLighting_RegisterCmdCallbacks( SAMPLELIGHT_ENDPOINT, &zllSampleLight_LightingCmdCBs );
  zclColor_init(zllSampleLight_TaskID);
#endif //#ifdef ZCL_COLOR_CTRL

  // Register the application's attribute list
  zcl_registerAttrList( SAMPLELIGHT_ENDPOINT, SAMPLELIGHT_NUM_ATTRIBUTES, zllSampleLight_Attrs );

  // Register the application's callback function to read the Scene Count attribute.
  zcl_registerReadWriteCB( SAMPLELIGHT_ENDPOINT, zllSampleLight_AttrReadWriteCB, NULL );

  // Register for all key events - This app will handle all key events
  RegisterForKeys( zllSampleLight_TaskID );

  zllTarget_RegisterApp( &zllSampleLight_SimpleDesc, &zllSampleLight_DeviceInfo );

  zllTarget_RegisterIdentifyCB( zllSampleLight_IdentifyCB );

  zllTarget_InitDevice();

  zllSampleLight_OnOffCB( zllSampleLight_OnOff );

#ifdef ZLL_1_0_HUB_COMPATIBILITY
  zclGeneral_RegisterCmdCallbacks( SAMPLELIGHT_ENDPOINT2, &zllSampleLight_GenCmdCBs );
#ifdef ZCL_COLOR_CTRL
  zclLighting_RegisterCmdCallbacks( SAMPLELIGHT_ENDPOINT2, &zllSampleLight_LightingCmdCBs );
#endif //ZCL_COLOR_CTRL
  zcl_registerAttrList( SAMPLELIGHT_ENDPOINT2, SAMPLELIGHT_NUM_ATTRIBUTES, zllSampleLight_Attrs );
  zll_RegisterSimpleDesc( &zllSampleLight_SimpleDesc2 );
#endif //ZLL_1_0_HUB_COMPATIBILITY

#ifdef THERMAL_SHUTDOWN
  hwThermal_Init( zllSampleLight_TaskID, TRUE );
#endif
}
/*********************************************************************
 * @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);
}
Example #4
0
/*********************************************************************
 * @fn          zclSampleSw_Init
 *
 * @brief       Initialization function for the zclGeneral layer.
 *
 * @param       none
 *
 * @return      none
 */
void zclSampleSw_Init( byte task_id )
{
  osal_nv_write(ZCD_NV_EXTADDR, 0, Z_EXTADDR_LEN, ieeeAddr);
  zclSampleSw_TaskID = task_id;

  // Set destination address to indirect
  zclSampleSw_DstAddr.addrMode = (afAddrMode_t)AddrNotPresent;
  zclSampleSw_DstAddr.endPoint = 0;
  zclSampleSw_DstAddr.addr.shortAddr = 0;

  // 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 );

  // 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 );
}
Example #5
0
/*********************************************************************
 * @fn          OTA_Dongle_Init
 *
 * @brief       Initialization function for the zclGeneral layer.
 *
 * @param       none
 *
 * @return      none
 */
void OTA_Dongle_Init( byte task_id )
{
    OTA_Dongle_TaskID = task_id;
    uint8 RxOnIdle = TRUE;

    OTA_Dongle_SeqNo = 0;

    ZMacSetReq( ZMacRxOnIdle, &RxOnIdle );

    // Register the ZCL General Cluster Library callback functions
    zclGeneral_RegisterCmdCallbacks( OTA_DONGLE_ENDPOINT, &OTA_Dongle_CmdCallbacks );

    // Register the application's attribute list
    zcl_registerAttrList( OTA_DONGLE_ENDPOINT, OTA_DONGLE_MAX_ATTRIBUTES, OTA_Dongle_Attrs );

    // Register the application's cluster option list
    zcl_registerClusterOptionList( OTA_DONGLE_ENDPOINT, OTA_DONGLE_MAX_OPTIONS, OTA_Dongle_Options );

    // Register the Application to receive the unprocessed Foundation command/response messages
    zcl_registerForMsg( OTA_Dongle_TaskID );

    // Register for all key events - This app will handle all key events
    RegisterForKeys( OTA_Dongle_TaskID );

    // Register endpoints
    afRegister( &ota_DongleEp );
    afRegister( &ota_SysAppEp );

    // Register with the ZDO to receive Match Descriptor Responses
    ZDO_RegisterForZDOMsg(task_id, Match_Desc_rsp);
    ZDO_RegisterForZDOMsg(task_id, Device_annce);

    // Start a timer to notify the console about the dongle
    osal_start_timerEx( OTA_Dongle_TaskID, OTA_DONGLE_DONGLE_NOTIFY_EVT, 4000 );
}
/*********************************************************************
 * @fn          zclSampleLight_Init
 *
 * @brief       Initialization function for the zclGeneral layer.
 *
 * @param       none
 *
 * @return      none
 */
void zclSampleLight_Init( byte task_id )
{
  zclSampleLight_TaskID = task_id;

  // Set destination address to indirect
  //zclSampleLight_DstAddr.addrMode = (afAddrMode_t)AddrNotPresent;
  //zclSampleLight_DstAddr.endPoint = 0;
  //zclSampleLight_DstAddr.addr.shortAddr = 0;

  // This app is part of the Home Automation Profile
  zclHA_Init( &zclSampleLight_SimpleDesc );

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

  // Register the application's attribute list
  zcl_registerAttrList( SAMPLELIGHT_ENDPOINT, SAMPLELIGHT_MAX_ATTRIBUTES, zclSampleLight_Attrs );

  // Register the Application to receive the unprocessed Foundation command/response messages
  zcl_registerForMsg( zclSampleLight_TaskID );
  
  // Register for all key events - This app will handle all key events
  RegisterForKeys( zclSampleLight_TaskID );

  // Register for a test endpoint
  afRegister( &sampleLight_TestEp );
}
Example #7
0
/*********************************************************************
 * @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          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
  }
}
Example #9
0
/*********************************************************************
 * @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 );
}
Example #10
0
/*********************************************************************
 * @fn          zclRouterVersion1_Init
 *
 * @brief       Initialization function for the zclGeneral layer.
 *
 * @param       none
 *
 * @return      none
 */
void zclRouterVersion1_Init( byte task_id )
{
  zclRouterVersion1_TaskID = task_id;

  // Set destination address to indirect
  zclRouterVersion1_DstAddr.addrMode = (afAddrMode_t)Addr16Bit;
  zclRouterVersion1_DstAddr.endPoint = 2;
  zclRouterVersion1_DstAddr.addr.shortAddr = 0x0000;

  // This app is part of the Home Automation Profile
  zclHA_Init( &zclRouterVersion1_SimpleDesc );

  // Register the ZCL General Cluster Library callback functions
  zclGeneral_RegisterCmdCallbacks( ROUTERVERSION1_ENDPOINT, &zclRouterVersion1_CmdCallbacks );
  // Register the application's attribute list
  zcl_registerAttrList( ROUTERVERSION1_ENDPOINT, zclRouterVersion1_NumAttributes, zclRouterVersion1_Attrs );

  // Register the Application to receive the unprocessed Foundation command/response messages
  zcl_registerForMsg( zclRouterVersion1_TaskID );

  // Register for all key events - This app will handle all key events
  RegisterForKeys( zclRouterVersion1_TaskID );

  // Register for a test endpoint
  afRegister( &sampleLight_TestEp );

  ZDO_RegisterForZDOMsg(task_id, Device_annce);

  osal_start_timerEx(zclRouterVersion1_TaskID, SET_PARAMETER, 1000);
  HAL_CONFIG_IO_OUTPUT(1,2,0);
  HAL_CONFIG_IO_OUTPUT(1,3,0);
  HAL_CONFIG_IO_OUTPUT(0,0,0);
  HAL_CONFIG_IO_OUTPUT(0,1,0);
  HAL_CONFIG_IO_OUTPUT(0,2,0);
  HAL_CONFIG_IO_OUTPUT(0,3,0);
  HAL_CONFIG_IO_OUTPUT(0,4,0);
  HAL_CONFIG_IO_OUTPUT(0,7,0);
  HalLedSet(HAL_LED_1,HAL_LED_MODE_OFF);
  HalLedSet(HAL_LED_2,HAL_LED_MODE_OFF);
  //ZDOInitDevice(0);
   if (ZDApp_ReadNetworkRestoreState() == 0) {
      ZDOInitDevice(0);
    }
}
Example #11
0
/*********************************************************************
 * @fn          zllSampleBridge_Init
 *
 * @brief       Initialization function for the Sample Bridge App task.
 *
 * @param       task_id
 *
 * @return      none
 */
void zllSampleBridge_Init( byte task_id )
{
  zllSampleBridge_TaskID = task_id;

  // Set destination address to indirect
  zllSampleBridge_DstAddr.addrMode = (afAddrMode_t)AddrNotPresent;
  zllSampleBridge_DstAddr.endPoint = 0;
  zllSampleBridge_DstAddr.addr.shortAddr = 0;

  // init linked list in NV
  zllSampleBridge_InitLinkedTargets();

  // Register the ZCL General Cluster Library callback functions
  zclGeneral_RegisterCmdCallbacks( SAMPLEBRIDGE_ENDPOINT, &zllSampleBridge_GenCmdCBs );

  // Register for ZCL Light Link Cluster Library callback functions
  zclLL_RegisterCmdCallbacks( SAMPLEBRIDGE_ENDPOINT, &zllSampleBridge_LLCmdCBs );

  // Register the application's attribute list
  zcl_registerAttrList( SAMPLEBRIDGE_ENDPOINT, SAMPLEBRIDGE_MAX_ATTRIBUTES, zllSampleBridge_Attrs );

  // Register the Application to receive the unprocessed Foundation command/response messages
  zllInitiator_RegisterForMsg( zllSampleBridge_TaskID );

  // Register the application for ZDO messages for device discovery
  ZDO_RegisterForZDOMsg( zllSampleBridge_TaskID, Device_annce );
  ZDO_RegisterForZDOMsg( zllSampleBridge_TaskID, Active_EP_rsp );
  ZDO_RegisterForZDOMsg( zllSampleBridge_TaskID, Simple_Desc_rsp );

  // Register for all key events - This app will handle all key events
  RegisterForKeys( zllSampleBridge_TaskID );

  zllInitiator_RegisterApp( &zllSampleBridge_SimpleDesc, &zllSampleBridge_DeviceInfo );

  zllInitiator_RegisterIdentifyCB( zllSampleBridge_IdentifyCB );

  zllInitiator_RegisterNotifyTLCB( zllSampleBridge_ProcessTL );

  zllInitiator_RegisterResetAppCB ( zllSampleBridge_BasicResetCB );

  zllInitiator_InitDevice();

}
void AT_ZCL_ONOFF_SWITCH_Init( byte task_id )
{
  AT_ZCL_ONOFF_SWITCH_TaskID = task_id;

  // This app is part of the Home Automation Profile
  zclHA_Init( &AT_ZCL_ONOFF_SWITCH_SimpleDesc );

  // Register the ZCL General Cluster Library callback functions
  zclGeneral_RegisterCmdCallbacks( AT_ZCL_ONOFF_SWITCH_ENDPOINT, &AT_ZCL_ONOFF_SWITCH_GEN_CmdCallbacks );
  
  // Register the application's attribute list
  zcl_registerAttrList( AT_ZCL_ONOFF_SWITCH_ENDPOINT, AT_ZCL_ONOFF_SWITCH_MAX_ATTRIBUTES, AT_ZCL_ONOFF_SWITCH_Attrs );
  
  //register for AT command system enable/disable call back function
  AT_ZCL_EP_ENABLE_Register(  AT_ZCL_ONOFF_SWITCH_ENDPOINT,AT_ZCL_ONOFF_SWITCH_EP_ENABLE);
  
  //initialize the switch device
  switch_init();
  
  
}
/*********************************************************************
 * @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
}
/*********************************************************************
 * @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 );
}