Add Report interface to dbus
Added AddReport method to ReportManager to allow dbus user
to create new Report. Added Report object with Report and Delete
interfaces.
Tested:
- Verified that telemetry service works in romulus
- Added and removed report from ReportManager collection
Change-Id: Ib20cfda1f0e27ef20b60e66d52c3d11f31f61a96
Signed-off-by: Wludzik, Jozef <jozef.wludzik@intel.com>
diff --git a/src/report.hpp b/src/report.hpp
new file mode 100644
index 0000000..7f74d49
--- /dev/null
+++ b/src/report.hpp
@@ -0,0 +1,43 @@
+#pragma once
+
+#include <boost/asio/io_context.hpp>
+#include <sdbusplus/asio/object_server.hpp>
+
+#include <chrono>
+#include <memory>
+
+using Readings = std::tuple<
+ uint64_t,
+ std::vector<std::tuple<std::string, std::string, double, uint64_t>>>;
+using ReadingParameters =
+ std::vector<std::tuple<std::vector<sdbusplus::message::object_path>,
+ std::string, std::string, std::string>>;
+
+class ReportManager;
+
+class Report
+{
+ public:
+ Report(boost::asio::io_context& ioc,
+ const std::shared_ptr<sdbusplus::asio::object_server>& objServer,
+ const std::string& name, const std::string& reportingType,
+ const bool emitsReadingsSignal,
+ const bool logToMetricReportsCollection,
+ const std::chrono::milliseconds period,
+ const ReadingParameters& metricParams, ReportManager& reportManager);
+ ~Report() = default;
+
+ Report(Report&) = delete;
+ Report(Report&&) = delete;
+ Report& operator=(Report&) = delete;
+ Report& operator=(Report&&) = delete;
+
+ const std::string name;
+ const std::string path;
+
+ private:
+ std::chrono::milliseconds interval;
+ std::shared_ptr<sdbusplus::asio::object_server> objServer;
+ std::unique_ptr<sdbusplus::asio::dbus_interface> reportIface;
+ std::unique_ptr<sdbusplus::asio::dbus_interface> deleteIface;
+};