NetBurner 3.1
Wifi

Classes

struct  NB::Wifi::driverStatusStruct
 
struct  wifi_init
 

Functions

nbWifiScanResult * WifiInitScan_SPI (int irqNum=-1, int moduleNum=-1, int csNum=-1, int connectorNum=-1, int gpioPinNum=-1, int resetPinNum=-1)
 Initializes the WiFi hardware, initializes the driver over the SPI bus, and performs an AP scan. More...
 
int WifiInitScanAndShow_SPI (int irqNum=-1, int moduleNum=-1, int csNum=-1, int connectorNum=-1, int gpioPinNum=-1, int resetPinNum=-1)
 Initializes the WiFi hardware, initializes the driver using the SPI bus, performs an AP scan, and prints the scan results via serial output. More...
 
int InitWifi_SPI (const char *SSID="", const char *password="", int irqNum=-1, int moduleNum=-1, int csNum=-1, int connectorNum=-1, int gpioPinNum=-1, int resetPinNum=-1)
 Initializes the WiFi hardware, initializes the driver using the SPI bus, and attempts to establish the specified connection. More...
 
int InitAP_SPI (const char *SSID="", const char *password="", uint8_t channel=NBWIFI_DEFAULT_WIFICHANNEL, int irqNum=-1, int moduleNum=-1, int csNum=-1, int connectorNum=-1, int gpioPinNum=-1, int resetPinNum=-1)
 Initializes the WiFi hardware, initializes the driver using the SPI bus, and attempts to establish the specified access point. More...
 
nbWifiScanResult * WifiInitScan_Serial (int portNum=-1, int resetPinNum=-1, int connectorNum=-1)
 Initializes the WiFi hardware, initializes the driver using the UART interface, performs an AP scan, and prints the scan results via serial output. More...
 
int WifiInitScanAndShow_Serial (int portNum=-1, int resetPinNum=-1, int connectorNum=-1)
 Initializes the WiFi hardware, initializes the driver using the UART interface, performs an AP scan, and prints the scan results via serial output. More...
 
int InitWifi_Serial (const char *SSID="", const char *password="", int portNum=-1, int resetPinNum=-1, int connectorNum=-1)
 Initializes the WiFi hardware, initializes the driver using the UART interface, and attempts to establish the specified access point. More...
 
void SetWifiSPISpeed (int busSpeed)
 Set SPI bus speed. More...
 
void ScanAndShowNetworks ()
 Scan for surrounding access points and print the results via iprintf. More...
 
nbWifiScanResult * ScanForNetworks ()
 Scan for surrounding access points. More...
 
void NB::PrintScanResult (nbWifiScanResult *scanResult)
 Print the results of one scan result using iprintf. More...
 
virtual int NB::Wifi::ConnectToAP (const char *ssid=nullptr, const char *passwd="", uint8_t retryCount=CONNECT_RETRIES, uint8_t security=DEFAULT_WIFI_SEC_ALL)=0
 Connect to an access point. If the SSID and Pass Phrase are not specified, values from the system configuration record will be used. More...
 
virtual int NB::Wifi::ConnectToAP (nbWifiConnect connect)=0
 Connect to an access point. If the SSID and Pass Phrase are not specified, values from the system configuration record will be used. More...
 
virtual int NB::Wifi::StartAP (const char *ssid=nullptr, const char *passwd="", uint8_t channel=DEFAULT_TABLE_LABEL_CHANNEL, uint8_t security=DEFAULT_TABLE_LABEL_SEC, uint8_t cipher=DEFAULT_TABLE_LABEL_CIPH, uint8_t ssidLen=0)=0
 Attempts to establish the specified software enabled access point (softAP). More...
 
virtual int NB::Wifi::StartConfigAP (uint8_t channel=DEFAULT_TABLE_LABEL_CHANNEL)=0
 Attempts to establish the specified software enabled access point (softAP). This softAP then hosts a DHCP server and a webpage which lists surrounding access points. The webpage also provides a means of establishing a connection with a network from the list. More...
 
virtual nbWifiScanResult * NB::Wifi::Scan (const char *ssid=nullptr, uint8_t optionCount=0, uint16_t *optionList=nullptr)=0
 Scan for all or requested access points. Results of Scan are valid until the next call to Scan() or FreeScanList(). More...
 
