Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: x-nucleo-iks01a1-test x-nucleo-iks01a1-test
Fork of X_NUCLEO_IDW01M1v2 by
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=false) | |
| SpwfSAInterface constructor. | |
| virtual | ~SpwfSAInterface () |
| SpwfSAInterface destructor. | |
| virtual nsapi_error_t | connect (const char *ssid, const char *pass, nsapi_security_t security=NSAPI_SECURITY_NONE, uint8_t channel=0) |
| network connect connects to Access Point | |
| virtual int8_t | get_rssi () |
| Get the RSSI of the last packet. | |
| 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 nsapi_error_t | socket_accept (nsapi_socket_t server, nsapi_socket_t *handle, SocketAddress *address=0) |
| 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 48 of file SpwfInterface.h.
Constructor & Destructor Documentation
| SpwfSAInterface | ( | PinName | tx, |
| PinName | rx, | ||
| 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 66 of file SpwfInterface.cpp.
| ~SpwfSAInterface | ( | ) | [virtual] |
SpwfSAInterface destructor.
- Parameters:
-
none
- Return values:
-
none
Definition at line 79 of file SpwfInterface.cpp.
Member Function Documentation
| nsapi_error_t connect | ( | const char * | ap, |
| const char * | pass_phrase, | ||
| nsapi_security_t | security = NSAPI_SECURITY_NONE, |
||
| uint8_t | channel = 0 |
||
| ) | [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 channel: the WiFi channel number
- Return values:
-
NSAPI Error Type
Definition at line 127 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 428 of file SpwfInterface.cpp.
| int disconnect | ( | ) | [virtual] |
network disconnect disconnects from Access Point
- Parameters:
-
none
- Return values:
-
NSAPI Error Type
Definition at line 173 of file SpwfInterface.cpp.
| const char * get_ip_address | ( | ) | [virtual] |
Get the local IP address.
- Parameters:
-
none
- Return values:
-
Null-terminated representation of the local IP address or null if not yet connected
Definition at line 184 of file SpwfInterface.cpp.
| const char * get_mac_address | ( | ) | [virtual] |
Get the MAC address.
- Parameters:
-
none
- Return values:
-
Null-terminated representation of the MAC address or null if not yet connected
Definition at line 195 of file SpwfInterface.cpp.
| int8_t get_rssi | ( | ) | [virtual] |
Get the RSSI of the last packet.
- Parameters:
-
none
- Return values:
-
RSSI of the last packet (dBm)
Definition at line 88 of file SpwfInterface.cpp.
| nsapi_error_t socket_accept | ( | nsapi_socket_t | server, |
| nsapi_socket_t * | handle, | ||
| SocketAddress * | address = 0 |
||
| ) | [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:
-
NSAPI Error Type
Definition at line 286 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 418 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:
-
NSAPI Error Type
Definition at line 262 of file SpwfInterface.cpp.
| int socket_close | ( | void * | handle ) | [protected, virtual] |
close a socket
- Parameters:
-
handle,: Pointer to handle
- Return values:
-
NSAPI Error Type
Definition at line 297 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:
-
NSAPI Error Type
Definition at line 229 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:
-
NSAPI Error Type
Definition at line 275 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:
-
NSAPI Error Type
Definition at line 206 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:
-
no of bytes read
Definition at line 355 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:
-
no of bytes read
Definition at line 404 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:
-
no of bytes sent
Definition at line 325 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:
-
no of bytes sent
Definition at line 383 of file SpwfInterface.cpp.
Generated on Wed Jul 13 2022 01:04:28 by
1.7.2
