This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Overview of ZStack program flowand event processing?

I'm new to the TI chipset and ZStack, although I've done some other ZigBee programming on another vendor's hardware & SDK, so I'm pretty familiar with ZigBee.  As near as I can tell, there is no common access to programmatic events and the data associated with them (button presses, timer events, ZigBee messages, etc.).  Is there some document I'm missing that shows how one traps these events?  There are event loops (as near as I can tell, at least a couple) and callback definitions.  I'm trying to be notified when a Report Attribute is sent from a remote device, and I can use the debugger and see where the message comes in, but can find no high-leve construct (either callback or event loop messages) that will notify me of the receipt of a Report Attributes command on a remote node.

TIA,

h

  • I think what you are looking for can be found in the SimpleApp.

    It uses a kind of COMMAND_ID to seperate the incoming messages. So by defining your own COMMAND_IDs you can stream the different information. Here the functions:

     

    The receiving function can be found in SimpleCollector.c / SimpleController.c / SimpleSensor.c / SimpleSwitch.c :

    /******************************************************************************
     * @fn          zb_ReceiveDataIndication
     *
     * @brief       The zb_ReceiveDataIndication callback function is called
     *              asynchronously by the ZigBee stack to notify the application
     *              when data is received from a peer device.
     *
     * @param       source - The short address of the peer device that sent the data
     *              command - The commandId associated with the data
     *              len - The number of bytes in the pData parameter
     *              pData - The data sent by the peer device
     *
     * @return      none
     */
    void zb_ReceiveDataIndication( uint16 source, uint16 command, uint16 len, uint8 *pData  )
    {
          ......................

      if (command == SENSOR_REPORT_CMD_ID)
      {

     

    The sending part can be found in SAPI.c:

    /******************************************************************************
     * @fn          zb_SendDataRequest
     *
     * @brief       The zb_SendDataRequest function initiates transmission of data
     *              to a peer device
     *
     * @param       destination - The destination of the data.  The destination can
     *                            be one of the following:
     *                            - 16-Bit short address of device [0-0xfffD]
     *                            - ZB_BROADCAST_ADDR sends the data to all devices
     *                              in the network.
     *                            - ZB_BINDING_ADDR sends the data to a previously
     *                              bound device.
     *
     *              commandId - The command ID to send with the message.  If the
     *                          ZB_BINDING_ADDR destination is used, this parameter
     *                          also indicates the binding to use.
     *
     *              len - The size of the pData buffer in bytes
     *              handle - A handle used to identify the send data request.
     *              ack - TRUE if requesting acknowledgement from the destination.
     *              radius - The max number of routers the data can travel through
     *                       before the data is dropped.
     *
     * @return      none
     */
    extern void zb_SendDataRequest ( uint16 destination, uint16 commandId, uint8 len, uint8 *pData, uint8 handle, uint8 ack, uint8 radius );

  • That looks to be exactly what I need.

     

    Thanks so much!