Organize the files

This commit is contained in:
2022-09-11 19:41:45 +02:00
parent 7111a20203
commit e6188b8e72
11 changed files with 14 additions and 14 deletions

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

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

View File

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

39
app/include/fan/Pwm.h Normal file
View File

@@ -0,0 +1,39 @@
#ifndef PWM_H_
#define PWM_H_
#include <string>
#include <unordered_map>
#include <vector>
enum class PWM_CONTROL_PROPERTY { CONTROL, ENABLE, MODE };
struct PWM_CONTROL {
std::string controlPath;
std::string enablePath;
std::string modePath;
std::string initialEnable;
std::string initialMode;
};
enum class PWM_ENABLE { FULL_SPEED = 0, MANUAL_CONTROL };
enum class PWM_MODE { DC = 0, PWM };
class PWM {
public:
PWM();
void dumpValues();
std::vector<PWM_CONTROL> getControls();
int readValue(PWM_CONTROL control, PWM_CONTROL_PROPERTY property);
void setEnable(PWM_CONTROL control, PWM_ENABLE value);
void setMode(PWM_CONTROL control, PWM_MODE mode);
void setValuePwm(PWM_CONTROL control, int pwm);
void setValuePercent(PWM_CONTROL control, int percentage);
private:
std::unordered_map<std::string, PWM_CONTROL> mPwmControls;
};
#endif // PWM_H_