]> pilppa.org Git - lib1wire.git/blob - src/W1Device.hh
initial version
[lib1wire.git] / src / W1Device.hh
1 /*
2  * W1Device.hh
3  *
4  *  Created on: Oct 20, 2010
5  *      Author: lamikr
6  */
7
8 #ifndef W1DEVICE_HH_
9 #define W1DEVICE_HH_
10
11 #include <dirent.h>
12 #include <stdbool.h>
13 #include <string>
14
15 #ifndef W1_SCAN_ROOTDIR
16 #define W1_SCAN_ROOTDIR         "/sys/bus/w1/devices"
17 #endif
18
19 #ifndef W1_SLAVE_FILE
20 #define W1_SLAVE_FILE           "w1_slave";
21 #endif
22
23 namespace w1 {
24         class W1Device {
25                 public:
26                         W1Device(dirent *direntry, int family_code_param, std::string id_param);
27                         virtual ~W1Device();
28                         int get_family_code();
29                         std::string get_id();
30                         std::string get_name();
31                         virtual void printout();
32                         void set_name(std::string name_param);
33                         virtual std::string get_value() = 0;
34                         virtual std::string get_unit() = 0;
35                         std::string get_time();
36                 protected:
37                         virtual bool is_supported_family_code(int family_code) = 0;
38                         int     family_code;
39                         std::string id;
40                         std::string name;
41                         std::string dir_path;
42                         std::string slave_file;
43                 private:
44         };
45 }
46
47 #endif /* W1DEVICE_HH_ */