diff options
Diffstat (limited to 'monitor')
-rw-r--r-- | monitor/fan.cpp | 2 | ||||
-rw-r--r-- | monitor/fan.hpp | 3 | ||||
-rw-r--r-- | monitor/main.cpp | 12 | ||||
-rw-r--r-- | monitor/tach_sensor.cpp | 2 | ||||
-rw-r--r-- | monitor/tach_sensor.hpp | 3 |
5 files changed, 10 insertions, 12 deletions
diff --git a/monitor/fan.cpp b/monitor/fan.cpp index 639d88e..17f5812 100644 --- a/monitor/fan.cpp +++ b/monitor/fan.cpp @@ -38,7 +38,7 @@ constexpr auto OPERATIONAL_STATUS_INTF = Fan::Fan(sdbusplus::bus::bus& bus, - std::shared_ptr<sd_event>& events, + phosphor::fan::event::EventPtr& events, const FanDefinition& def) : _bus(bus), _name(std::get<fanNameField>(def)), diff --git a/monitor/fan.hpp b/monitor/fan.hpp index 910b4eb..8e7f86f 100644 --- a/monitor/fan.hpp +++ b/monitor/fan.hpp @@ -3,6 +3,7 @@ #include <sdbusplus/bus.hpp> #include <tuple> #include <vector> +#include "event.hpp" #include "tach_sensor.hpp" #include "types.hpp" @@ -72,7 +73,7 @@ class Fan * @param def - the fan definition structure */ Fan(sdbusplus::bus::bus& bus, - std::shared_ptr<sd_event>& events, + phosphor::fan::event::EventPtr& events, const FanDefinition& def); /** diff --git a/monitor/main.cpp b/monitor/main.cpp index 6d51fbb..c10efb9 100644 --- a/monitor/main.cpp +++ b/monitor/main.cpp @@ -15,6 +15,7 @@ */ #include <phosphor-logging/log.hpp> #include <sdbusplus/bus.hpp> +#include "event.hpp" #include "fan.hpp" #include "fan_defs.hpp" @@ -22,16 +23,11 @@ using namespace phosphor::fan::monitor; using namespace phosphor::logging; -void EventDeleter(sd_event* event) -{ - sd_event_unref(event); -} - int main() { auto bus = sdbusplus::bus::new_default(); sd_event* events = nullptr; - std::vector<std::unique_ptr<Fan>> fans; + std::vector<Fan> fans; auto r = sd_event_default(&events); if (r < 0) @@ -41,7 +37,7 @@ int main() return -1; } - std::shared_ptr<sd_event> eventPtr{events, EventDeleter}; + phosphor::fan::event::EventPtr eventPtr{events}; //Attach the event object to the bus object so we can //handle both sd_events (for the timers) and dbus signals. @@ -49,7 +45,7 @@ int main() for (const auto& fanDef : fanDefinitions) { - fans.emplace_back(std::make_unique<Fan>(bus, eventPtr, fanDef)); + fans.emplace_back(bus, eventPtr, fanDef); } r = sd_event_loop(eventPtr.get()); diff --git a/monitor/tach_sensor.cpp b/monitor/tach_sensor.cpp index 806eed7..80eb974 100644 --- a/monitor/tach_sensor.cpp +++ b/monitor/tach_sensor.cpp @@ -85,7 +85,7 @@ TachSensor::TachSensor(sdbusplus::bus::bus& bus, const std::string& id, bool hasTarget, size_t timeout, - std::shared_ptr<sd_event>& events) : + phosphor::fan::event::EventPtr& events) : _bus(bus), _fan(fan), _name(FAN_SENSOR_PATH + id), diff --git a/monitor/tach_sensor.hpp b/monitor/tach_sensor.hpp index 7a65b64..84e02fe 100644 --- a/monitor/tach_sensor.hpp +++ b/monitor/tach_sensor.hpp @@ -3,6 +3,7 @@ #include <chrono> #include <sdbusplus/bus.hpp> #include <sdbusplus/server.hpp> +#include "event.hpp" #include "timer.hpp" namespace phosphor @@ -54,7 +55,7 @@ class TachSensor const std::string& id, bool hasTarget, size_t timeout, - std::shared_ptr<sd_event>& events); + phosphor::fan::event::EventPtr& events); /** * @brief Returns the target speed value |