30 return CPhidget_open(
handle_, serial_number);
40 return CPhidget_waitForAttachment(
handle_, timeout);
46 const char * deviceptr = a;
47 CPhidget_getDeviceType(
handle_, &deviceptr);
48 return std::string(deviceptr);
54 const char * deviceptr = a;
55 CPhidget_getDeviceName(
handle_, &deviceptr);
56 return std::string(deviceptr);
62 const char * deviceptr = a;
63 CPhidget_getDeviceType(
handle_, &deviceptr);
64 return std::string(deviceptr);
69 const char * deviceptr = a;
70 CPhidget_getLibraryVersion(&deviceptr);
71 return std::string(deviceptr);
77 CPhidget_getSerialNumber(
handle_, &sernum);
84 CPhidget_getDeviceVersion(
handle_, &version);
91 const char * errorPtr = a;
92 CPhidget_getErrorDescription(errorCode, &errorPtr);
93 return std::string(errorPtr);
113 ((
Phidget*)userptr)->attachHandler();
119 ((
Phidget*)userptr)->detachHandler();
125 ((
Phidget*)userptr)->errorHandler(ErrorCode);
static int DetachHandler(CPhidgetHandle handle, void *userptr)
static int AttachHandler(CPhidgetHandle handle, void *userptr)
virtual void registerHandlers()
int getDeviceSerialNumber()
Get the Phidget's serial number.
virtual void detachHandler()
static int ErrorHandler(CPhidgetHandle handle, void *userptr, int ErrorCode, const char *unknown)
int open(int serial_number)
Open a connection to a Phidget.
int waitForAttachment(int timeout)
Block until the unit is attached or timeout occurs.
static std::string getErrorDescription(int errorCode)
Lookup the string for a CPhidget Error Code.
int close()
Close the connection to the phidget.
virtual void errorHandler(int error)
virtual void attachHandler()
std::string getDeviceType()
Get the device type string.
std::string getDeviceLabel()
Get the device label string.
std::string getLibraryVersion()
Get the library version string.
int getDeviceVersion()
Get the Phidget's version.
void init(CPhidgetHandle handle)
std::string getDeviceName()
Get the device name string.