Use proper dbus path when possible.
Following methods and properties were updated to use full dbus path,
instead of internal telemetry id:
- TriggerManager.AddTrigger() - 'reportIds' arg
- Trigger.ReportIds - renamed to 'Reports'
- Report.TriggerIds - renamed to 'Triggers'
Testing done:
- UTs were updated and are passing.
Signed-off-by: Szymon Dompke <szymon.dompke@intel.com>
Change-Id: I78d812d38289fac575d25b48503cc8b9c6f736fe
diff --git a/src/report.cpp b/src/report.cpp
index be98c6d..cf2b389 100644
--- a/src/report.cpp
+++ b/src/report.cpp
@@ -6,6 +6,7 @@
#include "report_manager.hpp"
#include "utils/clock.hpp"
#include "utils/contains.hpp"
+#include "utils/dbus_path_utils.hpp"
#include "utils/ensure.hpp"
#include "utils/transform.hpp"
@@ -30,6 +31,7 @@
const bool enabledIn, std::unique_ptr<interfaces::Clock> clock,
Readings readingsIn) :
id(reportId),
+ path(utils::pathAppend(utils::constants::reportDirPath, id)),
name(reportName), reportingType(reportingTypeIn), interval(intervalIn),
reportActions(reportActionsIn.begin(), reportActionsIn.end()),
sensorCount(getSensorCount(metricsIn)),
@@ -104,7 +106,7 @@
if (triggerIds.size() != oldSize)
{
- reportIface->signal_property("TriggerIds");
+ reportIface->signal_property("Triggers");
}
});
@@ -391,10 +393,13 @@
},
[this](const auto&) { return utils::enumToString(reportUpdates); });
dbusIface->register_property_r(
- "TriggerIds", std::vector<std::string>{},
+ "Triggers", std::vector<sdbusplus::message::object_path>{},
sdbusplus::vtable::property_::emits_change, [this](const auto&) {
- return std::vector<std::string>(triggerIds.begin(),
- triggerIds.end());
+ return utils::transform<std::vector>(
+ triggerIds, [](const auto& triggerId) {
+ return utils::pathAppend(utils::constants::triggerDirPath,
+ triggerId);
+ });
});
dbusIface->register_method("Update", [this] {
if (reportingType == ReportingType::onRequest)