All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
mdc_interface.h File Reference
#include "legato.h"
#include "userInclude.h"

Go to the source code of this file.

Typedefs

typedef struct
le_mdc_SessionStateHandler * 
le_mdc_SessionStateHandlerRef_t
 
typedef void(* le_mdc_SessionStateHandlerFunc_t )(bool isConnected, void *contextPtr)
 

Functions

void le_mdc_StartClient (const char *serviceInstanceName)
 
void le_mdc_StopClient (void)
 
le_mdc_SessionStateHandlerRef_t le_mdc_AddSessionStateHandler (le_mdc_ProfileRef_t profileRef, le_mdc_SessionStateHandlerFunc_t handlerPtr, void *contextPtr)
 
void le_mdc_RemoveSessionStateHandler (le_mdc_SessionStateHandlerRef_t addHandlerRef)
 
le_mdc_ProfileRef_t le_mdc_LoadProfile (const char *name)
 
le_result_t le_mdc_GetProfileName (le_mdc_ProfileRef_t profileRef, char *name, size_t nameNumElements)
 
le_result_t le_mdc_StartSession (le_mdc_ProfileRef_t profileRef)
 
le_result_t le_mdc_StopSession (le_mdc_ProfileRef_t profileRef)
 
le_result_t le_mdc_GetSessionState (le_mdc_ProfileRef_t profileRef, bool *isConnectedPtr)
 
le_result_t le_mdc_GetInterfaceName (le_mdc_ProfileRef_t profileRef, char *interfaceName, size_t interfaceNameNumElements)
 
le_result_t le_mdc_GetIPv4Address (le_mdc_ProfileRef_t profileRef, char *ipAddr, size_t ipAddrNumElements)
 
le_result_t le_mdc_GetIPv4GatewayAddress (le_mdc_ProfileRef_t profileRef, char *gatewayAddr, size_t gatewayAddrNumElements)
 
le_result_t le_mdc_GetIPv4DNSAddresses (le_mdc_ProfileRef_t profileRef, char *dns1AddrStr, size_t dns1AddrStrNumElements, char *dns2AddrStr, size_t dns2AddrStrNumElements)
 
le_result_t le_mdc_GetIPv6Address (le_mdc_ProfileRef_t profileRef, char *ipAddr, size_t ipAddrNumElements)
 
le_result_t le_mdc_GetIPv6GatewayAddress (le_mdc_ProfileRef_t profileRef, char *gatewayAddr, size_t gatewayAddrNumElements)
 
le_result_t le_mdc_GetIPv6DNSAddresses (le_mdc_ProfileRef_t profileRef, char *dns1AddrStr, size_t dns1AddrStrNumElements, char *dns2AddrStr, size_t dns2AddrStrNumElements)
 
bool le_mdc_IsIPv4 (le_mdc_ProfileRef_t profileRef)
 
bool le_mdc_IsIPv6 (le_mdc_ProfileRef_t profileRef)
 
le_result_t le_mdc_GetAccessPointName (le_mdc_ProfileRef_t profileRef, char *apnNameStr, size_t apnNameStrNumElements)
 
le_result_t le_mdc_GetDataBearerTechnology (le_mdc_ProfileRef_t profileRef, le_mdc_dataBearerTechnology_t *dataBearerTechnologyPtrPtr)
 
le_result_t le_mdc_GetBytesCounters (uint64_t *rxBytesPtr, uint64_t *txBytesPtr)
 
le_result_t le_mdc_ResetBytesCounter (void)
 

Detailed Description

Legato Modem Data Control include file.

Copyright (C) Sierra Wireless, Inc. 2014. Use of this work is subject to license.

Typedef Documentation

typedef void(* le_mdc_SessionStateHandlerFunc_t)(bool isConnected, void *contextPtr)

Handler for Data session connection state changes.

Parameters
isConnectedData session connection status.
contextPtr
typedef struct le_mdc_SessionStateHandler* le_mdc_SessionStateHandlerRef_t

Reference type for le_mdc_SessionStateHandler handler ADD/REMOVE functions

Function Documentation

le_mdc_SessionStateHandlerRef_t le_mdc_AddSessionStateHandler ( le_mdc_ProfileRef_t  profileRef,
le_mdc_SessionStateHandlerFunc_t  handlerPtr,
void *  contextPtr 
)

le_mdc_SessionStateHandler handler ADD function

Parameters
[in]profileRefThe profile object of interest
[in]handlerPtr
[in]contextPtr
le_result_t le_mdc_GetAccessPointName ( le_mdc_ProfileRef_t  profileRef,
char *  apnNameStr,
size_t  apnNameStrNumElements 
)

Get the Access Point Name for the given profile, if the data session is connected.

Returns
  • LE_OK on success
  • LE_OVERFLOW if the Access Point Name would not fit in apnNameStr
  • LE_NOT_POSSIBLE for all other errors