virtual void NB::Wifi::Disconnect ()=0
 Disconnect from the network or disable software-enabled access point (softAP). More...
 
static Wifi * NB::Wifi::GetDriverByInterfaceNumber (int interfaceNumber)
 Get a pointer to the Wifi driver object. More...
 
static void NB::Wifi::SetDefaultITUCountry (NB::ITU_Country::CountryCode_t country)
 Set non-default country to be configured upon wifi interface creation. More...
 
virtual int NB::Wifi::SetITUCountry (NB::ITU_Country::CountryCode_t country)=0
 Set the country for regulatory compliant channel availability. More...
 
virtual bool NB::Wifi::isRegistered () const =0
 Check if the Wifi interface has been registered with the system networking stack. More...
 
virtual int NB::Wifi::GetWifiInterfaceNumber () const =0
 Get driver object's interface number within the WiFi driver. More...
 
virtual int NB::Wifi::GetSystemInterfaceNumber () const =0
 Get driver object's system interface number. More...
 
virtual int NB::Wifi::StoreSSIDPWToConfig (char *ssid, char *password, int ssidLen=0)=0
 Store an SSID and password into the configuration record, which is in non-volatile memory. More...
 
virtual const char * NB::Wifi::GetDriverName ()
 Get the name of the Wifi interface. More...
 
virtual int NB::Wifi::GetSSIDFromConfig (char *returnBuf, int maxLen)=0
 Get the Service Set Identity (SSID) stored in the configuration record, which is in non-volatile memory. More...
 
virtual int NB::Wifi::GetKeyFromConfig (char *returnBuf, int maxLen)=0
 Get the password stored in the configuration record, which is in non-volatile memory. More...
 
virtual int NB::Wifi::GetCurSSID (char *buf, int maxlen)=0
 Get the Service Set Identity (SSID) of the network you are currently connected to, or the SSID of the access point that is currently established. More...
 
virtual MACADR NB::Wifi::GetCurBSSID ()=0
 Get the basic service set identifier (BSSID) of the connected network. More...
 
virtual void NB::Wifi::GetCurrentAP (driverStatusStruct *ap)=0
 Get the full status of the connected network in the form of a driverStatusStruct structure that is passed by reference. More...
 
virtual void NB::Wifi::GetDeviceInformation (nbWifiDeviceInfo *ap)=0
 Get NB module device information in the form of a nbWifiDeviceInfo structure. More...
 
virtual bool NB::Wifi::Connected ()=0
 Check if the WiFi interface is currently connected to a network. More...
 
virtual int NB::Wifi::GetSignalStrength ()=0
 Get the received signal strength indicator (RSSI) of the current connection. More...
 
virtual uint8_t NB::Wifi::GetCurChannel ()=0
 Get the 802.11 channel of the current connection. More...
 
virtual uint8_t NB::Wifi::GetSecurity ()=0
 Get the security type of the current connection. More...
 
virtual uint8_t NB::Wifi::GetCipher ()=0
 Get the cipher of the current connection. More...
 
virtual void NB::Wifi::TransmitBuffer (PoolPtr txBuffer)=0
 Transmit a buffer via the WiFi interface. More...
 
virtual bool NB::Wifi::GetLinkStatus ()=0
 Get the connection/link status of the WiFi interface. This function simply checks a maintained connection status variable instead of polling the Wifi module. This function is faster than NB::Connected(). More...
 
virtual void NB::Wifi::enab_multicast (MACADR macAddress, BOOL addAddress)=0
 Enable/disable multicast filtering for a specific MAC address to receive multicast packets. More...
 
virtual int NB::Wifi::APIStart ()=0
 Start the WiFi message processing task. This is only applicable to the NBWIFIIN module. More...
 
virtual int NB::Wifi::Start ()=0
 For the NBWIFIIN module, this function begins the WiFi receive task. For the NBWIFIWILC module, this function begins the WiFi transmit/receive/message processing task. More...
 
virtual void NB::Wifi::Pause ()=0
 Pause the WiFi task. More...
 
