rename HardwareInterface to HardwareAbstract in file
This commit is contained in:
parent
85343d9bd4
commit
44b5d8cf14
6 changed files with 15 additions and 15 deletions
|
@ -1,13 +1,13 @@
|
||||||
#include "HardwareInterface.h"
|
#include "HardwareInterface.h"
|
||||||
|
|
||||||
HardwareInterface::HardwareInterface(std::shared_ptr<BatteryInterface> aBattery)
|
HardwareAbstract::HardwareAbstract(std::shared_ptr<BatteryInterface> aBattery)
|
||||||
: mBattery(std::move(aBattery)){
|
: mBattery(std::move(aBattery)){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<HardwareInterface::batteryStatus> HardwareInterface::getBatteryStatus(){
|
std::optional<HardwareAbstract::batteryStatus> HardwareAbstract::getBatteryStatus(){
|
||||||
if(mBattery){
|
if(mBattery){
|
||||||
HardwareInterface::batteryStatus currentStatus;
|
HardwareAbstract::batteryStatus currentStatus;
|
||||||
currentStatus.percentage = mBattery->getPercentage();
|
currentStatus.percentage = mBattery->getPercentage();
|
||||||
currentStatus.isCharging = mBattery->isCharging();
|
currentStatus.isCharging = mBattery->isCharging();
|
||||||
return currentStatus;
|
return currentStatus;
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "BatteryInterface.h"
|
#include "BatteryInterface.h"
|
||||||
|
|
||||||
class HardwareInterface {
|
class HardwareAbstract {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
struct batteryStatus {
|
struct batteryStatus {
|
||||||
|
@ -20,7 +20,7 @@ public:
|
||||||
};
|
};
|
||||||
virtual std::optional<batteryStatus> getBatteryStatus();
|
virtual std::optional<batteryStatus> getBatteryStatus();
|
||||||
|
|
||||||
HardwareInterface(std::shared_ptr<BatteryInterface> aBattery = nullptr);
|
HardwareAbstract(std::shared_ptr<BatteryInterface> aBattery = nullptr);
|
||||||
|
|
||||||
virtual void init() = 0;
|
virtual void init() = 0;
|
||||||
virtual void sendIR() = 0;
|
virtual void sendIR() = 0;
|
||||||
|
|
|
@ -49,7 +49,7 @@ void HardwareRevX::initIO() {
|
||||||
gpio_deep_sleep_hold_dis();
|
gpio_deep_sleep_hold_dis();
|
||||||
}
|
}
|
||||||
|
|
||||||
HardwareRevX::HardwareRevX():HardwareInterface(std::make_shared<Battery>(ADC_BAT,CRG_STAT)){
|
HardwareRevX::HardwareRevX():HardwareAbstract(std::make_shared<Battery>(ADC_BAT,CRG_STAT)){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
#include "omoteconfig.h"
|
#include "omoteconfig.h"
|
||||||
|
|
||||||
class HardwareRevX : public HardwareInterface {
|
class HardwareRevX : public HardwareAbstract {
|
||||||
public:
|
public:
|
||||||
enum class WakeReason { RESET, IMU, KEYPAD };
|
enum class WakeReason { RESET, IMU, KEYPAD };
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ public:
|
||||||
}
|
}
|
||||||
static std::weak_ptr<HardwareRevX> getRefrence() { return getInstance(); }
|
static std::weak_ptr<HardwareRevX> getRefrence() { return getInstance(); }
|
||||||
|
|
||||||
// HardwareInterface
|
// HardwareAbstract
|
||||||
virtual void init() override;
|
virtual void init() override;
|
||||||
virtual void sendIR() override;
|
virtual void sendIR() override;
|
||||||
virtual void MQTTPublish(const char *topic, const char *payload) override;
|
virtual void MQTTPublish(const char *topic, const char *payload) override;
|
||||||
|
|
|
@ -3,9 +3,9 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
class HardwareSimulator : public HardwareInterface {
|
class HardwareSimulator : public HardwareAbstract {
|
||||||
public:
|
public:
|
||||||
HardwareSimulator() : HardwareInterface(nullptr){};
|
HardwareSimulator() : HardwareAbstract(nullptr){};
|
||||||
|
|
||||||
virtual void debugPrint(std::string message) override {
|
virtual void debugPrint(std::string message) override {
|
||||||
std::cout << message;
|
std::cout << message;
|
||||||
|
@ -19,8 +19,8 @@ public:
|
||||||
|
|
||||||
virtual void init() override;
|
virtual void init() override;
|
||||||
|
|
||||||
virtual std::optional<HardwareInterface::batteryStatus> getBatteryStatus() override {
|
virtual std::optional<HardwareAbstract::batteryStatus> getBatteryStatus() override {
|
||||||
HardwareInterface::batteryStatus fakeStatus;
|
HardwareAbstract::batteryStatus fakeStatus;
|
||||||
fakeStatus.isCharging = false;
|
fakeStatus.isCharging = false;
|
||||||
fakeStatus.percentage = 100;
|
fakeStatus.percentage = 100;
|
||||||
return fakeStatus;
|
return fakeStatus;
|
||||||
|
|
|
@ -15,12 +15,12 @@
|
||||||
/// of resources.
|
/// of resources.
|
||||||
class OmoteUI {
|
class OmoteUI {
|
||||||
public:
|
public:
|
||||||
OmoteUI(std::shared_ptr<HardwareInterface> aHardware)
|
OmoteUI(std::shared_ptr<HardwareAbstract> aHardware)
|
||||||
: mHardware(aHardware){};
|
: mHardware(aHardware){};
|
||||||
|
|
||||||
static std::weak_ptr<OmoteUI> getRefrence() { return getInstance(); };
|
static std::weak_ptr<OmoteUI> getRefrence() { return getInstance(); };
|
||||||
static std::shared_ptr<OmoteUI>
|
static std::shared_ptr<OmoteUI>
|
||||||
getInstance(std::shared_ptr<HardwareInterface> aHardware = nullptr) {
|
getInstance(std::shared_ptr<HardwareAbstract> aHardware = nullptr) {
|
||||||
if (mInstance) {
|
if (mInstance) {
|
||||||
return mInstance;
|
return mInstance;
|
||||||
} else if (aHardware) {
|
} else if (aHardware) {
|
||||||
|
@ -54,7 +54,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static std::shared_ptr<OmoteUI> mInstance;
|
static std::shared_ptr<OmoteUI> mInstance;
|
||||||
std::shared_ptr<HardwareInterface> mHardware;
|
std::shared_ptr<HardwareAbstract> mHardware;
|
||||||
|
|
||||||
lv_obj_t *panel = nullptr;
|
lv_obj_t *panel = nullptr;
|
||||||
Images imgs = Images();
|
Images imgs = Images();
|
||||||
|
|
Loading…
Add table
Reference in a new issue