now this shit works
Fork of ESP8266NodeMCUInterface by
ESP8266Interface Class Reference
Interface using ESP8266 to connect to an IP-based network. More...
#include <ESP8266Interface.h>
Inherits ESP8266.
Public Member Functions | |
ESP8266Interface (PinName tx, PinName rx, PinName reset, int baud=9600, int timeout=3000) | |
Constructor. | |
bool | init () |
Initialize the wifi hardware. | |
bool | connect (const char *ssid, const char *phrase) |
Connect the wifi module to the specified ssid. | |
int | disconnect () |
Disconnect the ESP8266 module from the access point. | |
const char * | getIPAddress () |
Get IP address. | |
bool | is_connected () |
Check connection to the access point. | |
bool | close () |
Close a connection. | |
int | getc () |
Read a character or block. | |
int | putc (char c) |
Write a character. | |
bool | send (const char *buffer, int len) |
Write a string. | |
bool | recv (char *buffer, int *len) |
Read a string without blocking. | |
int | writeable () |
Check if wifi is writable. | |
int | readable () |
Check if wifi is readable. | |
bool | getHostByName (const char *host, char *ip) |
Return the IP address from host name. | |
bool | reset () |
Reset the wifi module. | |
bool | command (const char *cmd) |
Send part of a command to the wifi module. | |
Static Public Member Functions | |
static ESP8266 * | getInstance () |
Obtains the current instance of the ESP8266. |
Detailed Description
Interface using ESP8266 to connect to an IP-based network.
Definition at line 29 of file ESP8266Interface.h.
Constructor & Destructor Documentation
ESP8266Interface | ( | PinName | tx, |
PinName | rx, | ||
PinName | reset, | ||
int | baud = 9600 , |
||
int | timeout = 3000 |
||
) |
Constructor.
- Parameters:
-
tx mbed pin to use for tx line of Serial interface rx mbed pin to use for rx line of Serial interface reset reset pin of the wifi module () baud the baudrate of the serial connection timeout the timeout of the serial connection
Definition at line 3 of file ESP8266Interface.cpp.
Member Function Documentation
bool close | ( | ) | [inherited] |
bool command | ( | const char * | cmd ) | [inherited] |
Send part of a command to the wifi module.
- Parameters:
-
cmd string to be sent len optional length of cmd sanitize flag indicating if cmd is actually payload and needs to be escaped
- Returns:
- true if successful
Definition at line 402 of file ESP8266.cpp.
bool connect | ( | const char * | ssid, |
const char * | phrase | ||
) |
Connect the wifi module to the specified ssid.
- Parameters:
-
ssid ssid of the network phrase WEP, WPA or WPA2 key
- Returns:
- true if successful
Reimplemented from ESP8266.
Definition at line 12 of file ESP8266Interface.cpp.
int disconnect | ( | ) |
Disconnect the ESP8266 module from the access point.
- Returns:
- true if successful
Reimplemented from ESP8266.
Definition at line 16 of file ESP8266Interface.cpp.
int getc | ( | ) | [inherited] |
Read a character or block.
- Returns:
- the character read or -1 on error
Definition at line 275 of file ESP8266.cpp.
bool getHostByName | ( | const char * | host, |
char * | ip | ||
) | [inherited] |
Return the IP address from host name.
- Returns:
- true on success, false on failure
Definition at line 314 of file ESP8266.cpp.
static ESP8266* getInstance | ( | ) | [static, inherited] |
const char * getIPAddress | ( | ) |
Get IP address.
- Returns:
- Either a pointer to the internally stored IP address or null if not connected
Reimplemented from ESP8266.
Definition at line 20 of file ESP8266Interface.cpp.
bool init | ( | ) |
Initialize the wifi hardware.
- Returns:
- true if successful
Reimplemented from ESP8266.
Definition at line 8 of file ESP8266Interface.cpp.
bool is_connected | ( | ) | [inherited] |
Check connection to the access point.
- Returns:
- true if successful
Definition at line 133 of file ESP8266.cpp.
int putc | ( | char | c ) | [inherited] |
Write a character.
- Parameters:
-
the character which will be written
- Returns:
- -1 on error
Definition at line 269 of file ESP8266.cpp.
int readable | ( | ) | [inherited] |
Check if wifi is readable.
- Returns:
- number of characters available
Definition at line 296 of file ESP8266.cpp.
bool recv | ( | char * | buffer, |
int * | len | ||
) | [inherited] |
Read a string without blocking.
- Parameters:
-
buffer the buffer that will be written len the length of the buffer, is replaced by read length
- Returns:
- true on success
Definition at line 226 of file ESP8266.cpp.
bool reset | ( | ) | [inherited] |
Reset the wifi module.
Definition at line 56 of file ESP8266.cpp.
bool send | ( | const char * | buffer, |
int | len | ||
) | [inherited] |
Write a string.
- Parameters:
-
buffer the buffer that will be written len the length of the buffer
- Returns:
- true on success
Definition at line 202 of file ESP8266.cpp.
int writeable | ( | ) | [inherited] |
Check if wifi is writable.
- Returns:
- 1 if wifi is writable
Definition at line 291 of file ESP8266.cpp.
Generated on Thu Jul 14 2022 16:33:07 by 1.7.2