le_wifiClient_interface.h File Reference

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

Go to the source code of this file.

Macros

#define LE_WIFICLIENT_NO_SIGNAL_STRENGTH   32767
 

Typedefs

typedef void(* le_wifiClient_DisconnectHandler_t) (void *)
 
typedef struct le_wifiClient_AccessPoint * le_wifiClient_AccessPointRef_t
 
typedef struct le_wifiClient_NewEventHandler * le_wifiClient_NewEventHandlerRef_t
 
typedef void(* le_wifiClient_NewEventHandlerFunc_t) (le_wifiClient_Event_t event, void *contextPtr)
 

Enumerations

enum  le_wifiClient_Event_t { LE_WIFICLIENT_EVENT_CONNECTED = 0, LE_WIFICLIENT_EVENT_DISCONNECTED = 1, LE_WIFICLIENT_EVENT_SCAN_DONE = 2, LE_WIFICLIENT_EVENT_SCAN_FAILED = 3 }
 
enum  le_wifiClient_SecurityProtocol_t {
  LE_WIFICLIENT_SECURITY_NONE = 0, LE_WIFICLIENT_SECURITY_WEP = 1, LE_WIFICLIENT_SECURITY_WPA_PSK_PERSONAL = 2, LE_WIFICLIENT_SECURITY_WPA2_PSK_PERSONAL = 3,
  LE_WIFICLIENT_SECURITY_WPA_EAP_PEAP0_ENTERPRISE = 4, LE_WIFICLIENT_SECURITY_WPA2_EAP_PEAP0_ENTERPRISE = 5
}
 

Functions

void le_wifiClient_ConnectService (void)
 
le_result_t le_wifiClient_TryConnectService (void)
 
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_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)
 
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)
 

Detailed Description

Legato WiFi Client Service include file.

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_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

◆ 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_Event_t

WiFi Client Events.

Enumerator
LE_WIFICLIENT_EVENT_CONNECTED 

WiFi Client Connected.

LE_WIFICLIENT_EVENT_DISCONNECTED 

WiFi Client Disconnected.

LE_WIFICLIENT_EVENT_SCAN_DONE 

WiFi Scan result for available Access Points available.

LE_WIFICLIENT_EVENT_SCAN_FAILED 

WiFi Scan failed.

◆ le_wifiClient_SecurityProtocol_t

WiFi Client Security Protocol for connection

Enumerator
LE_WIFICLIENT_SECURITY_NONE 

no security.

LE_WIFICLIENT_SECURITY_WEP 

Using WEP.

LE_WIFICLIENT_SECURITY_WPA_PSK_PERSONAL 

Using WPA.

LE_WIFICLIENT_SECURITY_WPA2_PSK_PERSONAL 

Using WPA2.

LE_WIFICLIENT_SECURITY_WPA_EAP_PEAP0_ENTERPRISE 

Using WPA Enterprise.

LE_WIFICLIENT_SECURITY_WPA2_EAP_PEAP0_ENTERPRISE 

Using WPA2 Enterprise.

Function Documentation

◆ le_wifiClient_AddNewEventHandler()

le_wifiClient_NewEventHandlerRef_t le_wifiClient_AddNewEventHandler ( le_wifiClient_NewEventHandlerFunc_t  handlerPtr,
void *  contextPtr 
)

Add handler function for EVENT 'le_wifiClient_NewEvent'

This event provide information on WiFi Client event changes.

Parameters
[in]handlerPtr
[in]contextPtr

◆ 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_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_RemoveNewEventHandler()

void le_wifiClient_RemoveNewEventHandler ( le_wifiClient_NewEventHandlerRef_t  handlerRef)

Remove handler function for EVENT 'le_wifiClient_NewEvent'

Parameters
[in]handlerRef

◆ 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()

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_DUPLICATE 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.