本文整理汇总了C++中DeviceManager::deviceCount方法的典型用法代码示例。如果您正苦于以下问题:C++ DeviceManager::deviceCount方法的具体用法?C++ DeviceManager::deviceCount怎么用?C++ DeviceManager::deviceCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DeviceManager
的用法示例。
在下文中一共展示了DeviceManager::deviceCount方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: disabledReason
QString IosRunConfiguration::disabledReason() const
{
if (m_parseInProgress)
return tr("The .pro file \"%1\" is currently being parsed.")
.arg(QFileInfo(m_profilePath).fileName());
if (!m_parseSuccess)
return static_cast<QmakeProject *>(target()->project())
->disabledReasonForRunConfiguration(m_profilePath);
Core::Id devType = DeviceTypeKitInformation::deviceTypeId(target()->kit());
if (devType != Constants::IOS_DEVICE_TYPE && devType != Constants::IOS_SIMULATOR_TYPE)
return tr("Kit has incorrect device type for running on iOS devices.");
IDevice::ConstPtr dev = DeviceKitInformation::device(target()->kit());
QString validDevName;
bool hasConncetedDev = false;
if (devType == Constants::IOS_DEVICE_TYPE) {
DeviceManager *dm = DeviceManager::instance();
for (int idev = 0; idev < dm->deviceCount(); ++idev) {
IDevice::ConstPtr availDev = dm->deviceAt(idev);
if (!availDev.isNull() && availDev->type() == Constants::IOS_DEVICE_TYPE) {
if (availDev->deviceState() == IDevice::DeviceReadyToUse) {
validDevName += QLatin1Char(' ');
validDevName += availDev->displayName();
} else if (availDev->deviceState() == IDevice::DeviceConnected) {
hasConncetedDev = true;
}
}
}
}
if (dev.isNull()) {
if (!validDevName.isEmpty())
return tr("No device chosen. Select %1.").arg(validDevName); // should not happen
else if (hasConncetedDev)
return tr("No device chosen. Enable developer mode on a device."); // should not happen
else
return tr("No device available.");
} else {
switch (dev->deviceState()) {
case IDevice::DeviceReadyToUse:
break;
case IDevice::DeviceConnected:
return tr("To use this device you need to enable developer mode on it.");
case IDevice::DeviceDisconnected:
case IDevice::DeviceStateUnknown:
if (!validDevName.isEmpty())
return tr("%1 is not connected. Select %2?")
.arg(dev->displayName(), validDevName);
else if (hasConncetedDev)
return tr("%1 is not connected. Enable developer mode on a device?")
.arg(dev->displayName());
else
return tr("%1 is not connected.").arg(dev->displayName());
}
}
return RunConfiguration::disabledReason();
}
示例2: updateAvailableDevices
void IosDeviceManager::updateAvailableDevices(const QStringList &devices)
{
foreach (const QString &uid, devices)
deviceConnected(uid);
DeviceManager *devManager = DeviceManager::instance();
for (int iDevice = 0; iDevice < devManager->deviceCount(); ++iDevice) {
IDevice::ConstPtr dev = devManager->deviceAt(iDevice);
Core::Id devType(Constants::IOS_DEVICE_TYPE);
if (dev.isNull() || dev->type() != devType)
continue;
const IosDevice *iosDev = static_cast<const IosDevice *>(dev.data());
if (devices.contains(iosDev->uniqueDeviceID()))
continue;
if (iosDev->deviceState() != IDevice::DeviceDisconnected) {
qCDebug(detectLog) << "disconnecting device " << iosDev->uniqueDeviceID();
devManager->setDeviceState(iosDev->id(), IDevice::DeviceDisconnected);
}
}
}
示例3: getNeighborMacAddress
quint64 getNeighborMacAddress(int portId, int streamId, int frameIndex)
{
MyService *service = drone->rpcService();
DeviceManager *devMgr = NULL;
quint64 mac;
if (!service)
return 0;
if ((portId >= 0) && (portId < service->portInfo.size()))
devMgr = service->portInfo[portId]->deviceManager();
if (!devMgr || !devMgr->deviceCount())
return 0;
service->portLock[portId]->lockForWrite();
mac = service->portInfo[portId]->neighborMacAddress(streamId, frameIndex);
service->portLock[portId]->unlock();
return mac;
}
示例4: main
//-----------------------------------------------------------------------------
int main( int argc, char* argv[])
//-----------------------------------------------------------------------------
{
const char* pDevSerial = "BF*";
cout << "\n ++ Start PowerDownTest sample: " << __DATE__ << "/" << __TIME__ << endl;
if( argc > 1 )
{
pDevSerial = argv[1];
}
unsigned int uiDevCount = 0;
DeviceManager DevMgr;
if( ( uiDevCount = DevMgr.deviceCount() ) == 0 )
{
cout << "*** Error: No MATRIX VISION device found! Unable to continue!" << endl;
return 0;
}
cout << "Have found " << uiDevCount << " devices on this platform!" << endl;
for( unsigned i=0; i<uiDevCount; i++ )
{
Device* pDevTmp = DevMgr.getDevice( i );
cout << " " << i << " Serial: " << pDevTmp->serial.read() << endl;
}
cout << "Initialising the device: "<< pDevSerial << ". This might take some time..." << endl;
// create an interface to the first MATRIX VISION device with the serila number pDevSerial
Device* pDev = DevMgr.getDeviceBySerial( pDevSerial );
try
{
pDev->open();
}
catch( ImpactAcquireException& e )
{
// this e.g. might happen if the same device is already opened in another process...
cout << "*** Error: An error occurred while opening the device(error code: " << e.getErrorCode() << ")." << endl;
return 0;
}
FunctionInterface fi( pDev );
// only 8Bit/pixel destination image are supported by the \c writeFile() function
ImageDestination imgDst( pDev );
imgDst.pixelFormat.write( idpfMono8 );
// get mvBF system settings
SystemBlueFOX sbf( pDev );
bool bPowerDown = false;
do
{
cout << "Ready to snap. Press 'p'<return> to power down, 'q'<return> to quit or <return> to snap an image.." << endl;
char ch = getchar();
if( ch == 'p' )
{ // for mvBlueFOX only: test power down / up
cout << "Power off!" << endl;
sbf.powerMode.write( dpmOff );
bPowerDown = true;
// read and discard the <return>
getchar();
}
else if( ch == 'q' )
{ // break out of loop to finish application
// read and discard the <return>
getchar();
break;
}
else
{ // snap
if( bPowerDown )
{ // first we need to power up again
CTime timer1;
sbf.powerMode.write( dpmOn );
bPowerDown = false;
cout << "Power On!" << ". Power On took " << timer1.elapsed() << "s., " << endl;
}
CTime timer;
// send a request to the default request queue of the device and wait for the result.
fi.imageRequestSingle();
const int iMaxWaitTime_ms = 5000;
// wait for results from the default capture queue
int iRequestNr = fi.imageRequestWaitFor( iMaxWaitTime_ms );
cout << "Request Nr.: " << iRequestNr << ". Snap took " << timer.elapsed() << "s., " << endl;
// check if the image has been captured without any problems
if( !fi.isRequestNrValid( iRequestNr ) )
{
// this can not happen in this sample, but may happen if you wait for a request without
// sending one to the driver before
cout << "*** Error: No request has been sent to the driver." << endl;
// unlock the buffer to let the driver know that you no longer need this buffer
//.........这里部分代码省略.........
示例5: main
//-----------------------------------------------------------------------------
int main( int argc, char* argv[])
//-----------------------------------------------------------------------------
{
if( argc > 2 )
{
cout << "Invalid input parameter count" << endl
<< endl;
printHelp();
return 0;
}
unsigned int devCnt = 0;
DeviceManager devMgr;
if(( devCnt = devMgr.deviceCount()) == 0 )
{
cout << "*** Error: No MATRIX VISION device found! Unable to continue!" << endl;
return 0;
}
cout << "Have found " << devCnt << " devices on this platform!" << endl
<< "Please note that this application will only work for mvBlueFOX devices" <<endl;
if( argc == 1 )
{
int index = 0;
Device* pDev = 0;
while( ( pDev = devMgr.getDeviceByFamily( "mvBlueFOX", index ) ) != 0 )
{
updateFirmware( pDev );
++index;
}
}
else
{
string command(argv[1]);
if( command == "-sel" )
{
Device* pDev = getDeviceFromUserInput( devMgr );
if( !pDev )
{
return 0;
}
updateFirmware( pDev );
}
else if( command.find( "-d" ) == 0 )
{
string serial(command.substr( 2 ));
Device* pDev = devMgr.getDeviceBySerial( serial );
if( !pDev )
{
cout << "Can't find Device " << serial << endl;
return 0;
}
updateFirmware( pDev );
}
else if( command == "-help" )
{
printHelp();
}
else
{
cout << "Invalid input parameter: " << command << endl
<< endl;
printHelp();
return 0;
}
}
return 0;
}