Lauri Pirttiaho / SPWF01SA-lapi-1

Dependencies:   ATParser

Dependents:   X_NUCLEO_IDW01M1v2-lapi-1

Fork of SPWF01SA by ST

Embed: (wiki syntax)

« Back to documentation index

SPWFSA01 Class Reference

SPWFSA01 Class Reference

SPWFSA01Interface class. More...

#include <SPWFSA01.h>

Public Member Functions

bool startup (int mode)
 Init the SPWFSA01.
bool reset (void)
 Reset SPWFSA01.
bool dhcp (int mode)
 Enable/Disable DHCP.
bool connect (const char *ap, const char *passPhrase, int securityMode, int channel)
 Connect SPWFSA01 to AP.
bool disconnect (void)
 Disconnect SPWFSA01 from AP.
int8_t getRSSI (void)
 Get the RSSI of the last packet.
const char * getIPAddress (void)
 Get the IP address of SPWFSA01.
const char * getMACAddress (void)
 Get the MAC address of SPWFSA01.
bool isConnected (void)
 Check if SPWFSA01 is conenected.
bool open (const char *type, int *id, const char *addr, int port)
 Open a socketed connection.
bool send (int id, const void *data, uint32_t amount)
 Sends data to an open socket.
int32_t recv (int id, void *data, uint32_t amount)
 Receives data from an open socket.
bool close (int id)
 Closes a socket.
void setTimeout (uint32_t timeout_ms)
 Allows timeout to be changed between commands.
bool readable ()
 Checks if data is available.
bool writeable ()
 Checks if data can be written.

Detailed Description

SPWFSA01Interface class.

This is an interface to a SPWFSA01 module.

Definition at line 25 of file SPWFSA01.h.


Member Function Documentation

bool close ( int  id )

Closes a socket.

Parameters:
idid of socket to close, valid only 0-4
Returns:
true only if socket is closed successfully

Definition at line 446 of file SPWFSA01.cpp.

bool connect ( const char *  ap,
const char *  passPhrase,
int  securityMode,
int  channel 
)

Connect SPWFSA01 to AP.

Parameters:
apthe name of the AP
passPhrasethe password of AP
securityModethe security mode of AP (WPA/WPA2, WEP, Open)
channelthe WiFi channel number
Returns:
true only if SPWFSA01 is connected successfully

Definition at line 129 of file SPWFSA01.cpp.

bool dhcp ( int  mode )

Enable/Disable DHCP.

Parameters:
modemode of DHCP 2-softAP, 1-on, 0-off
Returns:
true only if SPWFSA01 enables/disables DHCP successfully

Definition at line 211 of file SPWFSA01.cpp.

bool disconnect ( void   )

Disconnect SPWFSA01 from AP.

Returns:
true only if SPWFSA01 is disconnected successfully

Definition at line 190 of file SPWFSA01.cpp.

const char * getIPAddress ( void   )

Get the IP address of SPWFSA01.

Returns:
null-teriminated IP address or null if no IP address is assigned

Definition at line 239 of file SPWFSA01.cpp.

const char * getMACAddress ( void   )

Get the MAC address of SPWFSA01.

Returns:
null-terminated MAC address or null if no MAC address is assigned

Definition at line 255 of file SPWFSA01.cpp.

int8_t getRSSI ( void   )

Get the RSSI of the last packet.

Returns:
the RSSI (dBm)

Definition at line 224 of file SPWFSA01.cpp.

bool isConnected ( void   )

Check if SPWFSA01 is conenected.

Returns:
true only if the chip has an IP address

Definition at line 271 of file SPWFSA01.cpp.

bool open ( const char *  type,
int *  id,
const char *  addr,
int  port 
)

Open a socketed connection.

Parameters:
typethe type of socket to open "u" (UDP) or "t" (TCP)
idid to get the new socket number, valid 0-7
portport to open connection with
addrthe IP address of the destination
Returns:
true only if socket opened successfully

Definition at line 276 of file SPWFSA01.cpp.

bool readable (  )

Checks if data is available.

Definition at line 471 of file SPWFSA01.cpp.

int32_t recv ( int  id,
void *  data,
uint32_t  amount 
)

Receives data from an open socket.

Parameters:
idid to receive from
dataplaceholder for returned information
amountnumber of bytes to be received
Returns:
the number of bytes received

Definition at line 371 of file SPWFSA01.cpp.

bool reset ( void   )

Reset SPWFSA01.

Returns:
true only if SPWFSA01 resets successfully

Definition at line 102 of file SPWFSA01.cpp.

bool send ( int  id,
const void *  data,
uint32_t  amount 
)

Sends data to an open socket.

Parameters:
idid of socket to send to
datadata to be sent
amountamount of data to be sent - max 1024
Returns:
true only if data sent successfully

Definition at line 306 of file SPWFSA01.cpp.

void setTimeout ( uint32_t  timeout_ms )

Allows timeout to be changed between commands.

Parameters:
timeout_mstimeout of the connection

Definition at line 466 of file SPWFSA01.cpp.

bool startup ( int  mode )

Init the SPWFSA01.

Parameters:
modemode in which to startup
Returns:
true only if SPWFSA01 has started up correctly

Definition at line 37 of file SPWFSA01.cpp.

bool writeable (  )

Checks if data can be written.

Definition at line 476 of file SPWFSA01.cpp.