kerneltest/e32test/usbho/t_usbdi/src/BasicWatcher.cpp
changeset 259 57b9594f5772
parent 0 a41df078684a
child 257 3e88ff8f41d5
child 271 dc268b18d709
equal deleted inserted replaced
247:d8d70de2bd36 259:57b9594f5772
     1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of the License "Eclipse Public License v1.0"
     4 // under the terms of the License "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
    16 // 
    16 // 
    17 //
    17 //
    18 
    18 
    19 #include "BasicWatcher.h"
    19 #include "BasicWatcher.h"
    20 #include "testdebug.h"
    20 #include "testdebug.h"
       
    21 #include "OstTraceDefinitions.h"
       
    22 #ifdef OST_TRACE_COMPILER_IN_USE
       
    23 #include "BasicWatcherTraces.h"
       
    24 #endif
    21 
    25 
    22 namespace NUnitTesting_USBDI
    26 namespace NUnitTesting_USBDI
    23 	{
    27 	{
    24 
    28 
    25 CBasicWatcher::CBasicWatcher(const TCallBack& aCallBack,TInt aPriority)
    29 CBasicWatcher::CBasicWatcher(const TCallBack& aCallBack,TInt aPriority)
    26 :	CActive(aPriority),
    30 :	CActive(aPriority),
    27 	iCallBack(aCallBack),
    31 	iCallBack(aCallBack),
    28 	iCompletionCode(KErrNone)
    32 	iCompletionCode(KErrNone)
    29 	{
    33 	{
       
    34 	OstTraceFunctionEntryExt( CBASICWATCHER_CBASICWATCHER_ENTRY, this );
    30 	CActiveScheduler::Add(this);
    35 	CActiveScheduler::Add(this);
       
    36 	OstTraceFunctionExit1( CBASICWATCHER_CBASICWATCHER_EXIT, this );
    31 	}
    37 	}
    32 	
    38 	
    33 CBasicWatcher::~CBasicWatcher()
    39 CBasicWatcher::~CBasicWatcher()
    34 	{
    40 	{
    35 	LOG_FUNC
    41     OstTraceFunctionEntry1( CBASICWATCHER_CBASICWATCHER_ENTRY_DUP01, this );
    36 
    42 
    37 	Cancel();
    43 	Cancel();
       
    44 	OstTraceFunctionExit1( CBASICWATCHER_CBASICWATCHER_EXIT_DUP01, this );
    38 	}
    45 	}
    39 
    46 
    40 void CBasicWatcher::DoCancel()
    47 void CBasicWatcher::DoCancel()
    41 	{
    48 	{
    42 	LOG_FUNC
    49     OstTraceFunctionEntry1( CBASICWATCHER_DOCANCEL_ENTRY, this );
    43 
    50 
    44 	RDebug::Printf("Watch cancelled");
    51 	OstTrace0(TRACE_NORMAL, CBASICWATCHER_DOCANCEL, "Watch cancelled");
    45 	iStatus = KErrCancel;
    52 	iStatus = KErrCancel;
       
    53 	OstTraceFunctionExit1( CBASICWATCHER_DOCANCEL_EXIT, this );
    46 	}
    54 	}
    47 
    55 
    48 
    56 
    49 void CBasicWatcher::StartWatching()
    57 void CBasicWatcher::StartWatching()
    50 	{
    58 	{
    51 	LOG_FUNC
    59     OstTraceFunctionEntry1( CBASICWATCHER_STARTWATCHING_ENTRY, this );
    52 
    60 
    53 	if(iStatus != KRequestPending)
    61 	if(iStatus != KRequestPending)
    54 		{
    62 		{
    55 		User::Panic(_L("iStatus has not been set to pending this will lead to E32USER-CBase Panic"),46);
    63 		User::Panic(_L("iStatus has not been set to pending this will lead to E32USER-CBase Panic"),46);
    56 		}
    64 		}
    57 	SetActive();
    65 	SetActive();
       
    66 	OstTraceFunctionExit1( CBASICWATCHER_STARTWATCHING_EXIT, this );
    58 	}
    67 	}
    59 
    68 
    60 
    69 
    61 void CBasicWatcher::RunL()
    70 void CBasicWatcher::RunL()
    62 	{
    71 	{
    63 	LOG_FUNC
    72     OstTraceFunctionEntry1( CBASICWATCHER_RUNL_ENTRY, this );
    64 
    73 
    65 	iCompletionCode = iStatus.Int();
    74 	iCompletionCode = iStatus.Int();
    66 	User::LeaveIfError(iCallBack.CallBack());
    75 	User::LeaveIfError(iCallBack.CallBack());
       
    76 	OstTraceFunctionExit1( CBASICWATCHER_RUNL_EXIT, this );
    67 	}
    77 	}
    68 
    78 
    69 
    79 
    70 TInt CBasicWatcher::RunError(TInt aError)
    80 TInt CBasicWatcher::RunError(TInt aError)
    71 	{
    81 	{
    72 	LOG_FUNC
    82     OstTraceFunctionEntryExt( CBASICWATCHER_RUNERROR_ENTRY, this );
    73 
    83 
    74 	RDebug::Printf("Watcher code Left with %d",aError);
    84 	OstTrace1(TRACE_NORMAL, CBASICWATCHER_RUNERROR, "Watcher code Left with %d",aError);
       
    85 	OstTraceFunctionExitExt( CBASICWATCHER_RUNERROR_EXIT, this, KErrNone );
    75 	return KErrNone;
    86 	return KErrNone;
    76 	}
    87 	}
    77 
    88 
    78 	}
    89 	}
    79 	
    90