le_data_interface.h File Reference

#include "legato.h"
#include "le_mdc_interface.h"
#include "le_dcs_interface.h"
#include "le_data_common.h"

Go to the source code of this file.

Typedefs

typedef void(* le_data_DisconnectHandler_t) (void *)
 

Functions

void le_data_ConnectService (void)
 
le_result_t le_data_TryConnectService (void)
 
LE_FULL_API void le_data_SetServerDisconnectHandler (le_data_DisconnectHandler_t disconnectHandler, void *contextPtr)
 
void le_data_DisconnectService (void)
 
le_data_ConnectionStateHandlerRef_t le_data_AddConnectionStateHandler (le_data_ConnectionStateHandlerFunc_t handlerPtr, void *contextPtr)
 
void le_data_RemoveConnectionStateHandler (le_data_ConnectionStateHandlerRef_t handlerRef)
 
le_data_RequestObjRef_t le_data_Request (void)
 
void le_data_Release (le_data_RequestObjRef_t requestRef)
 
le_result_t le_data_SetTechnologyRank (uint32_t rank, le_data_Technology_t technology)
 
le_data_Technology_t le_data_GetFirstUsedTechnology (void)
 
le_data_Technology_t le_data_GetNextUsedTechnology (void)
 
le_data_Technology_t le_data_GetTechnology (void)
 
bool le_data_GetDefaultRouteStatus (void)
 
le_result_t le_data_AddRoute (const char *LE_NONNULL ipDestAddrStr)
 
le_result_t le_data_DelRoute (const char *LE_NONNULL ipDestAddrStr)
 
int32_t le_data_GetCellularProfileIndex (void)
 
le_result_t le_data_SetCellularProfileIndex (int32_t profileIndex)
 
le_result_t le_data_GetDate (uint16_t *yearPtr, uint16_t *monthPtr, uint16_t *dayPtr)
 
le_result_t le_data_GetTime (uint16_t *hoursPtr, uint16_t *minutesPtr, uint16_t *secondsPtr, uint16_t *millisecondsPtr)
 

Detailed Description

Legato Data Connection include file.

Typedef Documentation

◆ le_data_DisconnectHandler_t

typedef void(* le_data_DisconnectHandler_t) (void *)

Type for handler called when a server disconnects.

Function Documentation

◆ le_data_AddConnectionStateHandler()

le_data_ConnectionStateHandlerRef_t le_data_AddConnectionStateHandler ( le_data_ConnectionStateHandlerFunc_t  handlerPtr,
void *  contextPtr 
)

Reference returned by Request function and used by Release function Technologies. Time protocols. Handler for connection state changes Reference type used by Add/Remove functions for EVENT 'le_data_ConnectionState' Add handler function for EVENT 'le_data_ConnectionState'

This event provides information on connection state changes

Parameters
[in]handlerPtr
[in]contextPtr

◆ le_data_AddRoute()

le_result_t le_data_AddRoute ( const char *LE_NONNULL  ipDestAddrStr)

Add a route on the data connection service interface, if the data session is connected using the cellular technology and has an IPv4 or IPv6 address.

Returns
  • LE_OK on success
  • LE_UNSUPPORTED cellular technology not currently used
  • LE_BAD_PARAMETER incorrect IP address
  • LE_FAULT for all other errors
Note
Limitations:
  • only IPv4 is supported for the moment
  • route only added for a cellular connection
Parameters
[in]ipDestAddrStrThe destination IP address in dotted format

◆ le_data_ConnectService()

void le_data_ConnectService ( void  )

Connect the current client thread to the service providing this API. Block until the service is available.

For each thread that wants to use this API, either ConnectService or TryConnectService must be called before any other functions in this API. Normally, ConnectService is automatically called for the main thread, but not for any other thread. For details, see Client-specific Functions.

This function is created automatically.

◆ le_data_DelRoute()

le_result_t le_data_DelRoute ( const char *LE_NONNULL  ipDestAddrStr)

Delete a route on the data connection service interface, if the data session is connected using the cellular technology and has an IPv4 or IPv6 address.

Returns
  • LE_OK on success
  • LE_UNSUPPORTED cellular technology not currently used
  • LE_BAD_PARAMETER incorrect IP address
  • LE_FAULT for all other errors
Note
Limitations:
  • only IPv4 is supported for the moment
  • route only removed for a cellular connection
Parameters
[in]ipDestAddrStrThe destination IP address in dotted format

◆ le_data_DisconnectService()

void le_data_DisconnectService ( void  )

Disconnect the current client thread from the service providing this API.

Normally, this function doesn't need to be called. After this function is called, there's no longer a connection to the service, and the functions in this API can't be used. For details, see Client-specific Functions.

This function is created automatically.

◆ le_data_GetCellularProfileIndex()

int32_t le_data_GetCellularProfileIndex ( void  )

Get the cellular profile index used by the data connection service when the cellular technology is active.

Returns
  • Cellular profile index

◆ le_data_GetDate()

