le_wifiClient_interface.h File Reference

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

Go to the source code of this file.

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

Typedef Documentation

typedef struct le_wifiClient_AccessPoint* le_wifiClient_AccessPointRef_t

Reference type for AccessPoint that is returned by the WiFi Scan.

typedef void(* le_wifiClient_DisconnectHandler_t) (void *)

Type for handler called when a server disconnects.

typedef void(* le_wifiClient_NewEventHandlerFunc_t) (le_wifiClient_Event_t event,void *contextPtr)

Handler for WiFi Client changes

typedef struct le_wifiClient_NewEventHandler* le_wifiClient_NewEventHandlerRef_t

Reference type used by Add/Remove functions for EVENT 'le_wifiClient_NewEvent'

Enumeration Type Documentation

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.

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_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_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_BAD_PARAMETER if parameter is invalid.
  • LE_OK if the function succeeded.
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.
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_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.

Note
This function fails if called while scan is running.
Returns
AccessPoint reference to the current
Parameters
[in]SsidPtrThe SSID as a octet array.
[in]SsidSize
le_result_t le_wifiClient_Delete ( le_wifiClient_AccessPointRef_t  accessPointRef)

Deletes an accessPointRef.

Note
The handle becomes invalid after it has been deleted.
Returns
  • LE_BAD_PARAMETER if accessPointRef was not found.
  • LE_BUSY if the function was called during a scan.
  • LE_OK if the function succeeded.
Parameters
[in]accessPointRefWiFi Access Point reference.
le_result_t le_wifiClient_Disconnect ( void  )

Disconnect from the current connected WiFi Access Point.

Returns
  • LE_FAULT if the function failed.
  • LE_OK if the function succeeded.
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_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_FAULT if the function failed.
  • LE_BAD_PARAMETER if some parameter is invalid.
  • LE_OK if the function succeeded.
Parameters
[in]accessPointRefWiFi Access Point reference.
[out]bssidThe BSSID
[in]bssidSize
le_wifiClient_AccessPointRef_t le_wifiClient_GetFirstAccessPoint ( void  )

Get the first WiFi Access Point found. Will return the Access Points in the order of found.

Returns
  • WiFi Access Point reference if ok.
  • NULL if no Access Point reference available.
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.
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 OxFFFF
Parameters
[in]accessPointRefWiFi Access Point reference.
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

Note
that the SSID does not have to be human readable ASCII values, but often has.
Returns
  • LE_FAULT if the function failed.
  • LE_BAD_PARAMETER if some parameter is invalid.
  • LE_OK if the function succeeded.
Parameters
[in]accessPointRefWiFi Access Point reference.
[out]ssidPtrThe SSID returned as a octet array.
[in,out]ssidSizePtr
void le_wifiClient_RemoveNewEventHandler ( le_wifiClient_NewEventHandlerRef_t  handlerRef)

Remove handler function for EVENT 'le_wifiClient_NewEvent'

Parameters
[in]handlerRef
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_FAULT if the function failed.
  • LE_OK if the function succeeded.
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.

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.
Returns
  • LE_BAD_PARAMETER if parameter is invalid.
  • LE_OK if the function succeeded.
Parameters
[in]accessPointRefWiFi Access Point reference.
[in]hiddenIf TRUE, the WIFI client will be able to connect to a hidden access point.
le_result_t le_wifiClient_SetPassphrase ( le_wifiClient_AccessPointRef_t  accessPointRef,
const char *LE_NONNULL  PassPhrase 
)

Set the passphrase used to generate the PSK.

Note
the difference between le_wifiClient_SetPreSharedKey() and this function
Returns
  • LE_FAULT if the function failed.
  • LE_BAD_PARAMETER if parameter is invalid.
  • LE_OK if the function succeeded.
Parameters
[in]accessPointRefWiFi Access Point reference.
[in]PassPhrasepass-phrase for PSK
le_result_t le_wifiClient_SetPreSharedKey ( le_wifiClient_AccessPointRef_t  accessPointRef,
const char *LE_NONNULL  PreSharedKey 
)

Set the Pre Shared Key, PSK.

Note
the difference between le_wifiClient_SetPassphrase() and this function
Returns
  • LE_FAULT if the function failed.
  • LE_BAD_PARAMETER if parameter is invalid.
  • LE_OK if the function succeeded.
Parameters
[in]accessPointRefWiFi Access Point reference.
[in]PreSharedKeyPSK. Note the difference between PSK and Pass Phrase.
le_result_t le_wifiClient_SetSecurityProtocol ( le_wifiClient_AccessPointRef_t  accessPointRef,
le_wifiClient_SecurityProtocol_t  securityProtocol 
)

Set the security protocol for connection

Returns
  • LE_FAULT if the function failed.
  • LE_BAD_PARAMETER if parameter is invalid.
  • LE_OK if the function succeeded.
Parameters
[in]accessPointRefWiFi Access Point reference.
[in]securityProtocolSecurity Mode
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_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_FAULT if the function failed.
  • LE_BAD_PARAMETER if parameter is invalid.
  • LE_OK if the function succeeded.
Parameters
[in]accessPointRefWiFi Access Point reference.
[in]userNameUserName used for WPA-Enterprise.
[in]passwordPassword used for WPA-Enterprise.
le_result_t le_wifiClient_SetWepKey ( le_wifiClient_AccessPointRef_t  accessPointRef,
const char *LE_NONNULL  wepKey 
)

Set the WEP key (WEP)

Returns
  • LE_FAULT if the function failed.
  • LE_OK if the function succeeded.
Parameters
[in]accessPointRefWiFi Access Point reference.
[in]wepKeyThe WEP key
le_result_t le_wifiClient_Start ( void  )

This function starts the WIFI device.

Returns
  • LE_FAULT if the function failed.
  • LE_BUSY if the WIFI device is already started.
  • LE_OK if the function succeeded.
le_result_t le_wifiClient_Stop ( void  )

This function stops the WIFI device.

Returns
  • LE_FAULT if the function failed.
  • LE_DUPLICATE if the WIFI device is already stopped.
  • LE_OK if the function succeeded.
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.