FreeRTOS: Wi-Fi Management Library
Return to main page ↑
iot_wifi.h File Reference

Wi-Fi Interface. More...

#include <stdint.h>
#include "portmacro.h"
#include "aws_wifi_config.h"

Go to the source code of this file.

Data Structures

struct  WIFIWEPKey_t
 Wi-Fi WEP keys (64- and 128-bit keys only) More...
 
struct  WIFIWPAPassphrase_t
 Wi-Fi WPA/WPA2 passphrase. More...
 
struct  WIFINetworkParams_t
 Parameters passed to the WIFI_ConnectAP API for connection. More...
 
struct  WIFIScanConfig_t
 Wi-Fi scan configuration. More...
 
struct  WIFIScanResult_t
 Wi-Fi scan results. More...
 
struct  WIFIStationInfo_t
 Wi-Fi SoftAP connected station info. More...
 
struct  WIFINetworkProfile_t
 Wi-Fi network parameters passed to the WIFI_NetworkAdd API. More...
 
struct  WIFIIPAddress_t
 Wi-Fi station IP address format. More...
 
struct  WIFIIPConfiguration_t
 IP address configuration. More...
 
struct  WIFIConnectionInfo_t
 Wi-Fi info of the connected AP. More...
 
struct  WiFiEventInfoReady_t
 Wi-Fi event info for WI-FI ready. More...
 
struct  WiFiEventInfoScanDone_t
 Wi-Fi event info for scan done. More...
 
struct  WiFiEventInfoConnected_t
 Wi-Fi event info for station connected to AP. More...
 
struct  WiFiEventInfoDisconnected_t
 Wi-Fi event info for station disconnected from AP. More...
 
struct  WiFiEventInfoConnectionFailed_t
 Wi-Fi event info for station connection failure. More...
 
struct  WiFiEventInfoIPReady_t
 Wi-Fi event info for IP ready. More...
 
struct  WiFiEventInfoAPStateChanged_t
 Wi-Fi event info for AP state change. More...
 
struct  WiFiEventInfoAPStationConnected_t
 Wi-Fi event info for AP got a connected station. More...
 
struct  WiFiEventInfoAPStationDisconnected_t
 Wi-Fi event info for AP got a disconnected station. More...
 
struct  WiFiEventInfoRxDone_t
 Wi-Fi event info for receiving a frame in monitor mode (or normal mode with RX filter). More...
 
struct  WiFiEventInfoTxDone_t
 Wi-Fi event info for finishing transmitting an injection frame. More...
 
struct  WIFIEvent_t
 Wi-Fi combined event data structure. More...
 
struct  WIFIStatisticInfo_t
 Wi-Fi Statistic info. More...
 
struct  WIFICapabilityInfo_t
 Wi-Fi capabilities. More...
 

Macros

#define IPV6_LENGTH   4
 IPV6 length in 32-bit words. More...
 
#define WIFI_WPS_SUPPORTED   0x0001
 Wi-Fi lower level supported feature mask. More...
 
#define WIFI_ENTERPRISE_SUPPORTED   0x0002
 
#define WIFI_P2P_SUPPORTED   0x0004
 
#define WIFI_TDLS_SUPPORTED   0x0008
 

Typedefs

typedef void(* WIFIEventHandler_t) (WIFIEvent_t *xEvent)
 Wi-Fi event handler definition. More...
 

Enumerations

enum  WIFIReturnCode_t { eWiFiSuccess = 0, eWiFiFailure = 1, eWiFiTimeout = 2, eWiFiNotSupported = 3 }
 Return code denoting API status. More...
 
enum  WIFISecurity_t {
  eWiFiSecurityOpen = 0, eWiFiSecurityWEP, eWiFiSecurityWPA, eWiFiSecurityWPA2,
  eWiFiSecurityWPA2_ent, eWiFiSecurityWPA3, eWiFiSecurityNotSupported
}
 Wi-Fi Security types. More...
 
enum  WIFIDeviceMode_t {
  eWiFiModeStation = 0, eWiFiModeAP, eWiFiModeP2P, eWiFiModeAPStation,
  eWiFiModeNotSupported
}
 Wi-Fi device modes. More...
 
enum  WIFIPMMode_t { eWiFiPMNormal = 0, eWiFiPMLowPower, eWiFiPMAlwaysOn, eWiFiPMNotSupported }
 Wi-Fi device power management modes. More...
 
enum  WIFIIPAddressType_t { eWiFiIPAddressTypeV4, eWiFiIPAddressTypeV6, eWiFiIPAddressTypeNotSupported }
 Wi-Fi station IP address type.
 
