Report: Add TriggerIds property
This change is adding TriggerIds property for Report interface. It is an
array of strings, each representing id of trigger which may update given
report Readings property, due to UpdateReport action. This properly is
read-only, but it can be changed in the runtime, when:
- New Trigger is made using AddTrigger dbus method, when ReportId
argument contains id of given report.
- Trigger is deleted from dbus, and its ReportNames property included id
of given report.
- ReportNames property of any trigger is updated to include (or not) id
of given report.
When this property is modified by service, signal will be emitted on
dbus for property change.
When there is existing trigger with id of non-existing report in its
ReportNames property, its id will be added to TriggerIds property of
such report, the moment it is created by user.
Testing done:
- new UTs were made, all UTs are passing.
- manual testing on dbus interface was successful.
Signed-off-by: Szymon Dompke <szymon.dompke@intel.com>
Change-Id: I1c4c94ce751ddaee001e3cadde3ea60aa8e1c224
diff --git a/src/report_factory.cpp b/src/report_factory.cpp
index df71fa0..df197a4 100644
--- a/src/report_factory.cpp
+++ b/src/report_factory.cpp
@@ -23,8 +23,8 @@
uint64_t appendLimit, const ReportUpdates reportUpdates,
interfaces::ReportManager& reportManager,
interfaces::JsonStorage& reportStorage,
- std::vector<LabeledMetricParameters> labeledMetricParams,
- bool enabled) const
+ std::vector<LabeledMetricParameters> labeledMetricParams, bool enabled,
+ const std::vector<std::string>& triggerIds) const
{
std::vector<std::shared_ptr<interfaces::Metric>> metrics = utils::transform(
labeledMetricParams,
@@ -40,10 +40,11 @@
std::make_unique<Clock>());
});
- return std::make_unique<Report>(
- bus->get_io_context(), objServer, id, name, reportingType,
- reportActions, period, appendLimit, reportUpdates, reportManager,
- reportStorage, std::move(metrics), enabled, std::make_unique<Clock>());
+ return std::make_unique<Report>(bus->get_io_context(), objServer, id, name,
+ reportingType, reportActions, period,
+ appendLimit, reportUpdates, reportManager,
+ reportStorage, std::move(metrics), enabled,
+ std::make_unique<Clock>(), triggerIds);
}
Sensors ReportFactory::getSensors(