The M2M_proc1.c file (default) contains the following callback functions:
Callback |
Event starting the callback: |
M2M_msgProc1(...) |
is the default callback. It is called by Task_1, see chapter Error! Reference source not found. |
M2M_msgProcCompl(...) |
is called by the control when the generic (default or user) M2M_msgProcX(...) callback has finished its execution. |
You can write custom M2M_procX.c files that may contain one or more M2M_msgProX(...) callback functions that are called by the connected AppZone Tasks.
The AppZone tasks, calling the M2M_msgProcX(...) callback, execute the code written by the user. The user may dedicate each task to a well-defined group of activities in accordance with the M2M application requirements and the needed execution priority.
Task_1 has the higher priority and Task_32 has the lower priority of the 32 tasks that can be provided by the AppZone Software Layer. The AppZone tasks have lower priorities than the modem tasks.
Example:
• Use the m2m_timer_create(…) API and its callback function to manage the timer expiration. Start the timer with the m2m_timer_start(…) API;
• When the timer is expired, the control executes the callback function to manage the timer expiration. Its code, written by the developer, in accordance with the timer identifier sends a message, for example, to Task_1 using the m2m_os_send_message_to_task(…) API;
• Task_1 detects the received message in its queue and calls the M2M_msgProc1(…) callback function that executes the code written by the developer;
• M2M_msgProc1(…) callback function, for example, sends a message to Task_5. In turn, it detects the message and calls the M2M_msgProc5(…) callback function.