X-NUCLEO-IDW01M1 Wi-Fi expansion board mbed OS 2 ("Classic") library. mbed OS 5 library also available (see below).

Dependencies:   SPWF01SA

Dependents:   SpwfInterface_NSAPI_Testsv2 Nucleo_read_a0_thingspace Nucleo_read_a0_thingspace_mems Cayenne-X-NUCLEO-IDW01M1 ... more

Fork of X_NUCLEO_IDW01M1v2 by ST Expansion SW Team

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 <SpwfInterface.h>

Public Member Functions

 SpwfSAInterface (PinName tx, PinName rx, bool debug)
 SpwfSAInterface constructor.
virtual ~SpwfSAInterface ()
 SpwfSAInterface destructor.
virtual int connect (const char *ssid, const char *pass, nsapi_security_t security=NSAPI_SECURITY_NONE)
 network connect connects to Access Point
virtual int disconnect ()
 network disconnect disconnects from Access Point
virtual const char * get_mac_address ()
 Get the MAC address.
virtual void set_secure_mode (void)
 set secure mode for all the subsequently created sockets
virtual void set_unsecure_mode (void)
 set unsecure mode for all the subsequently created sockets
virtual bool isSecure_mode (void)
 Return the interface security mode set.
virtual int set_time (time_t ctTime)
 set UTC time on wifi module
virtual int get_time (time_t *ctTime)
 get UTC time on wifi module
void debug (const char *string)
 utility debug function for printing to serial terminal
virtual const char * get_ip_address ()
 Get the local IP address.

Protected Member Functions

virtual int socket_open (void **handle, nsapi_protocol_t proto)
 open a socket handle
virtual int socket_close (void *handle)
 close a socket
virtual int socket_bind (void *handle, const SocketAddress &address)
 bind to a port number and address
virtual int socket_listen (void *handle, int backlog)
 start listening on a port and address
virtual int socket_connect (void *handle, const SocketAddress &address)
 connect to a remote socket
virtual int socket_accept (void **handle, void *server)
 accept connections from remote sockets
virtual int socket_send (void *handle, const void *data, unsigned size)
 write to a socket
virtual int socket_recv (void *handle, void *data, unsigned size)
 receive data on a socket
virtual int socket_sendto (void *handle, const SocketAddress &address, const void *data, unsigned size)
 send data to a udp socket
virtual int socket_recvfrom (void *handle, SocketAddress *address, void *buffer, unsigned size)
 receive data on a udp socket
virtual void socket_attach (void *handle, void(*callback)(void *), void *data)
 attach function/callback to the socket Not used
virtual int setsockopt (void *handle, int level, int optname, const void *optval, unsigned optlen)
 Set the socket options Not used.
virtual int getsockopt (void *handle, int level, int optname, void *optval, unsigned *optlen)
 Get the socket options Not used.

Detailed Description

SpwfSAInterface class Implementation of the NetworkStack for the SPWF Device.

Definition at line 49 of file SpwfInterface.h.


Constructor & Destructor Documentation

SpwfSAInterface ( PinName  tx,
PinName  rx,
bool  debug 
)

SpwfSAInterface constructor.

Parameters:
tx,:Pin USART TX rx: Pin USART RX rst: reset pin for Spwf module wkup: reset pin for Spwf module rts: Pin USART RTS debug : not used
Return values:
none

Definition at line 66 of file SpwfInterface.cpp.

~SpwfSAInterface (  ) [virtual]

SpwfSAInterface destructor.

Parameters:
none
Return values:
none

Definition at line 89 of file SpwfInterface.cpp.


Member Function Documentation

int connect ( const char *  ap,
const char *  pass_phrase,
nsapi_security_t  security = NSAPI_SECURITY_NONE 
) [virtual]

network connect connects to Access Point

Parameters:
ap,:Access Point (AP) Name String pass_phrase: Password String for AP security: type of NSAPI security supported
Return values:
NSAPIError Type

Definition at line 116 of file SpwfInterface.cpp.

void debug ( const char *  string )

utility debug function for printing to serial terminal

Parameters:
string,:Pointer to data
Return values:
none

Definition at line 476 of file SpwfInterface.cpp.

int disconnect (  ) [virtual]

network disconnect disconnects from Access Point

Parameters:
none
Return values:
NSAPIError Type

Definition at line 155 of file SpwfInterface.cpp.

const char * get_ip_address (  ) [virtual]

Get the local IP address.

Parameters:
none
Return values:
Null-terminatedrepresentation of the local IP address or null if not yet connected

Definition at line 201 of file SpwfInterface.cpp.

const char * get_mac_address (  ) [virtual]

Get the MAC address.

Parameters:
none
Return values:
Null-terminatedrepresentation of the MAC address or null if not yet connected

Definition at line 212 of file SpwfInterface.cpp.

int get_time ( time_t *  ctTime ) [virtual]

get UTC time on wifi module

Parameters:
timesince epoch in UTC format
Return values:
trueon succes

