Refactor getButtonEnabled/setButtonEnabled functions

Currently naming for the getButtonEnabled function is misleading, since
it returns not if button is enabled, but if it is disabled.
Instead of fixing its calling code rename both getButtonEnabled,
setButtonEnabled functions to getButtonDisabled/setButtonDisabled since
this is what IPMI is actually cares about.

Change-Id: I0c2d6c6a9a6b3deb04daa74200cfe5a5d3736ac3
Signed-off-by: Konstantin Aladyshev <aladyshev22@gmail.com>
diff --git a/chassishandler.cpp b/chassishandler.cpp
index ba6be52..de06c85 100644
--- a/chassishandler.cpp
+++ b/chassishandler.cpp
@@ -1037,8 +1037,8 @@
 }
 } // namespace power_policy
 
-static std::optional<bool> getButtonEnabled(const std::string& buttonPath,
-                                            const std::string& buttonIntf)
+static std::optional<bool> getButtonDisabled(const std::string& buttonPath,
+                                             const std::string& buttonIntf)
 {
     std::shared_ptr<sdbusplus::asio::connection> busp = getSdBus();
     bool buttonDisabled = false;
@@ -1058,9 +1058,9 @@
     return std::make_optional(buttonDisabled);
 }
 
-static bool setButtonEnabled(ipmi::Context::ptr& ctx,
-                             const std::string& buttonPath,
-                             const std::string& buttonIntf, bool enable)
+static bool setButtonDisabled(ipmi::Context::ptr& ctx,
+                              const std::string& buttonPath,
+                              const std::string& buttonIntf, bool disable)
 {
     std::string service;
     boost::system::error_code ec;
@@ -1068,7 +1068,7 @@
     if (!ec)
     {
         ec = ipmi::setDbusProperty(ctx, service, buttonPath, buttonIntf,
-                                   "Enabled", enable);
+                                   "Enabled", !disable);
     }
     if (ec)
     {
@@ -1183,7 +1183,7 @@
 
     //  Front Panel Button Capabilities and disable/enable status(Optional)
     std::optional<bool> powerButtonReading =
-        getButtonEnabled(powerButtonPath, powerButtonIntf);
+        getButtonDisabled(powerButtonPath, powerButtonIntf);
     // allow disable if the interface is present
     bool powerButtonDisableAllow = static_cast<bool>(powerButtonReading);
     // default return the button is enabled (not disabled)
@@ -1195,7 +1195,7 @@
     }
 
     std::optional<bool> resetButtonReading =
-        getButtonEnabled(resetButtonPath, resetButtonIntf);
+        getButtonDisabled(resetButtonPath, resetButtonIntf);
     // allow disable if the interface is present
     bool resetButtonDisableAllow = static_cast<bool>(resetButtonReading);
     // default return the button is enabled (not disabled)
@@ -2343,12 +2343,12 @@
     using namespace chassis::internal;
 
     // set power button Enabled property
-    bool success = setButtonEnabled(ctx, powerButtonPath, powerButtonIntf,
-                                    !disablePowerButton);
+    bool success = setButtonDisabled(ctx, powerButtonPath, powerButtonIntf,
+                                     disablePowerButton);
 
     // set reset button Enabled property
-    success &= setButtonEnabled(ctx, resetButtonPath, resetButtonIntf,
-                                !disableResetButton);
+    success &= setButtonDisabled(ctx, resetButtonPath, resetButtonIntf,
+                                 disableResetButton);
 
     if (!success)
     {