A data session is useful for applications that need to send or receive data over a network where SMS messages are insufficient. To start a data session, a data profile must be configured as specified by the target network.
The Modem Data Control (mdc) API is used to manage data profiles and data sessions.
All the functions of this API are provided by the modemService service.
Here's a code sample binding to modem services:
bindings: { clientExe.clientComponent.le_mdc -> modemService.le_mdc }
If a pre-defined data profile has been configured then this profile can be loaded using le_mdc_GetProfile(). le_mdc_GetProfile() must be called with LE_MDC_DEFAULT_PROFILE
to retrieve the default index used by the modem for data connection. le_mdc_GetProfile() must be called with LE_MDC_SIMTOOLKIT_BIP_DEFAULT_PROFILE
to retrieve the default index used by the modem for Bearer Independent Protocol (BIP). The maximum number of data profiles supported is modem dependent and can be retrieved with le_mdc_NumProfiles(). A pre-defined data profile can also be retrieved using le_mdc_GetProfileFromApn() thanks to its APN.
The following data profile parameters can be retrieved:
The following data profile parameters can be set:
A sample code can be seen in the following page:
A data session can be started using le_mdc_StartSession(). To start a data session, a data profile must be created and written to the modem, or an existing data profile can be used. A data session can be stopped using le_mdc_StopSession(). The number of simultaneous data sessions supported is dependent on the modem, but cannot be more than the maximum number of supported profiles.
The current state of a data session can be queried using le_mdc_GetSessionState(). An application can also a register handler to be notified when the session state changes. The handler can be managed using le_mdc_AddSessionStateHandler() and le_mdc_RemoveSessionStateHandler().
To be notified by the MT-PDP context request, the application has to subscribe to the state handler using le_mdc_AddMtPdpSessionStateHandler(). When the incoming MT-PDP context request is notified, the application takes responsibility to trigger the data session for that MT PDP request using le_mdc_StartSession. That data session can be stopped using le_mdc_StopSession().
The network interface settings of that MT-PDP context can be retrieved using the provided Data Profile. Please refer to Network interface settings.
A data session can be rejected using le_mdc_RejectMtPdpSession(). The number of simultaneous data sessions supported is dependent on the modem, but cannot be more than the maximum number of supported profiles.
The handler can be released using le_mdc_RemoveMtPdpSessionStateHandler().
Once a data session starts, a Linux network interface is created. It's the application's responsibility to configure the network interface, usually through a DHCP client. Query the interface name using le_mdc_GetInterfaceName(). The IP Preference can be checked with le_mdc_IsIPv4() or le_mdc_IsIPv6() when the profile is connected. The IP address for the current data session can be retreived by le_mdc_GetIPv4Address() or le_mdc_GetIPv6Address(). The Gateway and DNS addresses can be retrieved using le_mdc_GetIPv4GatewayAddress(), le_mdc_GetIPv4DNSAddresses() or le_mdc_GetIPv6GatewayAddress(), le_mdc_GetIPv6DNSAddresses(). The Access Point Name can be retrieved by le_mdc_GetAPN(). The Data bearer Technology can be retreived by le_mdc_GetDataBearerTechnology(). When the data session is stopped, the disconnection reason can be known using le_mdc_GetDisconnectionReason() or le_mdc_GetPlatformSpecificDisconnectionCode() (refer to your platform documentation for further details).
A sample code can be seen in the following page:
Data bytes received/transmitted can be access through le_mdc_GetBytesCounters(). These values correspond to the number of bytes received/transmitted since the last software reset or the last le_mdc_ResetBytesCounter() called. Making these value persistent after a software reboot is the client responsibility.
A sample code can be seen in the following page:
Copyright (C) Sierra Wireless Inc. Use of this work is subject to license.