Example of AWS IoT connection and Web Dashboard thru STM32 Nucleo evaluation board and mbed OS.
Dependencies: X_NUCLEO_IKS01A1 mbed FP MQTTPacket DnsQuery ATParser
SPWFSA01 Class Reference
SPWFSA01Interface class. More...
#include <SPWFSA01.h>
Public Member Functions | |
bool | startup (int mode) |
Init the SPWFSA01. | |
bool | reset (void) |
Reset SPWFSA01. | |
bool | dhcp (int mode) |
Enable/Disable DHCP. | |
bool | connect (const char *ap, const char *passPhrase, int securityMode) |
Connect SPWFSA01 to AP. | |
bool | disconnect (void) |
Disconnect SPWFSA01 from AP. | |
const char * | getIPAddress (void) |
Get the IP address of SPWFSA01. | |
const char * | getMACAddress (void) |
Get the MAC address of SPWFSA01. | |
bool | isConnected (void) |
Check if SPWFSA01 is conenected. | |
int | setSocketClientSecurity (uint8_t *tls_mode, uint8_t *root_ca_server, uint8_t *client_cert, uint8_t *client_key, uint8_t *client_domain, uint32_t tls_epoch_time) |
wifi_socket_client_security Set the security certificates and key for secure socket (TLS) | |
bool | open (const char *type, int *id, const char *addr, int port) |
Open a socketed connection. | |
bool | send (int id, const void *data, uint32_t amount) |
Sends data to an open socket. | |
int32_t | recv (int id, void *data, uint32_t amount) |
Receives data from an open socket. | |
bool | close (int id) |
Closes a socket. | |
bool | readable () |
Checks if data is available. | |
bool | writeable () |
Checks if data can be written. | |
void | set_debug (bool state) |
Sets debug mode. |
Detailed Description
SPWFSA01Interface class.
This is an interface to a SPWFSA01 module.
Definition at line 25 of file SPWFSA01.h.
Member Function Documentation
bool close | ( | int | id ) |
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 379 of file SPWFSA01.cpp.
bool connect | ( | const char * | ap, |
const char * | passPhrase, | ||
int | securityMode | ||
) |
Connect SPWFSA01 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 SPWFSA01 is connected successfully
Definition at line 168 of file SPWFSA01.cpp.
bool dhcp | ( | int | mode ) |
Enable/Disable DHCP.
- Parameters:
-
mode mode of DHCP 2-softAP, 1-on, 0-off
- Returns:
- true only if SPWFSA01 enables/disables DHCP successfully
Definition at line 238 of file SPWFSA01.cpp.
bool disconnect | ( | void | ) |
Disconnect SPWFSA01 from AP.
- Returns:
- true only if SPWFSA01 is disconnected successfully
Definition at line 217 of file SPWFSA01.cpp.
const char * getIPAddress | ( | void | ) |
Get the IP address of SPWFSA01.
- Returns:
- null-teriminated IP address or null if no IP address is assigned
Definition at line 251 of file SPWFSA01.cpp.
const char * getMACAddress | ( | void | ) |
Get the MAC address of SPWFSA01.
- Returns:
- null-terminated MAC address or null if no MAC address is assigned
Definition at line 267 of file SPWFSA01.cpp.
bool isConnected | ( | void | ) |
Check if SPWFSA01 is conenected.
- Returns:
- true only if the chip has an IP address
Definition at line 283 of file SPWFSA01.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 288 of file SPWFSA01.cpp.
bool readable | ( | ) |
Checks if data is available.
Definition at line 427 of file SPWFSA01.cpp.
int32_t recv | ( | int | id, |
void * | data, | ||
uint32_t | amount | ||
) |
Receives data from an open socket.
- Parameters:
-
id id to receive from data placeholder for returned information amount number of bytes to be received
- Returns:
- the number of bytes received
Definition at line 338 of file SPWFSA01.cpp.
bool reset | ( | void | ) |
Reset SPWFSA01.
- Returns:
- true only if SPWFSA01 resets successfully
Definition at line 142 of file SPWFSA01.cpp.
bool send | ( | int | id, |
const void * | data, | ||
uint32_t | amount | ||
) |
Sends data to an open socket.
- Parameters:
-
id id of socket to send to data data to be sent amount amount of data to be sent - max 1024
- Returns:
- true only if data sent successfully
Definition at line 319 of file SPWFSA01.cpp.
void set_debug | ( | bool | state ) |
Sets debug mode.
Definition at line 154 of file SPWFSA01.h.
int setSocketClientSecurity | ( | uint8_t * | tls_mode, |
uint8_t * | root_ca_server, | ||
uint8_t * | client_cert, | ||
uint8_t * | client_key, | ||
uint8_t * | client_domain, | ||
uint32_t | tls_epoch_time | ||
) |
wifi_socket_client_security Set the security certificates and key for secure socket (TLS)
- Parameters:
-
None
- Return values:
-
return nonzero in case of error
Definition at line 437 of file SPWFSA01.cpp.
bool startup | ( | int | mode ) |
Init the SPWFSA01.
- Parameters:
-
mode mode in which to startup
- Returns:
- true only if SPWFSA01 has started up correctly
Definition at line 39 of file SPWFSA01.cpp.
bool writeable | ( | ) |
Checks if data can be written.
Definition at line 432 of file SPWFSA01.cpp.
Generated on Wed Jul 13 2022 20:28:49 by 1.7.2