4 * Created on: Dec 9, 2010
8 #ifndef DEVICECONFIG_HH_
9 #define DEVICECONFIG_HH_
12 #include "DataSummary.hh"
19 #define DEVICE_CONFIG__FILE_NAME "device_cfg"
20 #define DEVICE_CONFIG__SECTION_TYPE "device"
21 #define DEVICE_CONFIG__SECTION_NAME "base_data"
22 #define DEVICE_CONFIG_VALUE_KEY__TYPE "type"
23 #define DEVICE_CONFIG_VALUE_KEY__ID "id"
24 #define DEVICE_CONFIG_VALUE_KEY__NAME "name"
26 #define DEFAULT_STORAGE_BASE_DIR "/tmp/w1data"
27 #define DATAFILE_SUFFIX ".txt"
28 #define CACHE_DIR_NAME "cache"
33 ConfigHandle(uci_context *ctx_param,
34 uci_package *pkg_param,
35 const char *short_fname_param,
36 const char *full_fname_param);
38 struct uci_context *_ctx;
39 struct uci_package *_pkg;
46 DeviceConfig(std::string device_id_param);
47 virtual ~DeviceConfig();
48 static std::string get_base_dir_name();
49 static void set_base_dir_name(std::string store_param);
50 static long get_read_interval_seconds();
51 static void set_read_interval_seconds(long seconds_param);
52 static DeviceConfig *get_device_config(std::string device_id);
53 bool get_config_value(std::string key, std::string& value);
54 bool set_config_value(std::string key,
56 bool save_immediately);
57 std::string get_config_path_name();
58 std::string get_config_file_name();
59 std::string get_pathless_config_file_name();
60 EnumSummaryCalculationType get_summary_calculation_type();
62 static std::string store_base_dir;
63 static long read_interval_seconds;
64 std::string device_id;
65 std::string device_type;
66 ConfigHandle *uci_handle;
67 ConfigHandle *load_device_config(std::string device_id_param);
72 #endif /* DEVICECONFIG_HH_ */