M2M_net.c File

The M2M_net.c file contains the following callback functions:

Callback

Event starting the callback:

M2M_onNetEvent(…)

PDP context activation/deactivation, SOCKET closed /error, etc.

M2M_onRegStatusEvent(…)

Cell change

M2M_onGprsRegStatusEvent(...)

GPRS registration update

M2M_onMsgIndEvent(…)

reception of a SMS

M2M_onIP6RawEvent(…)

reception of an ip6 raw packet

M2M_onNetEvent(...) example:

      Use the m2m_timer_create(…) API and write its callback function to manage the timer expiration. Start the timer through  the m2m_timer_start(…) API;

      When the timer is expired, the control calls the function to manage the timer expiration. Its code, written by the developer, in accordance with the timer identifier sends a message to the 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, using the m2m_pdp_activate(…) API, create a PDP context. To wait for the module registration and the PDP context activation the M2M_msgProc1(…) starts a timer. When the timer expires, the control sends again a message to Task_1 to check the PDP status.

      When the PDP is active, the M2M_onNetEvent callback is executed. In general, this callback is activated by several network events. It is responsibility of the developer to wait for the desired event.

M2M_onRegStatusEvent(…) example:

      Enable the notification of the location registration by means of the m2m_network_enable_ registration _location_unsolicited() API;

      When cell_id or LAC changes, the M2M_onRegStatusEvent(…) callback is executed.

M2M_onGprsRegStatusEvent(...) example:

      Enable the notification of the GPRS registration by means of the m2m_network_enable_gprs _registration _location_unsolicited() API;

      When GPRS registration change, the M2M_onGprsRegStatusEvent(...) callback is executed.

M2M_onMsgIndEvent(…) example:

      Enable the messages indication by means of the m2m_sms_enable_new_message_ indication(…) API;

      Send a SMS to the module;

      When the module receives the SMS message, the M2M_onMsgIndEvent (…) callback is executed.

M2M_onIP6RawEvent(…) example:

      Enable the ip6 raw mode by means of the m2m_ip6_raw(…) API;

      When the module receives an ip6 packet in raw mode, the M2M_onIP6RawEvent(…) callback is executed.