enum  WIFIReason_t {
  eWiFiReasonUnspecified, eWiFiReasonAPNotFound, eWiFiReasonAuthExpired, eWiFiReasonAuthLeaveBSS,
  eWiFiReasonAuthFailed, eWiFiReasonAssocExpired, eWiFiReasonAssocTooMany, eWiFiReasonAssocPowerCapBad,
  eWiFiReasonAssocSupChanBad, eWiFiReasonAssocFailed, eWiFiReasonIEInvalid, eWiFiReasonMICFailure,
  eWiFiReason4WayTimeout, eWiFiReason4WayIEDiffer, eWiFiReason4WayFailed, eWiFiReasonAKMPInvalid,
  eWiFiReasonPairwiseCipherInvalid, eWiFiReasonGroupCipherInvalid, eWiFiReasonRSNVersionInvalid, eWiFiReasonRSNCapInvalid,
  eWiFiReasonGroupKeyUpdateTimeout, eWiFiReasonCipherSuiteRejected, eWiFiReason8021XAuthFailed, eWiFiReasonBeaconTimeout,
  eWiFiReasonLinkFailed, eWiFiReasonDHCPExpired, eWiFiReasonDHCPFailed, eWiFiReasonMax
}
 Wi-Fi protocol reason codes. More...
 
enum  WIFIEventType_t {
  eWiFiEventReady, eWiFiEventScanDone, eWiFiEventConnected, eWiFiEventDisconnected,
  eWiFiEventConnectionFailed, eWiFiEventIPReady, eWiFiEventAPStateChanged, eWiFiEventAPStationConnected,
  eWiFiEventAPStationDisconnected, eWiFiEventWPSSuccess, eWiFiEventWPSFailed, eWiFiEventWPSTimeout,
  eWiFiEventMax
}
 Wi-Fi event types. More...
 
enum  WIFIBand_t { eWiFiBand2G = 0, eWiFiBand5G, eWiFiBandDual, eWiFiBandMax }
 Wi-Fi band. More...
 
enum  WIFIPhyMode_t {
  eWiFiPhy11b = 0, eWiFiPhy11g, eWiFiPhy11n, eWiFiPhy11ac,
  eWiFiPhy11ax, eWiFiPhyMax
}
 Wi-Fi PHY mode. More...
 
enum  WIFIBandwidth_t {
  eWiFiBW20 = 0, eWiFiBW40, eWiFiBW80, eWiFiBW160,
  eWiFiBWMax
}
 Wi-Fi bandwidth. More...
 

Functions

WIFIReturnCode_t WIFI_On (void)
 Turns on Wi-Fi. More...
 
WIFIReturnCode_t WIFI_Off (void)
 Turns off Wi-Fi. More...
 
WIFIReturnCode_t WIFI_ConnectAP (const WIFINetworkParams_t *const pxNetworkParams)
 Connects to the Wi-Fi Access Point (AP) specified in the input. More...
 
WIFIReturnCode_t WIFI_Disconnect (void)
 Disconnects from the currently connected Access Point. More...
 
WIFIReturnCode_t WIFI_Reset (void)
 Resets the Wi-Fi Module. More...
 
WIFIReturnCode_t WIFI_SetMode (WIFIDeviceMode_t xDeviceMode)
 Sets the Wi-Fi mode. More...
 
WIFIReturnCode_t WIFI_GetMode (WIFIDeviceMode_t *pxDeviceMode)
 Gets the Wi-Fi mode. More...
 
WIFIReturnCode_t WIFI_NetworkAdd (const WIFINetworkProfile_t *const pxNetworkProfile, uint16_t *pusIndex)
 Add a Wi-Fi Network profile. More...
 
WIFIReturnCode_t WIFI_NetworkGet (WIFINetworkProfile_t *pxNetworkProfile, uint16_t usIndex)
 Get a Wi-Fi network profile. More...
 
WIFIReturnCode_t WIFI_NetworkDelete (uint16_t usIndex)
 Delete a Wi-Fi Network profile. More...
 
WIFIReturnCode_t WIFI_Ping (uint8_t *pucIPAddr, uint16_t usCount, uint32_t ulIntervalMS)
 Ping an IP address in the network. More...
 
WIFIReturnCode_t WIFI_GetMAC (uint8_t *pucMac)
 Retrieves the Wi-Fi interface's MAC address. More...
 
WIFIReturnCode_t WIFI_GetHostIP (char *pcHost, uint8_t *pucIPAddr)
 Retrieves the host IP address from a host name using DNS. More...
 
