MAXREFDES143#: DeepCover Embedded Security in IoT Authenticated Sensing & Notification
Dependencies: MaximInterface mbed
ESP8266 Class Reference
Interface to the ESP8266 Wi-Fi module. More...
#include <ESP8266.hpp>
Data Structures | |
class | CmdBuilder |
Builds command strings for the ESP8266 with proper formatting. More... | |
Public Types | |
enum | CmdResult |
Result of sending an AT command. More... | |
enum | WifiMode |
ESP8266 Wi-Fi mode. More... | |
enum | ConnType |
Connection type. More... | |
Public Member Functions | |
ESP8266 (const PinName tx, const PinName rx, const PinName rst, const PinName CH_PD, const int baud, mbed::Serial *debugMsgIntf=NULL) | |
void | reset () |
Reset the ESP8266 via the hardware reset pin. | |
CmdResult | performSelfTest () |
Perform a self-test on the ESP8266. | |
CmdResult | setCurrentWifiMode (const WifiMode mode) |
Set the current Wi-Fi mode. | |
CmdResult | joinCurrentAccessPoint (const std::string &ssid, const std::string &pwd, const std::string &bssid="") |
Join a Wi-Fi access point. | |
CmdResult | quitAccessPoint () |
Quit the current access point. | |
CmdResult | setMaxRFTXPower (const float power_dBm) |
Set the maximum WiFi tranmission power. | |
CmdResult | ping (const std::string &IP) |
Ping a host via the current access point. | |
CmdResult | openConnection (const ConnType type, const std::string &remoteIP, const unsigned int remotePort) |
Open a connection to a host via the current access point. | |
CmdResult | closeConnection () |
Close the connection to the current host. | |
CmdResult | sendData (const std::string &data) |
Send data to the currently connected host. | |
CmdResult | sendCommand (const CmdBuilder &cmd) |
Send an AT command to the ESP8266. | |
bool | recvIpDataReadable () |
Check if received IP data is available in the buffer. | |
char | getcRecvIpData () |
Get the next character of received IP data from the buffer. | |
void | clearRecvData () |
Clear all received data from the buffer. | |
bool | powered () const |
Static Public Attributes | |
static const int | sendDataRecoveryTimeMs = 1000 |
Recovery time between Send Data operation as specified by datasheet. |
Detailed Description
Interface to the ESP8266 Wi-Fi module.
Definition at line 44 of file ESP8266.hpp.
Member Enumeration Documentation
enum CmdResult |
Result of sending an AT command.
Definition at line 47 of file ESP8266.hpp.
enum ConnType |
Connection type.
Definition at line 59 of file ESP8266.hpp.
enum WifiMode |
ESP8266 Wi-Fi mode.
Definition at line 56 of file ESP8266.hpp.
Constructor & Destructor Documentation
ESP8266 | ( | const PinName | tx, |
const PinName | rx, | ||
const PinName | rst, | ||
const PinName | CH_PD, | ||
const int | baud, | ||
mbed::Serial * | debugMsgIntf = NULL |
||
) |
Member Function Documentation
void clearRecvData | ( | ) |
Clear all received data from the buffer.
Definition at line 177 of file ESP8266.cpp.
ESP8266::CmdResult closeConnection | ( | ) |
Close the connection to the current host.
Definition at line 134 of file ESP8266.cpp.
char getcRecvIpData | ( | ) |
Get the next character of received IP data from the buffer.
Definition at line 163 of file ESP8266.cpp.
ESP8266::CmdResult joinCurrentAccessPoint | ( | const std::string & | ssid, |
const std::string & | pwd, | ||
const std::string & | bssid = "" |
||
) |
Join a Wi-Fi access point.
- Parameters:
-
ssid Network SSID to connect to. pwd Network password. bssid Optional network BSSID.
Definition at line 91 of file ESP8266.cpp.
ESP8266::CmdResult openConnection | ( | const ConnType | type, |
const std::string & | remoteIP, | ||
const unsigned int | remotePort | ||
) |
Open a connection to a host via the current access point.
- Parameters:
-
type TCP or UPD connection. remoteIP IP address or resolvable hostname to connect to. remotePort Port on the host to connect to.
Definition at line 124 of file ESP8266.cpp.
ESP8266::CmdResult performSelfTest | ( | ) |
Perform a self-test on the ESP8266.
Definition at line 81 of file ESP8266.cpp.
ESP8266::CmdResult ping | ( | const std::string & | IP ) |
Ping a host via the current access point.
- Parameters:
-
IP IP address or resolvable hostname.
Definition at line 118 of file ESP8266.cpp.
bool powered | ( | ) | const |
Control if the ESP8266 is powered via the hardware power-down pin.
Definition at line 66 of file ESP8266.cpp.
ESP8266::CmdResult quitAccessPoint | ( | ) |
Quit the current access point.
Definition at line 102 of file ESP8266.cpp.
bool recvIpDataReadable | ( | ) |
Check if received IP data is available in the buffer.
- Note:
- Allow some processing delay to happen between calls to this function.
- Returns:
- True if data is available.
Definition at line 151 of file ESP8266.cpp.
void reset | ( | ) |
Reset the ESP8266 via the hardware reset pin.
Definition at line 57 of file ESP8266.cpp.
ESP8266::CmdResult sendCommand | ( | const CmdBuilder & | cmd ) |
Send an AT command to the ESP8266.
- Parameters:
-
cmd Formatted command to send.
Definition at line 147 of file ESP8266.cpp.
ESP8266::CmdResult sendData | ( | const std::string & | data ) |
Send data to the currently connected host.
- Parameters:
-
data May be in text or binary form.
Definition at line 138 of file ESP8266.cpp.
ESP8266::CmdResult setCurrentWifiMode | ( | const WifiMode | mode ) |
Set the current Wi-Fi mode.
Definition at line 85 of file ESP8266.cpp.
ESP8266::CmdResult setMaxRFTXPower | ( | const float | power_dBm ) |
Set the maximum WiFi tranmission power.
- Parameters:
-
power_dBm Power in dBm valid from 0 to 20.5 in 0.25 dBm increments.
Definition at line 106 of file ESP8266.cpp.
Field Documentation
const int sendDataRecoveryTimeMs = 1000 [static] |
Recovery time between Send Data operation as specified by datasheet.
Definition at line 62 of file ESP8266.hpp.
Generated on Wed Jul 13 2022 21:31:03 by 1.7.2