1 #pragma once 2 3 #include "report_manager.hpp" 4 #include "types/report_types.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(Milliseconds val) 57 { 58 intervalProperty = val; 59 return *this; 60 } 61 62 Milliseconds interval() const 63 { 64 return intervalProperty; 65 } 66 67 ReportParams& enabled(bool val) 68 { 69 enabledProperty = val; 70 return *this; 71 } 72 73 bool enabled() const 74 { 75 return enabledProperty; 76 } 77 78 ReportParams& metricParameters(std::vector<LabeledMetricParameters> val) 79 { 80 metricParametersProperty = std::move(val); 81 return *this; 82 } 83 84 const std::vector<LabeledMetricParameters>& metricParameters() const 85 { 86 return metricParametersProperty; 87 } 88 89 private: 90 std::string reportNameProperty = "TestReport"; 91 std::string reportingTypeProperty = "OnRequest"; 92 bool emitReadingUpdateProperty = true; 93 bool logToMetricReportCollectionProperty = true; 94 Milliseconds intervalProperty = ReportManager::minInterval; 95 std::vector<LabeledMetricParameters> metricParametersProperty{ 96 {LabeledMetricParameters{ 97 {LabeledSensorParameters{"Service", 98 "/xyz/openbmc_project/sensors/power/p1"}}, 99 OperationType::single, 100 "MetricId1", 101 "Metadata1", 102 CollectionTimeScope::point, 103 CollectionDuration(Milliseconds(0u))}, 104 LabeledMetricParameters{ 105 {LabeledSensorParameters{"Service", 106 "/xyz/openbmc_project/sensors/power/p2"}}, 107 OperationType::single, 108 "MetricId2", 109 "Metadata2", 110 CollectionTimeScope::point, 111 CollectionDuration(Milliseconds(0u))}}}; 112 bool enabledProperty = true; 113 }; 114