Note
The process exits, if an invalid profile object is given
Parameters
[in]profileRefQuery this profile object
[out]apnNameStrThe Access Point Name
[in]apnNameStrNumElements
le_result_t le_mdc_GetBytesCounters ( uint64_t *  rxBytesPtr,
uint64_t *  txBytesPtr 
)

Get number of bytes received/transmitted without error since the last reset.

Returns
  • LE_OK on success
  • LE_NOT_POSSIBLE for all other errors
Note
  • The process exits, if an invalid pointer is given
Parameters
[out]rxBytesPtrbytes amount received since the last counter reset
[out]txBytesPtrbytes amount transmitted since the last counter reset
le_result_t le_mdc_GetDataBearerTechnology ( le_mdc_ProfileRef_t  profileRef,
le_mdc_dataBearerTechnology_t dataBearerTechnologyPtrPtr 
)

Get the Data Bearer Technology for the given profile, if the data session is connected.

Returns
  • LE_OK on success
  • LE_NOT_POSSIBLE for all other errors
Note
The process exits, if an invalid profile object is given
Parameters
[in]profileRefQuery this profile object
[out]dataBearerTechnologyPtrPtrThe data bearer technology
le_result_t le_mdc_GetInterfaceName ( le_mdc_ProfileRef_t  profileRef,
char *  interfaceName,
size_t  interfaceNameNumElements 
)

Get the network interface name, if the data session is connected.

Returns
  • LE_OK on success
  • LE_OVERFLOW if the interface name can't fit in interfaceNameStr
  • LE_NOT_POSSIBLE on any other failure
Note
The process exits, if an invalid profile object is given
Parameters
[in]profileRefQuery this profile object
[out]interfaceNameThe name of the network interface
[in]interfaceNameNumElements
le_result_t le_mdc_GetIPv4Address ( le_mdc_ProfileRef_t  profileRef,
char *  ipAddr,
size_t  ipAddrNumElements 
)

Get the IPv4 address for the given profile, if the data session is connected and has an IPv4 address.

Returns
  • LE_OK on success
  • LE_OVERFLOW if the IP address would not fit in ipAddrStr
  • LE_NOT_POSSIBLE for all other errors
Note
The process exits, if an invalid profile object is given
Parameters
[in]profileRefQuery this profile object
[out]ipAddrThe IP address in dotted format
[in]ipAddrNumElements
le_result_t le_mdc_GetIPv4DNSAddresses ( le_mdc_ProfileRef_t  profileRef,
char *  dns1AddrStr,
size_t  dns1AddrStrNumElements,
char *  dns2AddrStr,
size_t  dns2AddrStrNumElements 
)

Get the primary/secondary DNS v4 addresses for the given profile, if the data session is connected and has an IPv4 address.

Returns
  • LE_OK on success
  • LE_OVERFLOW if the IP address would not fit in buffer
  • LE_NOT_POSSIBLE for all other errors
Note
  • If only one DNS address is available, then it will be returned, and an empty string will be returned for the unavailable address
  • The process exits, if an invalid profile object is given
Parameters
[in]profileRefQuery this profile object
[out]dns1AddrStrThe primary DNS IP address in dotted format
[in]dns1AddrStrNumElements
[out]dns2AddrStrThe secondary DNS IP address in dotted format
[in]dns2AddrStrNumElements
le_result_t le_mdc_GetIPv4GatewayAddress ( le_mdc_ProfileRef_t  profileRef,
char *  gatewayAddr,
size_t  gatewayAddrNumElements 
)

Get the gateway IPv4 address for the given profile, if the data session is connected and has an IPv4 address.

Returns
  • LE_OK on success
  • LE_OVERFLOW if the IP address would not fit in gatewayAddrStr
  • LE_NOT_POSSIBLE for all other errors
Note
The process exits, if an invalid profile object is given
Parameters
[in]profileRefQuery this profile object
[out]gatewayAddrThe gateway IP address in dotted format
[in]gatewayAddrNumElements
le_result_t le_mdc_GetIPv6Address ( le_mdc_ProfileRef_t  profileRef,
char *  ipAddr,
size_t  ipAddrNumElements 
)

Get the IPv6 address for the given profile, if the data session is connected and has an IPv6 address.

Returns
  • LE_OK on success
  • LE_OVERFLOW if the IP address would not fit in ipAddrStr
  • LE_NOT_POSSIBLE for all other errors
Note
The process exits, if an invalid profile object is given
Parameters
[in]profileRefQuery this profile object
[out]ipAddrThe IP address in dotted format
[in]ipAddrNumElements
le_result_t le_mdc_GetIPv6DNSAddresses ( le_mdc_ProfileRef_t  profileRef,
char *  dns1AddrStr,
size_t  dns1AddrStrNumElements,
char *  dns2AddrStr,
size_t  dns2AddrStrNumElements 
)

