Jim Flynn / Mbed OS wifi_Example

Dependencies:   X_NUCLEO_IKS01A2 mbed-http

Embed: (wiki syntax)

« Back to documentation index

SPWFSA01 Class Reference

SPWFSA01 Class Reference

SPWFSA01 Interface class. More...

#include <SPWFSA01.h>

Inherits SPWFSAxx.

Public Member Functions

bool open (const char *type, int *id, const char *addr, int port)
 Open a socketed connection.
nsapi_size_or_error_t scan (WiFiAccessPoint *res, unsigned limit)
 Scan for available networks.
bool startup (int mode)
 Init the SPWFSAxx.
bool connect (const char *ap, const char *passPhrase, int securityMode)
 Connect SPWFSAxx to AP.
bool disconnect (void)
 Disconnect SPWFSAxx from AP.
const char * getIPAddress (void)
 Get the IP address of SPWFSAxx.
const char * getMACAddress (void)
 Get the MAC address of SPWFSAxx.
const char * getGateway (void)
 Get the local gateway.
const char * getNetmask (void)
 Get the local network mask.
int8_t getRssi ()
 Gets the current radio signal strength for active connection.
nsapi_size_or_error_t send (int spwf_id, const void *data, uint32_t amount, int internal_id)
 Sends data to an open socket.
int32_t recv (int id, void *data, uint32_t amount, bool datagram)
 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.
void attach (Callback< void()> func)
 Attach a function to call whenever network state has changed.
template<typename T , typename M >
void attach (T *obj, M method)
 Attach a function to call whenever network state has changed.

Detailed Description

SPWFSA01 Interface class.

This is an interface to a SPWFSA01 module.

Definition at line 32 of file SPWFSA01.h.


Member Function Documentation

void attach ( Callback< void()>  func ) [inherited]

Attach a function to call whenever network state has changed.

Parameters:
funcA pointer to a void function, or 0 to set as none

Definition at line 1117 of file SPWFSAxx.cpp.

void attach ( T *  obj,
method 
) [inherited]

Attach a function to call whenever network state has changed.

Parameters:
objpointer to the object to call the member function on
methodpointer to the member function to call

Definition at line 238 of file SPWFSAxx.h.

bool close ( int  id ) [inherited]

Closes a socket.

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

Definition at line 745 of file SPWFSAxx.cpp.

bool connect ( const char *  ap,
const char *  passPhrase,
int  securityMode 
) [inherited]

Connect SPWFSAxx to AP.

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

Definition at line 309 of file SPWFSAxx.cpp.

bool disconnect ( void   ) [inherited]

Disconnect SPWFSAxx from AP.

Returns:
true only if SPWFSAxx is disconnected successfully

Definition at line 385 of file SPWFSAxx.cpp.

const char * getGateway ( void   ) [inherited]

Get the local gateway.

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

Definition at line 448 of file SPWFSAxx.cpp.

const char * getIPAddress ( void   ) [inherited]

Get the IP address of SPWFSAxx.

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

Definition at line 428 of file SPWFSAxx.cpp.

const char * getMACAddress ( void   ) [inherited]

Get the MAC address of SPWFSAxx.

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

Definition at line 505 of file SPWFSAxx.cpp.

const char * getNetmask ( void   ) [inherited]

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 468 of file SPWFSAxx.cpp.

int8_t getRssi ( void   ) [inherited]

Gets the current radio signal strength for active connection.

Returns:
Connection strength in dBm (negative value)

Definition at line 488 of file SPWFSAxx.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 30 of file SPWFSA01.cpp.

int32_t recv ( int  id,
void *  data,
uint32_t  amount,
bool  datagram 
) [inherited]

Receives data from an open socket.

Recv Function.

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

Definition at line 1125 of file SPWFSAxx.cpp.

int scan ( WiFiAccessPoint *  res,
unsigned  limit 
)

Scan for available networks.

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

Definition at line 257 of file SPWFSA01.cpp.

nsapi_size_or_error_t send ( int  spwf_id,
const void *  data,
uint32_t  amount,
int  internal_id 
) [inherited]

Sends data to an open socket.

Parameters:
spwf_idmodule id of socket to send to
datadata to be sent
amountamount of data to be sent - max 1024
internal_iddriver id of socket to send to
Returns:
number of written bytes on success, negative on failure

Definition at line 530 of file SPWFSAxx.cpp.

void setTimeout ( uint32_t  timeout_ms ) [inherited]

Allows timeout to be changed between commands.

Parameters:
timeout_mstimeout of the connection

Definition at line 1111 of file SPWFSAxx.cpp.

bool startup ( int  mode ) [inherited]

Init the SPWFSAxx.

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

Definition at line 59 of file SPWFSAxx.cpp.