Debian Codegraph @

src/core/components/controls/amd/fan/fixed/fanfixed.h

raw symbols SCIP
1 // SPDX-License-Identifier: GPL-3.0-or-later
2 // Copyright 2019 Juan Palacios <[email protected]>
3
4 #pragma once
5
6 #include "core/components/controls/control.h"
7 #include "core/idatasource.h"
8 #include <memory>
9 #include <string>
10 #include <string_view>
11 #include <units.h>
12
13 namespace AMD {
14
15 class FanFixed : public Control
16 {
17 public:
18 static constexpr std::string_view ItemID{"AMD_FAN_FIXED"};
19
20 class Importer : public IControl::Importer
21 {
22 public:
23 virtual units::concentration::percent_t provideFanFixedValue() const = 0;
24 virtual bool provideFanFixedFanStop() const = 0;
25 virtual units::concentration::percent_t
26 provideFanFixedFanStartValue() const = 0;
27 };
28
29 class Exporter : public IControl::Exporter
30 {
31 public:
32 virtual void takeFanFixedValue(units::concentration::percent_t value) = 0;
33 virtual void takeFanFixedFanStop(bool enabled) = 0;
34 virtual void
35 takeFanFixedFanStartValue(units::concentration::percent_t value) = 0;
36 };
37
38 FanFixed(std::unique_ptr<IDataSource<unsigned int>> &&pwmEnableDataSource,
39 std::unique_ptr<IDataSource<unsigned int>> &&pwmDataSource) noexcept;
40
41 void preInit(ICommandQueue &ctlCmds) final override;
42 void postInit(ICommandQueue &ctlCmds) final override;
43 void init() final override;
44
45 std::string const &ID() const final override;
46
47 protected:
48 void importControl(IControl::Importer &i) final override;
49 void exportControl(IControl::Exporter &e) const final override;
50
51 void cleanControl(ICommandQueue &ctlCmds) final override;
52 void syncControl(ICommandQueue &ctlCmds) final override;
53
54 unsigned int value() const;
55 void value(unsigned int value);
56
57 bool fanStop() const;
58 void fanStop(bool active);
59
60 unsigned int fanStartValue() const;
61 void fanStartValue(unsigned int value);
62
63 private:
64 std::string const id_;
65
66 std::unique_ptr<IDataSource<unsigned int>> const pwmEnableDataSource_;
67 std::unique_ptr<IDataSource<unsigned int>> const pwmDataSource_;
68
69 unsigned int pwmEnable_;
70 unsigned int pwm_;
71
72 unsigned int value_;
73 unsigned int lastValue_;
74
75 bool fanStop_;
76 unsigned int fanStartValue_;
77 };
78
79 } // namespace AMD