timer: Remove in favor of sdeventplus/timer
This change removes the ad-hoc timer implementation and uses the common
one that comes with sdeventplus.
Tested: Compiled
Change-Id: Id3b7e464a472a7421785601634af58f681ebd3a6
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/power-supply/power_supply.cpp b/power-supply/power_supply.cpp
index f5187f0..ff98457 100644
--- a/power-supply/power_supply.cpp
+++ b/power-supply/power_supply.cpp
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+#include <functional>
#include <phosphor-logging/log.hpp>
#include <phosphor-logging/elog.hpp>
#include <org/open_power/Witherspoon/Fault/error.hpp>
@@ -74,7 +75,7 @@
: Device(name, inst), monitorPath(objpath), pmbusIntf(objpath),
inventoryPath(INVENTORY_OBJ_PATH + invpath), bus(bus),
presentInterval(p),
- presentTimer(e, [this]()
+ presentTimer(e, std::bind([this]()
{
// The hwmon path may have changed.
pmbusIntf.findHwmonDir();
@@ -85,12 +86,12 @@
// Update the inventory for the new device
updateInventory();
- }),
+ })),
powerOnInterval(t),
- powerOnTimer(e, [this]()
+ powerOnTimer(e, std::bind([this]()
{
this->powerOn = true;
- })
+ }))
{
using namespace sdbusplus::bus;
presentMatch = std::make_unique<match_t>(bus,
@@ -196,12 +197,12 @@
if (sdbusplus::message::variant_ns::get<bool>(valPropMap->second))
{
clearFaults();
- presentTimer.start(presentInterval, Timer::TimerType::oneshot);
+ presentTimer.restartOnce(presentInterval);
}
else
{
present = false;
- presentTimer.stop();
+ presentTimer.setEnabled(false);
//Clear out the now outdated inventory properties
updateInventory();
@@ -238,11 +239,11 @@
if (state)
{
clearFaults();
- powerOnTimer.start(powerOnInterval, Timer::TimerType::oneshot);
+ powerOnTimer.restartOnce(powerOnInterval);
}
else
{
- powerOnTimer.stop();
+ powerOnTimer.setEnabled(false);
powerOn = false;
}
}
@@ -329,7 +330,7 @@
powerOn = false;
// Start up the timer that will set the state to indicate we
// are ready for the powered on fault checks.
- powerOnTimer.start(powerOnInterval, Timer::TimerType::oneshot);
+ powerOnTimer.restartOnce(powerOnInterval);
}
}
}