Add average and max aggregator functions
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
#include <Settings.h>
|
||||
#include <fan/Aggregators.h>
|
||||
#include <fan/Fan.h>
|
||||
#include <fan/FanCurve.h>
|
||||
#include <sensor/Sensor.h>
|
||||
@@ -16,20 +17,22 @@
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
class Serializer {
|
||||
class Serializer
|
||||
{
|
||||
public:
|
||||
Serializer();
|
||||
void SerializeFans(std::vector<std::shared_ptr<Fan>> fans);
|
||||
std::vector<std::shared_ptr<Fan>>
|
||||
DeserializeFans(std::vector<std::shared_ptr<Sensor>> availableSensors);
|
||||
std::vector<std::shared_ptr<FanCurve>>
|
||||
DeserializeFanCurves(std::vector<std::shared_ptr<Sensor>> availableSensors,
|
||||
std::vector<std::shared_ptr<Fan>> availableFans);
|
||||
std::vector<std::shared_ptr<Fan>> DeserializeFans(
|
||||
std::vector<std::shared_ptr<Sensor>> availableSensors);
|
||||
std::vector<std::shared_ptr<FanCurve>> DeserializeFanCurves(
|
||||
std::vector<std::shared_ptr<Sensor>> availableSensors,
|
||||
std::vector<std::shared_ptr<Fan>> availableFans);
|
||||
std::shared_ptr<Settings> DeserializeSettings();
|
||||
|
||||
private:
|
||||
void WriteJson(json o);
|
||||
json ReadJson();
|
||||
std::unique_ptr<Aggregator> aggregatorFromString(std::string str) const;
|
||||
};
|
||||
|
||||
#endif // SERIALIZER_H_
|
||||
|
||||
@@ -4,19 +4,23 @@
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include <fan/Aggregators.h>
|
||||
#include <fan/HwmonFan.h>
|
||||
#include <sensor/Sensor.h>
|
||||
|
||||
struct FanStep {
|
||||
struct FanStep
|
||||
{
|
||||
int Temp;
|
||||
int Percent;
|
||||
};
|
||||
|
||||
class FanCurve {
|
||||
class FanCurve
|
||||
{
|
||||
public:
|
||||
FanCurve(std::vector<FanStep> steps,
|
||||
std::vector<std::shared_ptr<Sensor>> sensors,
|
||||
std::vector<std::shared_ptr<Fan>> fans);
|
||||
std::vector<std::shared_ptr<Fan>> fans,
|
||||
std::unique_ptr<Aggregator> aggregator);
|
||||
|
||||
void DoFanControl();
|
||||
|
||||
@@ -27,6 +31,7 @@ private:
|
||||
std::vector<FanStep> mSteps;
|
||||
std::vector<std::shared_ptr<Sensor>> mTempSensors;
|
||||
std::vector<std::shared_ptr<Fan>> mFans;
|
||||
std::unique_ptr<Aggregator> mAggregator;
|
||||
};
|
||||
|
||||
#endif // FANCURVE_H_
|
||||
|
||||
Reference in New Issue
Block a user