le_wifiClient_interface.h File Reference

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

Go to the source code of this file.

Typedefs

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_DisconnectService (void)
 
le_wifiClient_NewEventHandlerRef_t le_wifiClient_AddNewEventHandler (le_wifiClient_NewEventHandlerFunc_t handlerPtr, void *contextPtr)
 
void le_wifiClient_RemoveNewEventHandler (le_wifiClient_NewEventHandlerRef_t addHandlerRef)
 
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_GetSsid (le_wifiClient_AccessPointRef_t accessPointRef, uint8_t *SsidPtr, size_t *SsidNumElementsPtr)
 
le_result_t le_wifiClient_SetPassphrase (le_wifiClient_AccessPointRef_t accessPointRef, const char *PassPhrase)
 
le_result_t le_wifiClient_SetPreSharedKey (le_wifiClient_AccessPointRef_t accessPointRef, const char *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 *userName, const char *password)
 
le_result_t le_wifiClient_SetWepKey (le_wifiClient_AccessPointRef_t accessPointRef, const char *wepKey)
 
le_wifiClient_AccessPointRef_t le_wifiClient_Create (const uint8_t *SsidPtr, size_t SsidNumElements)
 
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 c_le_wifiClient 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_NewEventHandlerFunc_t) (le_wifiClient_Event_t event, void *contextPtr)

Handler for WiFi Client changes

Parameters
eventHandles the wifi events
contextPtr
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  SsidNumElements 
)

If an AccessPoint is not announcing it's precense, it will not show up in the scan. But if the SSID is known, a connnection can be tried using this create function. First create the AccessPoint, then le_wifiClient_Connect() to connect to it. Will fail if called while scan is running.

Returns
AccessPoint reference to the current
Parameters
[in]SsidPtrThe SSID as a octet array.
[in]SsidNumElements
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_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 *  SsidNumElementsPtr 
)

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]SsidNumElementsPtr
void le_wifiClient_RemoveNewEventHandler ( le_wifiClient_NewEventHandlerRef_t  addHandlerRef)

Remove handler function for EVENT 'le_wifiClient_NewEvent'

Parameters
[in]addHandlerRef
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_SetPassphrase ( le_wifiClient_AccessPointRef_t  accessPointRef,
const char *  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 *  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
le_result_t le_wifiClient_SetUserCredentials ( le_wifiClient_AccessPointRef_t  accessPointRef,
const char *  userName,
const char *  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 *  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.