sdbusplus: use shorter type aliases
The sdbusplus headers provide shortened aliases for many types.
Switch to using them to provide better code clarity and shorter
lines. Possible replacements are for:
* bus_t
* exception_t
* manager_t
* match_t
* message_t
* object_t
* slot_t
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Ie36d234f4580029a7832a0cd179f3bb78a1a403f
diff --git a/dbus/dbusactiveread.hpp b/dbus/dbusactiveread.hpp
index 8f92cb4..46532a6 100644
--- a/dbus/dbusactiveread.hpp
+++ b/dbus/dbusactiveread.hpp
@@ -19,7 +19,7 @@
class DbusActiveRead : public ReadInterface
{
public:
- DbusActiveRead(sdbusplus::bus::bus& bus, const std::string& path,
+ DbusActiveRead(sdbusplus::bus_t& bus, const std::string& path,
const std::string& service,
std::unique_ptr<DbusHelperInterface> helper) :
ReadInterface(),
@@ -29,7 +29,7 @@
ReadReturn read(void) override;
private:
- sdbusplus::bus::bus& _bus;
+ sdbusplus::bus_t& _bus;
const std::string _path;
const std::string _service; // the sensor service.
std::unique_ptr<DbusHelperInterface> _helper;
diff --git a/dbus/dbusconfiguration.cpp b/dbus/dbusconfiguration.cpp
index 1af938a..990dd53 100644
--- a/dbus/dbusconfiguration.cpp
+++ b/dbus/dbusconfiguration.cpp
@@ -81,7 +81,7 @@
return retString;
}
-std::vector<std::string> getSelectedProfiles(sdbusplus::bus::bus& bus)
+std::vector<std::string> getSelectedProfiles(sdbusplus::bus_t& bus)
{
std::vector<std::string> ret;
auto mapper =
@@ -161,7 +161,7 @@
const std::array<const char*, 1> skipList = {
"xyz.openbmc_project.Association"};
- sdbusplus::message::message message(m);
+ sdbusplus::message_t message(m);
if (std::string(message.get_member()) == "InterfacesAdded")
{
sdbusplus::message::object_path path;
@@ -206,10 +206,10 @@
return 1;
}
-void createMatches(sdbusplus::bus::bus& bus, boost::asio::steady_timer& timer)
+void createMatches(sdbusplus::bus_t& bus, boost::asio::steady_timer& timer)
{
// this is a list because the matches can't be moved
- static std::list<sdbusplus::bus::match::match> matches;
+ static std::list<sdbusplus::bus::match_t> matches;
const std::array<std::string, 4> interfaces = {
thermalControlIface, pidConfigurationInterface,
@@ -258,7 +258,7 @@
}
void populatePidInfo(
- sdbusplus::bus::bus& bus,
+ sdbusplus::bus_t& bus,
const std::unordered_map<std::string, DbusVariantType>& base,
conf::ControllerInfo& info, const std::string* thresholdProperty,
const std::map<std::string, conf::SensorConfig>& sensorConfig)
@@ -296,7 +296,7 @@
helper.getProperty(service, path, interface, *thresholdProperty,
reading);
}
- catch (const sdbusplus::exception::exception& ex)
+ catch (const sdbusplus::exception_t& ex)
{
// unsupported threshold, leaving reading at 0
}
@@ -346,7 +346,7 @@
info.pidInfo.positiveHysteresis = positiveHysteresis;
}
-bool init(sdbusplus::bus::bus& bus, boost::asio::steady_timer& timer,
+bool init(sdbusplus::bus_t& bus, boost::asio::steady_timer& timer,
std::map<std::string, conf::SensorConfig>& sensorConfig,
std::map<int64_t, conf::PIDConf>& zoneConfig,
std::map<int64_t, conf::ZoneConfig>& zoneDetailsConfig)
diff --git a/dbus/dbusconfiguration.hpp b/dbus/dbusconfiguration.hpp
index 318da68..a880a0c 100644
--- a/dbus/dbusconfiguration.hpp
+++ b/dbus/dbusconfiguration.hpp
@@ -50,7 +50,7 @@
* @param zoneConfig - The configuration converted PID list.
* @param zoneDetailsConfig - The configuration converted Zone configuration.
*/
-bool init(sdbusplus::bus::bus& bus, boost::asio::steady_timer& timer,
+bool init(sdbusplus::bus_t& bus, boost::asio::steady_timer& timer,
std::map<std::string, conf::SensorConfig>& sensorConfig,
std::map<int64_t, conf::PIDConf>& zoneConfig,
std::map<int64_t, conf::ZoneConfig>& zoneDetailsConfig);
diff --git a/dbus/dbushelper.cpp b/dbus/dbushelper.cpp
index d08f537..01383cb 100644
--- a/dbus/dbushelper.cpp
+++ b/dbus/dbushelper.cpp
@@ -58,7 +58,7 @@
responseMsg.read(response);
}
- catch (const sdbusplus::exception::exception& ex)
+ catch (const sdbusplus::exception_t& ex)
{
log<level::ERR>("ObjectMapper call failure",
entry("WHAT=%s", ex.what()));
@@ -88,7 +88,7 @@
auto valueResponseMsg = _bus.call(pimMsg);
valueResponseMsg.read(propMap);
}
- catch (const sdbusplus::exception::exception& ex)
+ catch (const sdbusplus::exception_t& ex)
{
log<level::ERR>("GetAll Properties Failed",
entry("WHAT=%s", ex.what()));
@@ -135,7 +135,7 @@
{
getProperty(service, path, availabilityIntf, "Available", available);
}
- catch (const sdbusplus::exception::exception& ex)
+ catch (const sdbusplus::exception_t& ex)
{
// unsupported Available property, leaving reading at 'True'
}
diff --git a/dbus/dbushelper.hpp b/dbus/dbushelper.hpp
index 3f3e688..f65784c 100644
--- a/dbus/dbushelper.hpp
+++ b/dbus/dbushelper.hpp
@@ -21,7 +21,7 @@
static constexpr char availabilityIntf[] =
"xyz.openbmc_project.State.Decorator.Availability";
- explicit DbusHelper(sdbusplus::bus::bus bus) : _bus(std::move(bus))
+ explicit DbusHelper(sdbusplus::bus_t bus) : _bus(std::move(bus))
{}
~DbusHelper() = default;
@@ -58,7 +58,7 @@
auto valueResponseMsg = _bus.call(msg);
valueResponseMsg.read(result);
}
- catch (const sdbusplus::exception::exception& ex)
+ catch (const sdbusplus::exception_t& ex)
{
log::log<log::level::ERR>("Get Property Failed",
log::entry("WHAT=%s", ex.what()));
@@ -69,7 +69,7 @@
}
private:
- sdbusplus::bus::bus _bus;
+ sdbusplus::bus_t _bus;
};
} // namespace pid_control
diff --git a/dbus/dbuspassive.cpp b/dbus/dbuspassive.cpp
index a5da100..038b1d7 100644
--- a/dbus/dbuspassive.cpp
+++ b/dbus/dbuspassive.cpp
@@ -33,7 +33,7 @@
{
std::unique_ptr<ReadInterface> DbusPassive::createDbusPassive(
- sdbusplus::bus::bus& bus, const std::string& type, const std::string& id,
+ sdbusplus::bus_t& bus, const std::string& type, const std::string& id,
std::unique_ptr<DbusHelperInterface> helper, const conf::SensorConfig* info,
const std::shared_ptr<DbusPassiveRedundancy>& redundancy)
{
@@ -79,7 +79,7 @@
}
DbusPassive::DbusPassive(
- sdbusplus::bus::bus& bus, const std::string& type, const std::string& id,
+ sdbusplus::bus_t& bus, const std::string& type, const std::string& id,
std::unique_ptr<DbusHelperInterface> helper,
const SensorProperties& settings, bool failed, const std::string& path,
const std::shared_ptr<DbusPassiveRedundancy>& redundancy) :
@@ -248,7 +248,7 @@
setValue(value);
}
-int handleSensorValue(sdbusplus::message::message& msg, DbusPassive* owner)
+int handleSensorValue(sdbusplus::message_t& msg, DbusPassive* owner)
{
std::string msgSensor;
std::map<std::string, std::variant<int64_t, double, bool>> msgData;
@@ -325,7 +325,7 @@
int dbusHandleSignal(sd_bus_message* msg, void* usrData, sd_bus_error* err)
{
- auto sdbpMsg = sdbusplus::message::message(msg);
+ auto sdbpMsg = sdbusplus::message_t(msg);
DbusPassive* obj = static_cast<DbusPassive*>(usrData);
return handleSensorValue(sdbpMsg, obj);
diff --git a/dbus/dbuspassive.hpp b/dbus/dbuspassive.hpp
index bc16719..72ad9a5 100644
--- a/dbus/dbuspassive.hpp
+++ b/dbus/dbuspassive.hpp
@@ -41,12 +41,12 @@
{
public:
static std::unique_ptr<ReadInterface> createDbusPassive(
- sdbusplus::bus::bus& bus, const std::string& type,
- const std::string& id, std::unique_ptr<DbusHelperInterface> helper,
+ sdbusplus::bus_t& bus, const std::string& type, const std::string& id,
+ std::unique_ptr<DbusHelperInterface> helper,
const conf::SensorConfig* info,
const std::shared_ptr<DbusPassiveRedundancy>& redundancy);
- DbusPassive(sdbusplus::bus::bus& bus, const std::string& type,
+ DbusPassive(sdbusplus::bus_t& bus, const std::string& type,
const std::string& id,
std::unique_ptr<DbusHelperInterface> helper,
const SensorProperties& settings, bool failed,
@@ -94,6 +94,6 @@
std::chrono::high_resolution_clock::time_point _updated;
};
-int handleSensorValue(sdbusplus::message::message& msg, DbusPassive* owner);
+int handleSensorValue(sdbusplus::message_t& msg, DbusPassive* owner);
} // namespace pid_control
diff --git a/dbus/dbuspassiveredundancy.cpp b/dbus/dbuspassiveredundancy.cpp
index 57c3c50..f7f82dd 100644
--- a/dbus/dbuspassiveredundancy.cpp
+++ b/dbus/dbuspassiveredundancy.cpp
@@ -45,11 +45,11 @@
} // namespace redundancy
-DbusPassiveRedundancy::DbusPassiveRedundancy(sdbusplus::bus::bus& bus) :
+DbusPassiveRedundancy::DbusPassiveRedundancy(sdbusplus::bus_t& bus) :
match(bus,
"type='signal',member='PropertiesChanged',arg0namespace='" +
std::string(redundancy::interface) + "'",
- std::move([this](sdbusplus::message::message& message) {
+ std::move([this](sdbusplus::message_t& message) {
std::string objectName;
std::unordered_map<
std::string,
diff --git a/dbus/dbuspassiveredundancy.hpp b/dbus/dbuspassiveredundancy.hpp
index 790c758..1fd2aed 100644
--- a/dbus/dbuspassiveredundancy.hpp
+++ b/dbus/dbuspassiveredundancy.hpp
@@ -34,15 +34,15 @@
class DbusPassiveRedundancy
{
public:
- explicit DbusPassiveRedundancy(sdbusplus::bus::bus& bus);
+ explicit DbusPassiveRedundancy(sdbusplus::bus_t& bus);
const std::set<std::string>& getFailed(void);
private:
void populateFailures(void);
- sdbusplus::bus::match::match match;
+ sdbusplus::bus::match_t match;
std::set<std::string> failed;
- sdbusplus::bus::bus& passiveBus;
+ sdbusplus::bus_t& passiveBus;
};
} // namespace pid_control
diff --git a/dbus/dbuswrite.cpp b/dbus/dbuswrite.cpp
index 880dea9..33ba730 100644
--- a/dbus/dbuswrite.cpp
+++ b/dbus/dbuswrite.cpp
@@ -89,7 +89,7 @@
// TODO: if we don't use the reply, call_noreply()
auto resp = writeBus.call(mesg);
}
- catch (const sdbusplus::exception::exception& ex)
+ catch (const sdbusplus::exception_t& ex)
{
log<level::ERR>("Dbus Call Failure", entry("PATH=%s", path.c_str()),
entry("WHAT=%s", ex.what()));
@@ -152,7 +152,7 @@
// TODO: consider call_noreplly
auto resp = writeBus.call(mesg);
}
- catch (const sdbusplus::exception::exception& ex)
+ catch (const sdbusplus::exception_t& ex)
{
log<level::ERR>("Dbus Call Failure", entry("PATH=%s", path.c_str()),
entry("WHAT=%s", ex.what()));