le_wifiClient API Reference
Data Structures | |
struct | le_wifiClient_EventInd_t |
Files | |
file | le_wifiClient_common.h |
file | le_wifiClient_interface.h |
Macros | |
#define | LE_WIFICLIENT_NO_SIGNAL_STRENGTH 32767 |
Typedefs | |
typedef struct le_wifiClient_AccessPoint * | le_wifiClient_AccessPointRef_t |
typedef struct le_wifiClient_NewEventHandler * | le_wifiClient_NewEventHandlerRef_t |
typedef struct le_wifiClient_ConnectionEventHandler * | le_wifiClient_ConnectionEventHandlerRef_t |
typedef void(* | le_wifiClient_NewEventHandlerFunc_t) (le_wifiClient_Event_t event, void *contextPtr) |
typedef void(* | le_wifiClient_ConnectionEventHandlerFunc_t) (const le_wifiClient_EventInd_t *LE_NONNULL wifiEventIndPtr, void *contextPtr) |
typedef void(* | le_wifiClient_DisconnectHandler_t) (void *) |
Detailed Description
Macro Definition Documentation
◆ LE_WIFICLIENT_NO_SIGNAL_STRENGTH
#define LE_WIFICLIENT_NO_SIGNAL_STRENGTH 32767 |
Value for no signal strength.
Typedef Documentation
◆ le_wifiClient_AccessPointRef_t
typedef struct le_wifiClient_AccessPoint* le_wifiClient_AccessPointRef_t |
Reference type for AccessPoint that is returned by the WiFi Scan.
◆ le_wifiClient_ConnectionEventHandlerFunc_t
typedef void(* le_wifiClient_ConnectionEventHandlerFunc_t) (const le_wifiClient_EventInd_t *LE_NONNULL wifiEventIndPtr, void *contextPtr) |
Handler for WiFi Client connection changes
◆ le_wifiClient_ConnectionEventHandlerRef_t
typedef struct le_wifiClient_ConnectionEventHandler* le_wifiClient_ConnectionEventHandlerRef_t |
Reference type used by Add/Remove functions for EVENT 'le_wifiClient_ConnectionEvent'
◆ le_wifiClient_DisconnectHandler_t
typedef void(* le_wifiClient_DisconnectHandler_t) (void *) |
Type for handler called when a server disconnects.
◆ le_wifiClient_NewEventHandlerFunc_t
typedef void(* le_wifiClient_NewEventHandlerFunc_t) (le_wifiClient_Event_t event, void *contextPtr) |
Handler for WiFi Client changes
- Deprecated:
- le_wifiClient_AddNewEventHandler() will be removed in near future. It is replaced by le_wifiClient_AddConnectionEventHandler().
◆ le_wifiClient_NewEventHandlerRef_t
typedef struct le_wifiClient_NewEventHandler* le_wifiClient_NewEventHandlerRef_t |
Reference type used by Add/Remove functions for EVENT 'le_wifiClient_NewEvent'
Enumeration Type Documentation
◆ le_wifiClient_DisconnectionCause_t
WiFi Client disconnect cause type enum.
◆ le_wifiClient_Event_t
◆ le_wifiClient_SecurityProtocol_t
WiFi Client Security Protocol for connection
Function Documentation
◆ le_wifiClient_AddConnectionEventHandler()
le_wifiClient_ConnectionEventHandlerRef_t le_wifiClient_AddConnectionEventHandler | ( | le_wifiClient_ConnectionEventHandlerFunc_t | handlerPtr, |
void * | contextPtr | ||
) |
Add handler function for EVENT 'le_wifiClient_ConnectionEvent'
This event provide information on WiFi Client connection event changes.
- Parameters
-
[in] handlerPtr [in] contextPtr
◆ le_wifiClient_AddNewEventHandler()
le_wifiClient_NewEventHandlerRef_t le_wifiClient_AddNewEventHandler | ( | le_wifiClient_NewEventHandlerFunc_t | handlerPtr, |
void * | contextPtr | ||
) |
Reference type for AccessPoint that is returned by the WiFi Scan. WiFi Client Events. WiFi Client disconnect cause type enum. WiFi Client Security Protocol for connection Handler for WiFi Client changes
- Deprecated:
- le_wifiClient_AddNewEventHandler() will be removed in near future. It is replaced by le_wifiClient_AddConnectionEventHandler().
Reference type used by Add/Remove functions for EVENT 'le_wifiClient_NewEvent' WiFi event indication structure. The disconnectionCause only applies to event EVENT_DISCONNECTED. Handler for WiFi Client connection changes Reference type used by Add/Remove functions for EVENT 'le_wifiClient_ConnectionEvent' Add handler function for EVENT 'le_wifiClient_NewEvent'
This event provide information on WiFi Client event changes. NewEvent will be deprecated.
- Parameters
-
[in] handlerPtr [in] contextPtr
◆ le_wifiClient_ConfigureEap()
le_result_t le_wifiClient_ConfigureEap | ( | const uint8_t * | ssidPtr, |
size_t | ssidSize, | ||
le_wifiClient_SecurityProtocol_t | protocol, | ||
const uint8_t * | usernamePtr, | ||
size_t | usernameSize, | ||
const uint8_t * | passwordPtr, | ||
size_t | passwordSize | ||
) |
Configure the given SSID to use EAP and the given EAP username and password in the respective input arguments. The protocol input is mandatory and has to be set to either LE_WIFICLIENT_SECURITY_WPA_EAP_PEAP0_ENTERPRISE or LE_WIFICLIENT_SECURITY_WPA2_EAP_PEAP0_ENTERPRISE. Besides, both the username and password inputs are mandatory.
- Returns
- LE_OK Succeeded to configure the given EAP username and password for the given SSID.
- LE_FAULT Failed to configure.
- LE_BAD_PARAMETER Invalid parameter.
- Parameters
-
[in] ssidPtr SSID which configs are to be installed [in] ssidSize [in] protocol security protocol WPA-EAP or WPA2-EAP [in] usernamePtr EAP username used for this SSID [in] usernameSize [in] passwordPtr EAP password used for this SSID [in] passwordSize
◆ le_wifiClient_ConfigurePsk()
le_result_t le_wifiClient_ConfigurePsk | ( | const uint8_t * | ssidPtr, |
size_t | ssidSize, | ||
le_wifiClient_SecurityProtocol_t | protocol, | ||
const uint8_t * | passPhrasePtr, | ||
size_t | passPhraseSize, | ||
const uint8_t * | pskPtr, | ||
size_t | pskSize | ||
) |
Configure the given SSID to use PSK and the given pass-phrase or pre-shared key in the respective input arguments. The protocol input is mandatory and has to be set to either LE_WIFICLIENT_SECURITY_WPA_PSK_PERSONAL or LE_WIFICLIENT_SECURITY_WPA2_PSK_PERSONAL. Besides, it's mandatory to have at least one of the pass-phrase and pre-shared key supplied. If both are provided as input, the pass-phrase has precedence and will be used. But it fails to authenticate, a second attempt using the provided pre-shared key will not be done.
- Returns
- LE_OK Succeeded to configure the given pass-phrase or pre-shared key for the given SSID.
- LE_FAULT Failed to configure.
- LE_BAD_PARAMETER Invalid parameter.
- Parameters
-
[in] ssidPtr SSID which configs are to be installed [in] ssidSize [in] protocol security protocol WPA-PSK or WPA2-PSK [in] passPhrasePtr pass-phrase used for this SSID [in] passPhraseSize [in] pskPtr pre-shared key used for this SSID [in] pskSize
◆ le_wifiClient_ConfigureWep()
le_result_t le_wifiClient_ConfigureWep | ( | const uint8_t * | ssidPtr, |
size_t | ssidSize, | ||
const uint8_t * | wepKeyPtr, | ||
size_t | wepKeySize | ||
) |
Configure the given SSID to use WEP and the given WEP key in the respective input argument. The WEP key is a mandatory input to be provided.
- Returns
- LE_OK Succeeded to configure the givwn WEP key for the given SSID.
- LE_FAULT Failed to configure.
- LE_BAD_PARAMETER Invalid parameter.
- Parameters
-
[in] ssidPtr SSID which configs are to be installed [in] ssidSize [in] wepKeyPtr WEP key used for this SSID [in] wepKeySize
◆ le_wifiClient_Connect()
le_result_t le_wifiClient_Connect | ( | le_wifiClient_AccessPointRef_t | accessPointRef | ) |
Connect to the WiFi Access Point. All authentication must be set prior to calling this function.
- Returns
- LE_OK Function succeeded.
- LE_BAD_PARAMETER Invalid parameter.
- Note
- For PSK credentials see le_wifiClient_SetPassphrase() or le_wifiClient_SetPreSharedKey() .
- For WPA-Enterprise credentials see le_wifiClient_SetUserCredentials()
- Parameters
-
[in] accessPointRef WiFi Access Point reference.
◆ le_wifiClient_ConnectService()
void le_wifiClient_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_wifiClient_Create()
le_wifiClient_AccessPointRef_t le_wifiClient_Create | ( | const uint8_t * | SsidPtr, |
size_t | SsidSize | ||
) |
This function creates a reference to an Access Point given its SSID. If an Access Point is hidden, it will not show up in the scan. So, its SSID must be known in advance in order to create a reference.
- Returns
- AccessPoint reference to the current Access Point.
- Note
- This function fails if called while scan is running.
- Parameters
-
[in] SsidPtr The SSID as a octet array. [in] SsidSize
◆ le_wifiClient_Delete()
le_result_t le_wifiClient_Delete | ( | le_wifiClient_AccessPointRef_t | accessPointRef | ) |
Deletes an accessPointRef.
- Returns
- LE_OK Function succeeded.
- LE_BAD_PARAMETER Invalid parameter.
- LE_BUSY Function called during scan.
- Note
- The handle becomes invalid after it has been deleted.
- Parameters
-
[in] accessPointRef WiFi Access Point reference.
◆ le_wifiClient_Disconnect()
le_result_t le_wifiClient_Disconnect | ( | void | ) |
Disconnect from the current connected WiFi Access Point.
- Returns
- LE_OK Function succeeded.
- LE_FAULT Function failed.
◆ le_wifiClient_DisconnectService()
void le_wifiClient_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_wifiClient_GetBssid()
le_result_t le_wifiClient_GetBssid | ( | le_wifiClient_AccessPointRef_t | accessPointRef, |
char * | bssid, | ||
size_t | bssidSize | ||
) |
Get the Basic Service set identifier (BSSID) of the AccessPoint
- Returns
- LE_OK Function succeeded. LE_FAULT Function failed. LE_BAD_PARAMETER Invalid parameter. LE_OVERFLOW bssid buffer is too small to contain the BSSID.
- Parameters
-
[in] accessPointRef WiFi Access Point reference. [out] bssid The BSSID [in] bssidSize
◆ le_wifiClient_GetCurrentConnection()
void le_wifiClient_GetCurrentConnection | ( | le_wifiClient_AccessPointRef_t * | apRefPtr | ) |
Get the currently selected connection to be established
- Returns
- LE_OK upon successful retrieval of the selected SSID to be connected
- LE_FAULT upon failure to retrieve it
- Parameters
-
[out] apRefPtr currently selected connection's AP reference
◆ le_wifiClient_GetCurrentSignalStrength()
le_result_t le_wifiClient_GetCurrentSignalStrength | ( | int16_t * | signalStrengthPtr | ) |
Get the signal strength from the Access Point which is currently connecting. signalStrength in dBm. Example -30 = -30dBm. If no signal is available, signalStrength will return LE_WIFICLIENT_NO_SIGNAL_STRENGTH.
- Returns
- LE_OK The function succeeded.
- LE_FAULT The function failed.
- Note
- The function returns the signal strength as reported at the time of the scan.
- Parameters
-
[out] signalStrengthPtr WiFi signal strength.
◆ le_wifiClient_GetFirstAccessPoint()
le_wifiClient_AccessPointRef_t le_wifiClient_GetFirstAccessPoint | ( | void | ) |
Get the first WiFi Access Point found.
- Returns
- WiFi Access Point reference if ok.
- NULL If no Access Point reference available.
◆ le_wifiClient_GetNextAccessPoint()
le_wifiClient_AccessPointRef_t le_wifiClient_GetNextAccessPoint | ( | void | ) |
Get the next WiFi Access Point. Will return the Access Points in the order of found. This function must be called in the same context as the GetFirstAccessPoint
- Returns
- WiFi Access Point reference if ok.
- NULL If no Access Point reference available.
◆ le_wifiClient_GetRxData()
le_result_t le_wifiClient_GetRxData | ( | uint64_t * | rxDataPtr | ) |
Get the RX data from the Access Point, RX data is in bytes. Example 1024 = 1024 bytes
- Returns
- LE_OK The function succeeded.
- LE_FAULT The function failed.
- Note
- The function returns the RX data following by "iw wlan0 link" command.
- Parameters
-
[out] rxDataPtr WiFi bytes of data received.
◆ le_wifiClient_GetSignalStrength()
int16_t le_wifiClient_GetSignalStrength | ( | le_wifiClient_AccessPointRef_t | accessPointRef | ) |
Get the signal strength of the AccessPoint
- Returns
- Signal strength in dBm. Example -30 = -30dBm
- If no signal available it will return LE_WIFICLIENT_NO_SIGNAL_STRENGTH
- Note
- The function returns the signal strength as reported at the time of the scan.
- Parameters
-
[in] accessPointRef WiFi Access Point reference.
◆ le_wifiClient_GetSsid()
le_result_t le_wifiClient_GetSsid | ( | le_wifiClient_AccessPointRef_t | accessPointRef, |
uint8_t * | ssidPtr, | ||
size_t * | ssidSizePtr | ||
) |
Get the Service set identification (SSID) of the AccessPoint
- Returns
- LE_OK Function succeeded. LE_FAULT Function failed. LE_BAD_PARAMETER Invalid parameter. LE_OVERFLOW ssid buffer is too small to contain the SSID.
- Note
- The SSID does not have to be human readable ASCII values, but often is.
- Parameters
-
[in] accessPointRef WiFi Access Point reference. [out] ssidPtr The SSID returned as a octet array. [in,out] ssidSizePtr
◆ le_wifiClient_GetTxData()
le_result_t le_wifiClient_GetTxData | ( | uint64_t * | txDataPtr | ) |
Get the TX data from the Access Point, TX data is in bytes. Example 1024 = 1024 bytes
- Returns
- LE_OK The function succeeded.
- LE_FAULT The function failed.
- Note
- The function returns the TX data following by "iw wlan0 link" command.
- Parameters
-
[out] txDataPtr WiFi bytes of data transmitted.
◆ le_wifiClient_LoadSsid()
le_result_t le_wifiClient_LoadSsid | ( | const uint8_t * | ssidPtr, |
size_t | ssidSize, | ||
le_wifiClient_AccessPointRef_t * | apRefPtr | ||
) |
Load the given SSID's configurations as it is selected as the connection to be established, after creating for it an AP reference
- Returns
- LE_OK Function succeeded.
- LE_FAULT Function failed.
- LE_BAD_PARAMETER Invalid parameter.
- Parameters
-
[in] ssidPtr SSID which configs are to be installed [in] ssidSize [out] apRefPtr reference to be created
◆ le_wifiClient_RemoveConnectionEventHandler()
void le_wifiClient_RemoveConnectionEventHandler | ( | le_wifiClient_ConnectionEventHandlerRef_t | handlerRef | ) |
Remove handler function for EVENT 'le_wifiClient_ConnectionEvent'
- Parameters
-
[in] handlerRef
◆ le_wifiClient_RemoveNewEventHandler()
void le_wifiClient_RemoveNewEventHandler | ( | le_wifiClient_NewEventHandlerRef_t | handlerRef | ) |
Remove handler function for EVENT 'le_wifiClient_NewEvent'
- Parameters
-
[in] handlerRef
◆ le_wifiClient_RemoveSsidSecurityConfigs()
le_result_t le_wifiClient_RemoveSsidSecurityConfigs | ( | const uint8_t * | ssidPtr, |
size_t | ssidSize | ||
) |
Remove and clear Wifi's security configurations to use with the given SSID from the config tree and secured store. This includes the security protocol and all the username, password, passphrase, pre-shared key, key, etc., previously configured via le_wifiClient_Configure APIs for WEP, PSK and EAP.
- Returns
- LE_OK upon success to deconfigure the given SSID's configured user credentials; LE_FAULT otherwise
- Parameters
-
[in] ssidPtr SSID which user credentials to be deconfigured [in] ssidSize
◆ le_wifiClient_Scan()
le_result_t le_wifiClient_Scan | ( | void | ) |
Start Scanning for WiFi Access points Will result in event LE_WIFICLIENT_EVENT_SCAN_DONE when the scan results are available.
- Returns
- LE_OK Function succeeded.
- LE_FAULT Function failed.
- LE_BUSY Scan already running.
◆ le_wifiClient_SetHiddenNetworkAttribute()
le_result_t le_wifiClient_SetHiddenNetworkAttribute | ( | le_wifiClient_AccessPointRef_t | accessPointRef, |
bool | hidden | ||
) |
This function specifies whether the target Access Point is hiding its presence from clients or not. When an Access Point is hidden, it cannot be discovered by a scan process.
- Returns
- LE_OK Function succeeded.
- LE_BAD_PARAMETER Invalid parameter.
- Note
- By default, this attribute is not set which means that the client is unable to connect to a hidden access point. When enabled, the client will be able to connect to the access point whether it is hidden or not.
- Parameters
-
[in] accessPointRef WiFi Access Point reference. [in] hidden If TRUE, the WIFI client will be able to connect to a hidden access point.
◆ le_wifiClient_SetPassphrase()
le_result_t le_wifiClient_SetPassphrase | ( | le_wifiClient_AccessPointRef_t | accessPointRef, |
const char *LE_NONNULL | PassPhrase | ||
) |
Set the passphrase used to generate the PSK.
- Returns
- LE_OK Function succeeded.
- LE_FAULT Function failed.
- LE_BAD_PARAMETER Invalid parameter.
- Note
- The difference between le_wifiClient_SetPreSharedKey() and this function
- Parameters
-
[in] accessPointRef WiFi Access Point reference. [in] PassPhrase pass-phrase for PSK
◆ le_wifiClient_SetPreSharedKey()
le_result_t le_wifiClient_SetPreSharedKey | ( | le_wifiClient_AccessPointRef_t | accessPointRef, |
const char *LE_NONNULL | PreSharedKey | ||
) |
Set the Pre Shared Key, PSK.
- Returns
- LE_OK Function succeeded.
- LE_FAULT Function failed.
- LE_BAD_PARAMETER Invalid parameter.
- Note
- This is one way to authenticate against the access point. The other one is provided by the le_wifiClient_SetPassPhrase() function. Both ways are exclusive and are effective only when used with WPA-personal authentication.
- Parameters
-
[in] accessPointRef WiFi Access Point reference. [in] PreSharedKey PSK. Note the difference between PSK and Pass Phrase.
◆ le_wifiClient_SetSecurityProtocol()
le_result_t le_wifiClient_SetSecurityProtocol | ( | le_wifiClient_AccessPointRef_t | accessPointRef, |
le_wifiClient_SecurityProtocol_t | securityProtocol | ||
) |
Set the security protocol for connection
- Returns
- LE_OK Function succeeded.
- LE_FAULT Function failed.
- LE_BAD_PARAMETER Invalid parameter.
- Parameters
-
[in] accessPointRef WiFi Access Point reference. [in] securityProtocol Security Mode
◆ le_wifiClient_SetServerDisconnectHandler()
LE_FULL_API void le_wifiClient_SetServerDisconnectHandler | ( | le_wifiClient_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_wifiClient_SetUserCredentials()
le_result_t le_wifiClient_SetUserCredentials | ( | le_wifiClient_AccessPointRef_t | accessPointRef, |
const char *LE_NONNULL | userName, | ||
const char *LE_NONNULL | password | ||
) |
WPA-Enterprise requires a username and password to authenticate. This function sets these parameters.
- Returns
- LE_OK Function succeeded.
- LE_FAULT Function failed.
- LE_BAD_PARAMETER Invalid parameter.
- Parameters
-
[in] accessPointRef WiFi Access Point reference. [in] userName UserName used for WPA-Enterprise. [in] password Password used for WPA-Enterprise.
◆ le_wifiClient_SetWepKey()
le_result_t le_wifiClient_SetWepKey | ( | le_wifiClient_AccessPointRef_t | accessPointRef, |
const char *LE_NONNULL | wepKey | ||
) |
Set the WEP key (WEP)
- Returns
- LE_OK Function succeeded.
- LE_FAULT Function failed.
- Parameters
-
[in] accessPointRef WiFi Access Point reference. [in] wepKey The WEP key
◆ le_wifiClient_Start()
le_result_t le_wifiClient_Start | ( | void | ) |
Start the WIFI device.
- Returns
- LE_OK Function succeeded.
- LE_FAULT Function failed.
- LE_BUSY The WIFI device is already started.
◆ le_wifiClient_Stop()
le_result_t le_wifiClient_Stop | ( | void | ) |
Stop the WIFI device.
- Returns
- LE_OK Function succeeded.
- LE_FAULT Function failed.
- LE_DUPLICATE The WIFI device is already stopped.
◆ le_wifiClient_TryConnectService()
le_result_t le_wifiClient_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.