le_result_t le_data_GetDate ( uint16_t *  yearPtr,
uint16_t *  monthPtr,
uint16_t *  dayPtr 
)

Get the date from the configured server using the configured time protocol.

Warning
An active data connection is necessary to retrieve the date.
Returns
  • LE_OK on success
  • LE_BAD_PARAMETER if a parameter is incorrect
  • LE_FAULT if an error occurred
Parameters
[out]yearPtrUTC Year A.D. [e.g. 2017].
[out]monthPtrUTC Month into the year [range 1...12].
[out]dayPtrUTC Days into the month [range 1...31].

◆ le_data_GetDefaultRouteStatus()

bool le_data_GetDefaultRouteStatus ( void  )

Get the default route activation status for the data connection service interface.

Returns
  • true: the default route is set by the data connection service
  • false: the default route is not set by the data connection service

◆ le_data_GetFirstUsedTechnology()

le_data_Technology_t le_data_GetFirstUsedTechnology ( void  )

Get the first technology to use

Returns
  • One of the technologies from le_data_Technology_t enumerator if the list is not empty
  • LE_DATA_MAX if the list is empty

◆ le_data_GetNextUsedTechnology()

le_data_Technology_t le_data_GetNextUsedTechnology ( void  )

Get the next technology to use

Returns
  • One of the technologies from le_data_Technology_t enumerator if the list is not empty
  • LE_DATA_MAX if the list is empty or the end of the list is reached

◆ le_data_GetTechnology()

le_data_Technology_t le_data_GetTechnology ( void  )

Get the technology of the currently connected data connection. In the absence of an actively connected data connection, LE_DATA_MAX is returned.

Returns
  • One of the technologies from le_data_Technology_t enumerator
  • LE_DATA_MAX if not connected

◆ le_data_GetTime()

le_result_t le_data_GetTime ( uint16_t *  hoursPtr,
uint16_t *  minutesPtr,
uint16_t *  secondsPtr,
uint16_t *  millisecondsPtr 
)

Get the time from the configured server using the configured time protocol.

Warning
An active data connection is necessary to retrieve the time.
Returns
  • LE_OK on success
  • LE_BAD_PARAMETER if a parameter is incorrect
  • LE_FAULT if an error occurred
Parameters
[out]hoursPtrUTC Hours into the day [range 0..23].
[out]minutesPtrUTC Minutes into the hour [range 0..59].
[out]secondsPtrUTC Seconds into the minute [range 0..59].
[out]millisecondsPtrUTC Milliseconds into the second [range 0..999].

◆ le_data_Release()

void le_data_Release ( le_data_RequestObjRef_t  requestRef)

Release a previously requested data connection

Parameters
[in]requestRefReference to a previously requested data connection

◆ le_data_RemoveConnectionStateHandler()

void le_data_RemoveConnectionStateHandler ( le_data_ConnectionStateHandlerRef_t  handlerRef)

Remove handler function for EVENT 'le_data_ConnectionState'

Parameters
[in]handlerRef

◆ le_data_Request()

le_data_RequestObjRef_t le_data_Request ( void  )

Request the default data connection

Returns
  • Reference to the data connection (to be used later for releasing the connection)
  • NULL if the data connection requested could not be processed

◆ le_data_SetCellularProfileIndex()

le_result_t le_data_SetCellularProfileIndex ( int32_t  profileIndex)

Set the cellular profile index used by the data connection service when the cellular technology is active.

Returns
  • LE_OK on success
  • LE_BAD_PARAMETER if the profile index is invalid
  • LE_BUSY the cellular connection is in use
Parameters
[in]profileIndexCellular profile index to be used

◆ le_data_SetServerDisconnectHandler()

LE_FULL_API void le_data_SetServerDisconnectHandler ( le_data_DisconnectHandler_t  disconnectHandler,
void *  contextPtr 
)

Set handler called when server disconnection is detected.

When a server connection is lost, call this handler then exit with LE_FATAL. If a program wants to continue without exiting, it should call longjmp() from inside the handler.

◆ le_data_SetTechnologyRank()

le_result_t le_data_SetTechnologyRank ( uint32_t  rank,
le_data_Technology_t  technology 
)

Set the rank of the technology used for the data connection service

Returns
Parameters
[in]rankRank of the used technology
[in]technologyTechnology

◆ le_data_TryConnectService()

le_result_t le_data_TryConnectService ( void  )

Try to connect the current client thread to the service providing this API. Return with an error if the service is not available.

For each thread that wants to use this API, either ConnectService or TryConnectService must be called before any other functions in this API. Normally, ConnectService is automatically called for the main thread, but not for any other thread. For details, see Client-specific Functions.

This function is created automatically.

Returns
  • LE_OK if the client connected successfully to the service.
  • LE_UNAVAILABLE if the server is not currently offering the service to which the client is bound.
  • LE_NOT_PERMITTED if the client interface is not bound to any service (doesn't have a binding).
  • LE_COMM_ERROR if the Service Directory cannot be reached.