SUPLA / supla-device

Create your own Supla device! This software can be used as a library for Arduino IDE, or can be used directly with ESP8266 RTOS SDK and with ESP IDF. It is also possible to compile and run it on Linux and in FreeRTOS.
GNU General Public License v2.0
28 stars 14 forks source link

Selected network interface should provide builder for network client #51

Closed klew closed 5 months ago

klew commented 1 year ago

Currently network client is generated based on selected HW type (for Arduino Mega, ESP8266/ESP32), however some network interfaces (like W5500) connected to ESP32 is using standard Ethernet lib in Arduino, which requires EthernetClient classes and not WiFiClient.

Network interface should provide interface to obtain proper Network::Client implementation.

klew commented 5 months ago

Supla SRPC layer will now build "network client" instance based on used Supla::Network type (class for handling Wi-Fi, or Ethernet, etc.) Client build is done by "main" network interface. Currently multiple network interfaces can be added. So "main" will be first enabled network interface. Network interfaces are checked based on order of class instance creation. So in order to build client based on custom network interface, you'll have to override following method:

  virtual Supla::Client *createClient();

It should return pointer to Supla::Client instance implemented on top of required transport client.

Completed in 4f0adf4