Add mapping logic, refactor stuff

This commit is contained in:
2022-09-19 20:02:18 +02:00
parent dccd6f2773
commit f507912623
19 changed files with 275 additions and 187 deletions

View File

@@ -11,7 +11,7 @@ public:
const sensors_subfeature *subfeature);
int value() override;
std::string name() override;
const std::string toString() const override;
private:
const sensors_chip_name *mChipName;

View File

@@ -9,7 +9,8 @@ public:
~NvidiaSensor();
int value() override;
std::string name() override;
const std::string toString() const override;
};
#endif // NVIDIASENSOR_H_

View File

@@ -1,15 +1,18 @@
#ifndef SENSOR_H_
#define SENSOR_H_
#include <iostream>
#include <Printable.h>
class Sensor {
class Sensor : public Printable {
public:
// Read the current value
virtual int value() = 0;
// Name for displaying. Should be descriptive, e.g. "GPU" or the label from
// libsensors.
virtual std::string name() = 0;
virtual int max() const;
virtual void max(int value);
protected:
int mMax = 0;
};
#endif // SENSOR_H_

View File

@@ -0,0 +1,26 @@
#ifndef SENSORSWRAPPER_H_
#define SENSORSWRAPPER_H_
#include <memory>
#include <vector>
#include <sensors/sensors.h>
#include <fan/PwmControl.h>
#include <sensor/Sensor.h>
class SensorsWrapper {
public:
SensorsWrapper();
~SensorsWrapper();
std::vector<std::shared_ptr<Sensor>>
Sensors(sensors_subfeature_type sensorType);
std::vector<std::shared_ptr<PwmControl>> PwmControls();
private:
FILE *mConfigFile;
};
#endif // SENSORSWRAPPER_H_