本文整理汇总了C++中IOService::metaCast方法的典型用法代码示例。如果您正苦于以下问题:C++ IOService::metaCast方法的具体用法?C++ IOService::metaCast怎么用?C++ IOService::metaCast使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IOService
的用法示例。
在下文中一共展示了IOService::metaCast方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handleStart
bool IOHIDDeviceShim::handleStart( IOService * provider )
{
IOService *device = 0;
if (!super::handleStart(provider))
return false;
if ((_hiDevice = OSDynamicCast(IOHIDevice, provider)))
{
if (_hiDevice->getProperty(kIOHIDVirtualHIDevice) == kOSBooleanTrue)
return false;
device = _hiDevice;
do {
if ((_device = (IOService *)device->metaCast("IOHIDDevice")))
{
break;
}
if ((_device = (IOService *)device->metaCast("IOUSBDevice")) || (_device = (IOService *)device->metaCast("IOUSBInterface")))
{
_transport = kIOHIDTransportUSB;
break;
}
if (_device = (IOService *)device->metaCast("IOADBDevice"))
{
_transport = kIOHIDTransportADB;
break;
}
if (_device = (IOService *)device->metaCast("ApplePS2Controller"))
{
_transport = kIOHIDTransportPS2;
break;
}
} while (device = device->getProvider());
}
return true;
}
示例2: connectClient
IOReturn IOHIDUserClient::connectClient( IOUserClient * client )
{
IOGBounds * bounds;
IOService * provider;
IOGraphicsDevice * graphicsDevice;
provider = client->getProvider();
// avoiding OSDynamicCast & dependency on graphics family
if( !provider || !provider->metaCast("IOGraphicsDevice"))
return( kIOReturnBadArgument );
graphicsDevice = (IOGraphicsDevice *) provider;
graphicsDevice->getBoundingRect(&bounds);
owner->registerScreen(graphicsDevice, bounds, bounds+1);
return( kIOReturnSuccess);
}