Client capable of using Ethernet interfaces#186
Conversation
…syncClient::close() instead [-Wdeprecated-declarations].
|
|
Thanks for your efforts! I can't comment on the crashes with PlatformIO, as I've never worked with it before. As far as I can tell, all the others are due to the missing “Network.h”. I'll try to find a solution using preprocessor macros. Best regards, |
|
Standard platformio is stuck on v2 of the Arduino framework but a community fork has moved to v3. CI doesn't use this fork so it is missing the "network"-versions of the stack. Can you adjust the workflow: Here: https://github.com/bertmelis/espMqttClient/blob/main/.github/workflows/build_platformio.yml#L57 I'll try to fix in the weekend should this not work. |
|
"Can you adjust the workflow: ..." Sorry, I haven't worked with PlatformIO yet. But I hope that at least the Arduino IDE can now handle my changes. It works with the ESP32. I don't know about the ESP8266, but I'll install the ‘board’ now and then test my code against the ESP8266. Edit: Best regards, |
|
I completely overlooked Lint. OK, I hope I've fixed all the bugs. If there's anything else that needs doing, I'll be happy to do it if I'm able to. Best regards, |
|
All green! Thank you for the contribution! |
|
It was my pleasure. |
With just a few changes, the client can use both WiFi and Ethernet.
Here are the changes:
diff --git a/src/Transport/ClientSecureSync.h b/src/Transport/ClientSecureSync.h
index b81681e..d4b0e06 100644
--- a/src/Transport/ClientSecureSync.h
+++ b/src/Transport/ClientSecureSync.h
@@ -10,7 +10,7 @@ the LICENSE file.
#if defined(ARDUINO_ARCH_ESP8266) || defined(ARDUINO_ARCH_ESP32)
-#include <WiFiClientSecure.h> // includes IPAddress
+#include <NetworkClientSecure.h> // includes IPAddress
#include ‘Transport.h’
@@ -26,7 +26,7 @@ class ClientSecureSync : public Transport {
void stop() override;
bool connected() override;
bool disconnected() override;
};
} // namespace espMqttClientInternals
diff --git a/src/Transport/ClientSync.h b/src/Transport/ClientSync.h
index ccfbdba..373a092 100644
-- - a/src/Transport/ClientSync.h
+++ b/src/Transport/ClientSync.h
@@ -10,7 +10,7 @@ the LICENSE file.
#if defined(ARDUINO_ARCH_ESP8266) || defined(ARDUINO_ARCH_ESP32)
-#include <WiFiClient.h> // includes IPAddress
+#include <Network.h> // includes IPAddress
#include ‘Transport.h’
@@ -26,7 +26,7 @@ class ClientSync : public Transport {
void stop() override;
bool connected() override;
bool disconnected() override;
};
Feel free to use the code.
Edit:
In addition, I have eliminated this compiler warning: 'void AsyncClient::close(bool)' is deprecated: Use AsyncClient::close() instead [-Wdeprecated-declarations]
Best Regards,
Arduinux