| Algorithm 1: Time interval selection and operation algorithm for an end device. |
| Data: ZigBee communication-initiation phase is over. Time intervals TI for priorities are configured. |
| Input: Received Offer message at the time T. |
| Output: Selected time interval TI(P). |
| 1 application selects a suitable priority P from the Offer message |
| 2 if Selection not sent then |
| 3 send Selection with priority P |
| 4 Sleep time = (TI(P) − time required for data processing) |
| 5 sleep while time < (T + Sleep time) |
| 6 repeat |
| 7 process data |
| 8 send data |
| 9 wait for Acknowledgement |
| 10 sleep for (Sleep time − time actually waited for Acknowledgement) |
| 11 until another Offer message received |