using new poller class to simplify the battery interface and downstream usages of battery. tweaked poller destructor and remove the default constructor in preference of using a unique pointer convert simulator to use a std::thread for lvgl Tick api because the SDL thread sleep was not true to time. (and is simplified the code...)
33 lines
816 B
C++
33 lines
816 B
C++
#pragma once
|
|
#include "HardwareAbstract.hpp"
|
|
|
|
#include "batterySimulator.hpp"
|
|
#include "SDLDisplay.hpp"
|
|
#include "wifiHandlerSim.hpp"
|
|
|
|
#include <thread>
|
|
|
|
class HardwareSimulator : public HardwareAbstract {
|
|
public:
|
|
HardwareSimulator();
|
|
|
|
virtual void init() override {};
|
|
|
|
virtual void debugPrint(const char* fmt, ...) override {
|
|
va_list arguments;
|
|
va_start(arguments, fmt);
|
|
vprintf(fmt, arguments);
|
|
va_end(arguments);
|
|
}
|
|
|
|
virtual std::shared_ptr<BatteryInterface> battery() override;
|
|
virtual std::shared_ptr<DisplayAbstract> display() override;
|
|
virtual std::shared_ptr<wifiHandlerInterface> wifi() override;
|
|
|
|
private:
|
|
std::thread mTickThread;
|
|
|
|
std::shared_ptr<BatterySimulator> mBattery;
|
|
std::shared_ptr<SDLDisplay> mDisplay;
|
|
std::shared_ptr<wifiHandlerSim> mWifiHandler;
|
|
};
|