Definition at line 175 of file SpwfInterface.cpp.

int getsockopt ( void *  handle,
int  level,
int  optname,
void *  optval,
unsigned *  optlen 
) [protected, virtual]

Get the socket options Not used.

Parameters:
handle,:Pointer to handle level: SOL_SOCKET optname: option name optval: pointer to option value optlen: pointer to option length
Return values:
NSAPIError Type

Definition at line 518 of file SpwfInterface.cpp.

bool isSecure_mode ( void   ) [virtual]

Return the interface security mode set.

Parameters:
none
Return values:
trueif secure

Definition at line 267 of file SpwfInterface.cpp.

void set_secure_mode ( void   ) [virtual]

set secure mode for all the subsequently created sockets

Parameters:
none
Return values:
void

Definition at line 247 of file SpwfInterface.cpp.

int set_time ( time_t  ctTime ) [virtual]

set UTC time on wifi module

Parameters:
timesince epoch in UTC format
Return values:
trueon succes

Definition at line 165 of file SpwfInterface.cpp.

void set_unsecure_mode ( void   ) [virtual]

set unsecure mode for all the subsequently created sockets

Parameters:
none
Return values:
void

Definition at line 257 of file SpwfInterface.cpp.

int setsockopt ( void *  handle,
int  level,
int  optname,
const void *  optval,
unsigned  optlen 
) [protected, virtual]

Set the socket options Not used.

Parameters:
handle,:Pointer to handle level: SOL_SOCKET optname: option name optval: pointer to option value optlen: option length
Return values:
NSAPIError Type

< Allow bind to reuse local addresses

< Enables sending of keepalive messages

< Keeps close from returning until queues empty

< Sets send buffer size

< Sets recv buffer size

Definition at line 491 of file SpwfInterface.cpp.

int socket_accept ( void **  handle,
void *  server 
) [protected, virtual]

accept connections from remote sockets

Parameters:
handle,:Pointer to handle of client socket (connecting) proto: handle of server socket which will accept connections
Return values:
NSAPIError Type

Definition at line 339 of file SpwfInterface.cpp.

void socket_attach ( void *  handle,
void(*)(void *)  callback,
void *  data 
) [protected, virtual]

attach function/callback to the socket Not used

Parameters:
handle,:Pointer to handle callback: callback function pointer data: pointer to data
Return values:
none

Definition at line 466 of file SpwfInterface.cpp.

int socket_bind ( void *  handle,
const SocketAddress &  address 
) [protected, virtual]

bind to a port number and address

Parameters:
handle,:Pointer to socket handle proto: address to bind to
Return values:
NSAPIError Type

Definition at line 315 of file SpwfInterface.cpp.

int socket_close ( void *  handle ) [protected, virtual]

close a socket

Parameters:
handle,:Pointer to handle
Return values:
NSAPIError Type

Definition at line 349 of file SpwfInterface.cpp.

int socket_connect ( void *  handle,
const SocketAddress &  addr 
) [protected, virtual]

connect to a remote socket

Parameters:
handle,:Pointer to socket handle addr: Address to connect to
Return values:
NSAPIError Type

Definition at line 278 of file SpwfInterface.cpp.

int socket_listen ( void *  handle,
int  backlog 
) [protected, virtual]

start listening on a port and address

Parameters:
handle,:Pointer to handle backlog: not used (always value is 1)
Return values:
NSAPIError Type

Definition at line 328 of file SpwfInterface.cpp.

int socket_open ( void **  handle,
nsapi_protocol_t  proto 
) [protected, virtual]

open a socket handle

Parameters:
handle,:Pointer to handle proto: TCP/UDP protocol
Return values:
NSAPIError Type

Definition at line 223 of file SpwfInterface.cpp.

int socket_recv ( void *  handle,
void *  data,
unsigned  size 
) [protected, virtual]

receive data on a socket

Parameters:
handle,:Pointer to handle data: pointer to data size: size of data
Return values:
noof bytes read

Definition at line 406 of file SpwfInterface.cpp.

int socket_recvfrom ( void *  handle,
SocketAddress *  addr,
void *  data,
unsigned  size 
) [protected, virtual]

receive data on a udp socket

Parameters:
handle,:Pointer to handle addr: address of udp socket data: pointer to data size: size of data
Return values:
noof bytes read

Definition at line 452 of file SpwfInterface.cpp.

int socket_send ( void *  handle,
const void *  data,
unsigned  size 
) [protected, virtual]

write to a socket

Parameters:
handle,:Pointer to handle data: pointer to data size: size of data
Return values:
noof bytes sent

Definition at line 376 of file SpwfInterface.cpp.

int socket_sendto ( void *  handle,
const SocketAddress &  addr,
const void *  data,
unsigned  size 
) [protected, virtual]

send data to a udp socket

Parameters:
handle,:Pointer to handle addr: address of udp socket data: pointer to data size: size of data
Return values:
noof bytes sent

Definition at line 431 of file SpwfInterface.cpp.