WIFIReturnCode_t WIFI_Scan (WIFIScanResult_t *pxBuffer, uint8_t ucNumNetworks)
 Perform a Wi-Fi network Scan. More...
 
WIFIReturnCode_t WIFI_StartAP (void)
 Start SoftAP mode. More...
 
WIFIReturnCode_t WIFI_StopAP (void)
 Stop SoftAP mode. More...
 
WIFIReturnCode_t WIFI_ConfigureAP (const WIFINetworkParams_t *const pxNetworkParams)
 Configure SoftAP. More...
 
WIFIReturnCode_t WIFI_SetPMMode (WIFIPMMode_t xPMModeType, const void *pvOptionValue)
 Set the Wi-Fi power management mode. More...
 
WIFIReturnCode_t WIFI_GetPMMode (WIFIPMMode_t *pxPMModeType, void *pvOptionValue)
 Get the Wi-Fi power management mode. More...
 
WIFIReturnCode_t WIFI_RegisterEvent (WIFIEventType_t xEventType, WIFIEventHandler_t xHandler)
 Register a Wi-Fi event Handler. More...
 
BaseType_t WIFI_IsConnected (const WIFINetworkParams_t *pxNetworkParams)
 Check if the Wi-Fi is connected and the AP configuration matches the query. More...
 
WIFIReturnCode_t WIFI_StartScan (WIFIScanConfig_t *pxScanConfig)
 Start a Wi-Fi scan. More...
 
WIFIReturnCode_t WIFI_GetScanResults (const WIFIScanResult_t **pxBuffer, uint16_t *ucNumNetworks)
 Get Wi-Fi scan results. It should be called only after scan is completed. Scan results are sorted in decreasing rssi order. More...
 
WIFIReturnCode_t WIFI_StartConnectAP (const WIFINetworkParams_t *pxNetworkParams)
 Connect to the Wi-Fi Access Point (AP) specified in the input. More...
 
WIFIReturnCode_t WIFI_StartDisconnect (void)
 Wi-Fi station disconnects from AP. More...
 
WIFIReturnCode_t WIFI_GetConnectionInfo (WIFIConnectionInfo_t *pxConnectionInfo)
 Get Wi-Fi info of the connected AP. More...
 
WIFIReturnCode_t WIFI_GetIPInfo (WIFIIPConfiguration_t *pxIPInfo)
 Get IP configuration (IP address, NetworkMask, Gateway and DNS server addresses). More...
 
WIFIReturnCode_t WIFI_GetRSSI (int8_t *pcRSSI)
 Get the RSSI of the connected AP. More...
 
WIFIReturnCode_t WIFI_GetStationList (WIFIStationInfo_t *pxStationList, uint8_t *pcStationListSize)
 SoftAP mode get connected station list. More...
 
WIFIReturnCode_t WIFI_StartDisconnectStation (uint8_t *pucMac)
 AP mode disconnecting a station. More...
 
WIFIReturnCode_t WIFI_SetMAC (uint8_t *pucMac)
 Set Wi-Fi MAC addresses. More...
 
WIFIReturnCode_t WIFI_SetCountryCode (const char *pcCountryCode)
 Set country based configuration (including channel list, power table) More...
 
WIFIReturnCode_t WIFI_GetCountryCode (char *pcCountryCode)
 Get the currently configured country code. More...
 
WIFIReturnCode_t WIFI_GetStatistic (WIFIStatisticInfo_t *pxStats)
 Get the Wi-Fi statistics. More...
 
WIFIReturnCode_t WIFI_GetCapability (WIFICapabilityInfo_t *pxCaps)
 Get the Wi-Fi capability. More...
 

Detailed Description

Wi-Fi Interface.

Macro Definition Documentation

◆ IPV6_LENGTH

#define IPV6_LENGTH   4

IPV6 length in 32-bit words.

Note
This is the constant for IPV6 length in 32-bit words

◆ WIFI_WPS_SUPPORTED

#define WIFI_WPS_SUPPORTED   0x0001

Wi-Fi lower level supported feature mask.

See also
WIFICapabilityInfo_t.

Typedef Documentation

◆ WIFIEventHandler_t

typedef void(* WIFIEventHandler_t) (WIFIEvent_t *xEvent)

Wi-Fi event handler definition.

Parameters
[in]xEvent- Wi-Fi event data structure.
Returns
None.

Enumeration Type Documentation

◆ WIFIReturnCode_t

Return code denoting API status.

