Dear Salah,
In SMAC Wireless UART application, you may see in main() function that, after initialization, only some functions are called periodically. The functions would correspond to the specific application’s state machine (Wireless UART in this case), the processing of UART buffers and the change of 802.15.4 channel.
for(;;)
{
WUApp_MainStateMachine();
WUApp_ProcessCommRxBuffer();
WUApp_ProcessChangeChannel();
}
Inside Wireless UART state machine there are several states possible. I will try to explain them using the enum defining the different states possible. Please just notice that the transitions form one to another may come from either a previous state or internal/external events. Running the demo and checking the source code is the best way to understand this is done.
typedef enum wuAppState_tag
{
gWUAppStateStart_c, // only used as start point, goes directly to Idle state
gWUAppStateIdle_c, // If menus are active, go to configuration state. Otherwise, go to RX always on
gWUAppStateRxAlwaysOn_c, // listen for incoming Over-the-air packets
gWUAppStateSendDataComm_c, //print received data to UART, set from MCPSDataIndication
gWUAppStateSendDataOta_c, // Send data over the air, set after typing characters in demo mode
gWUAppStateWaitAckOta_c, // Wait for ACK after sending a packet. Only if these are enabled.
gWUAppStateSendAckOta_c, // Send ACK if enabled.
gWUAppStateRetryDataOta_c, // Retry packet transmission (If ACK is enabled and was not received)
gWUAppStateMax_c // max value of states
}wuAppState_t;
I hope this helps.
Regards,
AngelC