| 1 | // SPDX-License-Identifier: GPL-3.0-or-later |
| 2 | // Copyright 2019 Juan Palacios <[email protected]> |
| 3 | |
| 4 | #pragma once |
| 5 | |
| 6 | #include "core/profilepartxmlparser.h" |
| 7 | #include "fanfixedprofilepart.h" |
| 8 | #include <string> |
| 9 | |
| 10 | namespace AMD { |
| 11 | |
| 12 | class FanFixedXMLParser final |
| 13 | : public ProfilePartXMLParser |
| 14 | , public AMD::FanFixedProfilePart::Exporter |
| 15 | , public AMD::FanFixedProfilePart::Importer |
| 16 | { |
| 17 | public: |
| 18 | FanFixedXMLParser() noexcept; |
| 19 | |
| 20 | std::unique_ptr<Exportable::Exporter> factory( |
| 21 | IProfilePartXMLParserProvider const &profilePartParserProvider) override; |
| 22 | std::unique_ptr<Exportable::Exporter> initializer() override; |
| 23 | |
| 24 | std::optional<std::reference_wrapper<Exportable::Exporter>> |
| 25 | provideExporter(Item const &i) override; |
| 26 | std::optional<std::reference_wrapper<Importable::Importer>> |
| 27 | provideImporter(Item const &i) override; |
| 28 | |
| 29 | void takeActive(bool active) override; |
| 30 | bool provideActive() const override; |
| 31 | |
| 32 | void takeFanFixedValue(units::concentration::percent_t value) override; |
| 33 | units::concentration::percent_t provideFanFixedValue() const override; |
| 34 | |
| 35 | void takeFanFixedFanStop(bool enabled) override; |
| 36 | bool provideFanFixedFanStop() const override; |
| 37 | |
| 38 | void takeFanFixedFanStartValue(units::concentration::percent_t value) override; |
| 39 | units::concentration::percent_t provideFanFixedFanStartValue() const override; |
| 40 | |
| 41 | void appendTo(pugi::xml_node &parentNode) override; |
| 42 | |
| 43 | protected: |
| 44 | void resetAttributes() override; |
| 45 | void loadPartFrom(pugi::xml_node const &parentNode) override; |
| 46 | |
| 47 | private: |
| 48 | class Initializer; |
| 49 | |
| 50 | bool active_; |
| 51 | bool activeDefault_; |
| 52 | |
| 53 | unsigned int value_; |
| 54 | unsigned int valueDefault_; |
| 55 | |
| 56 | bool fanStop_; |
| 57 | bool fanStopDefault_; |
| 58 | |
| 59 | unsigned int fanStartValue_; |
| 60 | unsigned int fanStartValueDefault_; |
| 61 | |
| 62 | static bool const registered_; |
| 63 | }; |
| 64 | |
| 65 | } // namespace AMD |