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


C++ DeviceList类代码示例

本文整理汇总了C++中DeviceList的典型用法代码示例。如果您正苦于以下问题:C++ DeviceList类的具体用法?C++ DeviceList怎么用?C++ DeviceList使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: TestSubscription

void TestSubscription(CpStack& aCpStack)
{
    gSubscriptionCount = 0; // reset this here in case we're run multiple times via TestShell
    Debug::SetLevel(Debug::kNone);
    Environment& env = aCpStack.Env();
    DeviceList* deviceList = new DeviceList(env);
    FunctorCpDevice added = MakeFunctorCpDevice(*deviceList, &DeviceList::Added);
    FunctorCpDevice removed = MakeFunctorCpDevice(*deviceList, &DeviceList::Removed);
    const Brn domainName("upnp.org");
    const Brn serviceType("ConnectionManager");
#if 1
    const TUint ver = 1;
    CpDeviceListUpnpServiceType* list =
                new CpDeviceListUpnpServiceType(aCpStack, domainName, serviceType, ver, added, removed);
#else
    const Brn uuid("896659847466-a4badbeaacbc-737837");
    CpDeviceListUpnpUuid* list = new CpDeviceListUpnpUuid(aCpStack, uuid, added, removed);
#endif
    Blocker* blocker = new Blocker(env);
    blocker->Wait(env.InitParams().MsearchTimeSecs());
    delete blocker;
    deviceList->Stop();

    TUint startTime = Os::TimeInMs(env.OsCtx());
    deviceList->Poll();

    const TUint count = deviceList->Count();
    Print("\n%u subscriptions on %u devices (avg %u) in %u seconds\n",
                        gSubscriptionCount, count, (count==0? 0 : gSubscriptionCount/count), (Os::TimeInMs(env.OsCtx())-startTime+500)/1000);

    delete list;
    delete deviceList;
}
开发者ID:ACDN,项目名称:ohNet,代码行数:33,代码来源:TestSubscription.cpp

示例2: qDebug

DeviceList DeviceInfo::xvAdaptors()
{
    qDebug("DeviceInfo::xvAdaptors");

    DeviceList l;
    QRegExp rx_device("^.*Adaptor #([0-9]+): \"(.*)\"");

    QProcess p;
    p.setProcessChannelMode(QProcess::MergedChannels);
    p.setEnvironment(QProcess::systemEnvironment() << "LC_ALL=C");
    p.start("xvinfo");

    if (p.waitForFinished()) {
        QByteArray line;

        while (p.canReadLine()) {
            line = p.readLine();
            qDebug("DeviceInfo::xvAdaptors: '%s'", line.constData());

            if (rx_device.indexIn(line) > -1) {
                QString id = rx_device.cap(1);
                QString desc = rx_device.cap(2);
                qDebug("DeviceInfo::xvAdaptors: found adaptor: '%s' '%s'", id.toUtf8().constData(), desc.toUtf8().constData());
                l.append(DeviceData(id, desc));
            }
        }
    } else {
        qDebug("DeviceInfo::xvAdaptors: could not start xvinfo, error %d", p.error());
    }

    return l;
}
开发者ID:JackieKu,项目名称:SMPlayer2,代码行数:32,代码来源:deviceinfo.cpp

示例3: OhNetTestRunner

extern "C" void OhNetTestRunner(OhNetHandleInitParams aInitParams)
{
    OhNetInitParamsSetMsearchTime(aInitParams, 1);
    OhNetInitParamsSetUseLoopbackNetworkAdapter(aInitParams);
    OhNetInitParamsSetDvUpnpServerPort(aInitParams, 0);
    OhNetLibraryInitialise(aInitParams);
    Print("TestDvDeviceC - starting\n");
    OhNetHandleNetworkAdapterList subnetList = OhNetSubnetListCreate();
    OhNetHandleNetworkAdapter nif = OhNetSubnetAt(subnetList, 0);
    TIpAddress subnet = OhNetNetworkAdapterSubnet(nif);
    OhNetSubnetListDestroy(subnetList);
    (void)OhNetLibraryStartCombined(subnet);
//    Debug::SetLevel(Debug::kService);

    Semaphore* sem = new Semaphore("SEM1", 0);
    DeviceBasicC* device = new DeviceBasicC(DeviceBasicC::eProtocolUpnp);
    DeviceList* deviceList = new DeviceList(*sem);
    HandleCpDeviceList dlh = CpDeviceListCreateUpnpServiceType("openhome.org", "TestBasic", 1,
                                                               added, deviceList, removed, deviceList);
    sem->Wait(30*1000); // allow up to 30 seconds to find our one device

    deviceList->TestActions();
    deviceList->TestSubscriptions();

    CpDeviceListDestroy(dlh);
    delete sem;
    delete deviceList;
    delete device;

    Print("TestDvDeviceC - completed\n");
    OhNetLibraryClose();
}
开发者ID:ACDN,项目名称:ohNet,代码行数:32,代码来源:TestDvDeviceC.cpp

示例4: qDebug

