1 #pragma once 2 3 #include "interfaces/types.hpp" 4 #include "report_manager.hpp" 5 6 #include <chrono> 7 #include <string> 8 9 class 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 34 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: 79 std::string reportNameProperty = "TestReport"; 80 std::string reportingTypeProperty = "OnRequest"; 81 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")}, 87 "SINGLE", 88 "MetricId1", 89 "Metadata1"}, 90 {{sdbusplus::message::object_path( 91 "/xyz/openbmc_project/sensors/power/p2")}, 92 "SINGLE", 93 "MetricId2", 94 "Metadata2"}}; 95 };