Jim Flynn / Mbed OS wifi_Example

Dependencies:   X_NUCLEO_IKS01A2 mbed-http

Embed: (wiki syntax)

« Back to documentation index

SpwfSAInterface Class Reference

SpwfSAInterface Class Reference

SpwfSAInterface class Implementation of the NetworkStack for the SPWF Device. More...

#include <SpwfSAInterface.h>

Public Member Functions

 SpwfSAInterface (PinName tx=MBED_CONF_IDW0XX1_TX, PinName rx=MBED_CONF_IDW0XX1_RX, PinName rts=SPWFSAXX_RTS_PIN, PinName cts=SPWFSAXX_CTS_PIN, bool debug=false, PinName wakeup=SPWFSAXX_WAKEUP_PIN, PinName reset=SPWFSAXX_RESET_PIN)
 SpwfSAInterface constructor.
virtual nsapi_error_t connect ()
 Start the interface.
virtual nsapi_error_t connect (const char *ssid, const char *pass, nsapi_security_t security=NSAPI_SECURITY_NONE, uint8_t channel=0)
 Start the interface.
virtual nsapi_error_t set_credentials (const char *ssid, const char *pass, nsapi_security_t security=NSAPI_SECURITY_NONE)
 Set the WiFi network credentials.
virtual nsapi_error_t set_channel (uint8_t channel)
 Set the WiFi network channel - NOT SUPPORTED.
virtual nsapi_error_t disconnect ()
 Stop the interface.
virtual const char * get_ip_address ()
 Get the internally stored IP address.
virtual const char * get_mac_address ()
 Get the internally stored MAC address.
virtual const char * get_gateway ()
 Get the local gateway.
virtual const char * get_netmask ()
 Get the local network mask.
virtual int8_t get_rssi ()
 Gets the current radio signal strength for active connection.
virtual nsapi_size_or_error_t scan (WiFiAccessPoint *res, unsigned count)
 Scan for available networks.

Friends

class SPWFSAxx
class SPWFSA01
class SPWFSA04

Detailed Description

SpwfSAInterface class Implementation of the NetworkStack for the SPWF Device.

Definition at line 73 of file SpwfSAInterface.h.


Constructor & Destructor Documentation

SpwfSAInterface ( PinName  tx = MBED_CONF_IDW0XX1_TX,
PinName  rx = MBED_CONF_IDW0XX1_RX,
PinName  rts = SPWFSAXX_RTS_PIN,
PinName  cts = SPWFSAXX_CTS_PIN,
bool  debug = false,
PinName  wakeup = SPWFSAXX_WAKEUP_PIN,
PinName  reset = SPWFSAXX_RESET_PIN 
)

SpwfSAInterface constructor.

Parameters:
txTX pin
rxRX pin
rtsRTS pin
ctsCTS pin
debugEnable debugging
wakeupWakeup pin
resetReset pin

Definition at line 47 of file SpwfSAInterface.cpp.


Member Function Documentation

nsapi_error_t connect ( void   ) [virtual]

Start the interface.

Attempts to connect to a WiFi network. Requires ssid and passphrase to be set. If passphrase is invalid, NSAPI_ERROR_AUTH_ERROR is returned.

Returns:
0 on success, negative error code on failure

Definition at line 67 of file SpwfSAInterface.cpp.

nsapi_error_t connect ( const char *  ssid,
const char *  pass,
nsapi_security_t  security = NSAPI_SECURITY_NONE,
uint8_t  channel = 0 
) [virtual]

Start the interface.

Attempts to connect to a WiFi network.

Parameters:
ssidName of the network to connect to
passSecurity passphrase to connect to the network
securityType of encryption for connection (Default: NSAPI_SECURITY_NONE)
channelThis parameter is not supported, setting it to anything else than 0 will result in NSAPI_ERROR_UNSUPPORTED
Returns:
0 on success, or error code on failure

Definition at line 125 of file SpwfSAInterface.cpp.

nsapi_error_t disconnect ( void   ) [virtual]

Stop the interface.

Returns:
`NSAPI_ERROR_OK` on success, negative on failure

Definition at line 141 of file SpwfSAInterface.cpp.

const char * get_gateway ( void   ) [virtual]

Get the local gateway.

Returns:
Null-terminated representation of the local gateway or null if no network mask has been received

Definition at line 170 of file SpwfSAInterface.cpp.

const char * get_ip_address ( void   ) [virtual]

Get the internally stored IP address.

Returns:
IP address of the interface or null if not yet connected

Definition at line 154 of file SpwfSAInterface.cpp.

const char * get_mac_address ( void   ) [virtual]

Get the internally stored MAC address.

Returns:
MAC address of the interface

Definition at line 162 of file SpwfSAInterface.cpp.

const char * get_netmask ( void   ) [virtual]

Get the local network mask.

Returns:
Null-terminated representation of the local network mask or null if no network mask has been received

Definition at line 180 of file SpwfSAInterface.cpp.

int8_t get_rssi ( void   ) [virtual]

Gets the current radio signal strength for active connection.

Returns:
Connection strength in dBm (negative value)

Definition at line 449 of file SpwfSAInterface.cpp.

nsapi_size_or_error_t scan ( WiFiAccessPoint *  res,
unsigned  count 
) [virtual]

Scan for available networks.

This function will block. If the count is 0, function will only return count of available networks, so that user can allocated necessary memory. If the is grater than 0 and the ap is not NULL it'll be populated with discovered networks up to value of count.

Parameters:
resPointer to allocated array to store discovered AP
countSize of allocated res array, or 0 to only count available AP
Returns:
Number of entries in , or if count was 0 number of available networks, negative on error see nsapi_error

Definition at line 459 of file SpwfSAInterface.cpp.

nsapi_error_t set_channel ( uint8_t  channel ) [virtual]

Set the WiFi network channel - NOT SUPPORTED.

This function is not supported and will return NSAPI_ERROR_UNSUPPORTED

Parameters:
channelChannel on which the connection is to be made, or 0 for any (Default: 0)
Returns:
Not supported, returns NSAPI_ERROR_UNSUPPORTED

Definition at line 444 of file SpwfSAInterface.cpp.

nsapi_error_t set_credentials ( const char *  ssid,
const char *  pass,
nsapi_security_t  security = NSAPI_SECURITY_NONE 
) [virtual]

Set the WiFi network credentials.

Parameters:
ssidName of the network to connect to
passSecurity passphrase to connect to the network
securityType of encryption for connection (defaults to NSAPI_SECURITY_NONE)
Returns:
0 on success, or error code on failure

Definition at line 415 of file SpwfSAInterface.cpp.