当前位置: 首页>>代码示例>>C++>>正文


C++ USBDevice::getName方法代码示例

本文整理汇总了C++中USBDevice::getName方法的典型用法代码示例。如果您正苦于以下问题:C++ USBDevice::getName方法的具体用法?C++ USBDevice::getName怎么用?C++ USBDevice::getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在USBDevice的用法示例。


在下文中一共展示了USBDevice::getName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: usbDeviceLeft

void FCServer::usbDeviceLeft(std::vector<USBDevice*>::iterator iter)
{
    USBDevice *dev = *iter;
    if (mVerbose) {
        std::clog << "USB device " << dev->getName() << " removed.\n";
    }
    mUSBDevices.erase(iter);
    delete dev;
    jsonConnectedDevicesChanged();
}
开发者ID:Elfkay,项目名称:fadecandy,代码行数:10,代码来源:fcserver.cpp

示例2: 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;
}
开发者ID:Elfkay,项目名称:fadecandy,代码行数:71,代码来源:fcserver.cpp


注:本文中的USBDevice::getName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。