Add functions to return the averages and maximums

Add functions to return the input history in a format
that can be used to write the D-Bus properties.

Change-Id: I7a395568dcdce89b5f3e4b6a73d58dc84adaaa7c
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
diff --git a/power-supply/record_manager.cpp b/power-supply/record_manager.cpp
index c3f8984..ec6e917 100644
--- a/power-supply/record_manager.cpp
+++ b/power-supply/record_manager.cpp
@@ -94,6 +94,32 @@
     return true;
 }
 
+auto RecordManager::getAverageRecords() -> DBusRecordList
+{
+    DBusRecordList list;
+
+    for (const auto& r : records)
+    {
+        list.emplace_back(std::get<recTimePos>(r),
+                          std::get<recAvgPos>(r));
+    }
+
+    return list;
+}
+
+auto RecordManager::getMaximumRecords() -> DBusRecordList
+{
+    DBusRecordList list;
+
+    for (const auto& r : records)
+    {
+        list.emplace_back(std::get<recTimePos>(r),
+                          std::get<recMaxPos>(r));
+    }
+
+    return list;
+}
+
 size_t RecordManager::getRawRecordID(
         const std::vector<uint8_t>& data) const
 {