Make core board agnostic #9
Labels
core
Core functionality that is board agnostic
enhancement
New feature or request
help wanted
Extra attention is needed
Allow the Core class to be used with any wifi module (ESP8266, ESP32, etc.)
Suggested implementations:
BoardClass implements CoreInterface
Have LazyBoxCore as an interface. All boards implement the interface, having to define their control logic.
Have a factory class that returns the right LazyBoxCore implementation board.
A downside to this would be the fact that all ESP8266 boards have to implement the control logic, meaning a lot of duplicated code.
BoardClass extends ModuleAbstractClass implements CoreInterface
Have LazyBoxCore as an interface. Each WiFi module represents an abstract class properly implementing the control logic. Each board extends the abstract class, specifying their properties (pins, memory, etc.)
Again, a factory class will return the correct BoardClass for the specific WiFi module.
A downside to this would be the need to create factories for all WiFi modules, and have the end user define the LazyBox variable type depending on the WiFi module he uses.
Apparently C++ doesn't support interfaces, but they can be mocked up via Virtual Classes.
The second implementation looks best, and we might go for something like:
The text was updated successfully, but these errors were encountered: