X-Git-Url: http://pilppa.org/gitweb/?a=blobdiff_plain;f=src%2FW1Device.hh;h=28d4d3852cf217fc17159e1a04698128e4ac0387;hb=e3fdbdfff2fc5e4ca6bc42e71ba8265c0e5c3719;hp=4dab3a657de10e960d58e6ebdf8657ad156a01f4;hpb=da203ad44792ca37320768f4cbe68587c4806910;p=lib1wire.git diff --git a/src/W1Device.hh b/src/W1Device.hh index 4dab3a6..28d4d38 100644 --- a/src/W1Device.hh +++ b/src/W1Device.hh @@ -13,10 +13,12 @@ #include #include +#include -#include "Data.hh" -#include "SensorDevice.hh" -#include "Device.hh" +#include +#include +#include +#include #ifndef W1_SCAN_ROOTDIR #define W1_SCAN_ROOTDIR "/sys/bus/w1/devices" @@ -29,32 +31,26 @@ namespace w1 { class W1Device : public plp::SensorDevice { public: - W1Device(std::string device_type_param, - std::string device_id_param, + W1Device(std::string device_id_param, + std::string device_type_param, dirent *direntry_param); - virtual ~W1Device(); - std::string get_id(); + ~W1Device(); std::string get_name(); void set_name(std::string name_param); void printout(); plp::Data *get_data(); - plp::DataReader *get_device_data(); - std::string get_device_type(); - plp::EnumDeviceLifeCycleStatus get_lifecycle_state(); + const plp::DataReader *get_device_data(); protected: - void save_and_clean_cache(); - virtual std::vector *get_raw_data() = 0; - virtual unsigned int get_data_decimal_precision() = 0; - void cache(plp::Data *data); - std::string to_string(double val, int digit_count); - //Data *get_formatted_data(Data *data); - std::string id; - std::string type; - std::string name; std::string dir_path; std::string slave_file; std::list memory_cache; - plp::EnumDeviceLifeCycleStatus lifecycle_status; + plp::DataReader *reader; + void save_and_clean_cache(); + virtual std::vector *get_raw_data() = 0; + virtual unsigned int get_data_decimal_precision() { return 1; } + void cache(plp::Data *new_data); + std::string to_string(double val, int digit_count); + pthread_mutex_t plock; }; }