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