Skip to content

Commit 36bd67f

Browse files
committed
update esp32 to support latest changes on master
1 parent b002963 commit 36bd67f

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

src/wifi/AdafruitIO_ESP32.cpp

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,9 @@ AdafruitIO_ESP32::AdafruitIO_ESP32(const char *user, const char *key, const char
1717
{
1818
_ssid = ssid;
1919
_pass = pass;
20-
_client = new WiFiClient;
21-
_mqtt = new Adafruit_MQTT_Client(_client, _host, _port);
22-
}
23-
24-
AdafruitIO_ESP32::AdafruitIO_ESP32(const __FlashStringHelper *user, const __FlashStringHelper *key, const __FlashStringHelper *ssid, const __FlashStringHelper *pass):AdafruitIO(user, key)
25-
{
26-
_ssid = (const char*)ssid;
27-
_pass = (const char*)pass;
28-
_client = new WiFiClient;
29-
_mqtt = new Adafruit_MQTT_Client(_client, _host, _port);
20+
_client = new WiFiClientSecure;
21+
_mqtt = new Adafruit_MQTT_Client(_client, _host, _mqtt_port);
22+
_http = new HttpClient(*_client, _host, _http_port);
3023
}
3124

3225
AdafruitIO_ESP32::~AdafruitIO_ESP32()
@@ -63,4 +56,9 @@ aio_status_t AdafruitIO_ESP32::networkStatus()
6356

6457
}
6558

59+
const char* AdafruitIO_ESP32::connectionType()
60+
{
61+
return "wifi";
62+
}
63+
6664
#endif // ESP32

src/wifi/AdafruitIO_ESP32.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,24 +17,25 @@
1717
#include "Arduino.h"
1818
#include "AdafruitIO.h"
1919
#include <WiFi.h>
20+
#include "WiFiClientSecure.h"
2021
#include "Adafruit_MQTT.h"
2122
#include "Adafruit_MQTT_Client.h"
2223

2324
class AdafruitIO_ESP32 : public AdafruitIO {
2425

2526
public:
2627
AdafruitIO_ESP32(const char *user, const char *key, const char *ssid, const char *pass);
27-
AdafruitIO_ESP32(const __FlashStringHelper *user, const __FlashStringHelper *key, const __FlashStringHelper *ssid, const __FlashStringHelper *pass);
2828
~AdafruitIO_ESP32();
2929

3030
aio_status_t networkStatus();
31+
const char* connectionType();
3132

3233
protected:
3334
void _connect();
3435

3536
const char *_ssid;
3637
const char *_pass;
37-
WiFiClient *_client;
38+
WiFiClientSecure *_client;
3839

3940
};
4041

0 commit comments

Comments
 (0)