le_wifiAp_interface.h File Reference

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

Go to the source code of this file.

Typedefs

typedef void(* le_wifiAp_DisconnectHandler_t) (void *)
 
typedef struct le_wifiAp_NewEventHandler * le_wifiAp_NewEventHandlerRef_t
 
typedef void(* le_wifiAp_EventHandlerFunc_t) (le_wifiAp_Event_t event, void *contextPtr)
 

Enumerations

enum  le_wifiAp_Event_t { LE_WIFIAP_EVENT_CLIENT_CONNECTED = 0, LE_WIFIAP_EVENT_CLIENT_DISCONNECTED = 1 }
 
enum  le_wifiAp_SecurityProtocol_t { LE_WIFIAP_SECURITY_NONE = 0, LE_WIFIAP_SECURITY_WPA2 = 1 }
 

Functions

void le_wifiAp_ConnectService (void)
 
le_result_t le_wifiAp_TryConnectService (void)
 
void le_wifiAp_SetServerDisconnectHandler (le_wifiAp_DisconnectHandler_t disconnectHandler, void *contextPtr)
 
void le_wifiAp_DisconnectService (void)
 
le_wifiAp_NewEventHandlerRef_t le_wifiAp_AddNewEventHandler (le_wifiAp_EventHandlerFunc_t handlerPtr, void *contextPtr)
 
void le_wifiAp_RemoveNewEventHandler (le_wifiAp_NewEventHandlerRef_t handlerRef)
 
le_result_t le_wifiAp_Start (void)
 
le_result_t le_wifiAp_Stop (void)
 
le_result_t le_wifiAp_SetSsid (const uint8_t *ssidPtr, size_t ssidSize)
 
le_result_t le_wifiAp_SetSecurityProtocol (le_wifiAp_SecurityProtocol_t securityProtocol)
 
le_result_t le_wifiAp_SetPassPhrase (const char *LE_NONNULL passPhrase)
 
le_result_t le_wifiAp_SetPreSharedKey (const char *LE_NONNULL preSharedKey)
 
le_result_t le_wifiAp_SetDiscoverable (bool discoverable)
 
le_result_t le_wifiAp_SetChannel (int8_t channelNumber)
 
le_result_t le_wifiAp_SetMaxNumberOfClients (int8_t maxNumberOfClient)
 
le_result_t le_wifiAp_SetIpRange (const char *LE_NONNULL ipAp, const char *LE_NONNULL ipStart, const char *LE_NONNULL ipStop)
 

Detailed Description

Legato c_le_wifiAp include file.

Typedef Documentation

typedef void(* le_wifiAp_DisconnectHandler_t) (void *)

Type for handler called when a server disconnects.

typedef void(* le_wifiAp_EventHandlerFunc_t) (le_wifiAp_Event_t event,void *contextPtr)

Handler for WiFi Access Point changes

typedef struct le_wifiAp_NewEventHandler* le_wifiAp_NewEventHandlerRef_t

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

Enumeration Type Documentation

WiFi Access Point Events.

Enumerator
LE_WIFIAP_EVENT_CLIENT_CONNECTED 

Client connected to WiFi Access Point.

LE_WIFIAP_EVENT_CLIENT_DISCONNECTED 

Client disconnected from WiFi Access Point.

WiFi Access Point Security levels.

Enumerator
LE_WIFIAP_SECURITY_NONE 

WiFi Access Point is open and has no password.

LE_WIFIAP_SECURITY_WPA2 

WiFi Access Point has WPA2 activated.

Function Documentation

le_wifiAp_NewEventHandlerRef_t le_wifiAp_AddNewEventHandler ( le_wifiAp_EventHandlerFunc_t  handlerPtr,
void *  contextPtr 
)

Add handler function for EVENT 'le_wifiAp_NewEvent'

These events provide information on WiFi Access Point

Parameters
[in]handlerPtr
[in]contextPtr
void le_wifiAp_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.

void le_wifiAp_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.

void le_wifiAp_RemoveNewEventHandler ( le_wifiAp_NewEventHandlerRef_t  handlerRef)

Remove handler function for EVENT 'le_wifiAp_NewEvent'

