Refactoring, housekeeping, documentation
Add a class diagram. Still needs some details. Refactor to better respect SOLID principles. Housekeeping, move and rename classes/files.
This commit is contained in:
14
app/include/sensor/GPUSensorsFacade.h
Normal file
14
app/include/sensor/GPUSensorsFacade.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#ifndef GPUSENSORSFACADE_H_
|
||||
#define GPUSENSORSFACADE_H_
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include <sensor/Sensor.h>
|
||||
|
||||
class GPUSensorsFacade {
|
||||
public:
|
||||
std::vector<std::shared_ptr<Sensor>> TemperatureSensors();
|
||||
};
|
||||
|
||||
#endif // GPUSENSORSFACADE_H_
|
||||
@@ -5,10 +5,10 @@
|
||||
|
||||
#include <sensor/Sensor.h>
|
||||
|
||||
class HwmonSensor : public Sensor {
|
||||
class LMSensor : public Sensor {
|
||||
public:
|
||||
HwmonSensor(const sensors_chip_name *chipName, const sensors_feature *feature,
|
||||
const sensors_subfeature *subfeature);
|
||||
LMSensor(const sensors_chip_name *chipName, const sensors_feature *feature,
|
||||
const sensors_subfeature *subfeature);
|
||||
|
||||
int value() override;
|
||||
const std::string toString() const override;
|
||||
27
app/include/sensor/LMSensorsFacade.h
Normal file
27
app/include/sensor/LMSensorsFacade.h
Normal file
@@ -0,0 +1,27 @@
|
||||
#ifndef LMSENSORSFACADE_H_
|
||||
#define LMSENSORSFACADE_H_
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include <sensors/sensors.h>
|
||||
|
||||
#include <sensor/Sensor.h>
|
||||
|
||||
class LMSensorsFacade {
|
||||
public:
|
||||
LMSensorsFacade();
|
||||
~LMSensorsFacade();
|
||||
|
||||
std::vector<std::shared_ptr<Sensor>> TemperatureSensors();
|
||||
std::vector<std::shared_ptr<Sensor>> RPMSensors();
|
||||
|
||||
private:
|
||||
template <sensors_subfeature_type T>
|
||||
std::vector<std::shared_ptr<Sensor>> Sensors();
|
||||
|
||||
private:
|
||||
FILE *mConfigFile;
|
||||
};
|
||||
|
||||
#endif // LMSENSORSFACADE_H_
|
||||
20
app/include/sensor/SensorManager.h
Normal file
20
app/include/sensor/SensorManager.h
Normal file
@@ -0,0 +1,20 @@
|
||||
#ifndef SENSORMANAGER_H_
|
||||
#define SENSORMANAGER_H_
|
||||
|
||||
#include <memory>
|
||||
#include <sensor/GPUSensorsFacade.h>
|
||||
#include <sensor/LMSensorsFacade.h>
|
||||
|
||||
class SensorManager {
|
||||
public:
|
||||
SensorManager();
|
||||
|
||||
std::vector<std::shared_ptr<Sensor>> TemperatureSensors();
|
||||
std::vector<std::shared_ptr<Sensor>> RPMSensors();
|
||||
|
||||
private:
|
||||
std::unique_ptr<LMSensorsFacade> mLMSensorsFacade;
|
||||
std::unique_ptr<GPUSensorsFacade> mGPUSensorsFacade;
|
||||
};
|
||||
|
||||
#endif // SENSORMANAGER_H_
|
||||
@@ -1,26 +0,0 @@
|
||||
#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_
|
||||
Reference in New Issue
Block a user