Cellular Network

API Reference


The Cellular Network service ensures that the modem is registered on the network when an user application makes a request for network access. This includes:

  • ensuring that the radio is turned on.
  • ensuring that there is a valid SIM, and it is unlocked.
  • ensuring that the modem is registered on the network.

If all of the above conditions are met, then the service indicates that the network is available.

IPC interfaces binding

All the functions of this API are provided by the cellNetService application service.

Here's a code sample binding to Cellular Network services:

bindings:
{
   clientExe.clientComponent.le_cellnet -> cellNetService.le_cellnet
}

Requesting the Cellular Network

The Cellular Network can be requested using le_cellnet_Request(). The le_cellnet_Request function will turn on the radio if it is switched off and it will unlock the SIM if a PIN code is required (it will retrieve the needed information from the config tree, cf. Cellular Network configuration). Before the cellular network is requested, an application should register a network state handler using le_cellnet_AddStateEventHandler(). Once the cellular network becomes available, the handler will be called to indicate that the modem is now registered on the network.

If the state of the network changes, then the handler will be called with the new state.

To release the cellular network, an application can use le_cellnet_Release(). Once all user applications release the cellular network access, then the service will turn off the radio.

All configuration data required for a network registration, such as the PIN code of the SIM, will be stored in the Config tree by the use of the le_cellnet_SetSimPinCode() function.

Cellular Network configuration

Setting the SIM PIN code in the config tree and retreiving it is performed by two functions: le_cellnet_SetSimPinCode() and le_cellnet_GetSimPinCode().

The le_cellnet_SetSimPinCode() function takes two parameters : SIM identifier and SIM card PIN code and stores the PIN code in the rigth path of the config tree. Note that the function erases the previous stored SIM card PIN code. Note that it is possible to set and retry a void entry ("") corresponding to an unlocked SIM.

The le_cellnet_GetSimPinCode() function takes one parameter: the SIM identifier and retreives the SIM card PIN code from the config tree.

Note
when a new SIM is inserted and :
  • is locked, Cellular Network Service will read automatically the config tree in order to try to enter the pin for the SIM card.
  • is blocked, Cellular Network Service just log an error and did not try to enter the puk code.
  • when setting a too long PIN code (max 8 digits), a fatal error occurs, the function will not return.