Initial implementation of Telemetry service
Implemented main application of Telemetry service.
Added ReportManager interface. Added MaxReports and
PollRateResolution properties to ReportManager interface.
Implemented simple logger.
Tested:
- Built without Yocto and ran on x86 platform with success
- Added telemetry to romulus image using
recipe-phosphor/telemetry from meta-phosphor repository
- Started as service in romulus image in QEMU with success
- Verified that all added properties are present in dbus
Change-Id: I26af7a19b1f9cac32e9e9da65523d72a36e13855
Signed-off-by: Wludzik, Jozef <jozef.wludzik@intel.com>
Signed-off-by: Krzysztof Grobelny <krzysztof.grobelny@intel.com>
diff --git a/src/main.cpp b/src/main.cpp
new file mode 100644
index 0000000..bea8a13
--- /dev/null
+++ b/src/main.cpp
@@ -0,0 +1,37 @@
+#include "telemetry.hpp"
+
+#include <boost/asio/io_context.hpp>
+#include <boost/asio/signal_set.hpp>
+#include <phosphor-logging/log.hpp>
+#include <sdbusplus/asio/connection.hpp>
+
+#include <memory>
+#include <stdexcept>
+
+int main()
+{
+ boost::asio::io_context ioc;
+ boost::asio::signal_set signals(ioc, SIGINT, SIGTERM);
+
+ auto bus = std::make_shared<sdbusplus::asio::connection>(ioc);
+
+ constexpr const char* serviceName = "xyz.openbmc_project.Telemetry";
+ bus->request_name(serviceName);
+
+ signals.async_wait(
+ [&ioc](const boost::system::error_code ec, const int& sig) {
+ if (ec)
+ {
+ throw std::runtime_error("Signal should not be canceled");
+ }
+
+ ioc.stop();
+ });
+
+ phosphor::logging::log<phosphor::logging::level::INFO>(
+ "Telemetry starting");
+ Telemetry app(bus);
+ ioc.run();
+
+ return 0;
+}