le_data API Reference
Files | |
file | le_data_common.h |
file | le_data_interface.h |
Macros | |
#define | LE_DATA_INTERFACE_NAME_MAX_LEN 100 |
#define | LE_DATA_INTERFACE_NAME_MAX_BYTES 101 |
Typedefs | |
typedef struct le_data_RequestObj * | le_data_RequestObjRef_t |
typedef struct le_data_ConnectionStateHandler * | le_data_ConnectionStateHandlerRef_t |
typedef void(* | le_data_ConnectionStateHandlerFunc_t) (const char *LE_NONNULL intfName, bool isConnected, void *contextPtr) |
typedef void(* | le_data_DisconnectHandler_t) (void *) |
Enumerations | |
enum | le_data_Technology_t { LE_DATA_WIFI = 0, LE_DATA_CELLULAR = 1, LE_DATA_MAX = 2 } |
enum | le_data_TimeProtocol_t { LE_DATA_TP = 0, LE_DATA_NTP = 1 } |
Detailed Description
Macro Definition Documentation
◆ LE_DATA_INTERFACE_NAME_MAX_BYTES
#define LE_DATA_INTERFACE_NAME_MAX_BYTES 101 |
Interface name string length. One extra byte is added for the null character.
◆ LE_DATA_INTERFACE_NAME_MAX_LEN
#define LE_DATA_INTERFACE_NAME_MAX_LEN 100 |
Interface name string length.
Typedef Documentation
◆ le_data_ConnectionStateHandlerFunc_t
typedef void(* le_data_ConnectionStateHandlerFunc_t) (const char *LE_NONNULL intfName, bool isConnected, void *contextPtr) |
Handler for connection state changes
◆ le_data_ConnectionStateHandlerRef_t
typedef struct le_data_ConnectionStateHandler* le_data_ConnectionStateHandlerRef_t |
Reference type used by Add/Remove functions for EVENT 'le_data_ConnectionState'
◆ le_data_DisconnectHandler_t
typedef void(* le_data_DisconnectHandler_t) (void *) |
Type for handler called when a server disconnects.
◆ le_data_RequestObjRef_t
typedef struct le_data_RequestObj* le_data_RequestObjRef_t |
Reference returned by Request function and used by Release function
Enumeration Type Documentation
◆ le_data_Technology_t
enum le_data_Technology_t |
◆ le_data_TimeProtocol_t
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] ipDestAddrStr The 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] ipDestAddrStr The 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
- To get the date and time, use GetDateTime rather than sequential calls to GetDate and GetTime to avoid the possibility of a date change between the two calls.
- 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] yearPtr UTC Year A.D. [e.g. 2017]. [out] monthPtr UTC Month into the year [range 1...12]. [out] dayPtr UTC Days into the month [range 1...31].
◆ le_data_GetDateTime()
le_result_t le_data_GetDateTime | ( | uint16_t * | yearPtr, |
uint16_t * | monthPtr, | ||
uint16_t * | dayPtr, | ||
uint16_t * | hoursPtr, | ||
uint16_t * | minutesPtr, | ||
uint16_t * | secondsPtr, | ||
uint16_t * | millisecondsPtr | ||
) |
Get the date and 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] yearPtr UTC Year A.D. [e.g. 2017]. [out] monthPtr UTC Month into the year [range 1...12]. [out] dayPtr UTC Days into the month [range 1...31]. [out] hoursPtr UTC Hours into the day [range 0..23]. [out] minutesPtr UTC Minutes into the hour [range 0..59]. [out] secondsPtr UTC Seconds into the minute [range 0..59]. [out] millisecondsPtr UTC Milliseconds into the second [range 0..999].
◆ 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
- To get the date and time, use GetDateTime rather than sequential calls to GetDate and GetTime to avoid the possibility of a date change between the two calls.
- 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] hoursPtr UTC Hours into the day [range 0..23]. [out] minutesPtr UTC Minutes into the hour [range 0..59]. [out] secondsPtr UTC Seconds into the minute [range 0..59]. [out] millisecondsPtr UTC 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] requestRef Reference 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] profileIndex Cellular 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
- LE_OK if the technology is added to the list
- LE_BAD_PARAMETER if the technology is unknown
- LE_UNSUPPORTED if the technology is not available
- Parameters
-
[in] rank Rank of the used technology [in] technology Technology
◆ 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.