X-Git-Url: http://pilppa.org/gitweb/?p=libplp.git;a=blobdiff_plain;f=src%2FDeviceConfig.hh;h=52f2db87397452bc4b60f32819323034dcd8a703;hp=0ede1351afaae9511f875142ea9603a163bbc837;hb=860d8c023b82eeca9833d4a3f534c6d11a9523f3;hpb=65f22bbea2531f7cd492d6108b8902f92b7750a8 diff --git a/src/DeviceConfig.hh b/src/DeviceConfig.hh index 0ede135..52f2db8 100644 --- a/src/DeviceConfig.hh +++ b/src/DeviceConfig.hh @@ -9,18 +9,13 @@ #define DEVICECONFIG_HH_ #include +#include "DataSummary.hh" extern "C" { #include #include } -enum EnumSummaryPeriod{PERIOD_YEARLY, PERIOD_MONTHLY, PERIOD_DAILY, PERIOD_HOURLY, PERIOD_MINUTELY, PERIOD_SECONDLY}; -enum EnumSummaryCalculationType {SUM, DELTA, MIN, MAX, MEAN}; - -const std::string SUMMARY_PERIOD_NAMES_ARRAY[] = {"yearly", "monthly", "daily", "minutely", "secondly"}; -const std::string CALCULATION_TYPE_NAMES_ARRAY[] = {"sum", "delta", "min", "max", "mean"}; - #define DEVICE_CONFIG__FILE_NAME "device_cfg" #define DEVICE_CONFIG__SECTION_TYPE "device" #define DEVICE_CONFIG__SECTION_NAME "base_data" @@ -55,9 +50,13 @@ namespace plp { static long get_read_interval_seconds(); static void set_read_interval_seconds(long seconds_param); static DeviceConfig *get_device_config(std::string device_id); - std::string get_config_value(std::string key); - void set_config_value(std::string key, - std::string value); + bool get_config_value(std::string key, std::string& value); + bool set_config_value(std::string key, + std::string value, + bool save_immediately); + std::string get_config_path_name(); + std::string get_config_file_name(); + std::string get_pathless_config_file_name(); EnumSummaryCalculationType get_summary_calculation_type(); private: static std::string store_base_dir; @@ -66,8 +65,7 @@ namespace plp { std::string device_type; ConfigHandle *uci_handle; ConfigHandle *load_device_config(std::string device_id_param); - std::string get_dir_name(std::string device_id); - std::string get_file_name(std::string device_id_param); + }; }