le_wifiClient_interface.h File Reference

#include "legato.h"
#include "le_wifiDefs_interface.h"
#include "le_wifiClient_common.h"

Go to the source code of this file.

Typedefs

typedef void(* le_wifiClient_DisconnectHandler_t) (void *)
 

Functions

void le_wifiClient_ConnectService (void)
 
le_result_t le_wifiClient_TryConnectService (void)
 
LE_FULL_API void le_wifiClient_SetServerDisconnectHandler (le_wifiClient_DisconnectHandler_t disconnectHandler, void *contextPtr)
 
void le_wifiClient_DisconnectService (void)
 
le_wifiClient_NewEventHandlerRef_t le_wifiClient_AddNewEventHandler (le_wifiClient_NewEventHandlerFunc_t handlerPtr, void *contextPtr)
 
void le_wifiClient_RemoveNewEventHandler (le_wifiClient_NewEventHandlerRef_t handlerRef)
 
le_wifiClient_ConnectionEventHandlerRef_t le_wifiClient_AddConnectionEventHandler (le_wifiClient_ConnectionEventHandlerFunc_t handlerPtr, void *contextPtr)
 
void le_wifiClient_RemoveConnectionEventHandler (le_wifiClient_ConnectionEventHandlerRef_t handlerRef)
 
le_result_t le_wifiClient_Start (void)
 
le_result_t le_wifiClient_Stop (void)
 
le_result_t le_wifiClient_Scan (void)
 
le_wifiClient_AccessPointRef_t le_wifiClient_GetFirstAccessPoint (void)
 
le_wifiClient_AccessPointRef_t le_wifiClient_GetNextAccessPoint (void)
 
int16_t le_wifiClient_GetSignalStrength (le_wifiClient_AccessPointRef_t accessPointRef)
 
le_result_t le_wifiClient_GetBssid (le_wifiClient_AccessPointRef_t accessPointRef, char *bssid, size_t bssidSize)
 
le_result_t le_wifiClient_GetSsid (le_wifiClient_AccessPointRef_t accessPointRef, uint8_t *ssidPtr, size_t *ssidSizePtr)
 
void le_wifiClient_GetCurrentConnection (le_wifiClient_AccessPointRef_t *apRefPtr)
 
le_result_t le_wifiClient_SetPassphrase (le_wifiClient_AccessPointRef_t accessPointRef, const char *LE_NONNULL PassPhrase)
 
le_result_t le_wifiClient_SetPreSharedKey (le_wifiClient_AccessPointRef_t accessPointRef, const char *LE_NONNULL PreSharedKey)
 
le_result_t le_wifiClient_SetSecurityProtocol (le_wifiClient_AccessPointRef_t accessPointRef, le_wifiClient_SecurityProtocol_t securityProtocol)
 
le_result_t le_wifiClient_SetUserCredentials (le_wifiClient_AccessPointRef_t accessPointRef, const char *LE_NONNULL userName, const char *LE_NONNULL password)
 
le_result_t le_wifiClient_SetWepKey (le_wifiClient_AccessPointRef_t accessPointRef, const char *LE_NONNULL wepKey)
 
le_result_t le_wifiClient_SetHiddenNetworkAttribute (le_wifiClient_AccessPointRef_t accessPointRef, bool hidden)
 
le_wifiClient_AccessPointRef_t le_wifiClient_Create (const uint8_t *SsidPtr, size_t SsidSize)
 
le_result_t le_wifiClient_Delete (le_wifiClient_AccessPointRef_t accessPointRef)
 
le_result_t le_wifiClient_Connect (le_wifiClient_AccessPointRef_t accessPointRef)
 
le_result_t le_wifiClient_Disconnect (void)
 
le_result_t le_wifiClient_LoadSsid (const uint8_t *ssidPtr, size_t ssidSize, le_wifiClient_AccessPointRef_t *apRefPtr)
 
le_result_t le_wifiClient_ConfigureWep (const uint8_t *ssidPtr, size_t ssidSize, const uint8_t *wepKeyPtr, size_t wepKeySize)
 
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)
 
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)
 
le_result_t le_wifiClient_RemoveSsidSecurityConfigs (const uint8_t *ssidPtr, size_t ssidSize)
 

Detailed Description

Legato WiFi Client Service include file.

Typedef Documentation

◆ le_wifiClient_DisconnectHandler_t

typedef void(* le_wifiClient_DisconnectHandler_t) (void *)

Type for handler called when a server disconnects.

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]ssidPtrSSID which configs are to be installed
[in]ssidSize
[in]protocolsecurity protocol WPA-EAP or WPA2-EAP
[in]usernamePtrEAP username used for this SSID
[in]usernameSize
[in]passwordPtrEAP 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]ssidPtrSSID which configs are to be installed
[in]ssidSize
[in]protocolsecurity protocol WPA-PSK or WPA2-PSK
[in]passPhrasePtrpass-phrase used for this SSID
[in]passPhraseSize
[in]pskPtrpre-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]ssidPtrSSID which configs are to be installed
[in]ssidSize
[in]wepKeyPtrWEP 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]accessPointRefWiFi 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]SsidPtrThe 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]accessPointRefWiFi 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]accessPointRefWiFi Access Point reference.
[out]bssidThe 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]apRefPtrcurrently selected connection's AP reference

◆ 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_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]accessPointRefWiFi 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]accessPointRefWiFi Access Point reference.
[out]ssidPtrThe SSID returned as a octet array.
[in,out]ssidSizePtr

◆ 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]ssidPtrSSID which configs are to be installed
[in]ssidSize
[out]apRefPtrreference 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]ssidPtrSSID 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]accessPointRefWiFi Access Point reference.
[in]hiddenIf 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]accessPointRefWiFi Access Point reference.
[in]PassPhrasepass-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]accessPointRefWiFi Access Point reference.
[in]PreSharedKeyPSK. 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]accessPointRefWiFi Access Point reference.
[in]securityProtocolSecurity 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]accessPointRefWiFi Access Point reference.
[in]userNameUserName used for WPA-Enterprise.
[in]passwordPassword 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]accessPointRefWiFi Access Point reference.
[in]wepKeyThe 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.