Note
Codes other than eWiFiSuccess are failure codes.
Enumerator
eWiFiSuccess 

Success.

eWiFiFailure 

Failure.

eWiFiTimeout 

Timeout.

eWiFiNotSupported 

Not supported.

◆ WIFISecurity_t

Wi-Fi Security types.

Enumerator
eWiFiSecurityOpen 

Open - No Security.

eWiFiSecurityWEP 

WEP Security.

eWiFiSecurityWPA 

WPA Security.

eWiFiSecurityWPA2 

WPA2 Security.

eWiFiSecurityWPA2_ent 

WPA2 Enterprise Security.

eWiFiSecurityWPA3 

WPA3 Security.

eWiFiSecurityNotSupported 

Unknown Security.

◆ WIFIDeviceMode_t

Wi-Fi device modes.

Device roles/modes supported.

Enumerator
eWiFiModeStation 

Station mode.

eWiFiModeAP 

Access point mode.

eWiFiModeP2P 

P2P mode.

eWiFiModeAPStation 

AP+Station (repeater) mode.

eWiFiModeNotSupported 

Unsupported mode.

◆ WIFIPMMode_t

Wi-Fi device power management modes.

Device power management modes supported.

Enumerator
eWiFiPMNormal 

Normal mode.

eWiFiPMLowPower 

Low Power mode.

eWiFiPMAlwaysOn 

Always On mode.

eWiFiPMNotSupported 

Unsupported PM mode.

◆ WIFIReason_t

Wi-Fi protocol reason codes.

Enumerator
eWiFiReasonUnspecified 

Unspecified error

eWiFiReasonAPNotFound 

Cannot find the target AP.

eWiFiReasonAuthExpired 

Previous auth invalid.

eWiFiReasonAuthLeaveBSS 

Deauth leaving BSS.

eWiFiReasonAuthFailed 

All other AUTH errors.

eWiFiReasonAssocExpired 

Disassoc due to inactivity.

eWiFiReasonAssocTooMany 

AP is overloaded.

eWiFiReasonAssocPowerCapBad 

Power capability unacceptable.

eWiFiReasonAssocSupChanBad 

Supported channel unacceptable.

eWiFiReasonAssocFailed 

All other ASSOC errors.

eWiFiReasonIEInvalid 

Management frame IE invalid.

eWiFiReasonMICFailure 

MIC failure detected.

eWiFiReason4WayTimeout 

4WAY handshake timeout.

eWiFiReason4WayIEDiffer 

4WAY handshake IE error.

eWiFiReason4WayFailed 

All other 4WAY errors.

eWiFiReasonAKMPInvalid 

AKMP invalid.

eWiFiReasonPairwiseCipherInvalid 

Pairwise cipher invalid.

eWiFiReasonGroupCipherInvalid 

Group cipher invalid.

eWiFiReasonRSNVersionInvalid 

RSN version invalid.

eWiFiReasonRSNCapInvalid 

RSN capability invalid.

eWiFiReasonGroupKeyUpdateTimeout 

Group key update timeout.

eWiFiReasonCipherSuiteRejected 

Cipher violates security policy.

eWiFiReason8021XAuthFailed 

802.1X auth errors.

eWiFiReasonBeaconTimeout 

Beacon timeout.

eWiFiReasonLinkFailed 

All other link errors.

eWiFiReasonDHCPExpired 

DHCP license expired.

eWiFiReasonDHCPFailed 

All other DHCP errors.

◆ WIFIEventType_t

Wi-Fi event types.

Enumerator
eWiFiEventReady 

Wi-Fi is initialized or was reset in the lower layer.

eWiFiEventScanDone 

Scan is finished.

eWiFiEventConnected 

Station is connected to the AP.

eWiFiEventDisconnected 

Station is disconnected from the AP.

eWiFiEventConnectionFailed 

Station connection has failed.

eWiFiEventIPReady 

DHCP is successful.

eWiFiEventAPStateChanged 

SoftAP state changed.

eWiFiEventAPStationConnected 

SoftAP got a new station.

eWiFiEventAPStationDisconnected 

SoftAP lost a new station.

eWiFiEventWPSSuccess 

WPS is completed successfully.

eWiFiEventWPSFailed 

WPS has failed.

eWiFiEventWPSTimeout 

WPS has timeout.

◆ WIFIBand_t

enum WIFIBand_t

Wi-Fi band.

Enumerator
eWiFiBand2G 

2.4G band

eWiFiBand5G 

5G band

eWiFiBandDual 

Dual band

eWiFiBandMax 

Unsupported

◆ WIFIPhyMode_t