virtual void NB::Wifi::Resume ()=0
 Resume the WiFi task. More...
 
virtual void NB::Wifi::Kill ()=0
 Abort the WiFi task. More...
 

Variables

uint8_t NB::Wifi::driverStatusStruct::connected
 1 if connected, 0 if disconnected
 
uint8_t NB::Wifi::driverStatusStruct::ssidLength
 Length of the SSID string.
 
uint16_t NB::Wifi::driverStatusStruct::txPower
 Transmit power.
 
int16_t NB::Wifi::driverStatusStruct::rssi
 Recieved Signal Strength Indicator.
 
uint8_t NB::Wifi::driverStatusStruct::band
 Refer to BANDSECTION for defenitions.
 
uint8_t NB::Wifi::driverStatusStruct::channel
 802.11 channel
 
uint32_t NB::Wifi::driverStatusStruct::maxTxRate
 Max transmit data throughput.
 
uint8_t NB::Wifi::driverStatusStruct::security
 Security used: WEP, WPA, WPA2, open, uknown.
 
uint8_t NB::Wifi::driverStatusStruct::cipher
 refer to OPTIONLISTCIPH for defenitions
 
MACADR NB::Wifi::driverStatusStruct::bssid
 Basic Service Set Identifier.
 
uint8_t NB::Wifi::driverStatusStruct::bssType
 refer to OPTIONLISTBSSTYPE for defenitions
 
char NB::Wifi::driverStatusStruct::ssid [SSID_MAX_LEN+1]
 Placeholder for char array pointer.
 
uint32_t NB::Wifi::driverStatusStruct::tickLastUpdated
 CPU tick count of when this struct was last updated.
 
static Wifi * NB::Wifi::wifiDrivers [MAX_WIFI_INTERFACES]
 

Detailed Description

Function Documentation

◆ APIStart()

virtual int NB::Wifi::APIStart ( )
pure virtual

Start the WiFi message processing task. This is only applicable to the NBWIFIIN module.

Returns
Constants::TaskStart_Err_NoError, if successful. Otherwise, returns NB::Constants::TaskStartError if the API task is already running or has already been started.

◆ Connected()

virtual bool NB::Wifi::Connected ( )
pure virtual

Check if the WiFi interface is currently connected to a network.

Note
performs a bus communication to query the module. This will perform more slowly than NB::Wifi::GetLinkStatus(), which simply checks a maintained connection status variable.
Returns
TRUE, if connected. FALSE, otherwise.

◆ ConnectToAP() [1/2]

virtual int NB::Wifi::ConnectToAP ( const char *  ssid = nullptr,
const char *  passwd = "",
uint8_t  retryCount = CONNECT_RETRIES,
uint8_t  security = DEFAULT_WIFI_SEC_ALL 
)
pure virtual

Connect to an access point. If the SSID and Pass Phrase are not specified, values from the system configuration record will be used.

Parameters
[in]SSIDService Set Identity (SSID), nullptr uses SSID stored in the configuration record.
[in]passwordPre-shared key to obtain access to the network; nullptr uses the key stored in the configuration record.
[in]retryCountamount of attempts to try to connect.
[in]securitytype of security of the network we are attempting to connect to. The options are DEFAULT_WIFI_SEC_ALL, SEC_VALUE_OPEN, SEC_VALUE_WEP, SEC_VALUE_WPA, SEC_VALUE_WPA2, SEC_VALUE_WPS.
Returns
returns the interface number, if succesful. Otherwise, returns NB::Error::Connect::ConnectErrors or NB::Error::GeneralErrors

◆ ConnectToAP() [2/2]

virtual int NB::Wifi::ConnectToAP ( nbWifiConnect  connect)
pure virtual

Connect to an access point. If the SSID and Pass Phrase are not specified, values from the system configuration record will be used.

Parameters
[in]connect.ssidService Set Identity (SSID). nullptr uses SSID stored in the configuration record.
[in]connect.ssidLengthLength of the SSID string that was given.
[in]connect.securitytype of security of the network we are attempting to connect to, DEFAULT_WIFI_SEC_ALL to try all security types.
[in]connect.pskkey shared with access point/peer; nullptr uses the key stored in the configuration record.
[in]connect.channel802.11 channel of the access point that is being connected to, DEFAULT_WIFI_CH_ALL to try all channels.
[in]connect.retryCountamount of attempts to try to connect.
Returns
returns the interface number, if succesful. Otherwise, returns NB::Error::Connect::ConnectErrors or NB::Error::GeneralErrors

