vrecko
virtual reality framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Device.h
Go to the documentation of this file.
1 /***************************************************************************
2  device.h - description
3  -------------------
4  begin : May 2002
5  copyright : (C) 2002 by Jan Flasar, Ludek Pokluda
6  email : flasar|xpokluda@fi.muni.cz
7  ***************************************************************************/
8 
9 #ifndef DEVICE_H
10 #define DEVICE_H
11 
12 #include <vrecko/BaseClass.h>
13 #include <vrecko/Export>
14 #include <vreckoDP/Export>
15 
16 #include <string>
17 #ifndef WIN32
18 #include <unistd.h>
19 #endif
20 
21 #define BASE_CALIBRATION_STRING "Sorry, no information."
22 
23 
24 namespace vrecko {
25 
27 class VRECKO_EXPORT Device: public BaseClass {
28  public:
29  //Device() {}; -> no default constructor -> forcing to create a device with a name
30  Device(const char* startingDeviceName, const char *pname = "");
31  virtual ~Device() {};
32 
34  inline int getID(void) {return id;}
35 
37  void setID(int new_id);
38 
40  inline const std::string &getDeviceType(void) {return device_type;}
41 
43  void setPortName(const char *pname) {port_name = pname;}
44 
46  inline const char *getPortName(void) {return port_name.c_str();}
47 
49  virtual int openDevice(void) = 0;
50 
52  virtual int closeDevice(void) = 0;
53 
55  virtual int calibrateDevice(void) {return 0;}
56 
58  virtual const std::string getCalibrationString(void) {return BASE_CALIBRATION_STRING;}
59 
61  virtual void update(void) = 0;
62 
63  protected:
65  int id;
67  std::string device_type;
69  std::string port_name;
70 };
71 
72 }
73 
74 #endif
75