Wi-Fi PHY mode.

Enumerator
eWiFiPhy11b 

11B

eWiFiPhy11g 

11G

eWiFiPhy11n 

11N

eWiFiPhy11ac 

11AC

eWiFiPhy11ax 

11AX

eWiFiPhyMax 

Unsupported

◆ WIFIBandwidth_t

Wi-Fi bandwidth.

Enumerator
eWiFiBW20 

20MHz only

eWiFiBW40 

Max 40MHz

eWiFiBW80 

Max 80MHz

eWiFiBW160 

Max 80+80 or 160MHz

eWiFiBWMax 

Unsupported

Function Documentation

◆ WIFI_On()

WIFIReturnCode_t WIFI_On ( void  )

Turns on Wi-Fi.

This function turns on Wi-Fi module,initializes the drivers and must be called before calling any other Wi-Fi API

Returns
eWiFiSuccess if Wi-Fi module was successfully turned on, failure code otherwise.

◆ WIFI_Off()

WIFIReturnCode_t WIFI_Off ( void  )

Turns off Wi-Fi.

This function turns off the Wi-Fi module. The Wi-Fi peripheral should be put in a low power or off state in this routine.

Returns
eWiFiSuccess if Wi-Fi module was successfully turned off, failure code otherwise.

◆ WIFI_ConnectAP()

WIFIReturnCode_t WIFI_ConnectAP ( const WIFINetworkParams_t *const  pxNetworkParams)

Connects to the Wi-Fi Access Point (AP) specified in the input.

The Wi-Fi should stay connected when the same Access Point it is currently connected to is specified. Otherwise, the Wi-Fi should disconnect and connect to the new Access Point specified. If the new Access Point specifed has invalid parameters, then the Wi-Fi should be disconnected.

Parameters
[in]pxNetworkParamsConfiguration to join AP.
Returns
eWiFiSuccess if connection is successful, failure code otherwise.

Example

WIFINetworkParams_t xNetworkParams;
WIFIReturnCode_t xWifiStatus;
xNetworkParams.pcSSID = "SSID String";
xNetworkParams.ucSSIDLength = SSIDLen;
xNetworkParams.pcPassword = "Password String";
xNetworkParams.ucPasswordLength = PassLength;
xNetworkParams.xSecurity = eWiFiSecurityWPA2;
xWifiStatus = WIFI_ConnectAP( &( xNetworkParams ) );
if(xWifiStatus == eWiFiSuccess)
{
//Connected to AP.
}
See also
WIFINetworkParams_t

◆ WIFI_Disconnect()

WIFIReturnCode_t WIFI_Disconnect ( void  )

Disconnects from the currently connected Access Point.

Returns
eWiFiSuccess if disconnection was successful or if the device is already disconnected, failure code otherwise.

◆ WIFI_Reset()

WIFIReturnCode_t WIFI_Reset ( void  )

Resets the Wi-Fi Module.

Returns
eWiFiSuccess if Wi-Fi module was successfully reset, failure code otherwise.

◆ WIFI_SetMode()

WIFIReturnCode_t WIFI_SetMode ( WIFIDeviceMode_t  xDeviceMode)

Sets the Wi-Fi mode.

Parameters
[in]xDeviceMode- Mode of the device Station / Access Point /P2P.

Example

WIFIReturnCode_t xWifiStatus;
if(xWifiStatus == eWiFiSuccess)
{
//device Set to station mode
}
Returns
eWiFiSuccess if Wi-Fi mode was set successfully, failure code otherwise.

◆ WIFI_GetMode()

WIFIReturnCode_t WIFI_GetMode ( WIFIDeviceMode_t pxDeviceMode)

Gets the Wi-Fi mode.

Parameters
[out]pxDeviceMode- return mode Station / Access Point /P2P

Example

WIFIReturnCode_t xWifiStatus;
WIFIDeviceMode_t xDeviceMode;
xWifiStatus = WIFI_GetMode(&xDeviceMode);
if(xWifiStatus == eWiFiSuccess)
{
//device mode is xDeviceMode
}
Returns
eWiFiSuccess if Wi-Fi mode was successfully retrieved, failure code otherwise.

◆ WIFI_NetworkAdd()

WIFIReturnCode_t WIFI_NetworkAdd ( const WIFINetworkProfile_t *const  pxNetworkProfile,
uint16_t *  pusIndex 
)

Add a Wi-Fi Network profile.

Adds a Wi-fi network to the network list in Non Volatile memory.

