ximpfw/tsrc/tsrcutils/testcaseutils/prfwgeneralwaiter.cpp
changeset 51 61fad867f68e
equal deleted inserted replaced
-1:000000000000 51:61fad867f68e
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  XIMP Framework Test code 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #include <e32std.h>
       
    21 
       
    22 #include "prfwgeneralwaiter.h"
       
    23 #include "prfwwaitobserver.h"
       
    24 
       
    25 
       
    26 
       
    27 // ======== LOCAL FUNCTIONS ========
       
    28 
       
    29 
       
    30 // ======== MEMBER FUNCTIONS ========
       
    31 
       
    32 
       
    33 // ---------------------------------------------------------------------------
       
    34 // ?description_if_needed
       
    35 // ---------------------------------------------------------------------------
       
    36 //
       
    37 CXIMPTestGeneralWaiter::CXIMPTestGeneralWaiter( T_MWaitObserver* aObserver ) :
       
    38     CActive( EPriorityNormal ),
       
    39     iObserver( aObserver )
       
    40     {
       
    41     CActiveScheduler::Add( this );
       
    42     }
       
    43 
       
    44 
       
    45 // ---------------------------------------------------------------------------
       
    46 // ?description_if_needed
       
    47 // ---------------------------------------------------------------------------
       
    48 //
       
    49 void CXIMPTestGeneralWaiter::ConstructL()
       
    50     {
       
    51     iTimer.CreateLocal();
       
    52     }
       
    53 
       
    54 
       
    55 // ---------------------------------------------------------------------------
       
    56 // ?description_if_needed
       
    57 // ---------------------------------------------------------------------------
       
    58 //
       
    59 EXPORT_C CXIMPTestGeneralWaiter* CXIMPTestGeneralWaiter::NewL( T_MWaitObserver* aObserver )
       
    60     {
       
    61     CXIMPTestGeneralWaiter* self = new( ELeave ) CXIMPTestGeneralWaiter( aObserver );
       
    62     CleanupStack::PushL( self );
       
    63     self->ConstructL();
       
    64     CleanupStack::Pop( self );
       
    65     return self;
       
    66     }
       
    67 
       
    68 
       
    69 // ---------------------------------------------------------------------------
       
    70 // ?description_if_needed
       
    71 // ---------------------------------------------------------------------------
       
    72 //
       
    73 CXIMPTestGeneralWaiter::~CXIMPTestGeneralWaiter()
       
    74     {
       
    75     iTimer.Close();
       
    76     }
       
    77 
       
    78 
       
    79 // ---------------------------------------------------------------------------
       
    80 // ?implementation_description
       
    81 // ---------------------------------------------------------------------------
       
    82 //
       
    83 EXPORT_C void CXIMPTestGeneralWaiter::WaitForL( TInt aSeconds )
       
    84     {
       
    85     TTimeIntervalMicroSeconds32 timeToWait( aSeconds * 1000000 );
       
    86     iTimer.After( iStatus, timeToWait );
       
    87     SetActive();
       
    88     }
       
    89 
       
    90 
       
    91 void CXIMPTestGeneralWaiter::RunL()
       
    92     {
       
    93     iObserver->WaitCompleted( KErrNone );
       
    94     }
       
    95 
       
    96 
       
    97 void CXIMPTestGeneralWaiter::DoCancel()
       
    98     {
       
    99     
       
   100     }
       
   101 
       
   102 
       
   103 TInt CXIMPTestGeneralWaiter::RunErrorL( TInt /* aError */ )
       
   104     {
       
   105     iObserver->WaitCompleted( KErrGeneral );
       
   106     return 0;
       
   107     }
       
   108 
       
   109 
       
   110 // End of file