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/trigger_manager.cpp b/src/trigger_manager.cpp
index 3c06b11..df8dea9 100644
--- a/src/trigger_manager.cpp
+++ b/src/trigger_manager.cpp
@@ -3,6 +3,7 @@
#include "trigger.hpp"
#include "types/trigger_types.hpp"
#include "utils/conversion_trigger.hpp"
+#include "utils/dbus_path_utils.hpp"
#include "utils/generate_id.hpp"
#include "utils/transform.hpp"
@@ -23,12 +24,13 @@
triggerManagerPath, triggerManagerIfaceName, [this](auto& iface) {
iface.register_method(
"AddTrigger",
- [this](boost::asio::yield_context& yield, const std::string& id,
- const std::string& name,
- const std::vector<std::string>& triggerActions,
- const SensorsInfo& sensors,
- const std::vector<std::string>& reportIds,
- const TriggerThresholdParamsExt& thresholds) {
+ [this](
+ boost::asio::yield_context& yield, const std::string& id,
+ const std::string& name,
+ const std::vector<std::string>& triggerActions,
+ const SensorsInfo& sensors,
+ const std::vector<sdbusplus::message::object_path>& reports,
+ const TriggerThresholdParamsExt& thresholds) {
LabeledTriggerThresholdParams
labeledTriggerThresholdParams = std::visit(
utils::ToLabeledThresholdParamConversion(),
@@ -37,6 +39,11 @@
std::vector<LabeledSensorInfo> labeledSensorsInfo =
triggerFactory->getLabeledSensorsInfo(yield, sensors);
+ auto reportIds = utils::transform<std::vector>(
+ reports, [](const auto& item) {
+ return utils::reportPathToId(item);
+ });
+
return addTrigger(id, name, triggerActions,
labeledSensorsInfo, reportIds,
labeledTriggerThresholdParams)