Parameters
[in]pxNetworkProfile- Network profile parameters
[out]pusIndex- Network profile index in storage
Returns
Index of the profile storage on success, or failure return code on failure.

Example

WIFINetworkProfile_t xNetworkProfile = {0};
WIFIReturnCode_t xWiFiStatus;
uint16_t usIndex;
strncpy( xNetworkProfile.cSSID, "SSID_Name", SSIDLen));
xNetworkProfile.ucSSIDLength = SSIDLen;
strncpy( xNetworkProfile.cPassword, "PASSWORD",PASSLen );
xNetworkProfile.ucPasswordLength = PASSLen;
xNetworkProfile.xSecurity = eWiFiSecurityWPA2;
WIFI_NetworkAdd( &xNetworkProfile, &usIndex );

◆ WIFI_NetworkGet()

WIFIReturnCode_t WIFI_NetworkGet ( WIFINetworkProfile_t pxNetworkProfile,
uint16_t  usIndex 
)

Get a Wi-Fi network profile.

Gets the Wi-Fi network parameters at the given index from network list in non-volatile memory.

Note
The WIFINetworkProfile_t data returned must have the the SSID and Password lengths specified as the length without a null terminator.
Parameters
[out]pxNetworkProfile- pointer to return network profile parameters
[in]usIndex- Index of the network profile, must be between 0 to wificonfigMAX_NETWORK_PROFILES
Returns
eWiFiSuccess if the network profile was successfully retrieved, failure code otherwise.
See also
WIFINetworkProfile_t

Example

WIFINetworkProfile_t xNetworkProfile = {0};
uint16_t usIndex = 3; //Get profile stored at index 3.
WIFI_NetworkGet( &xNetworkProfile, usIndex );

◆ WIFI_NetworkDelete()

WIFIReturnCode_t WIFI_NetworkDelete ( uint16_t  usIndex)

Delete a Wi-Fi Network profile.

Deletes the Wi-Fi network profile from the network profile list at given index in non-volatile memory

Parameters
[in]usIndex- Index of the network profile, must be between 0 to wificonfigMAX_NETWORK_PROFILES.

If wificonfigMAX_NETWORK_PROFILES is the index, then all network profiles will be deleted.

Returns
eWiFiSuccess if successful, failure code otherwise. If successful, the interface IP address is copied into the IP address buffer.

Example

uint16_t usIndex = 2; //Delete profile at index 2
WIFI_NetworkDelete( usIndex );

◆ WIFI_Ping()

WIFIReturnCode_t WIFI_Ping ( uint8_t *  pucIPAddr,
uint16_t  usCount,
uint32_t  ulIntervalMS 
)

Ping an IP address in the network.

Parameters
[in]pucIPAddrIP Address array to ping.
[in]usCountNumber of times to ping
[in]ulIntervalMSInterval in mili-seconds for ping operation
Returns
eWiFiSuccess if ping was successful, other failure code otherwise.

◆ WIFI_GetMAC()

WIFIReturnCode_t WIFI_GetMAC ( uint8_t *  pucMac)

Retrieves the Wi-Fi interface's MAC address.

Parameters
[out]pucMacMAC Address buffer sized 6 bytes.

Example

uint8_t ucMacAddressVal[ wificonfigMAX_BSSID_LEN ];
WIFI_GetMAC( &ucMacAddressVal[0] );
Returns
eWiFiSuccess if the MAC address was successfully retrieved, failure code otherwise. The returned MAC address must be 6 consecutive bytes with no delimitters.

◆ WIFI_GetHostIP()

WIFIReturnCode_t WIFI_GetHostIP ( char *  pcHost,
uint8_t *  pucIPAddr 
)

Retrieves the host IP address from a host name using DNS.

Parameters
[in]pcHost- Host (node) name.
[in]pucIPAddr- IP Address buffer.
Returns
eWiFiSuccess if the host IP address was successfully retrieved, failure code otherwise.

Example

uint8_t ucIPAddr[ 4 ];
WIFI_GetHostIP( "amazon.com", &ucIPAddr[0] );

◆ WIFI_Scan()

WIFIReturnCode_t WIFI_Scan ( WIFIScanResult_t pxBuffer,
uint8_t  ucNumNetworks 
)

Perform a Wi-Fi network Scan.

Parameters
[in]pxBuffer- Buffer for scan results.
[in]ucNumNetworks- Number of networks to retrieve in scan result.
Returns
eWiFiSuccess if the Wi-Fi network scan was successful, failure code otherwise.
Note
The input buffer will have the results of the scan.

Example