◆ Disconnect()

virtual void NB::Wifi::Disconnect ( )
pure virtual

Disconnect from the network or disable software-enabled access point (softAP).

Returns
nothing

◆ enab_multicast()

virtual void NB::Wifi::enab_multicast ( MACADR  macAddress,
BOOL  addAddress 
)
pure virtual

Enable/disable multicast filtering for a specific MAC address to receive multicast packets.

Parameters
[in]macAddressThe mac address to add/remove from the multifast filter in the form of a MACADR struct.
[in]addAddressTRUE to add the address to the multicast group. FALSE to remove the address.
Returns
nothing.

◆ GetCipher()

virtual uint8_t NB::Wifi::GetCipher ( )
pure virtual

Get the cipher of the current connection.

Warning
This function currently is not supported on the NBWIFIWILC.
Returns
OPTIONLISTCIPH, if successful.

◆ GetCurBSSID()

virtual MACADR NB::Wifi::GetCurBSSID ( )
pure virtual

Get the basic service set identifier (BSSID) of the connected network.

Returns
A MACADR structure which contains the 48-bit BSSID value, if successful. Otherwise, returns an empty structure.

◆ GetCurChannel()

virtual uint8_t NB::Wifi::GetCurChannel ( )
pure virtual

Get the 802.11 channel of the current connection.

Warning
This function currently is not supported on the NBWIFIWILC.
Returns
802.11 channel of the current connection or 0 if the request failed.

◆ GetCurrentAP()

virtual void NB::Wifi::GetCurrentAP ( driverStatusStruct ap)
pure virtual

Get the full status of the connected network in the form of a driverStatusStruct structure that is passed by reference.

Parameters
[out]apA pointer to a driverStatusStruct structure to be populated with the status information of the current WiFi network connection.
Returns
nothing

◆ GetCurSSID()

virtual int NB::Wifi::GetCurSSID ( char *  buf,
int  maxlen 
)
pure virtual

Get the Service Set Identity (SSID) of the network you are currently connected to, or the SSID of the access point that is currently established.

Parameters
[out]bufpointer to a buffer used by this function to store the SSID.
[in]maxlenThe size limit for writing to the buf paramter. This is usually the size of buf in bytes.
Returns
returns the length of the copied string. Otherwise, returns NB::Error::GeneralErrors.

◆ GetDeviceInformation()

virtual void NB::Wifi::GetDeviceInformation ( nbWifiDeviceInfo *  ap)
pure virtual

Get NB module device information in the form of a nbWifiDeviceInfo structure.

Parameters
[out]apA pointer to a nbwifiDeviceInfo structure to be populated with the NBWIFI module device information.
Returns
nothing

◆ GetDriverByInterfaceNumber()

static Wifi* NB::Wifi::GetDriverByInterfaceNumber ( int  interfaceNumber)
static

Get a pointer to the Wifi driver object.

Parameters
[in]interfaceNumberThe system interface number for the WiFi interface.
Returns
returns a pointer to the WiFi driver object of type NB::Wifi, if successful. Otherwise, returns nullptr.
Note
See also NB::Wifi::GetSystemInterfaceNumber().

◆ GetDriverName()

virtual const char* NB::Wifi::GetDriverName ( )
virtual

Get the name of the Wifi interface.

Returns
Pointer to a string containing the WiFi interface's name.

◆ GetKeyFromConfig()

virtual int NB::Wifi::GetKeyFromConfig ( char *  returnBuf,
int  maxLen 
)
pure virtual

Get the password stored in the configuration record, which is in non-volatile memory.

Parameters
[out]returnBufpointer to the buffer used by this function to store the password.
[in]maxLenThe size limit for writing to the returnBuf paramter. This is usually the size of returnBuf in bytes.
Returns
returns the length of the copied string. Otherwise, returns NB::Error::GeneralErrors.