DeviceList DeviceInfo::retrieveDevices(DeviceType type) {
	qDebug("DeviceInfo::retrieveDevices: %d", type);
	
	DeviceList l;
	QRegExp rx_device("^(\\d+): (.*)");
	
	if (QFile::exists("dxlist.exe")) {
		QProcess p;
		p.setProcessChannelMode( QProcess::MergedChannels );
		QStringList arg;
		if (type == Sound) arg << "-s"; else arg << "-d";
		p.start("dxlist", arg);

		if (p.waitForFinished()) {
			QByteArray line;
			while (p.canReadLine()) {
				line = p.readLine().trimmed();
				qDebug("DeviceInfo::retrieveDevices: '%s'", line.constData());
				if ( rx_device.indexIn(line) > -1 ) {
					int id = rx_device.cap(1).toInt();
					QString desc = rx_device.cap(2);
					qDebug("DeviceInfo::retrieveDevices: found device: '%d' '%s'", id, desc.toUtf8().constData());
					l.append( DeviceData(id, desc) );
				}
			}
		}
	}
	
	return l;
}
开发者ID:dradetsky,项目名称:smplayer-mirror,代码行数:30,代码来源:deviceinfo.cpp

示例5: startAudio

// Starts audio input
void KinectApp::startAudio()
{

	// Initialize audio device
	if ( !mInput ) {
		mInput = AudioInput::create();
	}

	// Find Kinect audio
	int32_t deviceId = -1;
	int32_t audioDeviceIndex = 0;
	DeviceList devices = mInput->getDeviceList();
	for ( DeviceList::const_iterator deviceIt = devices.cbegin(); deviceIt != devices.cend(); ++deviceIt, audioDeviceIndex ) {
		if ( boost::contains( boost::to_lower_copy( deviceIt->second ), "kinect" ) ) {
			deviceId = deviceIt->first;
			audioDeviceIndex++;
		}
	}

	// Start receiving audio
	mInput->setDevice( deviceId );
	mCallbackId = mInput->addCallback<KinectApp>( & KinectApp::onData, this );
	mInput->start();

}
开发者ID:momo-the-monster,项目名称:Cinder-KinectSdk,代码行数:26,代码来源:KinectApp.cpp

示例6: getMetronome

void
ManageMetronomeDialog::slotPreviewPitch(int pitch)
{
    RG_DEBUG << "ManageMetronomeDialog::slotPreviewPitch";

    DeviceList *devices = m_doc->getStudio().getDevices();
    DeviceListConstIterator it;
    int count = 0;
    Device *dev = 0;

    for (it = devices->begin(); it != devices->end(); it++) {

        dev = *it;
        if (!isSuitable(dev)) continue;

        if (count == m_metronomeDevice->currentIndex()) break;
        count++;
    }

    if (!dev || !isSuitable(dev)) return;

    const MidiMetronome *metronome = getMetronome(dev);
    if (metronome == 0) return;

    InstrumentList list = dev->getPresentationInstruments();

    Instrument *inst =
        list[m_metronomeInstrument->currentIndex()];
    StudioControl::playPreviewNote(inst, pitch, MidiMaxValue, RealTime(0, 10000000));
}
开发者ID:tedfelix,项目名称:rosegarden,代码行数:30,代码来源:ManageMetronomeDialog.cpp

示例7: SYNTAX_ERROR

RobotInterface::DeviceList RobotInterface::XMLReader::Private::readDevicesTag(TiXmlElement *devicesElem)
{
    const std::string &valueStr = devicesElem->ValueStr();

    if (valueStr.compare("devices") != 0) {
        SYNTAX_ERROR(devicesElem->Row()) << "Expected \"devices\". Found" << valueStr;
    }

    std::string filename;
    if (devicesElem->QueryStringAttribute("file", &filename) == TIXML_SUCCESS) {
        // yDebug() << "Found devices file [" << filename << "]";
#ifdef WIN32
        std::replace(filename.begin(), filename.end(), '/', '\\');
        filename = path + "\\" + filename;
#else // WIN32
        filename = path + "/" + filename;
#endif //WIN32
        return readDevicesFile(filename);
    }

    std::string robotName;
    if (devicesElem->QueryStringAttribute("robot", &robotName) != TIXML_SUCCESS) {
        SYNTAX_WARNING(devicesElem->Row()) << "\"devices\" element should contain the \"robot\" attribute";
    }

    if (robotName != robot.name()) {
        SYNTAX_WARNING(devicesElem->Row()) << "Trying to import a file for the wrong robot. Found" << robotName << "instead of" << robot.name();
    }

    unsigned int build;
#if TINYXML_UNSIGNED_INT_BUG
    if (devicesElem->QueryUnsignedAttribute("build", &build()) != TIXML_SUCCESS) {
        // No build attribute. Assuming build="0"
        SYNTAX_WARNING(devicesElem->Row()) << "\"devices\" element should contain the \"build\" attribute [unsigned int]. Assuming 0";
    }
#else
    int tmp;
    if (devicesElem->QueryIntAttribute("build", &tmp) != TIXML_SUCCESS || tmp < 0) {
        // No build attribute. Assuming build="0"
        SYNTAX_WARNING(devicesElem->Row()) << "\"devices\" element should contain the \"build\" attribute [unsigned int]. Assuming 0";
        tmp = 0;
    }
    build = (unsigned)tmp;
#endif

    if (build != robot.build()) {
        SYNTAX_WARNING(devicesElem->Row()) << "Import a file for a different robot build. Found" << build << "instead of" << robot.build();
    }

    DeviceList devices;
    for (TiXmlElement* childElem = devicesElem->FirstChildElement(); childElem != 0; childElem = childElem->NextSiblingElement()) {
        DeviceList childDevices = readDevices(childElem);
        for (DeviceList::const_iterator it = childDevices.begin(); it != childDevices.end(); ++it) {
            devices.push_back(*it);
        }
    }

    return devices;
}
开发者ID:AbuMussabRaja,项目名称:icub-main,代码行数:59,代码来源:XMLReader.cpp

