kerneltest/e32test/usbho/t_otgdi/src/b2bwatchers.cpp
branchRCL_3
changeset 257 3e88ff8f41d5
parent 256 c1f20ce4abcf
equal deleted inserted replaced
256:c1f20ce4abcf 257:3e88ff8f41d5
     1 // Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2007-2009 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".
    28 #include <e32def_private.h>
    28 #include <e32def_private.h>
    29 #include <d32otgdi.h>		// OTGDI header
    29 #include <d32otgdi.h>		// OTGDI header
    30 #include <d32usbc.h>		// USBCC header
    30 #include <d32usbc.h>		// USBCC header
    31 #include "testcaseroot.h"
    31 #include "testcaseroot.h"
    32 #include "b2bwatchers.h"
    32 #include "b2bwatchers.h"
    33 #include "OstTraceDefinitions.h"
       
    34 #ifdef OST_TRACE_COMPILER_IN_USE
       
    35 #include "b2bwatchersTraces.h"
       
    36 #endif
       
    37 
    33 
    38 
    34 
    39 
    35 
    40 void CNotifyWatcherBase::RunL()
    36 void CNotifyWatcherBase::RunL()
    41 	{
    37 	{
    47 	}
    43 	}
    48 
    44 
    49 
    45 
    50 CNotifyCollector::CNotifyCollector(TRequestStatus &aStatus)  : iStatusStep(aStatus) 
    46 CNotifyCollector::CNotifyCollector(TRequestStatus &aStatus)  : iStatusStep(aStatus) 
    51 	{
    47 	{
    52 	if(gVerboseOutput)
    48 	LOG_FUNC
    53 	    {
       
    54 	    OstTraceFunctionEntry0(CNOTIFYCOLLECTOR_CNOTIFYCOLLECTOR);
       
    55 	    }
       
    56 	TTimeIntervalDays oneday(1);
    49 	TTimeIntervalDays oneday(1);
    57 	iTimeStarted.HomeTime();
    50 	iTimeStarted.HomeTime();
    58 	iTimeStarted += (oneday); // force all durations to produce a negative (invalid) value
    51 	iTimeStarted += (oneday); // force all durations to produce a negative (invalid) value
    59 	}
    52 	}
    60 
    53 
    62 /***************************************************************
    55 /***************************************************************
    63  *  ~CNotifyCollector
    56  *  ~CNotifyCollector
    64  */ 
    57  */ 
    65 CNotifyCollector::~CNotifyCollector()
    58 CNotifyCollector::~CNotifyCollector()
    66 	{
    59 	{
    67 	if(gVerboseOutput)
    60 	LOG_FUNC
    68 	    {
       
    69 	    OstTraceFunctionEntry0(CNOTIFYCOLLECTOR_DCNOTIFYCOLLECTOR);
       
    70 	    }
       
    71 	
    61 	
    72 	ClearAllEvents(); // free event arrays
    62 	ClearAllEvents(); // free event arrays
    73 
    63 
    74 	iNotifyObjects.Close();
    64 	iNotifyObjects.Close();
    75 	iFailureEvents.Close();
    65 	iFailureEvents.Close();
    82  * Both the expected and already recieved events get cleared, this method 
    72  * Both the expected and already recieved events get cleared, this method 
    83  * is typically called at the start of each test-step
    73  * is typically called at the start of each test-step
    84  */
    74  */
    85 void CNotifyCollector::ClearAllEvents(TBool aClearRecieved/*=ETrue*/, TBool aClearRequired /*=ETrue*/)
    75 void CNotifyCollector::ClearAllEvents(TBool aClearRecieved/*=ETrue*/, TBool aClearRequired /*=ETrue*/)
    86 	{
    76 	{
       
    77 	//LOG_FUNC
    87 	if (aClearRequired)
    78 	if (aClearRequired)
    88 		{
    79 		{
    89 		iRequiredEvents.Reset();
    80 		iRequiredEvents.Reset();
    90 		iFailureEvents.Reset();
    81 		iFailureEvents.Reset();
    91 		}
    82 		}
    99 /* Creates and starts all 4 observers
    90 /* Creates and starts all 4 observers
   100  * Note: The Watchdog does not get started, because it needs an interval
    91  * Note: The Watchdog does not get started, because it needs an interval
   101  */
    92  */
   102 void CNotifyCollector::CreateObserversL(COtgRoot &aOtgDriver)
    93 void CNotifyCollector::CreateObserversL(COtgRoot &aOtgDriver)
   103 	{
    94 	{
   104 	if(gVerboseOutput)
    95 	LOG_FUNC
   105 	    {
       
   106 	    OstTraceFunctionEntry0(CNOTIFYCOLLECTOR_CREATEOBSERVERSL);
       
   107 	    }
       
   108 	TInt watchType;
    96 	TInt watchType;
   109 	ASSERT(aOtgDriver.LddLoaded());
    97 	ASSERT(aOtgDriver.LddLoaded());
   110 	
    98 	
   111 	for (watchType=EWatcherTimeouts; watchType < EWatcherInvalid; watchType++)
    99 	for (watchType=EWatcherTimeouts; watchType < EWatcherInvalid; watchType++)
   112 		{
   100 		{
   135 			}
   123 			}
   136 		// the TRequest object is added to scheduler in it's own constructor
   124 		// the TRequest object is added to scheduler in it's own constructor
   137 		
   125 		
   138 		// add it to our list so we can kill them after the test.
   126 		// add it to our list so we can kill them after the test.
   139 		iNotifyObjects.Append(pWatcher);
   127 		iNotifyObjects.Append(pWatcher);
   140 
   128 		//LOG_VERBOSE3(_L("Added watcher type %d, TRequest= %08X.\n"), iType, (TInt)(&pWatcher->iStatus));	
   141 		
   129 		
   142 		// start all watchers, except for the watchdog
   130 		// start all watchers, except for the watchdog
   143 		if (watchType != EWatcherTimeouts)
   131 		if (watchType != EWatcherTimeouts)
   144 			{
   132 			{
   145 			pWatcher->StartWatching(-1);
   133 			pWatcher->StartWatching(-1);
   146 			}
   134 			}
   147 		}
   135 		}
   148 	test.Printf(_L("\n"));
   136 	test.Printf(_L("\n"));
   149 	OstTrace0(TRACE_NORMAL, CNOTIFYCOLLECTOR_CREATEOBSERVERSL_DUP02, "\n");
       
   150 	}
   137 	}
   151 
   138 
   152 
   139 
   153 /* NOTE: OTG must still be loaded or else we cannot cancel the outstanding event watches here!
   140 /* NOTE: OTG must still be loaded or else we cannot cancel the outstanding event watches here!
   154  */
   141  */
   155 void CNotifyCollector::DestroyObservers()
   142 void CNotifyCollector::DestroyObservers()
   156 	{
   143 	{
   157 	if(gVerboseOutput)
   144 	LOG_FUNC
   158 	    {
       
   159 	    OstTraceFunctionEntry0(CNOTIFYCOLLECTOR_DESTROYOBSERVERS);
       
   160 	    }
       
   161 	
   145 	
   162 	// Free the Watchers
   146 	// Free the Watchers
   163 	for (TInt idx=0; idx < iNotifyObjects.Count(); idx++)
   147 	for (TInt idx=0; idx < iNotifyObjects.Count(); idx++)
   164 		{
   148 		{
   165 		LOG_VERBOSE2(_L(".. %d .."), idx);		
   149 		LOG_VERBOSE2(_L(".. %d .."), idx);		
   166 		if(gVerboseOutput)
       
   167 		    {
       
   168 		    OstTrace1(TRACE_VERBOSE, CNOTIFYCOLLECTOR_DESTROYOBSERVERS_DUP01, ".. %d ..", idx);		
       
   169 		    }
       
   170 		delete iNotifyObjects[idx];	// they will call their own Cancel() methods
   150 		delete iNotifyObjects[idx];	// they will call their own Cancel() methods
   171 		}
   151 		}
   172 	iNotifyObjects.Close();	
   152 	iNotifyObjects.Close();	
   173 	}
   153 	}
   174 
   154 
   200 		case EWatcherTimeouts:
   180 		case EWatcherTimeouts:
   201 			break;
   181 			break;
   202 		case EWatcherState:
   182 		case EWatcherState:
   203 			COtgRoot::OtgStateString(static_cast<RUsbOtgDriver::TOtgState>(aValue), aDescription);
   183 			COtgRoot::OtgStateString(static_cast<RUsbOtgDriver::TOtgState>(aValue), aDescription);
   204 			LOG_VERBOSE3(_L("AddRequiredNotification() State %d '%S' wanted\n"), aValue, &aDescription);
   184 			LOG_VERBOSE3(_L("AddRequiredNotification() State %d '%S' wanted\n"), aValue, &aDescription);
   205 			if(gVerboseOutput)
       
   206 			    {
       
   207 			    OstTraceExt2(TRACE_VERBOSE, CNOTIFYCOLLECTOR_ADDREQUIREDORFAILURENOTIFICATION, "AddRequiredNotification() State %d '%S' wanted\n", aValue, aDescription);
       
   208 			    }
       
   209 			break;
   185 			break;
   210 		case EWatcherEvent:
   186 		case EWatcherEvent:
   211 			COtgRoot::OtgEventString(static_cast<RUsbOtgDriver::TOtgEvent>(aValue), aDescription);
   187 			COtgRoot::OtgEventString(static_cast<RUsbOtgDriver::TOtgEvent>(aValue), aDescription);
   212 			LOG_VERBOSE3(_L("AddRequiredNotification() Event %d '%S' wanted\n"), aValue, &aDescription);
   188 			LOG_VERBOSE3(_L("AddRequiredNotification() Event %d '%S' wanted\n"), aValue, &aDescription);
   213 			if(gVerboseOutput)
       
   214 			    {
       
   215 			    OstTraceExt2(TRACE_VERBOSE, CNOTIFYCOLLECTOR_ADDREQUIREDORFAILURENOTIFICATION_DUP01, "AddRequiredNotification() Event %d '%S' wanted\n", aValue, aDescription);
       
   216 			    }
       
   217 			break;
   189 			break;
   218 		case EWatcherMessage:
   190 		case EWatcherMessage:
   219 			COtgRoot::OtgMessageString(static_cast<RUsbOtgDriver::TOtgMessage>(aValue), aDescription);
   191 			COtgRoot::OtgMessageString(static_cast<RUsbOtgDriver::TOtgMessage>(aValue), aDescription);
   220 			LOG_VERBOSE3(_L("AddRequiredNotification() Message %d '%S' wanted\n"), aValue, &aDescription);
   192 			LOG_VERBOSE3(_L("AddRequiredNotification() Message %d '%S' wanted\n"), aValue, &aDescription);
   221 			if(gVerboseOutput)
       
   222 			    {
       
   223 			    OstTraceExt2(TRACE_VERBOSE, CNOTIFYCOLLECTOR_ADDREQUIREDORFAILURENOTIFICATION_DUP02, "AddRequiredNotification() Message %d '%S' wanted\n", aValue, aDescription);
       
   224 			    }
       
   225 			break;
   193 			break;
   226 		case EWatcherPeripheralState:
   194 		case EWatcherPeripheralState:
   227 			COtgRoot::PeripheralStateString(static_cast<TUint>(aValue), aDescription);
   195 			COtgRoot::PeripheralStateString(static_cast<TUint>(aValue), aDescription);
   228 			LOG_VERBOSE3(_L("AddRequiredNotification() Peripheral State %d '%S' wanted\n"), aValue, &aDescription);
   196 			LOG_VERBOSE3(_L("AddRequiredNotification() Peripheral State %d '%S' wanted\n"), aValue, &aDescription);
   229 			if(gVerboseOutput)
       
   230 			    {
       
   231 			    OstTraceExt2(TRACE_VERBOSE, CNOTIFYCOLLECTOR_ADDREQUIREDORFAILURENOTIFICATION_DUP03, "AddRequiredNotification() Peripheral State %d '%S' wanted\n", aValue, aDescription);
       
   232 			    }
       
   233 			break;
   197 			break;
   234 		case EWatcherAConnectionIdle:
   198 		case EWatcherAConnectionIdle:
   235 			COtgRoot::AConnectionIdleString(static_cast<RUsbOtgDriver::TOtgConnection>(aValue), aDescription);
   199 			COtgRoot::AConnectionIdleString(static_cast<RUsbOtgDriver::TOtgConnection>(aValue), aDescription);
   236 			LOG_VERBOSE3(_L("AddRequiredNotification() AConnectionIdle %d '%S' wanted\n"), aValue, &aDescription);
   200 			LOG_VERBOSE3(_L("AddRequiredNotification() AConnectionIdle %d '%S' wanted\n"), aValue, &aDescription);
   237 			if(gVerboseOutput)
       
   238 			    {
       
   239 			    OstTraceExt2(TRACE_VERBOSE, CNOTIFYCOLLECTOR_ADDREQUIREDORFAILURENOTIFICATION_DUP04, "AddRequiredNotification() AConnectionIdle %d '%S' wanted\n", aValue, aDescription);
       
   240 			    }
       
   241 			break;
   201 			break;
   242 
   202 
   243 		}
   203 		}
   244 	
   204 	
   245 	// Find the watcher if possible
   205 	// Find the watcher if possible
   349 void CNotifyCollector::HandleEvent(TWatcherNotifyType aType, TInt aValue)
   309 void CNotifyCollector::HandleEvent(TWatcherNotifyType aType, TInt aValue)
   350 	{
   310 	{
   351 	if (aType == EWatcherTimeouts)
   311 	if (aType == EWatcherTimeouts)
   352 		{
   312 		{
   353 		test.Printf(_L("Step timed out..(%dms).\n\n"), GetWatcher(aType)->GetEventValue());
   313 		test.Printf(_L("Step timed out..(%dms).\n\n"), GetWatcher(aType)->GetEventValue());
   354 		OstTrace1(TRACE_NORMAL, CNOTIFYCOLLECTOR_HANDLEEVENT, "Step timed out..(%dms).\n\n", GetWatcher(aType)->GetEventValue());
       
   355 		CompleteStep(KTestCaseWatchdogTO);
   314 		CompleteStep(KTestCaseWatchdogTO);
   356 		return;
   315 		return;
   357 		}
   316 		}
   358 	
   317 	
   359 	TOtgObservedEvent evt(aType, aValue);
   318 	TOtgObservedEvent evt(aType, aValue);
   362 
   321 
   363 	//	Check to see whether the event denotes a failure for this event
   322 	//	Check to see whether the event denotes a failure for this event
   364 	if (IsFailureEvent(evt))
   323 	if (IsFailureEvent(evt))
   365 		{
   324 		{
   366 		test.Printf(_L("This event denotes failure for this test\n"));
   325 		test.Printf(_L("This event denotes failure for this test\n"));
   367 		OstTrace0(TRACE_NORMAL, CNOTIFYCOLLECTOR_HANDLEEVENT_DUP01, "This event denotes failure for this test\n");
       
   368 		CompleteStep(KTestCaseFailureEventReceived);
   326 		CompleteStep(KTestCaseFailureEventReceived);
   369 		return;
   327 		return;
   370 		}
   328 		}
   371 	
   329 	
   372 	if (iRequiredEvents.Count())
   330 	if (iRequiredEvents.Count())
   373 		{
   331 		{
   374 		// itterate all required events, search for each one in the incomming events list
   332 		// itterate all required events, search for each one in the incomming events list
   375 		while (start< iRequiredEvents.Count())
   333 		while (start< iRequiredEvents.Count())
   376 			{
   334 			{
       
   335 				//LOG_VERBOSE3(_L("Search for=[%d,%d] :"), 
       
   336 				//					iRequiredEvents[start].GetType(), iRequiredEvents[start].GetValue());
   377 				
   337 				
   378 				if (!EventReceivedAlready(iRequiredEvents[start]))
   338 				if (!EventReceivedAlready(iRequiredEvents[start]))
   379 					return;	// missing still, continue
   339 					return;	// missing still, continue
   380 			start++; 
   340 			start++; 
   381 			}
   341 			}
   382 		// found all the required events
   342 		// found all the required events
   383 		LOG_VERBOSE1(_L("Found all.\n"));
   343 		LOG_VERBOSE1(_L("Found all.\n"));
   384 		if(gVerboseOutput)
       
   385 		    {
       
   386 		    OstTrace0(TRACE_VERBOSE, CNOTIFYCOLLECTOR_HANDLEEVENT_DUP03, "Found all.\n");
       
   387 		    }
       
   388 		CompleteStep(KErrNone);
   344 		CompleteStep(KErrNone);
   389 		}
   345 		}
   390 	else
   346 	else
   391 		{
   347 		{
   392 		test.Printf(_L("Warning : No required events!\n"));
   348 		test.Printf(_L("Warning : No required events!\n"));
   393 		OstTrace0(TRACE_NORMAL, CNOTIFYCOLLECTOR_HANDLEEVENT_DUP04, "Warning : No required events!\n");
       
   394 		}	
   349 		}	
   395 	}
   350 	}
   396 
   351 
   397 //	Complete the test step's TRequestStatus (checking it is currently KRequestPending
   352 //	Complete the test step's TRequestStatus (checking it is currently KRequestPending
   398 //	to try and avoid multiple completions).
   353 //	to try and avoid multiple completions).
   400 void CNotifyCollector::CompleteStep(TInt aCompletionCode)
   355 void CNotifyCollector::CompleteStep(TInt aCompletionCode)
   401 	{
   356 	{
   402 	if(iStatusStep.Int() != KRequestPending)
   357 	if(iStatusStep.Int() != KRequestPending)
   403 		{
   358 		{
   404 		test.Printf(_L("Can't complete step - not KRequestPending!\n"));
   359 		test.Printf(_L("Can't complete step - not KRequestPending!\n"));
   405 		OstTrace0(TRACE_NORMAL, CNOTIFYCOLLECTOR_COMPLETESTEP, "Can't complete step - not KRequestPending!\n");
       
   406 		}
   360 		}
   407 	else
   361 	else
   408 		{
   362 		{
   409 		TRequestStatus *StatusStepPtr = &iStatusStep;
   363 		TRequestStatus *StatusStepPtr = &iStatusStep;
   410 		User::RequestComplete(StatusStepPtr, aCompletionCode);
   364 		User::RequestComplete(StatusStepPtr, aCompletionCode);
   416  */
   370  */
   417 COtgWatchdogWatcher *COtgWatchdogWatcher::NewL(MOtgNotificationHandler &wdHandler, 
   371 COtgWatchdogWatcher *COtgWatchdogWatcher::NewL(MOtgNotificationHandler &wdHandler, 
   418 												const TWatcherNotifyType aWatchType, 
   372 												const TWatcherNotifyType aWatchType, 
   419 												COtgRoot &aOtgRoot)
   373 												COtgRoot &aOtgRoot)
   420 	{
   374 	{
   421 	if(gVerboseOutput)
   375 	LOG_FUNC 
   422 	    {
       
   423 	    OstTraceFunctionEntry0(CNOTIFYCOLLECTOR_COMPLETESTEP_DUP01);
       
   424 	    }
       
   425 	COtgWatchdogWatcher* self = new (ELeave) COtgWatchdogWatcher(wdHandler, aWatchType, aOtgRoot);
   376 	COtgWatchdogWatcher* self = new (ELeave) COtgWatchdogWatcher(wdHandler, aWatchType, aOtgRoot);
   426 	CleanupStack::PushL(self);
   377 	CleanupStack::PushL(self);
   427 	self->ConstructL();
   378 	self->ConstructL();
   428 	CleanupStack::Pop(self);
   379 	CleanupStack::Pop(self);
   429 	return self;
   380 	return self;
   430 	}
   381 	}
   431 
   382 
   432 
   383 
   433 void COtgWatchdogWatcher::ConstructL()
   384 void COtgWatchdogWatcher::ConstructL()
   434 	{
   385 	{
   435 	if(gVerboseOutput)
   386 	LOG_FUNC
   436 	    {
       
   437 	    OstTraceFunctionEntry0(COTGWATCHDOGWATCHER_CONSTRUCTL);
       
   438 	    }
       
   439 	
   387 	
   440 	iTimer.CreateLocal();
   388 	iTimer.CreateLocal();
   441 	iIntervalMs = -1;
   389 	iIntervalMs = -1;
   442 	}
   390 	}
   443 
   391 
   444 
   392 
   445 void COtgWatchdogWatcher::StepExpired(TInt aInterval) 
   393 void COtgWatchdogWatcher::StepExpired(TInt aInterval) 
   446 	{
   394 	{
   447 	if(gVerboseOutput)
   395 	LOG_FUNC ; 
   448 	    {
       
   449 	    OstTraceFunctionEntry0(COTGWATCHDOGWATCHER_STEPEXPIRED);
       
   450 	    }
       
   451 	iHandler.HandleEvent(EWatcherTimeouts, aInterval) ; 
   396 	iHandler.HandleEvent(EWatcherTimeouts, aInterval) ; 
   452 	}
   397 	}
   453 
   398 
   454 
   399 
   455 void COtgWatchdogWatcher::RunL()
   400 void COtgWatchdogWatcher::RunL()
   456 	{ 
   401 	{ 
       
   402 	//LOG_FUNC 
   457 	StepExpired(iIntervalMs); 
   403 	StepExpired(iIntervalMs); 
   458 	}
   404 	}
   459 
   405 
   460 
   406 
   461 void COtgWatchdogWatcher::StartTimer(TInt aIntervalMs)
   407 void COtgWatchdogWatcher::StartTimer(TInt aIntervalMs)
   462 	{
   408 	{
   463 	if(gVerboseOutput)
   409 	LOG_FUNC ;
   464 	    {
       
   465 	    OstTraceFunctionEntry0(COTGWATCHDOGWATCHER_STARTTIMER);
       
   466 	    }
       
   467 
   410 
   468 	iIntervalMs = aIntervalMs;	// save value for printing latter 
   411 	iIntervalMs = aIntervalMs;	// save value for printing latter 
   469 	if (IsActive()) //cancel the last timer we set, this is easier than cancelling it in each test-step
   412 	if (IsActive()) //cancel the last timer we set, this is easier than cancelling it in each test-step
   470 		{
   413 		{
   471 		iTimer.Cancel();
   414 		iTimer.Cancel();
   476 		{
   419 		{
   477 		iTimer.After(iStatus, aIntervalMs*1000);
   420 		iTimer.After(iStatus, aIntervalMs*1000);
   478 		SetActive();
   421 		SetActive();
   479 		}
   422 		}
   480 	LOG_VERBOSE2(_L("wd Timer %dms\n"), aIntervalMs)
   423 	LOG_VERBOSE2(_L("wd Timer %dms\n"), aIntervalMs)
   481 	if(gVerboseOutput)
       
   482 	    {
       
   483 	    OstTrace1(TRACE_VERBOSE, COTGWATCHDOGWATCHER_STARTTIMER_DUP01, "wd Timer %dms\n", aIntervalMs);
       
   484 	    }
       
   485 	}	
   424 	}	
   486 
   425 
   487 
   426 
   488 /****************************************************************************
   427 /****************************************************************************
   489  * OTG Event/State/Message Watchers
   428  * OTG Event/State/Message Watchers
   490  */
   429  */
   491 COtgMessageWatcher* COtgMessageWatcher::NewL(MOtgNotificationHandler &wdHandler, 
   430 COtgMessageWatcher* COtgMessageWatcher::NewL(MOtgNotificationHandler &wdHandler, 
   492 										const TWatcherNotifyType aWatchType, 
   431 										const TWatcherNotifyType aWatchType, 
   493 										COtgRoot &aOtgRoot)
   432 										COtgRoot &aOtgRoot)
   494 	{
   433 	{
   495 	if(gVerboseOutput)
   434 	LOG_FUNC 
   496 	    {
       
   497 	    OstTraceFunctionEntry0(COTGMESSAGEWATCHER_NEWL);
       
   498 	    }
       
   499 	COtgMessageWatcher* self = new (ELeave) COtgMessageWatcher(wdHandler, aWatchType, aOtgRoot);
   435 	COtgMessageWatcher* self = new (ELeave) COtgMessageWatcher(wdHandler, aWatchType, aOtgRoot);
   500 	CleanupStack::PushL(self);
   436 	CleanupStack::PushL(self);
   501 	self->ConstructL();
   437 	self->ConstructL();
   502 	CleanupStack::Pop(self);
   438 	CleanupStack::Pop(self);
   503 	return self;
   439 	return self;
   507 void COtgMessageWatcher::DisplayEvent()
   443 void COtgMessageWatcher::DisplayEvent()
   508 	{
   444 	{
   509 	TBuf<MAX_DSTRLEN> aDescription;	
   445 	TBuf<MAX_DSTRLEN> aDescription;	
   510 	iOtgRoot.OtgMessageString(iMessage, aDescription);
   446 	iOtgRoot.OtgMessageString(iMessage, aDescription);
   511 	test.Printf(_L("Received Message %d '%S'\n"), iMessage, &aDescription);
   447 	test.Printf(_L("Received Message %d '%S'\n"), iMessage, &aDescription);
   512 	OstTraceExt2(TRACE_NORMAL, COTGMESSAGEWATCHER_DISPLAYEVENT, "Received Message %d '%S'\n", iMessage, aDescription);
       
   513 	}
   448 	}
   514 
   449 
   515 
   450 
   516 COtgStateWatcher* COtgStateWatcher::NewL(MOtgNotificationHandler &wdHandler, 
   451 COtgStateWatcher* COtgStateWatcher::NewL(MOtgNotificationHandler &wdHandler, 
   517 										const TWatcherNotifyType aWatchType, 
   452 										const TWatcherNotifyType aWatchType, 
   518 										COtgRoot &aOtgRoot)
   453 										COtgRoot &aOtgRoot)
   519 	{
   454 	{
   520 	if(gVerboseOutput)
   455 	LOG_FUNC 
   521 	    {
       
   522 	    OstTraceFunctionEntry0(COTGSTATEWATCHER_NEWL);
       
   523 	    }
       
   524 	COtgStateWatcher* self = new (ELeave) COtgStateWatcher(wdHandler, aWatchType, aOtgRoot);
   456 	COtgStateWatcher* self = new (ELeave) COtgStateWatcher(wdHandler, aWatchType, aOtgRoot);
   525 	CleanupStack::PushL(self);
   457 	CleanupStack::PushL(self);
   526 	self->ConstructL();
   458 	self->ConstructL();
   527 	CleanupStack::Pop(self);
   459 	CleanupStack::Pop(self);
   528 	return self;
   460 	return self;
   529 	}
   461 	}
   530 
   462 
   531 
   463 
   532 void COtgStateWatcher::DisplayEvent() 
   464 void COtgStateWatcher::DisplayEvent() 
   533 	{
   465 	{
       
   466 	//LOG_FUNC
   534 	TBuf<MAX_DSTRLEN> aDescription;	
   467 	TBuf<MAX_DSTRLEN> aDescription;	
   535 	iOtgRoot.OtgStateString(iState, aDescription);
   468 	iOtgRoot.OtgStateString(iState, aDescription);
   536 	test.Printf(_L("Received State %d '%S'\n"), iState, &aDescription);
   469 	test.Printf(_L("Received State %d '%S'\n"), iState, &aDescription);
   537 	OstTraceExt2(TRACE_NORMAL, COTGSTATEWATCHER_DISPLAYEVENT_DUP01, "Received State %d '%S'\n", iState, aDescription);
       
   538 	}
   470 	}
   539 
   471 
   540 
   472 
   541 COtgEventWatcher* COtgEventWatcher::NewL(MOtgNotificationHandler &wdHandler, 
   473 COtgEventWatcher* COtgEventWatcher::NewL(MOtgNotificationHandler &wdHandler, 
   542 										const TWatcherNotifyType aWatchType, 
   474 										const TWatcherNotifyType aWatchType, 
   543 										COtgRoot &aOtgRoot)
   475 										COtgRoot &aOtgRoot)
   544 	{
   476 	{
       
   477 	//LOG_FUNC 
   545 	COtgEventWatcher* self = new (ELeave) COtgEventWatcher(wdHandler, aWatchType, aOtgRoot);
   478 	COtgEventWatcher* self = new (ELeave) COtgEventWatcher(wdHandler, aWatchType, aOtgRoot);
   546 	CleanupStack::PushL(self);
   479 	CleanupStack::PushL(self);
   547 	self->ConstructL();
   480 	self->ConstructL();
   548 	CleanupStack::Pop(self);
   481 	CleanupStack::Pop(self);
   549 	return self;
   482 	return self;
   552 void COtgEventWatcher::DisplayEvent()
   485 void COtgEventWatcher::DisplayEvent()
   553 	{
   486 	{
   554 	TBuf<MAX_DSTRLEN> aDescription;	
   487 	TBuf<MAX_DSTRLEN> aDescription;	
   555 	iOtgRoot.OtgEventString(iEvent, aDescription);
   488 	iOtgRoot.OtgEventString(iEvent, aDescription);
   556 	test.Printf(_L("Received Event %d '%S'\n"), iEvent, &aDescription);
   489 	test.Printf(_L("Received Event %d '%S'\n"), iEvent, &aDescription);
   557 	OstTraceExt2(TRACE_NORMAL, COTGEVENTWATCHER_DISPLAYEVENT, "Received Event %d '%S'\n", iEvent, aDescription);
       
   558 	}
   490 	}
   559 
   491 
   560 CPeripheralStateWatcher* CPeripheralStateWatcher::NewL(MOtgNotificationHandler &wdHandler, 
   492 CPeripheralStateWatcher* CPeripheralStateWatcher::NewL(MOtgNotificationHandler &wdHandler, 
   561 														const TWatcherNotifyType aWatchType, 
   493 														const TWatcherNotifyType aWatchType, 
   562 														COtgRoot &aOtgRoot)
   494 														COtgRoot &aOtgRoot)
   563 	{
   495 	{
       
   496 	//LOG_FUNC 
   564 	CPeripheralStateWatcher* self = new (ELeave) CPeripheralStateWatcher(wdHandler, aWatchType, aOtgRoot);
   497 	CPeripheralStateWatcher* self = new (ELeave) CPeripheralStateWatcher(wdHandler, aWatchType, aOtgRoot);
   565 	CleanupStack::PushL(self);
   498 	CleanupStack::PushL(self);
   566 	self->ConstructL();
   499 	self->ConstructL();
   567 	CleanupStack::Pop(self);
   500 	CleanupStack::Pop(self);
   568 	return self;
   501 	return self;
   571 void CPeripheralStateWatcher::DisplayEvent()
   504 void CPeripheralStateWatcher::DisplayEvent()
   572 	{
   505 	{
   573 	TBuf<MAX_DSTRLEN> aDescription;	
   506 	TBuf<MAX_DSTRLEN> aDescription;	
   574 	iOtgRoot.PeripheralStateString(iPeripheralState, aDescription);
   507 	iOtgRoot.PeripheralStateString(iPeripheralState, aDescription);
   575 	test.Printf(_L("Peripheral State %d '%S'\n"), iPeripheralState, &aDescription);
   508 	test.Printf(_L("Peripheral State %d '%S'\n"), iPeripheralState, &aDescription);
   576 	OstTraceExt2(TRACE_NORMAL, CPERIPHERALSTATEWATCHER_DISPLAYEVENT, "Peripheral State %u '%S'\n", iPeripheralState, aDescription);
       
   577 	}
   509 	}
   578 
   510 
   579 CAConnectionIdleWatcher* CAConnectionIdleWatcher::NewL(MOtgNotificationHandler &wdHandler, 
   511 CAConnectionIdleWatcher* CAConnectionIdleWatcher::NewL(MOtgNotificationHandler &wdHandler, 
   580 														const TWatcherNotifyType aWatchType, 
   512 														const TWatcherNotifyType aWatchType, 
   581 														COtgRoot &aOtgRoot)
   513 														COtgRoot &aOtgRoot)
   582 	{
   514 	{
       
   515 	//LOG_FUNC 
   583 	CAConnectionIdleWatcher* self = new (ELeave) CAConnectionIdleWatcher(wdHandler, aWatchType, aOtgRoot);
   516 	CAConnectionIdleWatcher* self = new (ELeave) CAConnectionIdleWatcher(wdHandler, aWatchType, aOtgRoot);
   584 	CleanupStack::PushL(self);
   517 	CleanupStack::PushL(self);
   585 	self->ConstructL();
   518 	self->ConstructL();
   586 	CleanupStack::Pop(self);
   519 	CleanupStack::Pop(self);
   587 	return self;
   520 	return self;
   615 void CAConnectionIdleWatcher::DisplayEvent()
   548 void CAConnectionIdleWatcher::DisplayEvent()
   616 	{
   549 	{
   617 	TBuf<MAX_DSTRLEN> aDescription;	
   550 	TBuf<MAX_DSTRLEN> aDescription;	
   618 	iOtgRoot.AConnectionIdleString(iAConnectionIdle, aDescription);
   551 	iOtgRoot.AConnectionIdleString(iAConnectionIdle, aDescription);
   619 	test.Printf(_L("AConnectionIdle %d '%S'\n"), iAConnectionIdle, &aDescription);
   552 	test.Printf(_L("AConnectionIdle %d '%S'\n"), iAConnectionIdle, &aDescription);
   620 	OstTraceExt2(TRACE_NORMAL, CACONNECTIONIDLEWATCHER_DISPLAYEVENT, "AConnectionIdle %d '%S'\n", iAConnectionIdle, aDescription);
   553 	}
   621 	}