◆ GetLinkStatus()

virtual bool NB::Wifi::GetLinkStatus ( )
pure virtual

Get the connection/link status of the WiFi interface. This function simply checks a maintained connection status variable instead of polling the Wifi module. This function is faster than NB::Connected().

Returns
TRUE if connected. FALSE, if not connected.

◆ GetSecurity()

virtual uint8_t NB::Wifi::GetSecurity ( )
pure virtual

Get the security type of the current connection.

Returns
OPTIONLISTSEC, if successful. Otherwise, returns NB::Error::GeneralErrors, NB::Error::Init:InitializationErrors, or NB::Error::Connect::ConnectErrors.

◆ GetSignalStrength()

virtual int NB::Wifi::GetSignalStrength ( )
pure virtual

Get the received signal strength indicator (RSSI) of the current connection.

Returns
A value between 0 and -100, if a valid RSSI value is found. The signal strength is greater as the value approaches 0.

◆ GetSSIDFromConfig()

virtual int NB::Wifi::GetSSIDFromConfig ( char *  returnBuf,
int  maxLen 
)
pure virtual

Get the Service Set Identity (SSID) stored in the configuration record, which is in non-volatile memory.

Parameters
[out]returnBufpointer to the buffer used by this function to store the SSID.
[in]maxLenThe size limit for writing to the returnBuf paramter. This is usually the size of returnBuf in bytes.
Returns
returns the length of the copied string. Otherwise, returns NB::Error::GeneralErrors.

◆ GetSystemInterfaceNumber()

virtual int NB::Wifi::GetSystemInterfaceNumber ( ) const
pure virtual

Get driver object's system interface number.

Returns
interface number > 0, if it has been registered. Otherwise returns 0.

◆ GetWifiInterfaceNumber()

virtual int NB::Wifi::GetWifiInterfaceNumber ( ) const
pure virtual

Get driver object's interface number within the WiFi driver.

Note
The WiFi interface number only pertains to the WiFi driver and NOT the system interface values.
Returns
interface number >= 0, if the interface exists. Otherwise, returns -1.

◆ InitAP_SPI()

int InitAP_SPI ( const char *  SSID = "",
const char *  password = "",
uint8_t  channel = NBWIFI_DEFAULT_WIFICHANNEL,
int  irqNum = -1,
int  moduleNum = -1,
int  csNum = -1,
int  connectorNum = -1,
int  gpioPinNum = -1,
int  resetPinNum = -1 
)

Initializes the WiFi hardware, initializes the driver using the SPI bus, and attempts to establish the specified access point.

Parameters
[in]SSIDService Set Identity (SSID), nullptr uses SSID stored in the configuration record.
[in]passwordkey shared with access point/peer; nullptr uses the key stored in the configuration record.
[in]channel802.11 channel to establish an access point on.
[in]irqNumIRQ signal used to communicate with the WiFi module.
[in]spiModuleNumSPI module number used to communicate with the WiFi module.
[in]csNumChip Select signal used for SPI communication.
[in]connectorNumphysical header number of the NetBurner module used.
[in]csGpioPinNumGPIO pin number to use if not using SPI's chip select signal.
[in]resetPinNumpin number to use as an reset signal output to the wifi module.
Returns
returns the Wifi interface number, if successful. Otherwise, returns NB::Error::GeneralErrors or NB::Error::Init::InitializationErrors

◆ InitWifi_Serial()

int InitWifi_Serial ( const char *  SSID = "",
const char *  password = "",
int  portNum = -1,
int  resetPinNum = -1,
int  connectorNum = -1 
)

Initializes the WiFi hardware, initializes the driver using the UART interface, and attempts to establish the specified access point.

Serial functions pertaining to WiFi are only available for the NBWIFIIN.

Parameters
[in]SSIDService Set Identity (SSID), nullptr uses SSID stored in the configuration record.
[in]passwordkey shared with access point/peer; nullptr uses the key stored in the configuration record.
[in]portNumUART number
[in]resetPinNumpin number to use as an reset signal output to the wifi module.
[in]connectorNumphysical header number of the NetBurner module used.
Returns
returns zero if successful, otherwise returns NB::Error::GeneralErrors or NB::Error::Init::InitializationErrors

