Rename W5500 classes
This commit is contained in:
@@ -49,8 +49,8 @@ file(GLOB SRCFILES
|
|||||||
networkDevices/NetworkDevice.h
|
networkDevices/NetworkDevice.h
|
||||||
networkDevices/WifiDevice.cpp
|
networkDevices/WifiDevice.cpp
|
||||||
networkDevices/W5500Device.cpp
|
networkDevices/W5500Device.cpp
|
||||||
networkDevices/ClientSyncEthernet.cpp
|
networkDevices/ClientSyncW5500.cpp
|
||||||
networkDevices/espMqttClientEthernet.cpp
|
networkDevices/espMqttClientW5500.cpp
|
||||||
NukiWrapper.cpp
|
NukiWrapper.cpp
|
||||||
NukiOpenerWrapper.cpp
|
NukiOpenerWrapper.cpp
|
||||||
MqttTopics.h
|
MqttTopics.h
|
||||||
|
|||||||
@@ -8,17 +8,17 @@ the LICENSE file.
|
|||||||
|
|
||||||
#if defined(ARDUINO_ARCH_ESP8266) || defined(ARDUINO_ARCH_ESP32)
|
#if defined(ARDUINO_ARCH_ESP8266) || defined(ARDUINO_ARCH_ESP32)
|
||||||
|
|
||||||
#include "ClientSyncEthernet.h"
|
#include "ClientSyncW5500.h"
|
||||||
#include <lwip/sockets.h> // socket options
|
#include <lwip/sockets.h> // socket options
|
||||||
|
|
||||||
namespace espMqttClientInternals {
|
namespace espMqttClientInternals {
|
||||||
|
|
||||||
ClientSyncEthernet::ClientSyncEthernet()
|
ClientSyncW5500::ClientSyncW5500()
|
||||||
: client() {
|
: client() {
|
||||||
// empty
|
// empty
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ClientSyncEthernet::connect(IPAddress ip, uint16_t port) {
|
bool ClientSyncW5500::connect(IPAddress ip, uint16_t port) {
|
||||||
bool ret = client.connect(ip, port); // implicit conversion of return code int --> bool
|
bool ret = client.connect(ip, port); // implicit conversion of return code int --> bool
|
||||||
if (ret) {
|
if (ret) {
|
||||||
#if defined(ARDUINO_ARCH_ESP8266)
|
#if defined(ARDUINO_ARCH_ESP8266)
|
||||||
@@ -34,7 +34,7 @@ namespace espMqttClientInternals {
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ClientSyncEthernet::connect(const char* host, uint16_t port) {
|
bool ClientSyncW5500::connect(const char* host, uint16_t port) {
|
||||||
bool ret = client.connect(host, port); // implicit conversion of return code int --> bool
|
bool ret = client.connect(host, port); // implicit conversion of return code int --> bool
|
||||||
if (ret) {
|
if (ret) {
|
||||||
#if defined(ARDUINO_ARCH_ESP8266)
|
#if defined(ARDUINO_ARCH_ESP8266)
|
||||||
@@ -50,27 +50,27 @@ namespace espMqttClientInternals {
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t ClientSyncEthernet::write(const uint8_t* buf, size_t size) {
|
size_t ClientSyncW5500::write(const uint8_t* buf, size_t size) {
|
||||||
return client.write(buf, size);
|
return client.write(buf, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ClientSyncEthernet::available() {
|
int ClientSyncW5500::available() {
|
||||||
return client.available();
|
return client.available();
|
||||||
}
|
}
|
||||||
|
|
||||||
int ClientSyncEthernet::read(uint8_t* buf, size_t size) {
|
int ClientSyncW5500::read(uint8_t* buf, size_t size) {
|
||||||
return client.read(buf, size);
|
return client.read(buf, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientSyncEthernet::stop() {
|
void ClientSyncW5500::stop() {
|
||||||
client.stop();
|
client.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ClientSyncEthernet::connected() {
|
bool ClientSyncW5500::connected() {
|
||||||
return client.connected();
|
return client.connected();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ClientSyncEthernet::disconnected() {
|
bool ClientSyncW5500::disconnected() {
|
||||||
return !client.connected();
|
return !client.connected();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -7,9 +7,9 @@
|
|||||||
|
|
||||||
namespace espMqttClientInternals {
|
namespace espMqttClientInternals {
|
||||||
|
|
||||||
class ClientSyncEthernet : public Transport {
|
class ClientSyncW5500 : public Transport {
|
||||||
public:
|
public:
|
||||||
ClientSyncEthernet();
|
ClientSyncW5500();
|
||||||
bool connect(IPAddress ip, uint16_t port) override;
|
bool connect(IPAddress ip, uint16_t port) override;
|
||||||
bool connect(const char* host, uint16_t port) override;
|
bool connect(const char* host, uint16_t port) override;
|
||||||
size_t write(const uint8_t* buf, size_t size) override;
|
size_t write(const uint8_t* buf, size_t size) override;
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include "NetworkDevice.h"
|
#include "NetworkDevice.h"
|
||||||
#include "espMqttClient.h"
|
#include "espMqttClient.h"
|
||||||
#include "espMqttClientEthernet.h"
|
#include "espMqttClientW5500.h"
|
||||||
#include <Ethernet.h>
|
#include <Ethernet.h>
|
||||||
#include <Preferences.h>
|
#include <Preferences.h>
|
||||||
|
|
||||||
@@ -61,7 +61,7 @@ private:
|
|||||||
void resetDevice();
|
void resetDevice();
|
||||||
void initializeMacAddress(byte* mac);
|
void initializeMacAddress(byte* mac);
|
||||||
|
|
||||||
espMqttClientEthernet _mqttClient;
|
espMqttClientW5500 _mqttClient;
|
||||||
Preferences* _preferences = nullptr;
|
Preferences* _preferences = nullptr;
|
||||||
|
|
||||||
int _maintainResult = 0;
|
int _maintainResult = 0;
|
||||||
|
|||||||
@@ -1,8 +0,0 @@
|
|||||||
#include "espMqttClientEthernet.h"
|
|
||||||
|
|
||||||
espMqttClientEthernet::espMqttClientEthernet(uint8_t priority, uint8_t core)
|
|
||||||
: MqttClientSetup(true, priority, core),
|
|
||||||
_client()
|
|
||||||
{
|
|
||||||
_transport = &_client;
|
|
||||||
}
|
|
||||||
8
networkDevices/espMqttClientW5500.cpp
Normal file
8
networkDevices/espMqttClientW5500.cpp
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
#include "espMqttClientW5500.h"
|
||||||
|
|
||||||
|
espMqttClientW5500::espMqttClientW5500(uint8_t priority, uint8_t core)
|
||||||
|
: MqttClientSetup(true, priority, core),
|
||||||
|
_client()
|
||||||
|
{
|
||||||
|
_transport = &_client;
|
||||||
|
}
|
||||||
@@ -1,19 +1,19 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "MqttClientSetup.h"
|
#include "MqttClientSetup.h"
|
||||||
#include "ClientSyncEthernet.h"
|
#include "ClientSyncW5500.h"
|
||||||
|
|
||||||
class espMqttClientEthernet : public MqttClientSetup<espMqttClientEthernet> {
|
class espMqttClientW5500 : public MqttClientSetup<espMqttClientW5500> {
|
||||||
public:
|
public:
|
||||||
#if defined(ARDUINO_ARCH_ESP32)
|
#if defined(ARDUINO_ARCH_ESP32)
|
||||||
explicit espMqttClientEthernet(uint8_t priority = 1, uint8_t core = 1);
|
explicit espMqttClientW5500(uint8_t priority = 1, uint8_t core = 1);
|
||||||
#else
|
#else
|
||||||
espMqttClient();
|
espMqttClient();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
#if defined(ARDUINO_ARCH_ESP8266) || defined(ARDUINO_ARCH_ESP32)
|
#if defined(ARDUINO_ARCH_ESP8266) || defined(ARDUINO_ARCH_ESP32)
|
||||||
espMqttClientInternals::ClientSyncEthernet _client;
|
espMqttClientInternals::ClientSyncW5500 _client;
|
||||||
#elif defined(__linux__)
|
#elif defined(__linux__)
|
||||||
espMqttClientInternals::ClientPosix _client;
|
espMqttClientInternals::ClientPosix _client;
|
||||||
#endif
|
#endif
|
||||||
Reference in New Issue
Block a user