]> pilppa.org Git - lib1wire.git/blobdiff - src/DataReader.hh
Api cleanups for device querying
[lib1wire.git] / src / DataReader.hh
diff --git a/src/DataReader.hh b/src/DataReader.hh
new file mode 100644 (file)
index 0000000..ac7e13e
--- /dev/null
@@ -0,0 +1,67 @@
+/*
+ * DataReader.hh
+ *
+ *  Created on: Nov 7, 2010
+ *      Author: lamikr
+ */
+
+#ifndef W1DATALIST_H_
+#define W1DATALIST_H_
+
+#include <string>
+#include <vector>
+
+#include "Data.hh"
+#include "Date.hh"
+#include "DeviceConfig.hh"
+
+#include <time.h>
+
+namespace plp {
+       class DataReader {
+               public:
+                       DataReader(std::string device_id);
+                       virtual ~DataReader();
+                       plp::DataRange *get_data_range();
+                       /**
+                        * Get monthly summary data.
+                        * Depending from the device type, it may be daily mean value, daily delta, highest value, etc...
+                        */
+                       plp::DataRange *get_yearly_summary(plp::Date *date, EnumSummaryCalculationType calc_type);
+                       plp::DataRange *get_yearly_summary(plp::Date *date);
+                       plp::DataRange *get_yearly_summary(plp::Date *start_date, plp::Date *end_date);
+                       /**
+                        * Get monthly summary data.
+                        * Depending from the device type, it may be daily mean value, daily delta, highest value, etc...
+                        */
+                       plp::DataRange *get_monthly_summary(plp::Date *date, EnumSummaryCalculationType calc_type);
+                       plp::DataRange *get_monthly_summary(plp::Date *date);
+                       plp::DataRange *get_monthly_summary(plp::Date *start_date, plp::Date *end_date);
+                       /**
+                        * Get daily summary data calculated from the daily data items.
+                        * Depending from the device type, it may be daily mean value, daily delta, highest value, etc...
+                        */
+                       plp::DataRange *get_daily_summary(plp::Date *date, EnumSummaryCalculationType calc_type);
+                       plp::DataRange *get_daily_summary(plp::Date *date);
+                       plp::DataRange *get_daily_summary(plp::Date *start_date, plp::Date *end_date);
+                       plp::DataRange *get_hourly_summary(plp::Date *date, EnumSummaryCalculationType calc_type);
+                       plp::DataRange *get_hourly_summary(plp::Date *date);
+                       plp::DataRange *get_hourly_summary(plp::Date *start_date, plp::Date *end_date);
+                       plp::DataRange *get_data(plp::Date *start_date, plp::Date *end_date);
+                       std::string get_device_id();
+                       std::string get_device_type();
+               protected:
+                       std::string                     device_id;
+                       std::string                     device_dir;
+                       std::string                     device_ch_dir;
+                       w1::DeviceConfig                *device_config;
+                       EnumSummaryCalculationType      summary_calc_type;
+                       plp::Data *find_oldest_data(std::vector<std::string> year_vector);
+                       plp::Data *find_newest_data(std::vector<std::string> year_vector);
+                       plp::DataRange *get_summary(plp::Date *date_param,
+                                       EnumSummaryCalculationType calc_type_param,
+                                       EnumSummaryPeriod period_type_param);
+       };
+}
+
+#endif /* W1DATALIST_H_ */