◆ InitWifi_SPI()

int InitWifi_SPI ( const char *  SSID = "",
const char *  password = "",
int  irqNum = -1,
int  moduleNum = -1,
int  csNum = -1,
int  connectorNum = -1,
int  gpioPinNum = -1,
int  resetPinNum = -1 
)

Initializes the WiFi hardware, initializes the driver using the SPI bus, and attempts to establish the specified connection.

Parameters
[in]SSIDService Set Identity (SSID), nullptr uses SSID stored in the configuration record.
[in]passwordkey shared with access point/peer; nullptr uses the key stored in the configuration record.
[in]irqNumIRQ signal used to communicate with the WiFi module.
[in]spiModuleNumSPI module number used to communicate with the WiFi module.
[in]csNumChip Select signal used for SPI communication.
[in]connectorNumphysical header number of the NetBurner module used.
[in]csGpioPinNumGPIO pin number to use if not using SPI's chip select signal.
[in]resetPinNumpin number to use as an reset signal output to the wifi module.
Returns
returns the Wifi interface number, if successful. Otherwise, returns NB::Error::GeneralErrors or NB::Error::Init::InitializationErrors

◆ isRegistered()

virtual bool NB::Wifi::isRegistered ( ) const
pure virtual

Check if the Wifi interface has been registered with the system networking stack.

Returns
True if the Wifi interface has been registered. False if it has not ben registered.

◆ Kill()

virtual void NB::Wifi::Kill ( )
pure virtual

Abort the WiFi task.

Note
For the NBWIFIIN module, this function will pause the WiFi receive task that is executed with the Start() function call.
Returns
nothing.

◆ Pause()

virtual void NB::Wifi::Pause ( )
pure virtual

Pause the WiFi task.

Note
For the NBWIFIIN module, this function will pause the WiFi receive task that is executed with the Start() function call.
Returns
nothing.

◆ PrintScanResult()

void NB::PrintScanResult ( nbWifiScanResult *  scanResult)

Print the results of one scan result using iprintf.

Parameters
[in]scanResultPointer to the scan result structure containing the scan result to be printed
Returns
nothing

◆ Resume()

virtual void NB::Wifi::Resume ( )
pure virtual

Resume the WiFi task.

Note
For the NBWIFIIN module, this function will pause the WiFi receive task that is executed with the Start() function call.
Returns
nothing.

◆ Scan()

virtual nbWifiScanResult* NB::Wifi::Scan ( const char *  ssid = nullptr,
uint8_t  optionCount = 0,
uint16_t *  optionList = nullptr 
)
pure virtual

Scan for all or requested access points. Results of Scan are valid until the next call to Scan() or FreeScanList().

Warning
Scan CANNOT be performed while in access point (AP) mode on the NBWIFIWILC.
Parameters
[in]ssidService Set Identity (SSID) for network to scan for. If nullptr, scan for all access points. Otherwise, scan for this network only.
[in]optionCountCount of options used to filter scan results. This is an optional parameter unless optionList is used.
[in]optionListList of options used to filter scan results. This is an optional parameter. Passing nullptr will simply show all scan results. Option list values can be found in the following sections: OPTIONLISTSEC, OPTIONLISTCIPH, OPTIONLISTBAND, and OPTIONLISTBSSTYPE.
Returns
returns zero if succesful, otherwise returns NB::Error::Connect::ConnectErrors or NB::Error::GeneralErrors.

◆ ScanAndShowNetworks()

void ScanAndShowNetworks ( )

Scan for surrounding access points and print the results via iprintf.

Returns
nothing

This function is bus interface agnostic.

◆ ScanForNetworks()

nbWifiScanResult* ScanForNetworks ( )

Scan for surrounding access points.

Returns
nbWifiScanResult Head of linked list containing the AP scan results. nullptr if scan failed or no access points were found

This function is bus interface agnostic.

◆ SetDefaultITUCountry()

static void NB::Wifi::SetDefaultITUCountry ( NB::ITU_Country::CountryCode_t  country)
static

Set non-default country to be configured upon wifi interface creation.

