usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/src/mockcusbtimer.cpp
branchRCL_3
changeset 92 dde4619868dc
parent 86 703a2b94c06c
child 95 55a3258355ea
equal deleted inserted replaced
86:703a2b94c06c 92:dde4619868dc
     1 /*
       
     2 * Copyright (c) 2010 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:
       
    15 *
       
    16 */
       
    17 
       
    18 #include <e32base.h>
       
    19 #include <NormalHardcodedAssert.h>
       
    20 
       
    21 #include "stifassertmacros.h"
       
    22 
       
    23 #include "mockcusbtimer.h"
       
    24 
       
    25 #include "debug.h"
       
    26 
       
    27 CUsbTimer::CUsbTimer(MUsbTimerObserver& aObserver, TUsbTimerId aTimerId) :
       
    28     iObserver(&aObserver), 
       
    29     iActive(EFalse),
       
    30     iTimerId(aTimerId)
       
    31     {
       
    32     }
       
    33 
       
    34 CUsbTimer::~CUsbTimer()
       
    35     {
       
    36     LOG(  ( "[USBOTGWATCHER]\tMockCUsbTimer::~CUsbTimer" ) );
       
    37     }
       
    38 
       
    39 void CUsbTimer::ConstructL()
       
    40     {
       
    41     }
       
    42 
       
    43 CUsbTimer* CUsbTimer::NewL(MUsbTimerObserver& anObserver, TUsbTimerId aTimerId)
       
    44     {
       
    45     LOG(  ( "[USBOTGWATCHER]\tMockCUsbTimer::NewL" ) );
       
    46 
       
    47     CUsbTimer* self = new ( ELeave ) CUsbTimer(anObserver, aTimerId);
       
    48     CleanupStack::PushL(self);
       
    49     self->ConstructL();
       
    50     CleanupStack::Pop(); // pop self
       
    51     return self;
       
    52     }
       
    53 
       
    54 void CUsbTimer::After(TInt aMilliseconds)
       
    55     {
       
    56     LOG1 ( "[USBOTGWATCHER]\tMockCUsbTimer::After aMilliseconds %d", aMilliseconds);
       
    57     iActive = ETrue;
       
    58     }
       
    59 
       
    60 void CUsbTimer::Cancel()
       
    61     {
       
    62     }
       
    63 
       
    64 TBool CUsbTimer::IsActive()
       
    65     {
       
    66     return iActive;
       
    67     }
       
    68 
       
    69 void CUsbTimer::TriggerTimerElapsedL()
       
    70     {
       
    71     //STIF_ASSERT_NOT_NULL(iObserver);
       
    72     LOG1( "[USBOTGWATCHER]\tMockCUsbTimer::TriggerTimerElapsedL  iObserver: %d", (iObserver ? 1 : 0 ));
       
    73     LOG1( "[USBOTGWATCHER]\tMockCUsbTimer::TriggerTimerElapsedL  iTimerId: %d", (iTimerId ? 1 : 0 ));
       
    74     
       
    75     iObserver->TimerElapsedL(iTimerId);
       
    76     LOG(  ( "[USBOTGWATCHER]\tMockCUsbTimer::TriggerTimerElapsedL" ) );
       
    77     iActive = EFalse;
       
    78     }