Advantech / Mbed OS pelion-example-common
Embed: (wiki syntax)

« Back to documentation index

SPWFSAxx Class Reference

SPWFSAxx Class Reference

SPWFSAxx Interface class. More...

#include <SPWFSAxx.h>

Inherited by SPWFSA01, and SPWFSA04.

Public Member Functions

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.

Friends

class SPWFSA01
class SPWFSA04
class SpwfSAInterface

Detailed Description

SPWFSAxx Interface class.

This is an interface to a SPWFSAxx module.

Definition at line 119 of file SPWFSAxx.h.


Member Function Documentation

void attach ( Callback< void()>  func )

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 
)

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 )

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 
)

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   )

Disconnect SPWFSAxx from AP.

Returns:
true only if SPWFSAxx is disconnected successfully

Definition at line 385 of file SPWFSAxx.cpp.

const char * getGateway ( void   )

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   )

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   )

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   )

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   )

Gets the current radio signal strength for active connection.

Returns:
Connection strength in dBm (negative value)

Definition at line 488 of file SPWFSAxx.cpp.

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

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.

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

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 )

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 )

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.