Simple IoT Board用のライブラリです。 ESP8266ライブラリの軽量化 送信のみのソフトシリアルライブラリを含んでいます。
Dependents: SITB_HttpGetSample SITB_IFTTTSample SITB_INA226PRC AmbientExampleSITB ... more
ESP8266 Class Reference
#include <ESP8266.h>
Inherited by ESP8266Interface.
Public Member Functions | |
ESP8266 (PinName tx, PinName rx, PinName reset, const char *ssid, const char *phrase, uint32_t baud) | |
Constructor. | |
bool | join () |
Connect the wifi module to the ssid contained in the constructor. | |
bool | connect () |
Same as Join: connect to the ssid and get DHCP settings. | |
bool | is_connected () |
Check connection to the access point. | |
bool | disconnect () |
Disconnect the ESP8266 module from the access point. | |
bool | close () |
Close a connection. | |
char * | getIPAddress () |
Return the IP address. | |
bool | gethostbyname (const char *host, char *ip) |
Return the IP address from host name. | |
void | reset () |
Reset the wifi module. | |
bool | reboot () |
Reboot the wifi module. | |
int | readable () |
Check if characters are available. | |
int | writeable () |
Check if characters are available. | |
char | getc () |
Read a character. | |
int | putc (char c) |
Write a character. | |
void | flush () |
Flush the buffer. | |
bool | sendCommand (const char *cmd, const char *ack=NULL, char *res=NULL, int timeout=DEFAULT_WAIT_RESP_TIMEOUT) |
Send a command to the wifi module. | |
int | send (const char *buf, int len) |
Send a string to the wifi module by serial port. |
Detailed Description
The ESP8266 class.
Definition at line 41 of file ESP8266.h.
Constructor & Destructor Documentation
ESP8266 | ( | PinName | tx, |
PinName | rx, | ||
PinName | reset, | ||
const char * | ssid, | ||
const char * | phrase, | ||
uint32_t | baud | ||
) |
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 () ssid ssid of the network phrase WEP, WPA or WPA2 key baud the baudrate of the serial connection
Definition at line 52 of file ESP8266.cpp.
Member Function Documentation
bool close | ( | ) |
bool connect | ( | ) |
Same as Join: connect to the ssid and get DHCP settings.
- Returns:
- true if successful
Reimplemented in ESP8266Interface.
Definition at line 85 of file ESP8266.cpp.
bool disconnect | ( | ) |
Disconnect the ESP8266 module from the access point.
- Returns:
- true if successful
Reimplemented in ESP8266Interface.
Definition at line 202 of file ESP8266.cpp.
void flush | ( | ) |
Flush the buffer.
Definition at line 384 of file ESP8266.cpp.
char getc | ( | ) |
bool gethostbyname | ( | const char * | host, |
char * | ip | ||
) |
Return the IP address from host name.
- Returns:
- true on success, false on failure
Definition at line 292 of file ESP8266.cpp.
char * getIPAddress | ( | ) |
Return the IP address.
- Returns:
- IP address as a string
Reimplemented in ESP8266Interface.
Definition at line 260 of file ESP8266.cpp.
bool is_connected | ( | ) |
Check connection to the access point.
- Returns:
- true if successful
Definition at line 91 of file ESP8266.cpp.
bool join | ( | ) |
Connect the wifi module to the ssid contained in the constructor.
- Returns:
- true if connected, false otherwise
Definition at line 70 of file ESP8266.cpp.
int putc | ( | char | c ) |
Write a character.
- Parameters:
-
the character which will be written
Definition at line 378 of file ESP8266.cpp.
int readable | ( | ) |
Check if characters are available.
- Returns:
- number of available characters
Definition at line 360 of file ESP8266.cpp.
bool reboot | ( | ) |
Reboot the wifi module.
Definition at line 333 of file ESP8266.cpp.
void reset | ( | ) |
Reset the wifi module.
Definition at line 317 of file ESP8266.cpp.
int send | ( | const char * | buf, |
int | len | ||
) |
Send a string to the wifi module by serial port.
This function desactivates the user interrupt handler when a character is received to analyze the response from the wifi module. Useful to send a command to the module and wait a response.
- Parameters:
-
str string to be sent len string length ACK string which must be acknowledge by the wifi module. If ACK == NULL, no string has to be acknoledged. (default: "NO") res this field will contain the response from the wifi module, result of a command sent. This field is available only if ACK = "NO" AND res != NULL (default: NULL)
- Returns:
- true if ACK has been found in the response from the wifi module. False otherwise or if there is no response in 5s.
Definition at line 389 of file ESP8266.cpp.
bool sendCommand | ( | const char * | cmd, |
const char * | ack = NULL , |
||
char * | res = NULL , |
||
int | timeout = DEFAULT_WAIT_RESP_TIMEOUT |
||
) |
Send a command to the wifi module.
Check if the module is in command mode. If not enter in command mode
- Parameters:
-
str string to be sent ACK string which must be acknowledge by the wifi module. If ACK == NULL, no string has to be acknowledged. (default: "NO") res this field will contain the response from the wifi module, result of a command sent. This field is available only if ACK = "NO" AND res != NULL (default: NULL)
- Returns:
- true if successful
Definition at line 402 of file ESP8266.cpp.
int writeable | ( | ) |
Check if characters are available.
- Returns:
- number of available characters
Definition at line 365 of file ESP8266.cpp.
Generated on Tue Jul 12 2022 18:13:35 by 1.7.2