Get the primary/secondary DNS v6 addresses, if the data session is connected and has an IPv6 address.

Returns
  • LE_OK on success
  • LE_OVERFLOW if the IP address can't fit in buffer
  • LE_NOT_POSSIBLE for all other errors
Note
  • If only one DNS address is available, it will be returned, and an empty string will be returned for the unavailable address.
  • The process exits, if an invalid profile object is given
Parameters
[in]profileRefQuery this profile object
[out]dns1AddrStrThe primary DNS IP address in dotted format
[in]dns1AddrStrNumElements
[out]dns2AddrStrThe secondary DNS IP address in dotted format
[in]dns2AddrStrNumElements
le_result_t le_mdc_GetIPv6GatewayAddress ( le_mdc_ProfileRef_t  profileRef,
char *  gatewayAddr,
size_t  gatewayAddrNumElements 
)

Get the gateway IPv6 address for the given profile, if the data session is connected and has an IPv6 address.

Returns
  • LE_OK on success
  • LE_OVERFLOW if the IP address would not fit in gatewayAddrStr
  • LE_NOT_POSSIBLE for all other errors
Note
The process exits, if an invalid profile object is given
Parameters
[in]profileRefQuery this profile object
[out]gatewayAddrThe gateway IP address in dotted format
[in]gatewayAddrNumElements
le_result_t le_mdc_GetProfileName ( le_mdc_ProfileRef_t  profileRef,
char *  name,
size_t  nameNumElements 
)

Get profile name.

Returns
  • LE_OK on success
  • LE_OVERFLOW if the name would not fit in buffer
Note
The process exits, if an invalid profile object is given
Parameters
[in]profileRefQuery this profile object
[out]nameThe name of the profile
[in]nameNumElements
le_result_t le_mdc_GetSessionState ( le_mdc_ProfileRef_t  profileRef,
bool *  isConnectedPtr 
)

Get the current data session state.

Returns
  • LE_OK on success
  • LE_NOT_POSSIBLE on failure
Note
The process exits, if an invalid profile object is given
Parameters
[in]profileRefQuery this profile object
[out]isConnectedPtrThe data session state
bool le_mdc_IsIPv4 ( le_mdc_ProfileRef_t  profileRef)

Allow the caller to know if the given profile is actually supporting IPv4, if the data session is connected.

Returns
TRUE if PDP type is IPv4, FALSE otherwise.
Note
If the caller is passing a bad pointer into this function, it is a fatal error, the function will not return.
Parameters
[in]profileRefQuery this profile object
bool le_mdc_IsIPv6 ( le_mdc_ProfileRef_t  profileRef)

Allow the caller to know if the given profile is actually supporting IPv6, if the data session is connected.

Returns
TRUE if PDP type is IPv6, FALSE otherwise.
Note
If the caller is passing a bad pointer into this function, it is a fatal error, the function will not return.
Parameters
[in]profileRefQuery this profile object
le_mdc_ProfileRef_t le_mdc_LoadProfile ( const char *  name)

Load an existing data profile

Profile can either be pre-configured or stored on the modem

Returns
  • Reference to the data profile
  • NULL if the profile does not exist
Note
If profile name is too long (max 50 digits) the function will not return.
Parameters
[in]nameName of the profile.
void le_mdc_RemoveSessionStateHandler ( le_mdc_SessionStateHandlerRef_t  addHandlerRef)

le_mdc_SessionStateHandler handler REMOVE function

Parameters
[in]addHandlerRef
le_result_t le_mdc_ResetBytesCounter ( void  )

Reset received/transmitted data flow statistics

  • Returns
    • LE_OK on success
    • LE_NOT_POSSIBLE for all other errors
void le_mdc_StartClient ( const char *  serviceInstanceName)

Start the service for the client main thread

Parameters
[in]serviceInstanceName
le_result_t le_mdc_StartSession ( le_mdc_ProfileRef_t  profileRef)

Start profile data session.

Returns
  • LE_OK on success
  • LE_DUPLICATE if the data session is already connected for the given profile
  • LE_NOT_POSSIBLE for other failures
Note
The process exits, if an invalid profile object is given
Parameters
[in]profileRefStart data session for this profile object
void le_mdc_StopClient ( void  )

Stop the service for the current client thread

le_result_t le_mdc_StopSession ( le_mdc_ProfileRef_t  profileRef)

Stop profile data session.

Returns
  • LE_OK on success
  • LE_DUPLICATE if the data session has already been stopped (i.e. it is disconnected)
  • LE_NOT_POSSIBLE for other failures
Note
The process exits, if an invalid profile object is given
Parameters
[in]profileRefStop data session for this profile object