ST / X_NUCLEO_IDW01M1

Dependents:   SpwfInterface_NSAPI_Tests HelloWorld_IDW01M1

Fork of X_NUCLEO_IDW01M1 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, PinName rst, PinName wkup, PinName rts, bool debug=false)
 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.
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

Detailed Description

SpwfSAInterface class Implementation of the NetworkStack for the SPWF Device.

Definition at line 50 of file SPWFInterface.h.


Constructor & Destructor Documentation

SpwfSAInterface ( PinName  tx,
PinName  rx,
PinName  rst,
PinName  wkup,
PinName  rts,
bool  debug = false 
)

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 65 of file SPWFInterface.cpp.

~SpwfSAInterface (  ) [virtual]

SpwfSAInterface destructor.

Parameters:
none
Return values:
none

Definition at line 78 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 102 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 442 of file SPWFInterface.cpp.

int disconnect ( void   ) [virtual]

network disconnect disconnects from Access Point

Parameters:
none
Return values:
NSAPIError Type

Definition at line 146 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 157 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 168 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 275 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 432 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 233 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 311 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 202 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 246 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 179 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 373 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 418 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 346 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 397 of file SPWFInterface.cpp.