equal
deleted
inserted
replaced
410 /** Create logical channel, only open of one channel is allowed */ |
410 /** Create logical channel, only open of one channel is allowed */ |
411 TInt DTestResManLddFactory::Create(DLogicalChannelBase*& aChannel) |
411 TInt DTestResManLddFactory::Create(DLogicalChannelBase*& aChannel) |
412 { |
412 { |
413 if (iOpenChannels != 0) //A Channel is already open |
413 if (iOpenChannels != 0) //A Channel is already open |
414 return KErrInUse; |
414 return KErrInUse; |
415 //Deregister the client registered in ldd init. |
|
416 TInt r = PowerResourceManager::DeRegisterClient(DTestResManLddFactory::iClient.iClientId); |
|
417 if(r != KErrNone) |
|
418 Kern::Fault("PRM CLIENT DEREGISTER FAILED", __LINE__); |
|
419 delete DTestResManLddFactory::iClient.pName; |
|
420 DTestResManLddFactory::iClient.pName = NULL; |
|
421 DTestResManLddFactory::iClient.iClientId = 0; |
|
422 aChannel = new DTestResManLdd; |
415 aChannel = new DTestResManLdd; |
423 if(!aChannel) |
416 if(!aChannel) |
424 return KErrNoMemory; |
417 return KErrNoMemory; |
425 return KErrNone; |
418 return KErrNone; |
426 } |
419 } |
512 TInt r=DoControl(id,m.Ptr0(),m.Ptr1()); |
505 TInt r=DoControl(id,m.Ptr0(),m.Ptr1()); |
513 m.Complete(r,ETrue); |
506 m.Complete(r,ETrue); |
514 } |
507 } |
515 } |
508 } |
516 |
509 |
517 |
510 /** |
|
511 Function used for polling the PostBoot Notification status. |
|
512 */ |
|
513 TBool PollingPostBootStatus(TAny* aLddFactory) |
|
514 { |
|
515 if(aLddFactory) |
|
516 if(((DTestResManLddFactory *)aLddFactory)->iPostBootNotiCount == EXPECTED_POST_NOTI_COUNT) |
|
517 return ETrue; |
|
518 return EFalse; |
|
519 } |
|
520 |
518 /** |
521 /** |
519 Process synchronous 'control' requests |
522 Process synchronous 'control' requests |
520 */ |
523 */ |
521 TInt DTestResManLdd::DoControl(TInt aFunction, TAny* a1, TAny* a2) |
524 TInt DTestResManLdd::DoControl(TInt aFunction, TAny* a1, TAny* a2) |
522 { |
525 { |
988 r = Kern::ThreadDesWrite(iClientThreadPtr, a2, (const TDesC8&)*pBuf, 0); |
991 r = Kern::ThreadDesWrite(iClientThreadPtr, a2, (const TDesC8&)*pBuf, 0); |
989 break; |
992 break; |
990 } |
993 } |
991 case RTestResMan::ECheckPostBootLevelNotifications: |
994 case RTestResMan::ECheckPostBootLevelNotifications: |
992 { |
995 { |
993 if(DTestResManLddFactory::iPostBootNotiCount != EXPECTED_POST_NOTI_COUNT) |
996 //aPollPeriodMs = 3ms (3rd argument) |
994 { |
997 //aMaxPoll = 1000 (in total ~3000 ms timeout) |
995 r = KErrUnderflow; |
998 r = Kern::PollingWait(PollingPostBootStatus, (TAny*)iDevice, 3, 1000); |
996 break; |
|
997 } |
|
998 r = KErrNone; |
|
999 break; |
999 break; |
1000 } |
1000 } |
1001 case RTestResMan::EGetControllerVersion: |
1001 case RTestResMan::EGetControllerVersion: |
1002 { |
1002 { |
1003 TUint Version; |
1003 TUint Version; |
1333 void DTestResManLddFactory::PostBootNotificationFunc(TUint /*aClientId*/, TUint aResId, TInt /*aLevel*/, TInt /*aLevelOwnerId*/, TInt /*aResult*/, TAny* aParam) |
1333 void DTestResManLddFactory::PostBootNotificationFunc(TUint /*aClientId*/, TUint aResId, TInt /*aLevel*/, TInt /*aLevelOwnerId*/, TInt /*aResult*/, TAny* aParam) |
1334 { |
1334 { |
1335 iPostBootNotiCount++; |
1335 iPostBootNotiCount++; |
1336 DPowerResourceNotification *ptr = (DPowerResourceNotification*)aParam; |
1336 DPowerResourceNotification *ptr = (DPowerResourceNotification*)aParam; |
1337 TInt r = PowerResourceManager::CancelNotification(iClient.iClientId, aResId, *ptr); |
1337 TInt r = PowerResourceManager::CancelNotification(iClient.iClientId, aResId, *ptr); |
1338 if(r == KErrNone) |
1338 if(r == KErrCancel) |
|
1339 { |
1339 delete ptr; |
1340 delete ptr; |
1340 } |
1341 if(iPostBootNotiCount == EXPECTED_POST_NOTI_COUNT) |
|
1342 { |
|
1343 r = PowerResourceManager::DeRegisterClient(DTestResManLddFactory::iClient.iClientId); |
|
1344 if(r != KErrNone) |
|
1345 Kern::Fault("PRM CLIENT DEREGISTER FAILED", __LINE__); |
|
1346 delete DTestResManLddFactory::iClient.pName; |
|
1347 DTestResManLddFactory::iClient.pName = NULL; |
|
1348 DTestResManLddFactory::iClient.iClientId = 0; |
|
1349 } |
|
1350 } |
|
1351 } |