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_IDW01M1_AP_Test
Fork of X_NUCLEO_IDW01M1 by
SpwfSADevice Class Reference
SpwfSADevice class Implementation of the SPWF Device. More...
#include <SpwfSADevice.h>
Public Member Functions | |
| SpwfSADevice (PinName tx, PinName rx, PinName rst, PinName wkup, PinName rts) | |
| SpwfSADevice constructor. | |
| ~SpwfSADevice (void) | |
| SpwfSADevice destructor. | |
| int | init (void) |
| init function initializes timers, gpios, uart | |
| int | connect (char *ssid, char *sec_key, WiFi_Priv_Mode priv_mode) |
| network connect wrapper function for FW | |
| int | start_access_point (char *ssid, char *sec_key, WiFi_Priv_Mode priv_mode, int channel_num, unsigned int data_rates) |
| start the mini access point | |
| int | disconnect (void) |
| network disconnect wrapper function for FW | |
| const char * | getIPAddress () |
| Get the local IP address wrapper function for FW. | |
| const char * | getMACAddress () |
| Get the MAC address wrapper function for FW. | |
| void | network_scan (wifi_scan *scan_result, uint16_t max_scan_number) |
| scan the network | |
| int | socket_client_open (uint8_t *hostname, uint32_t port_number, uint8_t *protocol, uint8_t *sock_id) |
| connect to a remote socket | |
| int | socket_client_write (uint8_t sock_id, uint16_t DataLength, char *pData) |
| write to a remote socket | |
| int | socket_client_recv (uint8_t sock_id, uint16_t RecvLength, char *pData) |
| receive from a remote socket | |
| int | socket_client_close (uint8_t sock_close_id) |
| close a client socket | |
| int | socket_server_open (uint32_t port_number, uint8_t *protocol) |
| open a server socket | |
| int | socket_server_write (uint16_t data_length, char *pdata) |
| write to a server socket | |
| int | socket_server_close (void) |
| close a server socket | |
| void | http_get (uint8_t *hostname, uint8_t *path, uint32_t port_number) |
| HTTP GET from remote host. | |
| void | http_post (uint8_t *url_path) |
| HTTP GET from remote host. | |
| char | spwf_get (void) |
| read a byte from the UART | |
| int | spwf_send (const char *cmd, uint16_t size) |
| write byte(s) to the UART | |
| void | spwf_wakeup (int wake) |
| (re)set the SPWF wakeup GPIO pin | |
| void | spwf_reset (int reset) |
| (re)set the SPWF reset GPIO pin | |
| void | spwf_rts (int rts) |
| (re)set the SPWF RTS GPIO line | |
| void | spwf_attach_irq (wifi_bool attach) |
| attach/remove IRQ handler to UART | |
| int | spwf_read_rts () |
| read the SPWF RTS GPIO pin | |
| void | signal_data_receive (uint8_t socket_id, uint8_t *data_ptr, uint32_t message_size, uint32_t chunk_size) |
| FW callback with data in socket. | |
| void | signal_synch_wait (WiFi_Status_t code) |
| synchronization function called from FW (used for connect,disconnect, ready, etc.) | |
| void | set_wait_for_incoming_client (bool set) |
| (re)set the switch for incoming client (server socket) | |
| bool | get_wait_for_incoming_client () |
| get the switch for incoming client (server socket) | |
| void | debug_print (const char *string) |
| send debug print to serial terminal | |
Detailed Description
SpwfSADevice class Implementation of the SPWF Device.
Definition at line 50 of file SpwfSADevice.h.
Constructor & Destructor Documentation
| SpwfSADevice | ( | PinName | tx, |
| PinName | rx, | ||
| PinName | rst, | ||
| PinName | wkup, | ||
| PinName | rts | ||
| ) |
SpwfSADevice 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
- Return values:
-
none
Definition at line 67 of file SpwfSADevice.cpp.
| ~SpwfSADevice | ( | void | ) |
SpwfSADevice destructor.
- Parameters:
-
none
- Return values:
-
none
Definition at line 85 of file SpwfSADevice.cpp.
Member Function Documentation
| int connect | ( | char * | ssid, |
| char * | sec_key, | ||
| WiFi_Priv_Mode | priv_mode | ||
| ) |
network connect wrapper function for FW
- Parameters:
-
ssid,: Access Point (AP) Name String sec_key: Password String for AP priv_mode: type of security supported (FW mode)
- Return values:
-
NSAPI Error Type
Definition at line 154 of file SpwfSADevice.cpp.
| void debug_print | ( | const char * | string ) |
send debug print to serial terminal
- Parameters:
-
string,: data for debug print
- Return values:
-
none
Definition at line 677 of file SpwfSADevice.cpp.
| int disconnect | ( | void | ) |
network disconnect wrapper function for FW
- Parameters:
-
none
- Return values:
-
error value
Definition at line 242 of file SpwfSADevice.cpp.
| bool get_wait_for_incoming_client | ( | ) |
get the switch for incoming client (server socket)
- Parameters:
-
none
- Return values:
-
boolean
Definition at line 697 of file SpwfSADevice.cpp.
| const char * getIPAddress | ( | ) |
Get the local IP address wrapper function for FW.
- Parameters:
-
none
- Return values:
-
Null-terminated representation of the local IP address or null if not yet connected
Definition at line 262 of file SpwfSADevice.cpp.
| const char * getMACAddress | ( | ) |
Get the MAC address wrapper function for FW.
- Parameters:
-
none
- Return values:
-
Null-terminated representation of the MAC address or null if not yet connected
Definition at line 282 of file SpwfSADevice.cpp.
| void http_get | ( | uint8_t * | hostname, |
| uint8_t * | path, | ||
| uint32_t | port_number | ||
| ) |
HTTP GET from remote host.
- Parameters:
-
hostname,: address of remote host path: path to resource port_number: port number
- Return values:
-
none
Definition at line 408 of file SpwfSADevice.cpp.
| void http_post | ( | uint8_t * | url_path ) |
HTTP GET from remote host.
- Parameters:
-
url_path,: complete url of remote resource
- Return values:
-
none
Definition at line 424 of file SpwfSADevice.cpp.
| int init | ( | void | ) |
init function initializes timers, gpios, uart
- Parameters:
-
none
- Return values:
-
error value
Definition at line 96 of file SpwfSADevice.cpp.
| void network_scan | ( | wifi_scan * | scan_result, |
| uint16_t | max_scan_number | ||
| ) |
scan the network
- Parameters:
-
scan_result,: scan result data pointer max_scan_number: size of the scan result
- Return values:
-
error value
Definition at line 390 of file SpwfSADevice.cpp.
| void set_wait_for_incoming_client | ( | bool | set ) |
(re)set the switch for incoming client (server socket)
- Parameters:
-
set,: boolean to (re)set
- Return values:
-
none
Definition at line 687 of file SpwfSADevice.cpp.
| void signal_data_receive | ( | uint8_t | socket_id, |
| uint8_t * | data_ptr, | ||
| uint32_t | message_size, | ||
| uint32_t | chunk_size | ||
| ) |
FW callback with data in socket.
- Parameters:
-
sock_id,: FW ID of the socket data_ptr: pointer to data from FW message_size: total data to arrive chunk_size: size of the data in this callback (<= message_size)
- Return values:
-
none
Definition at line 443 of file SpwfSADevice.cpp.
| void signal_synch_wait | ( | WiFi_Status_t | code ) |
synchronization function called from FW (used for connect,disconnect, ready, etc.)
- Parameters:
-
code,: Status code value returned
- Return values:
-
none
Definition at line 488 of file SpwfSADevice.cpp.
| int socket_client_close | ( | uint8_t | sock_close_id ) |
close a client socket
- Parameters:
-
sock_close_id,: FW ID of the socket to close
- Return values:
-
error value
Definition at line 507 of file SpwfSADevice.cpp.
| int socket_client_open | ( | uint8_t * | hostname, |
| uint32_t | port_number, | ||
| uint8_t * | protocol, | ||
| uint8_t * | sock_id | ||
| ) |
connect to a remote socket
- Parameters:
-
hostname,: address of socket port_number: port number to connect protocol: TCP/UDP protocol sock_id: pointer to socket ID returned by FW
- Return values:
-
error value
Definition at line 303 of file SpwfSADevice.cpp.
| int socket_client_recv | ( | uint8_t | sock_id, |
| uint16_t | RecvLength, | ||
| char * | pData | ||
| ) |
receive from a remote socket
- Parameters:
-
sock_id,: FW ID of the socket DataLength: size of the data pData: pointer to data
- Return values:
-
error value
Definition at line 346 of file SpwfSADevice.cpp.
| int socket_client_write | ( | uint8_t | sock_id, |
| uint16_t | DataLength, | ||
| char * | pData | ||
| ) |
write to a remote socket
- Parameters:
-
sock_id,: FW ID of the socket DataLength: size of the data pData: pointer to data
- Return values:
-
error value
Definition at line 325 of file SpwfSADevice.cpp.
| int socket_server_close | ( | void | ) |
close a server socket
- Parameters:
-
none (only one server socket supported)
- Return values:
-
error value
Definition at line 565 of file SpwfSADevice.cpp.
| int socket_server_open | ( | uint32_t | port_number, |
| uint8_t * | protocol | ||
| ) |
open a server socket
- Parameters:
-
port_number,: port number to listen on protocol: TCP/UDP protocol
- Return values:
-
error value
Definition at line 527 of file SpwfSADevice.cpp.
| int socket_server_write | ( | uint16_t | data_length, |
| char * | pdata | ||
| ) |
write to a server socket
- Parameters:
-
data_length,: size of the data pdata: pointer to data
- Return values:
-
error value
Definition at line 547 of file SpwfSADevice.cpp.
| void spwf_attach_irq | ( | wifi_bool | attach ) |
attach/remove IRQ handler to UART
- Parameters:
-
attach,: attach/remove boolean
- Return values:
-
none
Definition at line 584 of file SpwfSADevice.cpp.
| char spwf_get | ( | void | ) |
read a byte from the UART
- Parameters:
-
none
- Return values:
-
byte character
Definition at line 627 of file SpwfSADevice.cpp.
| int spwf_read_rts | ( | ) |
read the SPWF RTS GPIO pin
- Parameters:
-
none
- Return values:
-
none
Definition at line 667 of file SpwfSADevice.cpp.
| void spwf_reset | ( | int | reset ) |
(re)set the SPWF reset GPIO pin
- Parameters:
-
reset (re)set value
- Return values:
-
none
Definition at line 647 of file SpwfSADevice.cpp.
| void spwf_rts | ( | int | rts ) |
(re)set the SPWF RTS GPIO line
- Parameters:
-
rts (re)set value
- Return values:
-
none
Definition at line 657 of file SpwfSADevice.cpp.
| int spwf_send | ( | const char * | cmd, |
| uint16_t | size | ||
| ) |
write byte(s) to the UART
- Parameters:
-
cmd,: pointer to data size: size of data
- Return values:
-
error value
Definition at line 602 of file SpwfSADevice.cpp.
| void spwf_wakeup | ( | int | wake ) |
(re)set the SPWF wakeup GPIO pin
- Parameters:
-
wake (re)set value
- Return values:
-
none
Definition at line 637 of file SpwfSADevice.cpp.
| int start_access_point | ( | char * | ssid, |
| char * | sec_key, | ||
| WiFi_Priv_Mode | priv_mode, | ||
| int | channel_num, | ||
| unsigned int | data_rates | ||
| ) |
start the mini access point
- Parameters:
-
ssid,: start with this SSID sec_key,: passphrase for STAtions to connect with priv_mode,: type of security to set up with channel_num,: WiFi channel to use data_rates,: bitmap of operational data rates to support
- Return values:
-
NSAPI Error Type
Definition at line 187 of file SpwfSADevice.cpp.
Generated on Tue Jul 12 2022 12:20:21 by
1.7.2