示例8: freeDeviceList

//---------------------------------------------------------------------------------//
DeviceList WiiMoteFactoryCreator::freeDeviceList()
{
	DeviceList list;
	for( std::deque<int>::iterator i = mFreeWiis.begin(); i != mFreeWiis.end(); ++i )
	{
		list.insert(std::make_pair(OISJoyStick, mVendorName));
	}
	return list;
}
开发者ID:jrsnail,项目名称:u2project_deps,代码行数:10,代码来源:OISWiiMoteFactoryCreator.cpp

示例9: GetFreeDeviceList

//----------------------------------------------------------------------------
DeviceList PhoneInputManager::GetFreeDeviceList()
{
	DeviceList ret;

	if (false == mIsMuliTouchUsed)
		ret.insert(std::make_pair(IT_TOUCH, mInputSystemName));

	return ret;
}
开发者ID:manyxu,项目名称:Phoenix3D_2.0,代码行数:10,代码来源:PX2PhoneInputManager.cpp

示例10: getDeviceList

void ControlPoint::print() {
    DeviceList *devList = getDeviceList();
    int devCnt = devList->size();
    cout << "Device Num = " << devCnt << endl;
    for (int n = 0; n < devCnt; n++) {
      Device *dev = devList->getDevice(n);
      cout << "[" << n <<  "] " << dev->getFriendlyName() << ", " << dev->getLeaseTime() << ", " << dev->getElapsedTime() << endl;
    }    
}
开发者ID:SrihariLibre,项目名称:CyberLink4CC,代码行数:9,代码来源:ControlPoint.cpp

示例11: onDeviceChange

void LeapHands::onDeviceChange(const Controller& controller) {
	std::cout << "Device Changed" << std::endl;
	const DeviceList devices = controller.devices();

	for (int i = 0; i < devices.count(); ++i) {
		std::cout << "id: " << devices[i].toString() << std::endl;
		std::cout << "  isStreaming: " << (devices[i].isStreaming() ? "true" : "false") << std::endl;
	}
}
开发者ID:AdamCarrick,项目名称:BGE,代码行数:9,代码来源:LeapHands.cpp

示例12: lock

void ControlPoint::renewSubscriberService(long timeout) {
  lock();
  DeviceList *devList = getDeviceList();
  int devCnt = devList->size();
  for (int n = 0; n < devCnt; n++) {
    Device *dev = devList->getDevice(n);
    renewSubscriberService(dev, timeout);
  }
  unlock();
}
开发者ID:SrihariLibre,项目名称:CyberLink4CC,代码行数:10,代码来源:ControlPoint.cpp

示例13: PrintDevice

void PrintDevice(Device *dev, int indent)
{
	PrintDeviceInfo(dev, indent);

	DeviceList *childDevList = dev->getDeviceList();
	int nChildDevs = childDevList->size();
	for (int n=0; n<nChildDevs; n++) {
		Device *childDev = childDevList->getDevice(n);
		PrintDevice(childDev, indent);
	}
}
开发者ID:Debanjan07,项目名称:CyberLink4CC,代码行数:11,代码来源:TestCtrlPoint.cpp

示例14: freeDeviceList

//--------------------------------------------------------------------------------//
DeviceList MacHIDManager::freeDeviceList()
{
	DeviceList ret;
	HidInfoList::iterator it = mDeviceList.begin(), end = mDeviceList.end();
	for(; it != end; ++it)
	{
		if((*it)->inUse == false)
			ret.insert(std::make_pair((*it)->type, (*it)->combinedKey));
	}
	
	return ret;
}
开发者ID:Ablu,项目名称:freeorion,代码行数:13,代码来源:MacHIDManager.cpp

示例15: resyncDeviceConnections

void
Studio::
resyncDeviceConnections(void)
{
    // Sync all the device connections
    DeviceList *devices = getDevices();
    for (uint i = 0; i < devices->size(); ++i) {
        DeviceId id = (*devices)[i]->getId();
        QString connection = RosegardenSequencer::getInstance()->getConnection(id);
        (*devices)[i]->setConnection(qstrtostr(connection));
    }
}
开发者ID:tedfelix,项目名称:rosegarden,代码行数:12,代码来源:Studio.cpp


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