const uint8_t ucNumNetworks = 10; //Get 10 scan results
WIFIScanResult_t xScanResults[ ucNumNetworks ];
WIFI_Scan( xScanResults, ucNumNetworks );

◆ WIFI_StartAP()

WIFIReturnCode_t WIFI_StartAP ( void  )

Start SoftAP mode.

Returns
eWiFiSuccess if SoftAP was successfully started, failure code otherwise.

◆ WIFI_StopAP()

WIFIReturnCode_t WIFI_StopAP ( void  )

Stop SoftAP mode.

Returns
eWiFiSuccess if the SoftAP was successfully stopped, failure code otherwise.

◆ WIFI_ConfigureAP()

WIFIReturnCode_t WIFI_ConfigureAP ( const WIFINetworkParams_t *const  pxNetworkParams)

Configure SoftAP.

Parameters
[in]pxNetworkParams- Network parameters to configure AP.
Returns
eWiFiSuccess if SoftAP was successfully configured, failure code otherwise.

Example

WIFINetworkParams_t xNetworkParams;
xNetworkParams.pcSSID = "SSID_Name";
xNetworkParams.pcPassword = "PASSWORD";
xNetworkParams.xSecurity = eWiFiSecurityWPA2;
xNetworkParams.cChannel = ChannelNum;
WIFI_ConfigureAP( &xNetworkParams );

◆ WIFI_SetPMMode()

WIFIReturnCode_t WIFI_SetPMMode ( WIFIPMMode_t  xPMModeType,
const void *  pvOptionValue 
)

Set the Wi-Fi power management mode.

Parameters
[in]xPMModeType- Power mode type.
[in]pvOptionValue- A buffer containing the value of the option to set depends on the mode type example - beacon interval in sec
Returns
eWiFiSuccess if the power mode was successfully configured, failure code otherwise.

◆ WIFI_GetPMMode()

WIFIReturnCode_t WIFI_GetPMMode ( WIFIPMMode_t pxPMModeType,
void *  pvOptionValue 
)

Get the Wi-Fi power management mode.

Parameters
[out]pxPMModeType- pointer to get current power mode set.
[out]pvOptionValue- optional value
Returns
eWiFiSuccess if the power mode was successfully retrieved, failure code otherwise.

◆ WIFI_RegisterEvent()

WIFIReturnCode_t WIFI_RegisterEvent ( WIFIEventType_t  xEventType,
WIFIEventHandler_t  xHandler 
)

Register a Wi-Fi event Handler.

Parameters
[in]xEventType- Wi-Fi event type.
[in]xHandler- Wi-Fi event handler.
Returns
eWiFiSuccess if registration is successful, failure code otherwise.

◆ WIFI_IsConnected()

BaseType_t WIFI_IsConnected ( const WIFINetworkParams_t pxNetworkParams)

Check if the Wi-Fi is connected and the AP configuration matches the query.

param[in] pxNetworkParams - Network parameters to query, if NULL then just check the Wi-Fi link status.

◆ WIFI_StartScan()

WIFIReturnCode_t WIFI_StartScan ( WIFIScanConfig_t pxScanConfig)

Start a Wi-Fi scan.

This is an asynchronous call, the result will be notified by an event.

See also
WiFiEventInfoScanDone_t.
Parameters
[in]pxScanConfig- Parameters for scan, NULL if default scan (i.e. broadcast scan on all channels).
Returns
eWiFiSuccess if scan was started successfully, failure code otherwise.

◆ WIFI_GetScanResults()

WIFIReturnCode_t WIFI_GetScanResults ( const WIFIScanResult_t **  pxBuffer,
uint16_t *  ucNumNetworks 
)

Get Wi-Fi scan results. It should be called only after scan is completed. Scan results are sorted in decreasing rssi order.

Parameters
[out]pxBuffer- Handle to the READ ONLY scan results buffer.
[out]ucNumNetworks- Actual number of networks in the scan results.
Returns
eWiFiSuccess if the scan results were got successfully, failure code otherwise.

◆ WIFI_StartConnectAP()

WIFIReturnCode_t WIFI_StartConnectAP ( const WIFINetworkParams_t pxNetworkParams)

Connect to the Wi-Fi Access Point (AP) specified in the input.

This is an asynchronous call, the result will be notified by an event.

See also
WiFiEventInfoConnected_t.

The Wi-Fi should stay connected when the specified AP is the same as the currently connected AP. Otherwise, the Wi-Fi should disconnect and connect to the specified AP. If the specified AP has invalid parameters, the Wi-Fi should be disconnected.