Parameters
[in]handlerRef
le_result_t le_wifiAp_SetChannel ( int8_t  channelNumber)

Set which WiFi Channel to use. Default value is 1. Some legal restrictions for values 12 - 14 might apply for your region.

Returns
  • LE_OUT_OF_RANGE if requested channel number is out of range.
  • LE_OK if the function succeeded.
Parameters
[in]channelNumberthe channel number must be between 1 and 14.
le_result_t le_wifiAp_SetDiscoverable ( bool  discoverable)

Set if the Access Point should announce its presence. Default value is TRUE. If the value is set to FALSE, the Access Point will be hidden.

Returns
LE_OK if the function succeeded.
Parameters
[in]discoverableIf TRUE the Access Point shows up on scans, else it is hidden.
le_result_t le_wifiAp_SetIpRange ( const char *LE_NONNULL  ipAp,
const char *LE_NONNULL  ipStart,
const char *LE_NONNULL  ipStop 
)

Defines the IP adresses range for the host AP.

Returns
  • LE_BAD_PARAMETER if at least one of the given IP addresses is invalid.
  • LE_FAULT if a system call failed.
  • LE_OK if the function succeeded.
Parameters
[in]ipApthe IP address of the Access Point.
[in]ipStartthe start IP address of the Access Point.
[in]ipStopthe stop IP address of the Access Point.
le_result_t le_wifiAp_SetMaxNumberOfClients ( int8_t  maxNumberOfClient)

Set number of maximally allowed clients to connect to the Access Point at the same time.

Returns
  • LE_OUT_OF_RANGE if requested number of users exceeds the capabilities of the Access Point.
  • LE_OK if the function succeeded.
Parameters
[in]maxNumberOfClientthe maximum number of clients
le_result_t le_wifiAp_SetPassPhrase ( const char *LE_NONNULL  passPhrase)

Set the passphrase used to generate the PSK.

Note
If the PSK is to be set directly, please use le_wifiAp_SetPreSharedKey()
Returns
  • LE_BAD_PARAMETER if parameter is invalid.
  • LE_OK if the function succeeded.
Parameters
[in]passPhrasepass-phrase for PSK
le_result_t le_wifiAp_SetPreSharedKey ( const char *LE_NONNULL  preSharedKey)

Set the Pre Shared Key, PSK. There is no default value, since le_wifiAp_SetPassPhrase is used as default.

Note
the difference between le_wifiAp_SetPassPhrase() and this function
Returns
  • LE_BAD_PARAMETER if parameter is invalid.
  • LE_OK if the function succeeded.
Parameters
[in]preSharedKeyPSK. Note the difference between PSK and Pass Phrase.
le_result_t le_wifiAp_SetSecurityProtocol ( le_wifiAp_SecurityProtocol_t  securityProtocol)

Set the Security protocol to use. Default value is SECURITY_WPA2.

Note
that the SSID does not have to be human readable ASCII values, but often has.
Returns
  • LE_BAD_PARAMETER if some parameter is invalid.
  • LE_OK if the function succeeded.
Parameters
[in]securityProtocolThe security protocol to use.
void le_wifiAp_SetServerDisconnectHandler ( le_wifiAp_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_wifiAp_SetSsid ( const uint8_t *  ssidPtr,
size_t  ssidSize 
)

Set the Service set identification (SSID) of the AccessPoint Default value is "LEGATO Access Point"

Note
that the SSID does not have to be human readable ASCII values, but often has.
Returns
  • LE_BAD_PARAMETER if some parameter is invalid.
  • LE_OK if the function succeeded.
Parameters
[in]ssidPtrThe SSID to set as a octet array.
[in]ssidSize
le_result_t le_wifiAp_Start ( void  )

This function starts the WIFI Access Point.

Note
that all settings, if to be used, such as security, username, password must set prior to starting the Access Point.
Returns
  • LE_FAULT if the function failed.
  • LE_OK if the function succeeded.
le_result_t le_wifiAp_Stop ( void  )

This function stops the WIFI Access Point.

Returns
  • LE_FAULT if the function failed.
  • LE_OK if the function succeeded.
le_result_t le_wifiAp_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.