本文整理汇总了C++中DeviceManager::findDevice方法的典型用法代码示例。如果您正苦于以下问题:C++ DeviceManager::findDevice方法的具体用法?C++ DeviceManager::findDevice怎么用?C++ DeviceManager::findDevice使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DeviceManager
的用法示例。
在下文中一共展示了DeviceManager::findDevice方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sigemptyset
int
main( int argc, char *argv[] )
{
struct sigaction sigact;
int rval = 0;
sigact.sa_handler = sighandler;
sigemptyset(&sigact.sa_mask);
sigact.sa_flags = 0;
sigaction(SIGINT, &sigact, NULL);
sigaction(SIGTERM, &sigact, NULL);
sigaction(SIGQUIT, &sigact, NULL);
using namespace USB;
DeviceManager mgr;
theMgr = &mgr;
try
{
mgr.registerDevice( SpacePilotDevice::VendorID,
SpacePilotDevice::ProductID,
&SpacePilotDevice::factory );
mgr.start();
if ( argc > 1 )
{
std::shared_ptr<Device> sppro = mgr.findDevice(
SpacePilotDevice::VendorID, SpacePilotDevice::ProductID );
if ( sppro )
{
SpacePilotDevice *dev = reinterpret_cast<SpacePilotDevice *>( sppro.get() );
dev->setLCD( std::string( argv[1] ) );
}
}
mgr.processEventLoop();
}
catch ( usb_error &e )
{
int err = e.getUSBError();
libusb_error ec = (libusb_error)( err );
std::cerr << "ERROR: " << libusb_error_name( err ) << " - " <<
libusb_strerror( ec ) << std::endl;
rval = -1;
}
catch ( ... )
{
rval = -1;
}
mgr.shutdown();
theMgr = nullptr;
return rval;
}