本文整理汇总了C++中USBDevice::loadConfiguration方法的典型用法代码示例。如果您正苦于以下问题:C++ USBDevice::loadConfiguration方法的具体用法?C++ USBDevice::loadConfiguration怎么用?C++ USBDevice::loadConfiguration使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类USBDevice
的用法示例。
在下文中一共展示了USBDevice::loadConfiguration方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: usbDeviceArrived
void FCServer::usbDeviceArrived(libusb_device *device)
{
/*
* New USB device. Is this a device we recognize?
*/
USBDevice *dev;
if (FCDevice::probe(device)) {
dev = new FCDevice(device, mVerbose);
} else if (EnttecDMXDevice::probe(device)) {
dev = new EnttecDMXDevice(device, mVerbose);
} else {
return;
}
int r = dev->open();
if (r < 0) {
if (mVerbose) {
switch (r) {
// Errors that may occur transiently while a device is connecting...
case LIBUSB_ERROR_NOT_FOUND:
case LIBUSB_ERROR_NOT_SUPPORTED:
#ifdef OS_WINDOWS
std::clog << "Waiting for Windows to install " << dev->getName() << " driver. This may take a moment...\n";
#endif
#ifdef OS_LINUX
// Try again in ~100ms or so.
mPollForDevicesOnce = true;
#endif
break;
default:
std::clog << "Error opening " << dev->getName() << ": " << libusb_strerror(libusb_error(r)) << "\n";
break;
}
}
delete dev;
return;
}
if (!dev->probeAfterOpening()) {
// We were mistaken, this device isn't actually one we want.
delete dev;
return;
}
for (unsigned i = 0; i < mDevices.Size(); ++i) {
if (dev->matchConfiguration(mDevices[i])) {
// Found a matching configuration for this device. We're keeping it!
dev->loadConfiguration(mDevices[i]);
dev->writeColorCorrection(mColor);
mUSBDevices.push_back(dev);
if (mVerbose) {
std::clog << "USB device " << dev->getName() << " attached.\n";
}
jsonConnectedDevicesChanged();
return;
}
}
if (mVerbose) {
std::clog << "USB device " << dev->getName() << " has no matching configuration. Not using it.\n";
}
delete dev;
}