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.
Dependencies: X_NUCLEO_IKS01A2 mbed-http
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:
-
func A pointer to a void function, or 0 to set as none
Definition at line 1117 of file SPWFSAxx.cpp.
| void attach | ( | T * | obj, |
| M | method | ||
| ) | [inherited] |
Attach a function to call whenever network state has changed.
- Parameters:
-
obj pointer to the object to call the member function on method pointer to the member function to call
Definition at line 238 of file SPWFSAxx.h.
| bool close | ( | int | id ) | [inherited] |
Closes a socket.
- Parameters:
-
id id 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:
-
ap the name of the AP passPhrase the password of AP securityMode the 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:
-
type the type of socket to open "u" (UDP) or "t" (TCP) id id to get the new socket number, valid 0-7 port port to open connection with addr the 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:
-
id id to receive from data placeholder for returned information amount number of bytes to be received datagram receive 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:
-
ap Pointer to allocated array to store discovered AP limit Size 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_id module id of socket to send to data data to be sent amount amount of data to be sent - max 1024 internal_id driver 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_ms timeout of the connection
Definition at line 1111 of file SPWFSAxx.cpp.
| bool startup | ( | int | mode ) | [inherited] |
Init the SPWFSAxx.
- Parameters:
-
mode mode in which to startup
- Returns:
- true only if SPWFSAxx has started up correctly
Definition at line 59 of file SPWFSAxx.cpp.
Generated on Tue Jul 12 2022 17:09:12 by
1.7.2