fulf / lazybox Goto Github PK
View Code? Open in Web Editor NEWEmbedded Framework
Embedded Framework
Grab some inspiration from PREi's OTA
For the future poller, blinking LEDs and so on, add a feature to allow for delayed actions without the actual use of delay
.
A good example would be the Arduino LED Blinker repo
Grab some inspiration from PREi NTP
Allow the Core class to be used with any wifi module (ESP8266, ESP32, etc.)
Suggested implementations:
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.
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:
class CoreInterface {
public:
LazyBoxPin* getPins() {
// implementation
}
virtual void setPins(LazyBoxPin* p) = 0;
virtual uint8_t connectWiFi(const char*, const char* = "") = 0;
virtual void setPinMode(LazyBoxPin, const char*) = 0;
// ...
}
class MyWiFiModule : CoreInterface {
public:
virtual uint8_t connectWiFi(const char*, const char* = "") {
// implementation
}
virtual void setPinMode(LazyBoxPin, const char*) {
// implementation
};
// ...
}
class MyBoardClass : public MyWiFiModule {
public:
MyBoardClass() {
// set board pins, memory, etc.
}
}
class MyWiFiModuleFactory {
public:
static MyWiFiModule getBoard(String board) {
// return MyBoardClass
}
}
// ---
class MyApp {
public:
MyApp() {
MyWiFiModule module = MyWiFiModuleFactory::getBoard("MyBoard");
}
}
Try to come up with something better than PREi
Permit the LazyBox constructor to set a device id, otherwise fall back on ESP.getChipId()
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.