Network API

Network API provides functions for multi-thread application network management. It allows multiple threads to request to join to network (internet access).

Network API module controls when network connection shall be active or can be closed.

group LWGSM_NETWORK_API

Network API functions for multi-thread operations.

Functions

lwgsmr_t lwgsm_network_set_credentials(const char *apn, const char *user, const char *pass)

Set system network credentials before asking for attach.

Parameters
  • apn[in] APN domain. Set to NULL if not used

  • user[in] APN username. Set to NULL if not used

  • pass[in] APN password. Set to NULL if not used

Returns

lwgsmOK on success, member of lwgsmr_t otherwise

lwgsmr_t lwgsm_network_request_attach(void)

Request manager to attach to network.

Note

This function is blocking and cannot be called from event functions

Returns

lwgsmOK on success (when attached), member of lwgsmr_t otherwise

lwgsmr_t lwgsm_network_request_detach(void)

Request manager to detach from network.

If other threads use network, manager will not disconnect from network otherwise it will disable network access

Note

This function is blocking and cannot be called from event functions

Returns

lwgsmOK on success (when attached), member of lwgsmr_t otherwise