コード例 #1
0
/*********************************************************************
 * @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);
}
コード例 #2
0
ファイル: ipd.c プロジェクト: junstrix/zstack-end-device
/*********************************************************************
 * @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 );
}
コード例 #3
0
/*********************************************************************
 * @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 );
}