Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion extras/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ include(FetchContent)
FetchContent_Declare(
googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG release-1.10.0
GIT_TAG origin/master
)

FetchContent_GetProperties(googletest)
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ sentence=Library enables you to connect the device to the SUPLA automation syste
paragraph=It provides easy interface for adding various sensors, relays, buttons, roller shutters, etc. that can be controlled via SUPLA Cloud and application on mobile device.
url=https://github.com/SUPLA/supla-arduino
architectures=avr,esp32,esp8266
version=2.3.4
version=2.3.5
dependencies=
core-dependencies=arduino (>=1.5.0)
category=Communication
4 changes: 2 additions & 2 deletions src/SuplaDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ bool SuplaDeviceClass::begin(unsigned char version) {

if (strnlen(Supla::Channel::reg_dev.SoftVer, SUPLA_SOFTVER_MAXSIZE) == 0) {
setString(Supla::Channel::reg_dev.SoftVer,
"User SW, lib 2.3.4",
"User SW, lib 2.3.5",
SUPLA_SOFTVER_MAXSIZE);
}

Expand Down Expand Up @@ -247,7 +247,7 @@ void SuplaDeviceClass::iterate(void) {
if (!isInitialized(false)) return;

unsigned long _millis = millis();
unsigned long timeDiff = abs(_millis - lastIterateTime);
unsigned long timeDiff = _millis - lastIterateTime;

uptime.iterate(_millis);

Expand Down
2 changes: 2 additions & 0 deletions src/SuplaDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,9 @@ class SuplaDeviceClass {

bool begin(unsigned char version = 12);

// Use ASCII only in name
void setName(const char *Name);

void setGUID(char GUID[SUPLA_GUID_SIZE]);
void setAuthKey(char authkey[SUPLA_AUTHKEY_SIZE]);
void setEmail(const char *email);
Expand Down
34 changes: 9 additions & 25 deletions src/supla/network/esp_wifi.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ class ESPWifi : public Supla::Network {
setSsid(wifiSsid);
setPassword(wifiPassword);
#ifdef ARDUINO_ARCH_ESP32
enableSSL(
false); // current ESP32 WiFiClientSecure does not suport "setInsecure"
enableSSL(false); // ESP32 WiFiClientSecure does not suport "setInsecure"
#endif
}

Expand Down Expand Up @@ -96,22 +95,19 @@ class ESPWifi : public Supla::Network {
if (client == NULL) {
if (isSecured) {
message = "Secured connection";
client = new WiFiClientSecure();
auto clientSec = new WiFiClientSecure();
client = clientSec;

#ifdef ARDUINO_ARCH_ESP8266
clientSec->setBufferSizes(2048, 512); // EXPERIMENTAL
if (fingerprint.length() > 0) {
message += " with certificate matching";
#ifdef ARDUINO_ARCH_ESP8266
((WiFiClientSecure *)client)->setFingerprint(fingerprint.c_str());
#else
message += " - NOT SUPPORTED ON ESP32 implmentation";
#endif
clientSec->setFingerprint(fingerprint.c_str());
} else {
message += " without certificate matching";
#ifdef ARDUINO_ARCH_ESP8266
((WiFiClientSecure *)client)->setInsecure();
#else
message += " - NOT SUPPORTED ON ESP32 implmentation";
#endif
clientSec->setInsecure();
}
#endif
} else {
message = "unsecured connection";
client = new WiFiClient();
Expand All @@ -129,20 +125,8 @@ class ESPWifi : public Supla::Network {
server,
connectionPort);

#ifdef ARDUINO_ARCH_ESP8266
static_cast<WiFiClientSecure*>(client)->setBufferSizes(2048, 512); // EXPERIMENTAL
#endif

bool result = client->connect(server, connectionPort);

if (result && isSecured) {
if (!((WiFiClientSecure *)client)->verify(fingerprint.c_str(), server)) {
supla_log(LOG_DEBUG, "Provided certificates doesn't match!");
client->stop();
return false;
}
};

return result;
}

Expand Down