00001 00060 #ifndef _PHIDGET_H_ 00061 #define _PHIDGET_H_ 00062 00063 #include <string> 00064 #include <libphidgets/phidget21.h> 00065 00066 class Phidget 00067 { 00068 public: 00069 enum class SensingMode{EVENT=0, POLLING=1}; 00070 00071 ~Phidget(); 00072 00073 auto open(int serial_number) -> int; 00074 auto close(int serial_number) -> int; 00075 auto waitForAttachment(int timeout) -> int; 00076 auto getDeviceType() -> std::string; 00077 auto getDeviceName() -> std::string; 00078 auto getDeviceLabel() -> std::string; 00079 auto getLibraryVersion() -> std::string; 00080 auto getDeviceSerialNumber() -> int; 00081 auto getDeviceVersion() -> int; 00082 00083 virtual auto update() -> void; 00084 00085 static auto getErrorDescription(int errorCode) -> std::string; 00086 00087 protected: 00088 CPhidgetHandle* _phiHandle; 00089 int _serialNumber; 00090 int _last_error; 00091 SensingMode _sensMode; 00092 00093 Phidget(CPhidgetHandle * handle, SensingMode mode); 00094 00095 virtual auto attachHandler() -> int; 00096 virtual auto detachHandler() -> int; 00097 }; 00098 #endif //_PHIDGET_H_