Note
See NB::ITU_Country::CountryCode_t for a list of country codes

◆ SetITUCountry()

virtual int NB::Wifi::SetITUCountry ( NB::ITU_Country::CountryCode_t  country)
pure virtual

Set the country for regulatory compliant channel availability.

Returns
Nonzero on error
Note
See NB::ITU_Country::CountryCode_t for a list of country codes

◆ SetWifiSPISpeed()

void SetWifiSPISpeed ( int  busSpeed)

Set SPI bus speed.

Parameters
[in]busSpeedBus speed in Hz.
Returns
nothing

◆ Start()

virtual int NB::Wifi::Start ( )
pure virtual

For the NBWIFIIN module, this function begins the WiFi receive task. For the NBWIFIWILC module, this function begins the WiFi transmit/receive/message processing task.

Returns
Constants::TaskStart_Err_NoError, if successful. Otherwise, returns NB::Constants::TaskStartError if the API task is already running or has already been started

◆ StartAP()

virtual int NB::Wifi::StartAP ( const char *  ssid = nullptr,
const char *  passwd = "",
uint8_t  channel = DEFAULT_TABLE_LABEL_CHANNEL,
uint8_t  security = DEFAULT_TABLE_LABEL_SEC,
uint8_t  cipher = DEFAULT_TABLE_LABEL_CIPH,
uint8_t  ssidLen = 0 
)
pure virtual

Attempts to establish the specified software enabled access point (softAP).

Warning
Scan CANNOT be performed while in access point (AP) mode on the NBWIFIWILC.
Parameters
[in]ssidService Set Identity (SSID) for softAP. If nullptr, uses SSID stored in the configuration record. SSID maximum length is 32 characters. Returns Error::InvalidArgument (-258) if not set properly.
[in]passwdKey shared with access point/peer. If nullptr, uses the key stored in the configuration record. Password must be between 8 and 64 characters, or nullptr for an open network. returns Error::InvalidArgument (-258) otherwise.
[in]channel802.11 channel to establish the access point on.
[in]securityType of security of the network we are attempting to establish. The NBWIFIWILC module supports only WPA/WPA2 secured and open networks. The options are SEC_VALUE_OPEN, SEC_VALUE_WEP, SEC_VALUE_WPA, SEC_VALUE_WPA2, SEC_VALUE_WPS.
[in]cipherCipher used to encrypt data transmitted over 802.11. Option not available on the NBWIFIWILC module. The options are CIPH_VALUE_NONE, CIPH_VALUE_TKIP, CIPH_VALUE_AES, CIPH_VALUE_MIXED.
[in]ssidLenLength of the SSID string not include the nullptr terminating char.
Returns
returns zero if succesful, otherwise returns Configuration Errors, NB::Error::Connect::ConnectErrors, or NB::Error::GeneralErrors.

◆ StartConfigAP()

virtual int NB::Wifi::StartConfigAP ( uint8_t  channel = DEFAULT_TABLE_LABEL_CHANNEL)
pure virtual

Attempts to establish the specified software enabled access point (softAP). This softAP then hosts a DHCP server and a webpage which lists surrounding access points. The webpage also provides a means of establishing a connection with a network from the list.

Warning
Scan CANNOT be performed while in access point (AP) mode on the NBWIFIWILC. The scan for the webpage is performed before the AP is established. Therefore, if your AP has been running for a while, the scan results may not still be valid.
Parameters
[in]channel802.11 channel to establsh the softAP on.
Returns
returns zero if succesful, otherwise returns NB::Error::Connect::ConnectErrors or NB::Error::GeneralErrors or 1 if a DHCP server already exists.

◆ StoreSSIDPWToConfig()

virtual int NB::Wifi::StoreSSIDPWToConfig ( char *  ssid,
char *  password,
int  ssidLen = 0 
)
pure virtual

Store an SSID and password into the configuration record, which is in non-volatile memory.

Parameters
[in]ssidService Set Identity (SSID) to store in the config record. Max length of SSID_MAX_LEN, defined in wifi/include/nbwifi/nbWificonstants.h.
[in]passwdPre-shared key. Password must be between 8 and 64 characters, or nullptr for an open network. returns Error::InvalidArgument (-258) otherwise.
[in]ssidLenLength of the ssid string, not including nullptr terminating chars.
Returns
returns 1 if successful, returns 0 otherwise.