Parameters
[in]pxNetworkParams- Configuration of the targeted AP.
Returns
eWiFiSuccess if connection was started successfully, failure code otherwise.

◆ WIFI_StartDisconnect()

WIFIReturnCode_t WIFI_StartDisconnect ( void  )

Wi-Fi station disconnects from AP.

This is an asynchronous call. The result will be notified by an event.

See also
WiFiEventInfoDisconnected_t.
Returns
eWiFiSuccess if disconnection was started successfully, failure code otherwise.

◆ WIFI_GetConnectionInfo()

WIFIReturnCode_t WIFI_GetConnectionInfo ( WIFIConnectionInfo_t pxConnectionInfo)

Get Wi-Fi info of the connected AP.

This is a synchronous call.

Parameters
[out]pxConnectionInfo- Wi-Fi info of the connected AP.
Returns
eWiFiSuccess if connection info was got successfully, failure code otherwise.

◆ WIFI_GetIPInfo()

WIFIReturnCode_t WIFI_GetIPInfo ( WIFIIPConfiguration_t pxIPInfo)

Get IP configuration (IP address, NetworkMask, Gateway and DNS server addresses).

This is a synchronous call.

Parameters
[out]pxIPInfo- Current IP configuration.
Returns
eWiFiSuccess if connection info was got successfully, failure code otherwise.

◆ WIFI_GetRSSI()

WIFIReturnCode_t WIFI_GetRSSI ( int8_t *  pcRSSI)

Get the RSSI of the connected AP.

This only works when the station is connected.

Parameters
[out]pcRSSI- RSSI of the connected AP.
Returns
eWiFiSuccess if RSSI was got successfully, failure code otherwise.

◆ WIFI_GetStationList()

WIFIReturnCode_t WIFI_GetStationList ( WIFIStationInfo_t pxStationList,
uint8_t *  pcStationListSize 
)

SoftAP mode get connected station list.

Parameters
[out]pxStationList- Buffer for station list, supplied by the caller.
[in,out]pcStationListSize- Input size of the list, output number of connected stations.
Returns
eWiFiSuccess if stations were got successfully (manybe none), failure code otherwise.

◆ WIFI_StartDisconnectStation()

WIFIReturnCode_t WIFI_StartDisconnectStation ( uint8_t *  pucMac)

AP mode disconnecting a station.

This is an asynchronous call, the result will be notified by an event.

See also
WiFiEventInfoAPStationDisconnected_t.
Parameters
[in]pucMac- MAC Address of the station to be disconnected.
Returns
eWiFiSuccess if disconnection was started successfully, failure code otherwise.

◆ WIFI_SetMAC()

WIFIReturnCode_t WIFI_SetMAC ( uint8_t *  pucMac)

Set Wi-Fi MAC addresses.

The given MAC address will become the station MAC address. The AP MAC address (i.e. BSSID) will be the same MAC address but with the local bit set.

Parameters
[in]pucMac- Station MAC address.
Returns
eWiFiSuccess if MAC address was set successfully, failure code otherwise.
Note
On some platforms the change of MAC address can only take effect after reboot.

◆ WIFI_SetCountryCode()

WIFIReturnCode_t WIFI_SetCountryCode ( const char *  pcCountryCode)

Set country based configuration (including channel list, power table)

Parameters
[in]pcCountryCode- Country code (null-terminated string, e.g. "US", "CN". See ISO-3166).
Returns
eWiFiSuccess if Country Code is set successfully, failure code otherwise.

◆ WIFI_GetCountryCode()

WIFIReturnCode_t WIFI_GetCountryCode ( char *  pcCountryCode)

Get the currently configured country code.

Parameters
[out]pcCountryCode- Null-terminated string to hold the country code (see ISO-3166). Must be at least 4 bytes.
Returns
eWiFiSuccess if Country Code is retrieved successfully, failure code otherwise.

◆ WIFI_GetStatistic()

WIFIReturnCode_t WIFI_GetStatistic ( WIFIStatisticInfo_t pxStats)

Get the Wi-Fi statistics.

Parameters
[out]pxStats- Structure to hold the WiFi statistics.
Returns
eWiFiSuccess if statistics are retrieved successfully, failure code otherwise.

◆ WIFI_GetCapability()

WIFIReturnCode_t WIFI_GetCapability ( WIFICapabilityInfo_t pxCaps)

Get the Wi-Fi capability.

Parameters
[out]pxCaps- Structure to hold the Wi-Fi capabilities.
Returns
eWiFiSuccess if capabilities are retrieved successfully, failure code otherwise.