X-Git-Url: http://pilppa.org/gitweb/?p=libplp.git;a=blobdiff_plain;f=src%2FDeviceConfig.hh;h=bc8241603753689f5022b3f72c2bbe693425e87f;hp=194b8a7c6aaabd6fdec6106a9245055661262374;hb=23a30eb765fc6aaf347da839567140ae41e8cc6b;hpb=6eb270983373b863deeca1497b56fcb1d23f2c2b diff --git a/src/DeviceConfig.hh b/src/DeviceConfig.hh index 194b8a7..bc82416 100644 --- a/src/DeviceConfig.hh +++ b/src/DeviceConfig.hh @@ -13,6 +13,7 @@ extern "C" { #include #include "config.h" + #include } enum EnumSummaryPeriod{PERIOD_YEARLY, PERIOD_MONTHLY, PERIOD_DAILY, PERIOD_HOURLY, PERIOD_MINUTELY, PERIOD_SECONDLY}; @@ -21,16 +22,16 @@ 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" -#define DEVICE_CONFIG_VALUE_KEY__TYPE "type" -#define DEVICE_CONFIG_VALUE_KEY__ID "id" -#define DEVICE_CONFIG_VALUE_KEY__NAME "name" +#define DEVICE_CONFIG__FILE_NAME "device_cfg" +#define DEVICE_CONFIG__SECTION_TYPE "device" +#define DEVICE_CONFIG__SECTION_NAME "base_data" +#define DEVICE_CONFIG_VALUE_KEY__TYPE "type" +#define DEVICE_CONFIG_VALUE_KEY__ID "id" +#define DEVICE_CONFIG_VALUE_KEY__NAME "name" -#define DEFAULT_STORAGE_BASE_DIR "/tmp/w1data" -#define DATAFILE_SUFFIX ".txt" -#define CACHE_DIR_NAME "cache" +#define DEFAULT_STORAGE_BASE_DIR "/tmp/w1data" +#define DATAFILE_SUFFIX ".txt" +#define CACHE_DIR_NAME "cache" namespace plp { struct ConfigHandle { @@ -48,8 +49,10 @@ namespace plp { static std::string get_base_dir_name(); static void set_base_dir_name(std::string store_param); static DeviceConfig *get_device_config(std::string device_id); - std::string get_cfg_value(std::string key); - void set_cfg_value(std::string key, std::string value); + std::string get_config_value(std::string key); + void set_config_value(std::string key, + std::string value, + bool save_immediately); EnumSummaryCalculationType get_summary_calculation_type(); private: static std::string store_base_dir;