Add Fan stubs, rework Sensors classes

This commit is contained in:
2022-09-11 18:34:56 +02:00
parent 20cb22de01
commit 2208aa8672
6 changed files with 40 additions and 25 deletions

10
app/include/Fan.h Normal file
View File

@@ -0,0 +1,10 @@
#ifndef FAN_H_
#define FAN_H_
class Fan {
public:
virtual void PWM(int value) = 0;
virtual int RPM() = 0;
};
#endif // FAN_H_

12
app/include/HwmonFan.h Normal file
View File

@@ -0,0 +1,12 @@
#ifndef HWMONFAN_H_
#define HWMONFAN_H_
#include <Fan.h>
class HwmonFan : public Fan {
public:
void PWM(int value) override;
int RPM() override;
};
#endif // HWMONFAN_H_

View File

@@ -7,8 +7,10 @@
class HwmonTemperatureSensor : public TemperatureSensor {
public:
HwmonTemperatureSensor(sensors_chip_name chipName,
sensors_subfeature subfeature);
int getTemperature() override;
std::string toJson() override;
private:
sensors_chip_name mChipName;

View File

@@ -1,12 +1,13 @@
#ifndef TEMPERATURESENSOR_H_
#define TEMPERATURESENSOR_H_
#include <boost/json.hpp>
#include <iostream>
class TemperatureSensor {
public:
virtual int getTemperature() = 0;
virtual std::string toJson() = 0;
virtual int getTemperature() = 0;
};
#endif // TEMPERATURESENSOR_H_