4 * Created on: Oct 20, 2010
17 #include <plp/Data.hh>
18 #include <plp/DataReader.hh>
19 #include <plp/SensorDevice.hh>
20 #include <plp/Device.hh>
22 #ifndef W1_SCAN_ROOTDIR
23 #define W1_SCAN_ROOTDIR "/sys/bus/w1/devices"
27 #define W1_SLAVE_FILE "w1_slave";
31 class W1Device : public plp::SensorDevice {
33 W1Device(std::string device_id_param,
34 std::string device_type_param,
35 dirent *direntry_param);
37 std::string get_name();
38 void set_name(std::string name_param);
40 plp::Data *get_data();
41 plp::DataReader *get_device_data();
44 std::string slave_file;
45 std::list<plp::Data *> memory_cache;
46 plp::DataReader *reader;
47 void save_and_clean_cache();
48 virtual std::vector<double> *get_raw_data() = 0;
49 virtual unsigned int get_data_decimal_precision() = 0;
50 void cache(plp::Data *data);
51 std::string to_string(double val, int digit_count);
55 #endif /* W1DEVICE_HH_ */