X-Git-Url: http://pilppa.org/gitweb/?a=blobdiff_plain;f=src%2FDeviceConfig.hh;h=c2cfb31512fbce5f2619a3b405bf4339f2e59b8c;hb=83dba70b46600014932da34e8744ba70584077aa;hp=ced5c81ae5ccfddc9af7bd041b1365f72b6494e5;hpb=9c47855d3ddc3d09b9733c43d420a7d5b739bd37;p=lib1wire.git diff --git a/src/DeviceConfig.hh b/src/DeviceConfig.hh index ced5c81..c2cfb31 100644 --- a/src/DeviceConfig.hh +++ b/src/DeviceConfig.hh @@ -10,17 +10,45 @@ #include +extern "C" { +#include +#include +} + +#define DEVICE_CONFIG__FILE_NAME "dev_cfg.txt" +#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__NAME "name" + namespace w1 { enum enum_summary_calculation {SUM, DELTA, MEAN, MAX, MIN}; + struct ConfigHandle { + public: + ConfigHandle(uci_context *ctx_param, uci_package *pkg_param); + ~ConfigHandle(); + struct uci_context *ctx; + struct uci_package *pkg; + }; + class DeviceConfig { public: DeviceConfig(std::string device_id_param); virtual ~DeviceConfig(); - std::string get_config_value(std::string key); + static std::string get_base_dir_name(); + static void set_base_dir_name(std::string store_param); + std::string get_cfg_value(std::string key); + void set_cfg_value(std::string key, std::string value); enum_summary_calculation get_summary_calculation_type(); private: - std::string device_id; + static std::string store_base_dir; + std::string device_id; + 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); }; }