// OMOTE Hardware Abstraction // 2023 Matthew Colvin #pragma once #include #include #include #include #include #include #include "BatteryInterface.h" #include "DisplayAbstract.h" #include "wifiHandlerInterface.h" #include "Notification.hpp" class HardwareAbstract { public: HardwareAbstract( std::shared_ptr aDisplay, std::shared_ptr aBattery = nullptr, std::shared_ptr aWifiHandler = nullptr ); struct batteryStatus { /// @brief Percent of battery remaining (0-100] int percentage; /// @brief True - Battery is Charging /// False - Battery discharging bool isCharging; }; virtual std::optional getBatteryStatus(); /// @brief Register function to be ran when hardware notifies battery /// status has changed. /// @param onBatteryStatusChangeHandler - Callable to be ran when batter status changes void onBatteryChange(std::function onBatteryStatusChangeHandler); /// @brief Override in order to do setup of hardware devices virtual void init() = 0; /// @brief Override to allow printing of a message for debugging /// @param message - Debug message virtual void debugPrint(std::string message) = 0; protected: Notification mBatteryNotification; private: std::shared_ptr mBattery; std::shared_ptr mWifiHandler; std::shared_ptr mDisplay; };