39 const char *error_ptr;
40 PhidgetReturnCode ret = Phidget_getErrorDescription(code, &error_ptr);
41 if (ret == EPHIDGET_OK)
43 msg_ = msg +
": " + std::string(error_ptr);
46 msg_ = msg +
": Unknown error";
58 int hub_port,
bool is_hub_port_device,
int channel)
60 PhidgetReturnCode ret;
62 ret = Phidget_setDeviceSerialNumber(handle, serial_number);
63 if (ret != EPHIDGET_OK)
68 ret = Phidget_setHubPort(handle, hub_port);
69 if (ret != EPHIDGET_OK)
74 ret = Phidget_setIsHubPortDevice(handle, is_hub_port_device);
75 if (ret != EPHIDGET_OK)
77 throw Phidget22Error(
"Failed to set device is hub port device", ret);
80 ret = Phidget_setChannel(handle, channel);
81 if (ret != EPHIDGET_OK)
86 ret = Phidget_openWaitForAttachment(handle, PHIDGET_TIMEOUT_DEFAULT);
87 if (ret != EPHIDGET_OK)
95 Phidget_close(*handle);
96 Phidget_delete(handle);