blob: 25422bcdbdc9a99905f1fd8e8c0575f7a255ee20 [file] [log] [blame]
Krzysztof Grobelnyc8e3a642020-10-23 12:29:16 +02001#pragma once
2
Krzysztof Grobelny9f9ff902021-03-05 14:57:53 +00003#include "interfaces/types.hpp"
Wludzik, Jozefe2362792020-10-27 17:23:55 +01004#include "report_manager.hpp"
5
Krzysztof Grobelnyc8e3a642020-10-23 12:29:16 +02006#include <chrono>
7#include <string>
8
9class ReportParams final
10{
11 public:
12 ReportParams& reportName(std::string val)
13 {
14 reportNameProperty = std::move(val);
15 return *this;
16 }
17
18 const std::string& reportName() const
19 {
20 return reportNameProperty;
21 }
22
23 ReportParams& reportingType(std::string val)
24 {
25 reportingTypeProperty = std::move(val);
26 return *this;
27 }
28
29 const std::string& reportingType() const
30 {
31 return reportingTypeProperty;
32 }
33
Wludzik, Jozefe2362792020-10-27 17:23:55 +010034 ReportParams& emitReadingUpdate(bool val)
35 {
36 emitReadingUpdateProperty = val;
37 return *this;
38 }
39
40 bool emitReadingUpdate() const
41 {
42 return emitReadingUpdateProperty;
43 }
44
45 ReportParams& logToMetricReportCollection(bool val)
46 {
47 logToMetricReportCollectionProperty = val;
48 return *this;
49 }
50
51 bool logToMetricReportCollection() const
52 {
53 return logToMetricReportCollectionProperty;
54 }
55
56 ReportParams& interval(std::chrono::milliseconds val)
57 {
58 intervalProperty = val;
59 return *this;
60 }
61
62 std::chrono::milliseconds interval() const
63 {
64 return intervalProperty;
65 }
66
67 ReportParams& readingParameters(ReadingParameters val)
68 {
69 readingParametersProperty = std::move(val);
70 return *this;
71 }
72
73 const ReadingParameters& readingParameters() const
74 {
75 return readingParametersProperty;
76 }
77
78 private:
Krzysztof Grobelnyc8e3a642020-10-23 12:29:16 +020079 std::string reportNameProperty = "TestReport";
80 std::string reportingTypeProperty = "OnRequest";
Wludzik, Jozefe2362792020-10-27 17:23:55 +010081 bool emitReadingUpdateProperty = true;
82 bool logToMetricReportCollectionProperty = true;
83 std::chrono::milliseconds intervalProperty = ReportManager::minInterval;
84 ReadingParameters readingParametersProperty = {
85 {{sdbusplus::message::object_path(
86 "/xyz/openbmc_project/sensors/power/p1")},
Krzysztof Grobelnye8fc5752021-02-05 14:30:45 +000087 utils::enumToString(OperationType::single),
Wludzik, Jozefe2362792020-10-27 17:23:55 +010088 "MetricId1",
Krzysztof Grobelny9f9ff902021-03-05 14:57:53 +000089 "Metadata1"},
Wludzik, Jozefe2362792020-10-27 17:23:55 +010090 {{sdbusplus::message::object_path(
91 "/xyz/openbmc_project/sensors/power/p2")},
Krzysztof Grobelnye8fc5752021-02-05 14:30:45 +000092 utils::enumToString(OperationType::single),
Wludzik, Jozefe2362792020-10-27 17:23:55 +010093 "MetricId2",
Krzysztof Grobelny9f9ff902021-03-05 14:57:53 +000094 "Metadata2"}};
Krzysztof Grobelnyd2238192020-12-02 09:27:28 +000095};