◆ TransmitBuffer()

virtual void NB::Wifi::TransmitBuffer ( PoolPtr  txBuffer)
pure virtual

Transmit a buffer via the WiFi interface.

Parameters
[in]txBufferBuffer to be transfered over the WiFi interface
Returns
nothing

◆ WifiInitScan_Serial()

nbWifiScanResult* WifiInitScan_Serial ( int  portNum = -1,
int  resetPinNum = -1,
int  connectorNum = -1 
)

Initializes the WiFi hardware, initializes the driver using the UART interface, performs an AP scan, and prints the scan results via serial output.

Serial functions pertaining to WiFi are only available for the NBWIFIIN.

Parameters
[in]portNumUART number
[in]resetPinNumpin number to use as an reset signal output to the wifi module.
[in]connectorNumphysical header number of the NetBurner module used.
Returns
nbWifiScanResult Head of linked list containing the AP scan results. nullptr if scan failed or no access points were found

◆ WifiInitScan_SPI()

nbWifiScanResult* WifiInitScan_SPI ( int  irqNum = -1,
int  moduleNum = -1,
int  csNum = -1,
int  connectorNum = -1,
int  gpioPinNum = -1,
int  resetPinNum = -1 
)

Initializes the WiFi hardware, initializes the driver over the SPI bus, and performs an AP scan.

Parameters
[in]irqNumIRQ signal used to communicate with the WiFi module.
[in]spiModuleNumSPI module number used to communicate with the WiFi module.
[in]csNumChip Select signal used for SPI communication.
[in]connectorNumphysical header number of the NetBurner module used.
[in]csGpioPinNumGPIO pin number to use if not using SPI's chip select signal.
[in]resetPinNumpin number to use as an reset signal output to the wifi module.
Returns
nbWifiScanResult Head of linked list containing the AP scan results. nullptr if scan failed or no access points were found

Initializes the WiFi Driver to communicate with the WiFi module over the SPI bus and performs a scan for surrounding access points (AP). The result of the scan is returned as the head of a linked list that contains the scan results. If the WiFi driver has already been initialized by a previous call to one of the WifiInit function variations, then only a scan will be performed.

◆ WifiInitScanAndShow_Serial()

int WifiInitScanAndShow_Serial ( int  portNum = -1,
int  resetPinNum = -1,
int  connectorNum = -1 
)

Initializes the WiFi hardware, initializes the driver using the UART interface, performs an AP scan, and prints the scan results via serial output.

Serial functions pertaining to WiFi are only available for the NBWIFIIN.

Parameters
[in]portNumUART number
[in]resetPinNumpin number to use as an reset signal output to the wifi module.
[in]connectorNumphysical header number of the NetBurner module used.
Returns
the Wifi interface number, if successful. Otherwise, returns NB::Error::GeneralErrors or NB::Error::Init::InitializationErrors

◆ WifiInitScanAndShow_SPI()

int WifiInitScanAndShow_SPI ( int  irqNum = -1,
int  moduleNum = -1,
int  csNum = -1,
int  connectorNum = -1,
int  gpioPinNum = -1,
int  resetPinNum = -1 
)

Initializes the WiFi hardware, initializes the driver using the SPI bus, performs an AP scan, and prints the scan results via serial output.

Parameters
[in]irqNumIRQ signal used to communicate with the WiFi module.
[in]spiModuleNumSPI module number used to communicate with the WiFi module.
[in]csNumChip Select signal used for SPI communication.
[in]connectorNumphysical header number of the NetBurner module used.
[in]csGpioPinNumGPIO pin number to use if not using SPI's chip select signal.
[in]resetPinNumpin number to use as an reset signal output to the wifi module.
Returns
returns the Wifi interface number, if successful. Otherwise, returns NB::Error::GeneralErrors or NB::Error::Init::InitializationErrors

Variable Documentation

◆ wifiDrivers

Wifi* NB::Wifi::wifiDrivers[MAX_WIFI_INTERFACES]
static

Array of WiFi driver objects