telephonyutils/telephonywatchers/src/watcherbase.cpp
branchRCL_3
changeset 65 630d2f34d719
parent 0 3553901f7fa8
child 66 07a122eea281
equal deleted inserted replaced
61:17af172ffa5f 65:630d2f34d719
    11 // Contributors:
    11 // Contributors:
    12 //
    12 //
    13 // Description:
    13 // Description:
    14 //
    14 //
    15 
    15 
       
    16 
       
    17 
       
    18 #include "OstTraceDefinitions.h"
       
    19 #ifdef OST_TRACE_COMPILER_IN_USE
       
    20 #include "watcherbaseTraces.h"
       
    21 #endif
       
    22 
       
    23 #undef TCOM_ARG
       
    24 #ifdef OST_TRACE_COMPILER_IN_USE
       
    25 #define TCOM_ARG(x) x
       
    26 #else
       
    27 #define TCOM_ARG(x)
       
    28 #endif
       
    29 
    16 #include "watcherbase.h"
    30 #include "watcherbase.h"
    17 #include "watcherlog.h"
       
    18 
    31 
    19 // System includes
    32 // System includes
    20  #include <commsdattypesv1_1.h>
    33  #include <commsdattypesv1_1.h>
    21  #include <commsdat_partner.h>
    34  #include <commsdat_partner.h>
    22 
    35 
    51 	TTime now;
    64 	TTime now;
    52 	now.UniversalTime();
    65 	now.UniversalTime();
    53 	TheSeed = now.Int64();
    66 	TheSeed = now.Int64();
    54 
    67 
    55     //-- define properties for test purposes
    68     //-- define properties for test purposes
    56     LOGCOMMON1("CTelWatcherBase : defining properties for testing");
    69     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, CWATCHERBASE_CTOR_1, "CTelWatcherBase : defining properties for testing");
    57    
    70    
    58     //-- For debugging purposes only, used by TE_TelWatchers(Unit).
    71     //-- For debugging purposes only, used by TE_TelWatchers(Unit).
    59 
    72 
    60     //- this property change (to any value) informs that CTelPhoneWatcher has re-read modem table from commdb in
    73     //- this property change (to any value) informs that CTelPhoneWatcher has re-read modem table from commdb in
    61     //- CTelPhoneWatcher::DoRetrieveTSYNameL(). 
    74     //- CTelPhoneWatcher::DoRetrieveTSYNameL(). 
    81 	iPhonePowerProperty.Close();
    94 	iPhonePowerProperty.Close();
    82 	}
    95 	}
    83 
    96 
    84 EXPORT_C void CWatcherBase::ConstructL()
    97 EXPORT_C void CWatcherBase::ConstructL()
    85 	{
    98 	{
    86 	LOGCOMMON1("WatcherBase : Creating timer");
    99 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, CWATCHERBASE_CONSTRUCTL_1, "WatcherBase : Creating timer");
    87 	User::LeaveIfError(iTimer.CreateLocal());
   100 	User::LeaveIfError(iTimer.CreateLocal());
    88 
   101 
    89 	User::LeaveIfError(iPhonePowerProperty.Attach(KUidSystemCategory, KUidPhonePwr.iUid));    
   102 	User::LeaveIfError(iPhonePowerProperty.Attach(KUidSystemCategory, KUidPhonePwr.iUid));    
    90 	
   103 	
    91 	// This starts the whole ball rolling
   104 	// This starts the whole ball rolling
    96 //
   109 //
    97 //
   110 //
    98 
   111 
    99 EXPORT_C void CWatcherBase::SuspendFor(TInt aTimeInSeconds)
   112 EXPORT_C void CWatcherBase::SuspendFor(TInt aTimeInSeconds)
   100 	{
   113 	{
   101 	LOGCOMMON1("WatcherBase : Pausing after error");
   114 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, CWATCHERBASE_SUSPENDFOR_1, "WatcherBase : Pausing after error");
   102 	TTimeIntervalMicroSeconds32 timeToSuspendFor = aTimeInSeconds * KOneSecond;
   115 	TTimeIntervalMicroSeconds32 timeToSuspendFor = aTimeInSeconds * KOneSecond;
   103 	iTimer.After(iStatus, timeToSuspendFor);
   116 	iTimer.After(iStatus, timeToSuspendFor);
   104 	State() = EBaseStateSuspending;
   117 	State() = EBaseStateSuspending;
   105 	SetActive();
   118 	SetActive();
   106 	}
   119 	}
   107 
   120 
   108 EXPORT_C void CWatcherBase::SetDisabled(const TDesC& aLogEntry, TInt aError)
   121 EXPORT_C void CWatcherBase::SetDisabled(const TDesC& TCOM_ARG(aLogEntry), TInt TCOM_ARG(aError))
   109 	{
   122 	{
   110 #ifdef _WATCHER_LOGGING_ENABLED
   123 	OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, CWATCHERBASE_SETDISABLED_1, "Log Entry \"%S\" error %d", aLogEntry, aError);
   111 	TBuf8<256>  tmpBuf;
   124 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, CWATCHERBASE_SETDISABLED_2, "WatcherBase : Watcher is now disabled");
   112 	tmpBuf.Copy(aLogEntry);
       
   113 	LOGCOMMON3("Log Entry \"%S\" error %d", &tmpBuf, aError);
       
   114 #else
       
   115 	(void) aLogEntry;
       
   116 	(void) aError;
       
   117 #endif
       
   118 	LOGCOMMON1("WatcherBase : Watcher is now disabled");
       
   119 	State() = EBaseStateDisabled;
   125 	State() = EBaseStateDisabled;
   120 	}
   126 	}
   121 
   127 
   122 EXPORT_C void CWatcherBase::RequestNextState()
   128 EXPORT_C void CWatcherBase::RequestNextState()
   123 	{
   129 	{
   124 	LOGCOMMON1("WatcherBase : Requesting State Change");
   130 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, CWATCHERBASE_REQUESTNEXTSTATE_1, "WatcherBase : Requesting State Change");
   125 
   131 
   126 	if	(State() != EBaseStateDisabled)
   132 	if	(State() != EBaseStateDisabled)
   127 		{
   133 		{
   128 		TRequestStatus* status = &iStatus;
   134 		TRequestStatus* status = &iStatus;
   129 		User::RequestComplete(status, KErrNone);
   135 		User::RequestComplete(status, KErrNone);
   137 //	again before the watchers can continue.
   143 //	again before the watchers can continue.
   138 //
   144 //
   139 	{
   145 	{
   140 	TInt val;	
   146 	TInt val;	
   141 	
   147 	
   142 	LOGCOMMON1("WatcherBase : Waiting for phone to be turned on");
   148 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, CWATCHERBASE_WAITFORPHONETOPOWERUPL_1, "WatcherBase : Waiting for phone to be turned on");
   143 	__ASSERT_DEBUG(!IsActive(), WatcherBasePanic(EUnexpectedActiveState));
   149 	__ASSERT_DEBUG(!IsActive(), WatcherBasePanic(EUnexpectedActiveState));
   144 	Cancel();
   150 	Cancel();
   145 
   151 
   146 	//-- Subscribe to phone power state change property and wait until it changes
   152 	//-- Subscribe to phone power state change property and wait until it changes
   147 	iPhonePowerProperty.Subscribe(iStatus);
   153 	iPhonePowerProperty.Subscribe(iStatus);
   155 	User::LeaveIfError(iPhonePowerProperty.Get(val));
   161 	User::LeaveIfError(iPhonePowerProperty.Get(val));
   156 
   162 
   157 	if (val != ESAPhoneOff)
   163 	if (val != ESAPhoneOff)
   158 		{//-- phone is already ON, complete request so that we go to RunL without waiting
   164 		{//-- phone is already ON, complete request so that we go to RunL without waiting
   159 		iPhonePowerProperty.Cancel();        
   165 		iPhonePowerProperty.Cancel();        
   160 		LOGCOMMON1("CTelWatcherBase::WaitForPhoneToPowerUpL ??? phone is already turned ON");
   166 		OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, CWATCHERBASE_WAITFORPHONETOPOWERUPL_2, "CTelWatcherBase::WaitForPhoneToPowerUpL ??? phone is already turned ON");
   161 		}
   167 		}
   162 	}
   168 	}
   163 
   169 
   164 //
   170 //
   165 //
   171 //
   166 //
   172 //
   167 
   173 
   168 EXPORT_C void CWatcherBase::RunL()
   174 EXPORT_C void CWatcherBase::RunL()
   169 	{
   175 	{
   170 	LOGCOMMON2("WatcherBase : RunL(%d)", iStatus.Int());
   176 	OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, CWATCHERBASE_RUNL_1, "WatcherBase : RunL(%d)", iStatus.Int());
   171 
   177 
   172 	switch(State())
   178 	switch(State())
   173 		{
   179 		{
   174 	case EBaseStateConnectingToPropertyNotifier:		
   180 	case EBaseStateConnectingToPropertyNotifier:		
   175 		LOGCOMMON1("WatcherBase : Attaching to Property");
   181 		OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, CWATCHERBASE_RUNL_2, "WatcherBase : Attaching to Property");
   176 
   182 
   177 		// Virtual function call back, for any subclasses that need to implement
   183 		// Virtual function call back, for any subclasses that need to implement
   178 		// any special stuff.
   184 		// any special stuff.
   179 		HandleConnectionToChangeNotifierEstablishedL();
   185 		HandleConnectionToChangeNotifierEstablishedL();
   180 
   186 
   184 		break;
   190 		break;
   185 
   191 
   186 	case EBaseStateWaitingForPhoneToPowerUp:
   192 	case EBaseStateWaitingForPhoneToPowerUp:
   187 		// We were waiting for the phone to become available again. We now must restart
   193 		// We were waiting for the phone to become available again. We now must restart
   188 		// this watcher from scratch.
   194 		// this watcher from scratch.
   189 		LOGCOMMON1("WatcherBase : Phone available again. Restarting watcher framework");
   195 		OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, CWATCHERBASE_RUNL_3, "WatcherBase : Phone available again. Restarting watcher framework");
   190 		
   196 		
   191         //--  phone power state has changed (it must be turned ON)
   197         //--  phone power state has changed (it must be turned ON)
   192         //--  retrieve its state and check.
   198         //--  retrieve its state and check.
   193         TInt val;
   199         TInt val;
   194 	    
   200 	    
   195         User::LeaveIfError(iPhonePowerProperty.Get(val));
   201         User::LeaveIfError(iPhonePowerProperty.Get(val));
   196 
   202 
   197         if (val == ESAPhoneOn)
   203         if (val == ESAPhoneOn)
   198         {   //-- everything OK, the phone has been turned ON, restart this watcher from scratch.
   204         {   //-- everything OK, the phone has been turned ON, restart this watcher from scratch.
   199 		    LOGCOMMON1("CTelWatcherBase : Phone has been turned ON. Restarting watcher framework");
   205 		    OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, CWATCHERBASE_RUNL_4, "CTelWatcherBase : Phone has been turned ON. Restarting watcher framework");
   200             State() = EBaseStateConnectingToPropertyNotifier;
   206             State() = EBaseStateConnectingToPropertyNotifier;
   201             RequestNextState();
   207             RequestNextState();
   202         }
   208         }
   203         else
   209         else
   204         {   //-- strange situation, we were waiting for phone On and it now Off, try to wait again
   210         {   //-- strange situation, we were waiting for phone On and it now Off, try to wait again
   205             LOGCOMMON1("CTelWatcherBase : ??? Phone has been turned OFF. Continue waiting...");
   211             OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, CWATCHERBASE_RUNL_5, "CTelWatcherBase : ??? Phone has been turned OFF. Continue waiting...");
   206             WaitForPhoneToPowerUpL();
   212             WaitForPhoneToPowerUpL();
   207         } 		
   213         } 		
   208 		break;
   214 		break;
   209 
   215 
   210 	case EBaseStateSuspending:
   216 	case EBaseStateSuspending:
   211 		LOGCOMMON1("WatcherBase : Completed suspension. Resuming passive state");
   217 		OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, CWATCHERBASE_RUNL_6, "WatcherBase : Completed suspension. Resuming passive state");
   212 		
   218 		
   213 		State() = EBaseStatePassive; // Fall through
   219 		State() = EBaseStatePassive; // Fall through
   214 
   220 
   215 	case EBaseStatePassive: // In passive mode, so just call framework function
   221 	case EBaseStatePassive: // In passive mode, so just call framework function
   216 		HandleStateEventL(iStatus.Int());
   222 		HandleStateEventL(iStatus.Int());
   217 		break;
   223 		break;
   218 	
   224 	
   219 	default:
   225 	default:
   220 	case EBaseStateDisabled:
   226 	case EBaseStateDisabled:
   221 		LOGCOMMON1("WatcherBase : RunL called in Disabled state. Ooops");
   227 		OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, CWATCHERBASE_RUNL_7, "WatcherBase : RunL called in Disabled state. Ooops");
   222 		__ASSERT_DEBUG(0, WatcherBasePanic(EUnexpectedState));
   228 		__ASSERT_DEBUG(0, WatcherBasePanic(EUnexpectedState));
   223 		}
   229 		}
   224 	}
   230 	}
   225 
   231 
   226 EXPORT_C void CWatcherBase::DoCancel()
   232 EXPORT_C void CWatcherBase::DoCancel()
   245 		}
   251 		}
   246 
   252 
   247 	// Let other sub classes cancel their requests
   253 	// Let other sub classes cancel their requests
   248 	HandleCancel();
   254 	HandleCancel();
   249 	}
   255 	}
   250 
   256  
   251 EXPORT_C TInt CWatcherBase::RunError(TInt aError)
   257 EXPORT_C TInt CWatcherBase::RunError(TInt TCOM_ARG(aError))
   252 //
   258 //
   253 //	Called when RunL (or a sub-function there-of) leaves.
   259 //	Called when RunL (or a sub-function there-of) leaves.
   254 //
   260 //
   255 	{
   261 	{
   256 #ifdef _WATCHER_LOGGING_ENABLED
   262 	OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, CWATCHERBASE_RUNERROR_1, "WatcherBase : RunError called with error of %d", aError);
   257 	LOGCOMMON2("WatcherBase : RunError called with error of %d", aError);
       
   258 #else
       
   259 	(void) aError;
       
   260 #endif
       
   261 
   263 
   262 	// Should never be called from outside the framework
   264 	// Should never be called from outside the framework
   263 	__ASSERT_DEBUG(!IsActive(), WatcherBasePanic(EUnexpectedActiveState));
   265 	__ASSERT_DEBUG(!IsActive(), WatcherBasePanic(EUnexpectedActiveState));
   264 	Cancel();
   266 	Cancel();
   265 
   267 
   282 		SetDisabled(_L("WatcherBase : RunError called too many times in succession"), KErrNone);
   284 		SetDisabled(_L("WatcherBase : RunError called too many times in succession"), KErrNone);
   283 		}
   285 		}
   284 	else
   286 	else
   285 		{
   287 		{
   286 		// Put us in the start up state again
   288 		// Put us in the start up state again
   287 		LOGCOMMON1("WatcherBase : Phone available again. Restarting watcher framework");
   289 		OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, CWATCHERBASE_RUNERROR_2, "WatcherBase : Phone available again. Restarting watcher framework");
   288 		State() = EBaseStateConnectingToPropertyNotifier;
   290 		State() = EBaseStateConnectingToPropertyNotifier;
   289 		RequestNextState();
   291 		RequestNextState();
   290 		}
   292 		}
   291 
   293 
   292 	return KErrNone;
   294 	return KErrNone;
   405 //
   407 //
   406 //
   408 //
   407 
   409 
   408 TInt CPhoneWatcher::RetrieveTSYName()
   410 TInt CPhoneWatcher::RetrieveTSYName()
   409 	{
   411 	{
   410 	LOGCOMMON1("PhoneWatcher : RetrieveTSYName()");
   412 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CPHONEWATCHER_RETRIEVETSYNAME_1, "PhoneWatcher : RetrieveTSYName()");
   411 	TRAPD(error, DoRetrieveTSYNameL());
   413 	TRAPD(error, DoRetrieveTSYNameL());
   412 	return error;
   414 	return error;
   413 	}
   415 	}
   414 
   416 
   415 TInt CPhoneWatcher::ConnectToETelServer()
   417 TInt CPhoneWatcher::ConnectToETelServer()
   416 	{
   418 	{
   417 	LOGCOMMON1("PhoneWatcher : ConnectToETelServer()");
   419 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CPHONEWATCHER_CONNECTTOETELSERVER_1, "PhoneWatcher : ConnectToETelServer()");
   418 	return ETel().Connect();
   420 	return ETel().Connect();
   419 	}
   421 	}
   420 
   422 
   421 TInt CPhoneWatcher::LoadPhoneModule()
   423 TInt CPhoneWatcher::LoadPhoneModule()
   422 	{
   424 	{
   423 #ifdef _WATCHER_LOGGING_ENABLED
   425 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CPHONEWATCHER_LOADPHONEMODULE_1, "PhoneWatcher : LoadPhoneModule()");
   424 	TBuf8<256>  tmpBuf;
   426 	OstTraceDefExt1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CPHONEWATCHER_LOADPHONEMODULE_2, "TSY Name to load is %S",iTSYName);
   425 	tmpBuf.Copy(iTSYName);
       
   426 	LOGCOMMON1("PhoneWatcher : LoadPhoneModule()");
       
   427 	LOGCOMMON2("TSY Name to load is %S",&tmpBuf);
       
   428 #endif
       
   429 
   427 
   430 	return ETel().LoadPhoneModule(iTSYName);
   428 	return ETel().LoadPhoneModule(iTSYName);
   431 	}
   429 	}
   432 
   430 
   433 TInt CPhoneWatcher::ConnectToPhone()
   431 TInt CPhoneWatcher::ConnectToPhone()
   434 	{
   432 	{
   435 	LOGCOMMON1("PhoneWatcher : ConnectToPhone()");
   433 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CPHONEWATCHER_CONNECTTOPHONE_1, "PhoneWatcher : ConnectToPhone()");
   436 	TInt error;
   434 	TInt error;
   437 
   435 
   438 	RTelServer::TPhoneInfo phoneInfo;
   436 	RTelServer::TPhoneInfo phoneInfo;
   439 
   437 
   440 	// Get the number of phones
   438 	// Get the number of phones
   441 	TInt phoneCount = 0;
   439 	TInt phoneCount = 0;
   442 	error = ETel().EnumeratePhones(phoneCount);
   440 	error = ETel().EnumeratePhones(phoneCount);
   443 	if	(error < KErrNone)
   441 	if	(error < KErrNone)
   444 		{
   442 		{
   445 		LOGCOMMON2("PhoneWatcher : Failed to enumerate phones (%d)", error);
   443 		OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CPHONEWATCHER_CONNECTTOPHONE_2, "PhoneWatcher : Failed to enumerate phones (%d)", error);
   446 		return error;
   444 		return error;
   447 		}
   445 		}
   448 
   446 
   449 	LOGCOMMON2("PhoneWatcher : Counted %d 'phones'", phoneCount);
   447 	OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CPHONEWATCHER_CONNECTTOPHONE_3, "PhoneWatcher : Counted %d 'phones'", phoneCount);
   450 
   448 
   451 	// Iterate through all the phones
   449 	// Iterate through all the phones
   452 	for(TInt i=0; i<phoneCount; i++)
   450 	for(TInt i=0; i<phoneCount; i++)
   453 		{
   451 		{
   454 		// Get the TSY name for the phone
   452 		// Get the TSY name for the phone
   455 		TName matchTsyName;
   453 		TName matchTsyName;
   456 		
   454 		
   457 		error = ETel().GetTsyName(i, matchTsyName);
   455 		error = ETel().GetTsyName(i, matchTsyName);
   458 		if	(error < KErrNone)
   456 		if	(error < KErrNone)
   459 			{
   457 			{
   460 			LOGCOMMON2("PhoneWatcher : Getting TSY name failed (%d)", error);
   458 			OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CPHONEWATCHER_CONNECTTOPHONE_4, "PhoneWatcher : Getting TSY name failed (%d)", error);
   461 			return error;
   459 			return error;
   462 			}
   460 			}
   463 
   461 
   464 #ifdef _WATCHER_LOGGING_ENABLED
   462 		OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CPHONEWATCHER_CONNECTTOPHONE_5, "PhoneWatcher : TSY for phone %d is '%S'", i, matchTsyName);
   465 		TBuf8<256>  tmpMatchTsyName;
   463 
   466 		tmpMatchTsyName.Copy(matchTsyName);
       
   467 		LOGCOMMON3("PhoneWatcher : TSY for phone %d is '%S'", i, &tmpMatchTsyName);
       
   468 #endif
       
   469 
   464 
   470 		// See if the phone belongs to the TSY
   465 		// See if the phone belongs to the TSY
   471 		if	(matchTsyName.CompareF(iTSYName) == 0)
   466 		if	(matchTsyName.CompareF(iTSYName) == 0)
   472 			{
   467 			{
   473 #ifdef _WATCHER_LOGGING_ENABLED
   468 			OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CPHONEWATCHER_CONNECTTOPHONE_6, "PhoneWatcher : %S is a match for CommDb TSY: %S", matchTsyName, iTSYName);
   474 			TBuf8<256>  tsyNameBuf;
       
   475 			tsyNameBuf.Copy(iTSYName);
       
   476 			LOGCOMMON3("PhoneWatcher : %S is a match for CommDb TSY: %S", &tmpMatchTsyName, &tsyNameBuf);
       
   477 #endif
       
   478 
   469 
   479 			error = ETel().GetPhoneInfo(i, phoneInfo);
   470 			error = ETel().GetPhoneInfo(i, phoneInfo);
   480 			if	(error < KErrNone)
   471 			if	(error < KErrNone)
   481 				{
   472 				{
   482 				LOGCOMMON2("PhoneWatcher : Getting phone info failed (%d)", error);
   473 				OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CPHONEWATCHER_CONNECTTOPHONE_7, "PhoneWatcher : Getting phone info failed (%d)", error);
   483 				return error;
   474 				return error;
   484 				}
   475 				}
   485 			break;
   476 			break;
   486 			}
   477 			}
   487 		}
   478 		}
   488 
   479 
   489 	// Connect to the specified phone
   480 	// Connect to the specified phone
   490 	error = Phone().Open(ETel(), phoneInfo.iName);
   481 	error = Phone().Open(ETel(), phoneInfo.iName);
   491 	if	(error < KErrNone)
   482 	if	(error < KErrNone)
   492 		{
   483 		{
   493 #ifdef _WATCHER_LOGGING_ENABLED
   484 		OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CPHONEWATCHER_CONNECTTOPHONE_8, "PhoneWatcher : Open phone %S failed (%d)", phoneInfo.iName, error);
   494 		TBuf8<256>  tmpBuf;
       
   495 		tmpBuf.Copy(phoneInfo.iName);
       
   496 		LOGCOMMON3("PhoneWatcher : Open phone %S failed (%d)", &tmpBuf, error);
       
   497 #endif
       
   498 		return error;
   485 		return error;
   499 		}
   486 		}
   500 
   487 	OstTraceDefExt1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CPHONEWATCHER_CONNECTTOPHONE_9, "PhoneWatcher : Opened 'phone' %S", phoneInfo.iName);
   501 #ifdef _WATCHER_LOGGING_ENABLED
   488 
   502 	TBuf8<256>  tmpBuf;
       
   503 	tmpBuf.Copy(phoneInfo.iName);
       
   504 	LOGCOMMON2("PhoneWatcher : Opened 'phone' %S", &tmpBuf);
       
   505 #endif
       
   506 
   489 
   507 	// Indicate we're connected and to move to next state.
   490 	// Indicate we're connected and to move to next state.
   508 	return error;
   491 	return error;
   509 	}
   492 	}
   510 
   493