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.

"Standard" Sleepy End Device Functionality

Other Parts Discussed in Thread: Z-STACK

Hallo,

we would like to implement a sleepy end device with the following "standard" functionality:

1. When the device starts it checks whether it belongs to a network and if so activates the network (ZDO_StartDevice I guess). Otherwise it enters the deep sleep mode.

2. If not on a network a 10 second button press activates the join/paring functionality. The joining/beaconing is active only for 30/60 seconds. If a join cannot be accomplished, the device goes back to deep sleep.

3. During normal operation (when joined a network) the device should be polling every 5-10 Minutes. If an attribute reporting fails, the polling should be automatically increased and if the parent is no longer reachable, a rejoin should be attempted. Initially rejoins should be sent every minute. After some time rejoin attempts should be made every 10 minutes.

Is there a sample application, which implements this "standard" functionality? If no, could you please outline the necessary steps/APIs needed for implementing it. For instance, is it possible to change the beacon-rate dynamically???

Thanks in advance,

Todor Dimitrov

  • Hi Todor,
    In order to achieve the desired functionality below is a list of relevant API's and description on how to use them that can be helpful for you:
    1. Typically Z-Stack will automatically start the device in the network if HOLD_AUTO_START compile option is not defined. If the compile option is defined, then Z-Stack will wait for the application to call ZDOInitDevice(0) to start the device in the network. You can call for example function NLME_GetShortAddr() and check the return value, if the return value is not 0xFFFE, then the device had joined a network before and you can call ZDOInitDevice(0) to start the device in the network. Else you can set the device as a power saving device by calling
    osal_pwrmgr_device( PWRMGR_BATTERY );
    and the device will then enter the sleep mode.
    To wake up the device you can use button press, etc. Before starting the network join operation you can call the
    osal_pwrmgr_device( PWRMGR_ALWAYS_ON);
    to set the device as always on during the join process and then the stack will automatically configure the device as a sleepy device when the network join is successful and POWER_SAVING compile option is defined.
    ZDOInitDevice(0) : Allows the application to initiate the network join procedure
    2. ZDApp_StopJoiningCycle() Allows the application to stop the end device attempting to join the network and go back to sleep until the API ZDApp_StartJoiningCycle() is called after which the end device automatically starts the join procedure.
    3. NLME_SetPollRate(poll_rate): Allows application to configure the poll duration for a end device

    I hope this helps.