00001 /* 00002 * HIDDevice.hpp 00003 * 00004 * Created on: Oct 24, 2011 00005 * Author: mriedel 00006 */ 00007 00008 #ifndef HIDDEVICE_HPP_ 00009 #define HIDDEVICE_HPP_ 00010 00011 #include <telekyb_defines/telekyb_defines.hpp> 00012 00013 #include <hidapi.h> 00014 00015 #include <string> 00016 00017 namespace TELEKYB_NAMESPACE 00018 { 00019 00020 class HIDDevice { 00021 protected: 00022 // IDs 00023 unsigned short int vendorID; 00024 unsigned short int productID; 00025 // Handle 00026 hid_device *handle; 00027 // WString 00028 std::wstring serialNumber; 00029 std::wstring manufacturerString; 00030 std::wstring productString; 00031 00032 bool init(); 00033 00034 public: 00035 HIDDevice(unsigned short int vendorID_ , unsigned short int productID_); 00036 virtual ~HIDDevice(); 00037 00038 bool isOpen() const; 00039 void close(); 00040 00041 std::wstring getWSerialNumber() const; 00042 std::wstring getWManufacturerString() const; 00043 std::wstring getWProductString() const; 00044 std::string getSerialNumber() const; 00045 std::string getManufacturerString() const; 00046 std::string getProductString() const; 00047 }; 00048 00049 } /* namespace telekyb */ 00050 #endif /* HIDDEVICE_HPP_ */