sdbusplus: object: don't use 'bool' argument constructor
`sdbusplus::server::object_t` has long had an enum-based parameter for
signal action, but maintained a backwards compatible boolean mapping.
It is time to remove this boolean to make it more observable which
actions are being used in applications. Map all `true` occurrences to
`action::defer_emit` or `action::emit_no_signals` as appropriate.
- Value: defer_emit (primary object)
- Others: emit_no_signals (secondary objects)
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I892a1c953231123aa5407b388ff9133882d80feb
diff --git a/fan_pwm.hpp b/fan_pwm.hpp
index 7aa2a75..f1dedd6 100644
--- a/fan_pwm.hpp
+++ b/fan_pwm.hpp
@@ -32,7 +32,9 @@
const std::string& devPath, const std::string& id,
sdbusplus::bus::bus& bus, const char* objPath, bool defer,
uint64_t target) :
- FanPwmObject(bus, objPath, defer),
+ FanPwmObject(bus, objPath,
+ defer ? FanPwmObject::action::emit_no_signals
+ : FanPwmObject::action::emit_object_added),
_id(id), _ioAccess(std::move(io)), _devPath(devPath)
{
FanPwmObject::target(target);
diff --git a/fan_speed.hpp b/fan_speed.hpp
index 4b79b2a..f1a3fdb 100644
--- a/fan_speed.hpp
+++ b/fan_speed.hpp
@@ -33,7 +33,9 @@
const std::string& devPath, const std::string& id,
sdbusplus::bus::bus& bus, const char* objPath, bool defer,
uint64_t target) :
- FanSpeedObject(bus, objPath, defer),
+ FanSpeedObject(bus, objPath,
+ defer ? FanSpeedObject::action::emit_no_signals
+ : FanSpeedObject::action::emit_object_added),
_id(id), _ioAccess(std::move(io)), _devPath(devPath)
{
FanSpeedObject::target(target);
diff --git a/sensor.cpp b/sensor.cpp
index ddca883..add4617 100644
--- a/sensor.cpp
+++ b/sensor.cpp
@@ -121,8 +121,6 @@
ObjectInfo& info,
TimedoutMap& timedoutMap)
{
- static constexpr bool deferSignals = true;
-
// Get the initial value for the value interface.
auto& bus = *std::get<sdbusplus::bus::bus*>(info);
auto& obj = std::get<InterfaceMap>(info);
@@ -180,8 +178,8 @@
#endif
}
- auto iface =
- std::make_shared<ValueObject>(bus, objPath.c_str(), deferSignals);
+ auto iface = std::make_shared<ValueObject>(bus, objPath.c_str(),
+ ValueObject::action::defer_emit);
hwmon::Attributes attrs;
if (hwmon::getAttributes(_sensor.first, attrs))
@@ -253,10 +251,10 @@
}
}
- static constexpr bool deferSignals = true;
auto& bus = *std::get<sdbusplus::bus::bus*>(info);
- iface = std::make_shared<StatusObject>(bus, objPath.c_str(), deferSignals);
+ iface = std::make_shared<StatusObject>(
+ bus, objPath.c_str(), StatusObject::action::emit_no_signals);
// Set functional property
iface->functional(functional);
diff --git a/thresholds.hpp b/thresholds.hpp
index fe88977..d339ea8 100644
--- a/thresholds.hpp
+++ b/thresholds.hpp
@@ -129,10 +129,10 @@
auto tHi = env::getEnv(Thresholds<T>::envHi, sensorType, sensorID);
if (!tLo.empty() || !tHi.empty())
{
- static constexpr bool deferSignals = true;
auto& bus = *std::get<sdbusplus::bus::bus*>(info);
- iface = std::make_shared<T>(bus, objPath.c_str(), deferSignals);
+ iface = std::make_shared<T>(bus, objPath.c_str(),
+ T::action::emit_no_signals);
if (!tLo.empty())
{
auto lo = stod(tLo) * std::pow(10, scale);