sensor.cpp (0e7ae5dbf1c07c19f11166acc812907e4ccd01ec) sensor.cpp (7e098e93ef0974739459d296f99ddfab54722c23)
1#include "sensor.hpp"
2
3#include <boost/container/flat_map.hpp>
4#include <phosphor-logging/log.hpp>
5#include <sdbusplus/asio/property.hpp>
6#include <sdbusplus/bus/match.hpp>
7
8#include <functional>

--- 61 unchanged lines hidden (view full) ---

70 }
71 else
72 {
73 async_read();
74 }
75 }
76}
77
1#include "sensor.hpp"
2
3#include <boost/container/flat_map.hpp>
4#include <phosphor-logging/log.hpp>
5#include <sdbusplus/asio/property.hpp>
6#include <sdbusplus/bus/match.hpp>
7
8#include <functional>

--- 61 unchanged lines hidden (view full) ---

70 }
71 else
72 {
73 async_read();
74 }
75 }
76}
77
78void Sensor::unregisterFromUpdates(
79 const std::weak_ptr<interfaces::SensorListener>& weakListener)
80{
81 if (auto listener = weakListener.lock())
82 {
83 listeners.erase(
84 std::remove_if(
85 listeners.begin(), listeners.end(),
86 [listenerToUnregister = listener.get()](const auto& listener) {
87 return (listener.expired() ||
88 listener.lock().get() == listenerToUnregister);
89 }),
90 listeners.end());
91 }
92}
93
78void Sensor::updateValue(double newValue)
79{
80 timestamp = std::time(0);
81
82 if (value == newValue)
83 {
84 for (const auto& weakListener : listeners)
85 {

--- 73 unchanged lines hidden ---
94void Sensor::updateValue(double newValue)
95{
96 timestamp = std::time(0);
97
98 if (value == newValue)
99 {
100 for (const auto& weakListener : listeners)
101 {

--- 73 unchanged lines hidden ---