telephonyserverplugins/multimodetsy/test/Te_LoopBack/Te_LoopbackCWrapGetDetNet.cpp
changeset 0 3553901f7fa8
child 24 6638e7f4bd8f
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #include "Te_LoopbackCWrapGetDetNet.h"
       
    17 
       
    18 // Wrapper object for CRetrieveMobilePhoneDetectedNetworks.
       
    19 // The CRetrieveMobilePhoneDetectedNetworks active object needs
       
    20 // both a CActiveScheduler installed and for it to have been started. 
       
    21 // As a result of starting the CActiveScheduler, another AO must be 
       
    22 // implemented to stop the CActiveScheduler when the
       
    23 // CRetrieveMobilePhoneDetetctedNetworks active object completes.
       
    24 // Can extend for other classes too.
       
    25 CWrapperGetDetectedNetworks* CWrapperGetDetectedNetworks::NewL(RMobilePhone& aPhone)
       
    26 	{
       
    27     CWrapperGetDetectedNetworks* r = new(ELeave) CWrapperGetDetectedNetworks(aPhone);
       
    28     CleanupStack::PushL(r);
       
    29     r->ConstructL();
       
    30 	CleanupStack::Pop();
       
    31     return r;
       
    32     }
       
    33 
       
    34 CWrapperGetDetectedNetworks::CWrapperGetDetectedNetworks(RMobilePhone& aPhone)
       
    35     : CActive(EPriorityNormal), iPhone3(aPhone)
       
    36     {
       
    37 	}
       
    38 
       
    39 void CWrapperGetDetectedNetworks::ConstructL()
       
    40 	{
       
    41     CActiveScheduler::Add(this);
       
    42 	iRetrieve=CRetrieveMobilePhoneDetectedNetworks::NewL(iPhone3);
       
    43     }
       
    44          
       
    45 CWrapperGetDetectedNetworks::~CWrapperGetDetectedNetworks()
       
    46     {
       
    47 	if (iRetrieve) iRetrieve->Cancel();
       
    48 	delete iRetrieve;
       
    49 	}
       
    50 
       
    51 CMobilePhoneNetworkList* CWrapperGetDetectedNetworks::RetrieveList()
       
    52 	{
       
    53 	CMobilePhoneNetworkList* ptr=NULL;
       
    54 	TRAP_IGNORE(ptr=iRetrieve->RetrieveListL());		
       
    55 	return(ptr);
       
    56 	}
       
    57 
       
    58 void CWrapperGetDetectedNetworks::Start()
       
    59     {
       
    60     iRetrieve->Start(iStatus);
       
    61 
       
    62     SetActive();
       
    63     }       
       
    64 
       
    65 void CWrapperGetDetectedNetworks::RunL()
       
    66     {
       
    67 	TInt ret = iStatus.Int();
       
    68     User::LeaveIfError(ret);
       
    69     CActiveScheduler::Stop();
       
    70 	}
       
    71 
       
    72 void CWrapperGetDetectedNetworks::DoCancel()
       
    73     {
       
    74 	iRetrieve->Cancel();
       
    75     }