本文整理汇总了C++中HIDDevice::AssignIDs方法的典型用法代码示例。如果您正苦于以下问题:C++ HIDDevice::AssignIDs方法的具体用法?C++ HIDDevice::AssignIDs怎么用?C++ HIDDevice::AssignIDs使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HIDDevice
的用法示例。
在下文中一共展示了HIDDevice::AssignIDs方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddDevices
void InputHandler_MacOSX_HID::AddDevices( int usagePage, int usage, InputDevice &id )
{
io_iterator_t iter;
CFDictionaryRef dict = GetMatchingDictionary( usagePage, usage );
kern_return_t ret = IOServiceAddMatchingNotification( m_NotifyPort, kIOFirstMatchNotification, dict,
InputHandler_MacOSX_HID::DeviceAdded, this, &iter );
io_object_t device;
if( ret != KERN_SUCCESS )
return;
m_vIters.push_back( iter );
// Iterate over the devices and add them
while( (device = IOIteratorNext(iter)) )
{
LOG->Trace( "\tFound device %d", id );
HIDDevice *dev = MakeDevice( id );
int num;
if( !dev )
{
LOG->Trace( "\t\tInvalid id, deleting device" );
IOObjectRelease( device );
continue;
}
if( !dev->Open(device) || (num = dev->AssignIDs(id)) == -1 )
{
LOG->Trace( "\tFailed top open or assign id, deleting device" );
delete dev;
IOObjectRelease( device );
continue;
}
io_iterator_t i;
enum_add( id, num );
m_vDevices.push_back( dev );
ret = IOServiceAddInterestNotification(
m_NotifyPort, device, kIOGeneralInterest,
InputHandler_MacOSX_HID::DeviceChanged,
this, &i
);
if( ret == KERN_SUCCESS )
m_vIters.push_back( i );
else
LOG->Trace( "\t\tFailed to add device changed notification, deleting device" );
IOObjectRelease( device );
}
}