regulators: Implement ComparePresenceAction class
The ComparePresenceAction::execute() method reads the presence value
using the Services->getPresenceService()->isPresent() method.
Then it compares the actual value to the expected value.
It returns true if they match and false if they don't.
Signed-off-by: Bob King <Bob_King@wistron.com>
Change-Id: Ie6a17191313b2c80a0ecd7a7d7357448985d0673
diff --git a/phosphor-regulators/src/actions/compare_presence_action.hpp b/phosphor-regulators/src/actions/compare_presence_action.hpp
index b2c7880..b16c98f 100644
--- a/phosphor-regulators/src/actions/compare_presence_action.hpp
+++ b/phosphor-regulators/src/actions/compare_presence_action.hpp
@@ -18,8 +18,6 @@
#include "action.hpp"
#include "action_environment.hpp"
-#include <ios>
-#include <sstream>
#include <string>
namespace phosphor::power::regulators
@@ -57,16 +55,10 @@
/**
* Executes this action.
*
- * TODO: Not implemented yet
- *
* @param environment Action execution environment.
* @return true
*/
- virtual bool execute(ActionEnvironment& /* environment */) override
- {
- // TODO: Not implemented yet
- return true;
- }
+ virtual bool execute(ActionEnvironment& environment) override;
/**
* Returns the Field-Replaceable Unit (FRU).
@@ -93,17 +85,7 @@
*
* @return description of action
*/
- virtual std::string toString() const override
- {
- std::ostringstream ss;
- ss << "compare_presence: { ";
-
- ss << "fru: " << fru << ", ";
-
- ss << "value: " << std::boolalpha << value << " }";
-
- return ss.str();
- }
+ virtual std::string toString() const override;
private:
/**