14.2.3.4.1 Task management
Zigbee stack task internally uses a priority based proprietary scheduler to process the requests from various zigbee stack layers organized as tasks. The Zigbee stack may use two functions to manage task execution. The SYS_RunTask() function shall be called in the infinite loop inside the Zigbee task to instruct the stack to process the next task. The stack checks what components have posted tasks via the SYS_PostTask() function and executes them according to priority of layers. The priority of Zigbee layers increases from top to bottom,i.e the lower layers get high priority (The priority order from high to low : MAC/PHY, NWK, APS, ZDO and so on). Executing a task means calling the task handler function of the corresponding layer (e.g ZDO_TaskHandler(), NWK_TaskHandler() ). A task handler function implements the state machine of the component, selecting the code to execute according to the current state.