本文整理汇总了C++中IOService::addPowerChild方法的典型用法代码示例。如果您正苦于以下问题:C++ IOService::addPowerChild方法的具体用法?C++ IOService::addPowerChild怎么用?C++ IOService::addPowerChild使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IOService
的用法示例。
在下文中一共展示了IOService::addPowerChild方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RegisterServiceInTree
bool IOPlatformExpert::RegisterServiceInTree (IOService * theService, OSDictionary * theTreeNode, OSDictionary * theTreeParentNode, IOService * theProvider)
{
IOService * aService;
bool registered = false;
OSArray * children;
unsigned int numChildren;
OSDictionary * child;
// make sure someone is not already registered here
if ( NULL == theTreeNode->getObject ("service") ) {
if ( theTreeNode->setObject ("service", OSDynamicCast ( OSObject, theService)) ) {
// 1. CHILDREN ------------------
// we registered the node in the tree...now if the node has children
// registered we must tell this service to add them.
if ( NULL != (children = (OSArray *) theTreeNode->getObject ("children")) ) {
numChildren = children->getCount ();
for ( unsigned int i = 0; i < numChildren; i++ ) {
if ( NULL != (child = (OSDictionary *) children->getObject (i)) ) {
if ( NULL != (aService = (IOService *) child->getObject ("service")) )
theService->addPowerChild (aService);
}
}
}
// 2. PARENT --------------------
// also we must notify the parent of this node (if a registered service
// exists there) of a new child.
if ( theTreeParentNode ) {
if ( NULL != (aService = (IOService *) theTreeParentNode->getObject ("service")) )
if (aService != theProvider)
aService->addPowerChild (theService);
}
registered = true;
}
}
return registered;
}
示例2: setAggressiveness
IOReturn IOPMPagingPlexus::setAggressiveness ( unsigned long type, unsigned long )
{
OSDictionary * dict;
OSIterator * iter;
OSObject * next;
IOService * candidate = 0;
IOService * pagingProvider;
if( type != kPMMinutesToSleep)
return IOPMNoErr;
IOLockLock(ourLock);
if ( systemBooting ) {
systemBooting = false;
IOLockUnlock(ourLock);
dict = IOBSDNameMatching(rootdevice);
if ( dict ) {
iter = getMatchingServices(dict);
if ( iter ) {
while ( (next = iter->getNextObject()) ) {
if ( (candidate = OSDynamicCast(IOService,next)) ) {
break;
}
}
iter->release();
}
}
if ( candidate ) {
pagingProvider = findProvider(candidate);
if ( pagingProvider ) {
processSiblings(pagingProvider);
pagingProvider->addPowerChild(this);
getPMRootDomain()->removePowerChild(((IOPowerConnection *)getParentEntry(gIOPowerPlane)));
processChildren();
}
}
}
else {
IOLockUnlock(ourLock);
}
return IOPMNoErr;
}