Initial commit for adding WiFiManager compatibilty for ESP8266

This commit is contained in:
bradrblack 2022-08-17 19:19:27 -04:00
parent 848e3eafd3
commit 75ac996cd1
2 changed files with 19 additions and 0 deletions

View file

@ -31,6 +31,21 @@ AdafruitIO_ESP8266::AdafruitIO_ESP8266(const char *user, const char *key,
_http = new HttpClient(*_client, _host, _http_port);
}
AdafruitIO_ESP8266::AdafruitIO_ESP8266(const char *user, const char *key)
: AdafruitIO(user, key) {
_ssid = NULL;
_pass = NULL;
// Uncomment the following lines and remove the existing WiFiClient and MQTT
// client constructors to use Secure MQTT with ESP8266.
// _client = new WiFiClientSecure;
// _client->setFingerprint(AIO_SSL_FINGERPRINT);
// _mqtt = new Adafruit_MQTT_Client(_client, _host, _mqtt_port);
_client = new WiFiClient;
_mqtt = new Adafruit_MQTT_Client(_client, _host, 1883);
_http = new HttpClient(*_client, _host, _http_port);
}
AdafruitIO_ESP8266::~AdafruitIO_ESP8266() {
if (_client)
delete _client;
@ -39,6 +54,7 @@ AdafruitIO_ESP8266::~AdafruitIO_ESP8266() {
}
void AdafruitIO_ESP8266::_connect() {
if (_ssid != NULL) {
if (strlen(_ssid) == 0) {
_status = AIO_SSID_INVALID;
} else {
@ -49,6 +65,7 @@ void AdafruitIO_ESP8266::_connect() {
_status = AIO_NET_DISCONNECTED;
}
}
}
/**************************************************************************/
/*!

View file

@ -39,6 +39,8 @@ class AdafruitIO_ESP8266 : public AdafruitIO {
public:
AdafruitIO_ESP8266(const char *user, const char *key, const char *ssid,
const char *pass);
AdafruitIO_ESP8266(const char *user, const char *key);
~AdafruitIO_ESP8266();
aio_status_t networkStatus();