Network

group LWGSM_NETWORK

Network manager.

Enums

enum lwgsm_network_reg_status_t

Network Registration status.

Values:

enumerator LWGSM_NETWORK_REG_STATUS_SIM_ERR = 0x00

SIM card error

enumerator LWGSM_NETWORK_REG_STATUS_CONNECTED = 0x01

Device is connected to network

enumerator LWGSM_NETWORK_REG_STATUS_SEARCHING = 0x02

Network search is in progress

enumerator LWGSM_NETWORK_REG_STATUS_DENIED = 0x03

Registration denied

enumerator LWGSM_NETWORK_REG_STATUS_CONNECTED_ROAMING = 0x05

Device is connected and is roaming

enumerator LWGSM_NETWORK_REG_STATUS_CONNECTED_SMS_ONLY = 0x06

Device is connected to home network in SMS-only mode

enumerator LWGSM_NETWORK_REG_STATUS_CONNECTED_ROAMING_SMS_ONLY = 0x07

Device is roaming in SMS-only mode

Functions

lwgsmr_t lwgsm_network_rssi(int16_t *rssi, const lwgsm_api_cmd_evt_fn evt_fn, void *const evt_arg, const uint32_t blocking)

Read RSSI signal from network operator.

Parameters
  • rssi[out] RSSI output variable. When set to 0, RSSI is not valid

  • evt_fn[in] Callback function called when command has finished. Set to NULL when not used

  • evt_arg[in] Custom argument for event callback function

  • blocking[in] Status whether command should be blocking or not

Returns

lwgsmOK on success, member of lwgsmr_t enumeration otherwise

lwgsm_network_reg_status_t lwgsm_network_get_reg_status(void)

Get network registration status.

Returns

Member of lwgsm_network_reg_status_t enumeration

lwgsmr_t lwgsm_network_attach(const char *apn, const char *user, const char *pass, const lwgsm_api_cmd_evt_fn evt_fn, void *const evt_arg, const uint32_t blocking)

Attach to network and active PDP context.

Parameters
  • apn[in] APN name

  • user[in] User name to attach. Set to NULL if not used

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

  • evt_fn[in] Callback function called when command has finished. Set to NULL when not used

  • evt_arg[in] Custom argument for event callback function

  • blocking[in] Status whether command should be blocking or not

Returns

lwgsmOK on success, member of lwgsmr_t enumeration otherwise

lwgsmr_t lwgsm_network_detach(const lwgsm_api_cmd_evt_fn evt_fn, void *const evt_arg, const uint32_t blocking)

Detach from network.

Parameters
  • evt_fn[in] Callback function called when command has finished. Set to NULL when not used

  • evt_arg[in] Custom argument for event callback function

  • blocking[in] Status whether command should be blocking or not

Returns

lwgsmOK on success, member of lwgsmr_t enumeration otherwise

uint8_t lwgsm_network_is_attached(void)

Check if device is attached to network and PDP context is active.

Returns

1 on success, 0 otherwise

lwgsmr_t lwgsm_network_copy_ip(lwgsm_ip_t *ip)

Copy IP address from internal value to user variable.

Parameters

ip[out] Pointer to output IP variable

Returns

lwgsmOK on success, member of lwgsmr_t enumeration otherwise

lwgsmr_t lwgsm_network_check_status(const lwgsm_api_cmd_evt_fn evt_fn, void *const evt_arg, const uint32_t blocking)

Check network PDP status.

Parameters
  • evt_fn[in] Callback function called when command has finished. Set to NULL when not used

  • evt_arg[in] Custom argument for event callback function

  • blocking[in] Status whether command should be blocking or not

Returns

lwgsmOK on success, member of lwgsmr_t enumeration otherwise