Added Periodic reportingType support to Report
When report interval expires report will collect readings from
metrics and update timestamp.
Tested:
- Added new units tests covering added code
- All existing unit tests are passing
Change-Id: I7f23ca05d77efb0f18d2c0d0f138c524ffb4f6af
Signed-off-by: Krzysztof Grobelny <krzysztof.grobelny@intel.com>
diff --git a/src/metric.hpp b/src/metric.hpp
new file mode 100644
index 0000000..a676e25
--- /dev/null
+++ b/src/metric.hpp
@@ -0,0 +1,22 @@
+#pragma once
+
+#include "interfaces/metric.hpp"
+#include "interfaces/sensor_listener.hpp"
+
+class Metric : public interfaces::Metric, public interfaces::SensorListener
+{
+ public:
+ const std::vector<MetricValue>& getReadings() const override
+ {
+ return readings;
+ }
+
+ void sensorUpdated(interfaces::Sensor&, uint64_t) override
+ {}
+
+ void sensorUpdated(interfaces::Sensor&, uint64_t, double value) override
+ {}
+
+ private:
+ std::vector<MetricValue> readings;
+};