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/trigger_manager.hpp b/src/trigger_manager.hpp
index 72b6274..2c76c3a 100644
--- a/src/trigger_manager.hpp
+++ b/src/trigger_manager.hpp
@@ -25,6 +25,11 @@
void removeTrigger(const interfaces::Trigger* trigger) override;
+ static void verifyReportIds(const std::vector<std::string>& newReportIds);
+
+ std::vector<std::string>
+ getTriggerIdsForReport(const std::string& reportId) const override;
+
private:
std::unique_ptr<interfaces::TriggerFactory> triggerFactory;
std::unique_ptr<interfaces::JsonStorage> triggerStorage;
@@ -32,7 +37,8 @@
std::vector<std::unique_ptr<interfaces::Trigger>> triggers;
void verifyAddTrigger(const std::string& triggerId,
- const std::string& triggerName) const;
+ const std::string& triggerName,
+ const std::vector<std::string>& newReportIds) const;
interfaces::Trigger&
addTrigger(const std::string& triggerId, const std::string& triggerName,