telephonyserverplugins/multimodetsy/hayes/NOTIFY.CPP
changeset 0 3553901f7fa8
child 20 244d7c5f118e
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #include "ETELFAX.H"
       
    17 #include "PHONE.H"
       
    18 #include "LINE.H"
       
    19 #include "CALL.H"
       
    20 #include "mSLOGGER.H"
       
    21 #include "mnetwork.h"
       
    22 #include "GprsNotify.h"
       
    23 
       
    24 //
       
    25 //	CNotifications - handles array of notifications placed on TSY
       
    26 //
       
    27 CNotifications* CNotifications::NewL()
       
    28 	{
       
    29 	CNotifications* notifications=new(ELeave) CNotifications();
       
    30 	CleanupStack::PushL(notifications);
       
    31 	notifications->ConstructL();
       
    32 	CleanupStack::Pop();
       
    33 	return notifications;
       
    34 	}
       
    35 
       
    36 CNotifications::CNotifications()
       
    37 	{}
       
    38 
       
    39 void CNotifications::ConstructL()
       
    40 	{
       
    41 	iNotifications = new (ELeave) CArrayPtrFlat<CNotifyBase>(4);
       
    42 	iLastEvents = new (ELeave) CArrayFixFlat<TLastEvent>(4);
       
    43 	}
       
    44 
       
    45 CNotifications::~CNotifications()
       
    46 //
       
    47 //	Notifications are removed by server prior to this
       
    48 //
       
    49 	{
       
    50 	if(iNotifications)
       
    51 		{
       
    52 		__ASSERT_ALWAYS(iNotifications->Count()==0,Panic(ENotifications_Remaining));
       
    53 		delete iNotifications;
       
    54 		}
       
    55 	if(iLastEvents)
       
    56 		{
       
    57 		__ASSERT_ALWAYS(iLastEvents->Count()==0,Panic(ELastEvents_Remaining));
       
    58 		delete iLastEvents;
       
    59 		}
       
    60 	}
       
    61 
       
    62 //
       
    63 //	Last Events
       
    64 //
       
    65 //	The most recent event to occur must be stored in the notification handler to be compared
       
    66 //  with the event passed with CheckNotification(), so that they can be compared (if they are 
       
    67 //  equal, the notification should not be completed).
       
    68 //	Each TelObject to use this Notification handler has a last event associated with it.
       
    69 //	The first time a TelObject calls RegisterNotification() to add a notification to the array, 
       
    70 //	an entry is made in the iLastEvents array connecting this TelObject with an event (to start
       
    71 //  with this is ENoEvent).
       
    72 //	When the notification completes, the LastEvent entry remains, as even if a TelObject has no
       
    73 //	notifications outstanding there must still be a record of its last event. This LastEvent
       
    74 //	entry must only be removed when the TelObject is destroyed, hence in the destructor of 
       
    75 //	each of CPhoneHayes, CLineHayes, CCallHayes and CFaxHayes RemoveClientFromLastEvents() is
       
    76 //  called.
       
    77 //
       
    78 
       
    79 TInt CNotifications::FindLastEvent(CTelObject* aTelObject)
       
    80 //
       
    81 // Finds the last event to occur to this TelObject
       
    82 // Returns the position in the array
       
    83 //
       
    84 	{
       
    85 	for (TInt i=0;i<iLastEvents->Count();i++)
       
    86 		{
       
    87 		if (iLastEvents->At(i).iTelObject==aTelObject)
       
    88 			return i;
       
    89 		}
       
    90 	return KErrNotFound;
       
    91 	}
       
    92 
       
    93 TInt CNotifications::GetLastEvent(CTelObject* aTelObject, TLastEvent& aLastEvent)
       
    94 //
       
    95 //	Searches for the relevant Last Event entry by TelObject, returns the reference to entry
       
    96 //  and its position
       
    97 //
       
    98 	{
       
    99 	TInt pos = FindLastEvent(aTelObject);
       
   100 	if (pos!=KErrNotFound)
       
   101 		{
       
   102 		aLastEvent = iLastEvents->At(pos);
       
   103 		}
       
   104 	return pos;
       
   105 	}
       
   106 
       
   107 TInt CNotifications::AddLastEvent(CTelObject* aTelObject,TEvent aLastEvent)
       
   108 //
       
   109 //	Searches for relevant entry. If exists, updates it with new event. If not, appends a new
       
   110 //	entry to the array.
       
   111 //
       
   112 	{
       
   113 	TLastEvent lastEvent;
       
   114 	lastEvent.iLastEvent=aLastEvent;
       
   115 
       
   116 	TInt pos = FindLastEvent(aTelObject);
       
   117 	if (pos!=KErrNotFound)
       
   118 		{
       
   119 		iLastEvents->At(pos).iLastEvent=lastEvent.iLastEvent; // Update array element's iLastEvent.
       
   120 		}
       
   121 	else
       
   122 		{	
       
   123 		lastEvent.iTelObject=aTelObject;
       
   124 		TRAPD(ret, iLastEvents->AppendL(lastEvent,1) );
       
   125 
       
   126 		if (ret!=KErrNone)
       
   127 			{
       
   128 			LOGTEXT2(_L8("CNotifications::AddLastEvent Append failed with error %d"), ret);
       
   129 			return ret; 
       
   130 			}
       
   131 		}
       
   132 
       
   133 	return pos;
       
   134 	}
       
   135 	
       
   136 //
       
   137 //	public functions
       
   138 //
       
   139 
       
   140 void CNotifications::RemoveClientFromLastEvents(CTelObject* aTelObject)
       
   141 //
       
   142 //	The notification store needs to know when a TelObject is closed so it can remove its
       
   143 //  entry in the Last Events list.
       
   144 	{
       
   145 	for (TInt i=0;i<iLastEvents->Count();i++)
       
   146 		{
       
   147 		if (iLastEvents->At(i).iTelObject==aTelObject)
       
   148 			{
       
   149 			iLastEvents->Delete(i);
       
   150 			return;
       
   151 			}
       
   152 		}
       
   153 	}
       
   154 
       
   155 void CNotifications::RemoveEventFromLastEvents(TEvent aEvent)
       
   156 //
       
   157 // The removes all events of a particular type from the event list.  It is used when a line stops
       
   158 // ringing to remove all ringing references.
       
   159 //
       
   160 	{
       
   161 	for (TInt i=0;i<iLastEvents->Count();i++)
       
   162 		{
       
   163 		if (iLastEvents->At(i).iLastEvent==aEvent)
       
   164 			{
       
   165 			iLastEvents->Delete(i);
       
   166 			return;
       
   167 			}
       
   168 		}
       
   169 	}
       
   170 
       
   171 void CNotifications::RegisterNotification(TNotifications aWhichNotification,TTsyReqHandle aTsyReqHandle,CTelObject* aTelObject,TAny* aParams)
       
   172 	{
       
   173 	CNotifyBase* newNotify = NULL;
       
   174 	TInt ret=KErrNone;
       
   175 	switch (aWhichNotification)
       
   176 		{
       
   177 	case EModemDetection:
       
   178 		TRAP(ret,newNotify = CNotifyModemDetected::NewL((RPhone::TModemDetection*)aParams,aTsyReqHandle,aTelObject));
       
   179 		break;
       
   180 	case EIncomingCall:
       
   181 		TRAP(ret,newNotify = CNotifyIncomingCall::NewL((TDes*)aParams,aTsyReqHandle,aTelObject));
       
   182 		break;
       
   183 	case ELineHookChange:
       
   184 		TRAP(ret,newNotify = CNotifyLineHookChange::NewL((RCall::THookStatus*)aParams,aTsyReqHandle,aTelObject));
       
   185 		break;
       
   186 	case ECallHookChange:
       
   187 		TRAP(ret,newNotify = CNotifyCallHookChange::NewL((RCall::THookStatus*)aParams,aTsyReqHandle,aTelObject));
       
   188 		break;
       
   189 	case ELineStatusChange:
       
   190 		TRAP(ret,newNotify = CNotifyLineStatusChange::NewL((RCall::TStatus*)aParams,aTsyReqHandle,aTelObject));
       
   191 		break;
       
   192 	case EMobileLineStatusChange:
       
   193 		TRAP(ret,newNotify = CNotifyMobileLineStatusChange::NewL((RMobileCall::TMobileCallStatus*)aParams,aTsyReqHandle,aTelObject));
       
   194 		break;
       
   195 	case ECallDurationChange:
       
   196 		TRAP(ret,newNotify = CNotifyCallDurationChange::NewL((TTimeIntervalSeconds*)aParams,aTsyReqHandle,aTelObject));
       
   197 		break;
       
   198 	case ENewCallAdded:
       
   199 		TRAP(ret,newNotify = CNotifyLineNewCallAdded::NewL((TDes*)aParams,aTsyReqHandle,aTelObject));
       
   200 		break;
       
   201 	case ECallStatusChange:
       
   202 		TRAP(ret,newNotify = CNotifyCallStatusChange::NewL((RCall::TStatus*)aParams,aTsyReqHandle,aTelObject));
       
   203 		break;
       
   204 	case EMobileCallStatusChange:
       
   205 		TRAP(ret,newNotify = CNotifyMobileCallStatusChange::NewL((RMobileCall::TMobileCallStatus*)aParams,aTsyReqHandle,aTelObject));
       
   206 		break;
       
   207 	case EReadOrWriteFax:
       
   208 		TRAP(ret,newNotify = CNotifyFaxReadOrWrite::NewL(aTsyReqHandle,aTelObject));
       
   209 		break;
       
   210 	case EEndOfFaxPage:
       
   211 		TRAP(ret,newNotify = CNotifyFaxEndOfPage::NewL(aTsyReqHandle,aTelObject));
       
   212 		break;
       
   213 	case ECallCaps:
       
   214 		TRAP(ret,newNotify = CNotifyCallCaps::NewL((RCall::TCaps*)aParams,aTsyReqHandle,aTelObject));
       
   215 		break;
       
   216 	case ECallMobileCaps:
       
   217 		TRAP(ret,newNotify = CNotifyMobileCallCaps::NewL((TDes8*)aParams,aTsyReqHandle,aTelObject));
       
   218 		break;
       
   219 	case ERegistrationStatus:
       
   220 		TRAP(ret,newNotify = CNotifyNetworkRegistrationStatusChange::NewL(aTsyReqHandle,aTelObject,(RMobilePhone::TMobilePhoneRegistrationStatus*)aParams));
       
   221 		break;
       
   222 	case ECurrentNetwork:
       
   223 		TRAP(ret,newNotify = CNotifyCurrentNetworkChange::NewL(aTsyReqHandle,aTelObject,(TInt*)aParams)); 
       
   224 		break;
       
   225 
       
   226 	// GPRS
       
   227 	case EPacketContextAdded:
       
   228 		TRAP(ret,newNotify = CGprsContextAddedNotify::NewL(aTsyReqHandle,aTelObject,(TDes*)aParams));
       
   229 		break; 
       
   230 	case EPacketStatusChange:
       
   231 		TRAP(ret,newNotify = CGprsStatusNotify::NewL(aTsyReqHandle,aTelObject,(RPacketService::TStatus*)aParams));
       
   232 		break;
       
   233 	case EPacketNtwkRegStatusChange:
       
   234 		TRAP(ret,newNotify = CGprsNtwkRegStatusChangeNotify::NewL(aTsyReqHandle,aTelObject,(RPacketService::TRegistrationStatus*)aParams));
       
   235 		break;
       
   236 
       
   237 	// GPRS context
       
   238 	case EPacketContextConfigChange:
       
   239 		TRAP(ret,newNotify = CGprsContextConfigNotify::NewL(aTsyReqHandle,aTelObject,(TDes8*)aParams));
       
   240 		break;
       
   241 	case EPacketContextStatusChange:
       
   242 		TRAP(ret,newNotify = CGprsContextStatusNotify::NewL(aTsyReqHandle,aTelObject,(RPacketContext::TContextStatus*)aParams));
       
   243 		break;
       
   244 
       
   245 	// GPRS QoS
       
   246 	case EPacketQoSProfileChange:
       
   247 		TRAP(ret,newNotify = CGprsQoSProfileNotify::NewL(aTsyReqHandle, aTelObject, (TDes8*)aParams));
       
   248 		break;
       
   249 
       
   250 	default:
       
   251 		Panic(EIllegalEvent);
       
   252 		break;
       
   253 		}
       
   254 	if (ret!=KErrNone)
       
   255 		{
       
   256 		aTelObject->ReqCompleted(aTsyReqHandle,ret);
       
   257 		delete newNotify;
       
   258 		}
       
   259 	else
       
   260 		{
       
   261 		TRAP(ret,RegisterNotificationL(newNotify));
       
   262 		if (ret!=KErrNone)
       
   263 			aTelObject->ReqCompleted(aTsyReqHandle,ret);
       
   264 		}
       
   265 	}
       
   266 
       
   267 void CNotifications::RegisterNotificationL(CNotifyBase* aNotify)
       
   268 	{
       
   269 	iNotifications->AppendL(aNotify);
       
   270 	TInt pos = FindLastEvent(aNotify->TelObject());
       
   271 	if (pos==KErrNotFound)
       
   272 		{
       
   273 		TLastEvent lastEvent;
       
   274 		lastEvent.iTelObject=aNotify->TelObject();
       
   275 		lastEvent.iLastEvent=ENoEvent;
       
   276 		iLastEvents->AppendL(lastEvent,1);
       
   277 		}
       
   278 	}
       
   279 
       
   280 void CNotifications::CheckNotification(CTelObject* aTelObject,TEvent aEvent)
       
   281 //
       
   282 //	Due to the possibility of immediate re-posting of notification from server which may
       
   283 //	initiate another CheckNotification synchronously causing the problem that the last event
       
   284 //  has not yet been set to current event - an infinite loop occurs. Fixed here by setting
       
   285 //  a boolean on entry and resetting on exit
       
   286 //
       
   287 	{
       
   288 	if (iAlreadyChecking)
       
   289 		return;
       
   290 	iAlreadyChecking = ETrue;
       
   291 	TLastEvent lastEvent;
       
   292 	TInt ret = GetLastEvent(aTelObject,lastEvent);
       
   293 	if (ret==KErrNotFound)
       
   294 		lastEvent.iLastEvent=ENoEvent;	// to be passed to each notify object
       
   295 	TBool flag=EFalse;
       
   296 	for (TInt i=iNotifications->Count(); i>0; i--)
       
   297 		{
       
   298 		CNotifyBase* notify = iNotifications->At(i-1);
       
   299 		if(notify->CheckAndCompleteNotification(aTelObject,aEvent,lastEvent.iLastEvent))
       
   300 			{
       
   301 			iNotifications->Delete(i-1);
       
   302 			delete notify;
       
   303 			flag=ETrue;
       
   304 			}
       
   305 		}
       
   306 	if (flag)
       
   307 		iNotifications->Compress();
       
   308 	ret = AddLastEvent(aTelObject,aEvent);
       
   309 	__ASSERT_ALWAYS( ret == KErrNotFound  || ret >= 0,Panic(EGeneral));
       
   310 	iAlreadyChecking = EFalse;
       
   311 	}
       
   312 
       
   313 void CNotifications::CheckNotification(CCallBase* aCallObject,TEvent aEvent)
       
   314 	{
       
   315 	if (iAlreadyChecking)
       
   316 		return;
       
   317 	iAlreadyChecking = ETrue;
       
   318 	TLastEvent lastEvent;
       
   319 	TInt ret = GetLastEvent(aCallObject,lastEvent);
       
   320 	if (ret==KErrNotFound)
       
   321 		lastEvent.iLastEvent=ENoEvent;
       
   322 	TBool flag=EFalse;
       
   323 	for (TInt i=iNotifications->Count(); i>0; i--)
       
   324 		{
       
   325 		CNotifyBase* notify = iNotifications->At(i-1);
       
   326 		if (notify->CheckAndCompleteNotification(aCallObject,aEvent,lastEvent.iLastEvent))
       
   327 			{
       
   328 			iNotifications->Delete(i-1);
       
   329 			delete notify;
       
   330 			flag=ETrue;
       
   331 			}
       
   332 		}
       
   333 	if (flag)
       
   334 		iNotifications->Compress();
       
   335 	ret = AddLastEvent(aCallObject,aEvent);
       
   336 	__ASSERT_ALWAYS( ret == KErrNotFound  || ret >= 0,Panic(EGeneral));
       
   337 	iAlreadyChecking = EFalse;
       
   338 	}
       
   339 
       
   340 void CNotifications::CheckNotification(CFaxSession* aETelFaxObject,TEvent aEvent,TInt aError,TAny* aParams)
       
   341 	{
       
   342 	iAlreadyChecking = ETrue;
       
   343 	TBool flag=EFalse;
       
   344 	for (TInt i=iNotifications->Count(); i>0; i--)
       
   345 		{
       
   346 		CNotifyBase* notify = iNotifications->At(i-1);
       
   347 		if (notify->CheckAndCompleteNotification(aETelFaxObject,aEvent,aError,aParams))
       
   348 			{
       
   349 			iNotifications->Delete(i-1);
       
   350 			delete notify;
       
   351 			flag=ETrue;
       
   352 			}
       
   353 		}
       
   354 	if (flag)
       
   355 		iNotifications->Compress();
       
   356 	iAlreadyChecking = EFalse;
       
   357 	}
       
   358 
       
   359 //
       
   360 //
       
   361 // This function is added to deal specifically with notifications only (ie: no events)
       
   362 // An incoming SMS message notification for example!
       
   363 //
       
   364 //
       
   365 void CNotifications::CheckNotification(CTelObject* aTelObject, TNotifications aNotification)
       
   366 	{
       
   367 	if (iAlreadyChecking)
       
   368 		return;
       
   369 	iAlreadyChecking = ETrue;
       
   370 	TBool flag = EFalse;
       
   371 	for (TInt i = 0; i<iNotifications->Count(); i++)
       
   372 		{
       
   373 		CNotifyBase* notify = iNotifications->At(i);
       
   374 		if (notify->CheckAndCompleteNotification(aTelObject, aNotification))
       
   375 			{
       
   376 			iNotifications->Delete(i);
       
   377 			delete notify;
       
   378 			flag = ETrue;
       
   379 			} 
       
   380 		} 
       
   381 	if (flag)
       
   382 		iNotifications->Compress();
       
   383 	iAlreadyChecking = EFalse;
       
   384 }
       
   385 
       
   386 void CNotifications::RemoveNotification(TTsyReqHandle aTsyReqHandle)
       
   387 //
       
   388 //	Cancel a notification by its TsyReqHandle (unique to that notification)
       
   389 //
       
   390 	{
       
   391 	for (TInt i=0;i<iNotifications->Count();i++)
       
   392 		{
       
   393 		CNotifyBase* notify = iNotifications->At(i);
       
   394 		if (notify->TsyReqHandle() == aTsyReqHandle)
       
   395 			{
       
   396 			notify->TelObject()->ReqCompleted(notify->TsyReqHandle(),KErrCancel);
       
   397 			iNotifications->Delete(i);
       
   398 			delete notify;
       
   399 			break;
       
   400 			}
       
   401 		}
       
   402 	}
       
   403 
       
   404 void CNotifications::CompleteNotificationsWithError(TInt aError)
       
   405 	{
       
   406 	for (TInt i=0;i<iNotifications->Count();i++)
       
   407 		{
       
   408 		CNotifyBase* notify = iNotifications->At(0);
       
   409 		notify->TelObject()->ReqCompleted(notify->TsyReqHandle(),aError);
       
   410 		iNotifications->Delete(0);
       
   411 		delete notify;
       
   412 		}
       
   413 	}
       
   414 	
       
   415 //
       
   416 //	CNotifyBase class - base class for all notifications
       
   417 //
       
   418 
       
   419 CNotifyBase::CNotifyBase(TTsyReqHandle aReqHandle,CTelObject* aTelObject)
       
   420 	: iReqHandle(aReqHandle),iTelObject(aTelObject)
       
   421 	{}
       
   422 
       
   423 CNotifyBase::~CNotifyBase()
       
   424 	{}
       
   425 
       
   426 TTsyReqHandle CNotifyBase::TsyReqHandle()
       
   427 	{
       
   428 	return iReqHandle;
       
   429 	}
       
   430 
       
   431 CTelObject* CNotifyBase::TelObject()
       
   432 	{
       
   433 	return iTelObject;
       
   434 	}
       
   435 
       
   436 TBool CNotifyBase::CheckAndCompleteNotification(CTelObject* /*aTelObject*/,TEvent /*aEvent*/,TEvent /*aLastEvent*/)
       
   437 	{
       
   438 	return EFalse;
       
   439 	}
       
   440 	
       
   441 TBool CNotifyBase::CheckAndCompleteNotification(CCallBase* /*aCallObject*/,TEvent /*aEvent*/,TEvent /*aLastEvent*/)
       
   442 	{
       
   443 	return EFalse;
       
   444 	}
       
   445 
       
   446 TBool CNotifyBase::CheckAndCompleteNotification(CFaxSession* /*aETelFaxObject*/,TEvent /*aEvent*/,TInt /*aError*/,TAny* /*aParams*/)
       
   447 	{
       
   448 	return EFalse;
       
   449 	}
       
   450 
       
   451 TBool CNotifyBase::CheckAndCompleteNotification(CTelObject* /*aTelObject*/, TNotifications /*aNotification*/)
       
   452 	{
       
   453 	return EFalse;
       
   454 	}
       
   455 
       
   456 //
       
   457 // CNotifyPhoneDetection
       
   458 //
       
   459 CNotifyModemDetected* CNotifyModemDetected::NewL(RPhone::TModemDetection* aDetection,TTsyReqHandle aReqHandle,CTelObject* aTelObject)
       
   460 	{
       
   461 	return new(ELeave) CNotifyModemDetected(aDetection,aReqHandle,aTelObject);
       
   462 	}
       
   463 
       
   464 CNotifyModemDetected::CNotifyModemDetected(RPhone::TModemDetection* aDetection,TTsyReqHandle aReqHandle,CTelObject* aTelObject)
       
   465 	 : CNotifyBase(aReqHandle,aTelObject),iDetection(aDetection)
       
   466 	{}
       
   467 
       
   468 CNotifyModemDetected::~CNotifyModemDetected()
       
   469 	{}
       
   470 
       
   471 TBool CNotifyModemDetected::CheckAndCompleteNotification(CTelObject* /*aTelObject*/,TEvent aEvent,TEvent aLastEvent)
       
   472 //
       
   473 //	After phone has been in the "Not detected" state, the next state should be "Detected"
       
   474 //  or a "Ring Occurred"
       
   475 //  
       
   476 	{
       
   477 	if ((aEvent==ERingOccurred || aEvent==EPhoneDetected)
       
   478 		&&(aLastEvent==EPhoneNotDetected || aLastEvent==ENoEvent))
       
   479 		{
       
   480 		*iDetection=RPhone::EDetectedPresent;
       
   481 		}
       
   482 	else if (aEvent==EPhoneNotDetected && aLastEvent!=EPhoneNotDetected)
       
   483 		{
       
   484 		*iDetection=RPhone::EDetectedNotPresent;
       
   485 		}
       
   486 	else return EFalse;
       
   487 	LOGTEXT2(_L8("Event %d:\tModem Detection Change Notification completed"),aEvent);
       
   488 	iTelObject->ReqCompleted(iReqHandle,KErrNone);
       
   489 	return ETrue;
       
   490 	}
       
   491 
       
   492 TBool CNotifyModemDetected::CheckAndCompleteNotification(CCallBase* aCallObject,TEvent aEvent,TEvent aLastEvent)
       
   493 	{
       
   494 	return CheckAndCompleteNotification(STATIC_CAST(CTelObject*,aCallObject),aEvent,aLastEvent);
       
   495 	}
       
   496 //
       
   497 // CNotifyIncomingCall
       
   498 //
       
   499 CNotifyIncomingCall* CNotifyIncomingCall::NewL(TDes* aName,TTsyReqHandle aReqHandle,CTelObject* aTelObject)
       
   500 	{
       
   501 	return new(ELeave) CNotifyIncomingCall(aName,aReqHandle,aTelObject);
       
   502 	}
       
   503 
       
   504 CNotifyIncomingCall::CNotifyIncomingCall(TDes* aName,TTsyReqHandle aReqHandle,CTelObject* aTelObject)
       
   505 	 : CNotifyBase(aReqHandle,aTelObject),iName(aName)
       
   506 	{}
       
   507 
       
   508 CNotifyIncomingCall::~CNotifyIncomingCall()
       
   509 	{}
       
   510 
       
   511 TBool CNotifyIncomingCall::CheckAndCompleteNotification(CTelObject* aTelObject,TEvent aEvent,TEvent aLastEvent)
       
   512 //
       
   513 //	Checks that the last event to happen was not an incoming call. 
       
   514 //  Adv: If the first Notification for an incoming call is placed after the line started ringing,
       
   515 //		 it can check the line status and complete immediately.
       
   516 	{
       
   517 	if (aEvent==ERingOccurred && aLastEvent!=ERingOccurred
       
   518 		&& aTelObject==iTelObject)
       
   519 		{
       
   520 		CLineHayes* line = STATIC_CAST(CLineHayes*,iTelObject);
       
   521 		line->GetNameOfCallForAnswering(*iName);
       
   522 		line->ResetNotifyIncomingCall();	
       
   523 		LOGTEXT2(_L8("Event %d:\tIncoming Call Notification completed"),aEvent);
       
   524 		iTelObject->ReqCompleted(iReqHandle,KErrNone);
       
   525 		return ETrue;
       
   526 		}
       
   527 	return EFalse;
       
   528 	}
       
   529 
       
   530 TBool CNotifyIncomingCall::CheckAndCompleteNotification(CCallBase* aCallBase,TEvent aEvent,TEvent aLastEvent)
       
   531 	{
       
   532 	return CheckAndCompleteNotification(REINTERPRET_CAST(CLineBase*,aCallBase->Owner()),aEvent,aLastEvent);
       
   533 	}
       
   534 
       
   535 //
       
   536 // CNotifyLineHookChange
       
   537 //
       
   538 CNotifyLineHookChange* CNotifyLineHookChange::NewL(RCall::THookStatus* aHookStatus,TTsyReqHandle aReqHandle,CTelObject* aTelObject)
       
   539 	{
       
   540 	return new(ELeave) CNotifyLineHookChange(aHookStatus,aReqHandle,aTelObject);
       
   541 	}
       
   542 
       
   543 CNotifyLineHookChange::CNotifyLineHookChange(RCall::THookStatus* aHookStatus,TTsyReqHandle aReqHandle,CTelObject* aTelObject)
       
   544 	 : CNotifyBase(aReqHandle,aTelObject),iHookStatus(aHookStatus)
       
   545 	{}
       
   546 
       
   547 CNotifyLineHookChange::~CNotifyLineHookChange()
       
   548 	{}
       
   549 
       
   550 TBool CNotifyLineHookChange::CheckAndCompleteNotification(CCallBase* aCallObject,TEvent aEvent,TEvent aLastEvent)
       
   551 //
       
   552 //	Line hook can only change if a call-owned object (eg ATDial) is in progress
       
   553 //
       
   554 	{
       
   555 	if (iTelObject != REINTERPRET_CAST(CLineHayes*,aCallObject->Owner()))
       
   556 		return EFalse;
       
   557 	if (aEvent==EBegunConnecting && aLastEvent!=EBegunConnecting)
       
   558 		*iHookStatus = RCall::EHookStatusOff;
       
   559 	else if (aEvent==EBecomeIdle && aLastEvent!=EBecomeIdle)
       
   560 		*iHookStatus = RCall::EHookStatusOn;
       
   561 	else 
       
   562 		return EFalse;
       
   563 	LOGTEXT2(_L8("Event %d:\tLine Hook Change Notification completed"),aEvent);
       
   564 	iTelObject->ReqCompleted(iReqHandle,KErrNone);
       
   565 	return ETrue;
       
   566 	}
       
   567 //
       
   568 // CNotifyCallHookChange
       
   569 //
       
   570 CNotifyCallHookChange* CNotifyCallHookChange::NewL(RCall::THookStatus* aHookStatus,TTsyReqHandle aReqHandle,CTelObject* aTelObject)
       
   571 	{
       
   572 	return new(ELeave) CNotifyCallHookChange(aHookStatus,aReqHandle,aTelObject);
       
   573 	}
       
   574 	
       
   575 CNotifyCallHookChange::CNotifyCallHookChange(RCall::THookStatus* aHookStatus,TTsyReqHandle aReqHandle,CTelObject* aTelObject)
       
   576 	 : CNotifyBase(aReqHandle,aTelObject),iHookStatus(aHookStatus)
       
   577 	{}
       
   578 
       
   579 CNotifyCallHookChange::~CNotifyCallHookChange()
       
   580 	{}
       
   581 
       
   582 TBool CNotifyCallHookChange::CheckAndCompleteNotification(CTelObject* /*aTelObject*/,TEvent aEvent,TEvent aLastEvent)
       
   583 	{
       
   584 	if (aEvent==EBegunConnecting && aLastEvent!=EBegunConnecting)
       
   585 		*iHookStatus = RCall::EHookStatusOff;
       
   586 	else if (aEvent==EBecomeIdle && aLastEvent!=EBecomeIdle)
       
   587 		*iHookStatus = RCall::EHookStatusOn;
       
   588 	else 
       
   589 		return EFalse;
       
   590 	LOGTEXT2(_L8("Event %d:\tCall Hook Change Notification completed"),aEvent);
       
   591 	iTelObject->ReqCompleted(iReqHandle,KErrNone);
       
   592 	return ETrue;
       
   593 	}
       
   594 
       
   595 TBool CNotifyCallHookChange::CheckAndCompleteNotification(CCallBase* aCallObject,TEvent aEvent,TEvent aLastEvent)
       
   596 	{
       
   597 	if (iTelObject != aCallObject)
       
   598 		return EFalse;
       
   599 	return CheckAndCompleteNotification(STATIC_CAST(CTelObject*,aCallObject),aEvent,aLastEvent);
       
   600 	}
       
   601 //
       
   602 // CNotifyLineStatusChange
       
   603 //
       
   604 CNotifyLineStatusChange* CNotifyLineStatusChange::NewL(RCall::TStatus* aStatus,TTsyReqHandle aReqHandle,CTelObject* aTelObject)
       
   605 	{
       
   606 	return new(ELeave) CNotifyLineStatusChange(aStatus,aReqHandle,aTelObject);
       
   607 	}
       
   608 
       
   609 CNotifyLineStatusChange::CNotifyLineStatusChange(RCall::TStatus* aStatus,TTsyReqHandle aReqHandle,CTelObject* aTelObject)
       
   610 	 : CNotifyBase(aReqHandle,aTelObject),iStatus(aStatus)
       
   611 	{}
       
   612 	
       
   613 CNotifyLineStatusChange::~CNotifyLineStatusChange()
       
   614 	{}
       
   615 
       
   616 TBool CNotifyLineStatusChange::CheckAndCompleteNotification(CTelObject* /*aTelObject*/,TEvent aEvent,TEvent aLastEvent)
       
   617 	{
       
   618 	if ((aEvent==ERingOccurred && aLastEvent!=ERingOccurred) ||
       
   619 		(aEvent==EBegunConnecting && aLastEvent!=EBegunConnecting) ||
       
   620 		(aEvent==EConnected && aLastEvent!=EConnected) ||
       
   621 		(aEvent==EBegunHangingUp && aLastEvent!=EBegunHangingUp) ||
       
   622 		(aEvent==EBecomeIdle && aLastEvent!=EBecomeIdle))
       
   623 		{
       
   624 		REINTERPRET_CAST(CLineHayes*,iTelObject)->GetLineStatus(*iStatus);
       
   625 		LOGTEXT2(_L8("Event %d:\tLine Status change Notification completed"),aEvent);
       
   626 		iTelObject->ReqCompleted(iReqHandle,KErrNone);
       
   627 		return ETrue;
       
   628 		}
       
   629 	return EFalse;
       
   630 	}
       
   631 
       
   632 TBool CNotifyLineStatusChange::CheckAndCompleteNotification(CCallBase* aCallObject,TEvent aEvent,TEvent aLastEvent)
       
   633 	{
       
   634 	if (iTelObject == REINTERPRET_CAST(CLineHayes*,aCallObject->Owner()))
       
   635 		return CheckAndCompleteNotification(STATIC_CAST(CTelObject*,aCallObject),aEvent,aLastEvent);
       
   636 	else 
       
   637 		return EFalse;
       
   638 	}
       
   639 
       
   640 
       
   641 //
       
   642 // CNotifyMobileLineStatusChange
       
   643 //
       
   644 CNotifyMobileLineStatusChange* CNotifyMobileLineStatusChange::NewL(RMobileCall::TMobileCallStatus* aStatus,TTsyReqHandle aReqHandle,CTelObject* aTelObject)
       
   645 	{
       
   646 	return new(ELeave) CNotifyMobileLineStatusChange(aStatus,aReqHandle,aTelObject);
       
   647 	}
       
   648 
       
   649 CNotifyMobileLineStatusChange::CNotifyMobileLineStatusChange(RMobileCall::TMobileCallStatus* aStatus,TTsyReqHandle aReqHandle,CTelObject* aTelObject)
       
   650 	 : CNotifyBase(aReqHandle,aTelObject),iStatus(aStatus)
       
   651 	{}
       
   652 	
       
   653 CNotifyMobileLineStatusChange::~CNotifyMobileLineStatusChange()
       
   654 	{}
       
   655 
       
   656 TBool CNotifyMobileLineStatusChange::CheckAndCompleteNotification(CTelObject* /*aTelObject*/,TEvent aEvent,TEvent aLastEvent)
       
   657 	{
       
   658 	if ((aEvent==ERingOccurred && aLastEvent!=ERingOccurred) ||
       
   659 		(aEvent==EBegunConnecting && aLastEvent!=EBegunConnecting) ||
       
   660 		(aEvent==EConnected && aLastEvent!=EConnected) ||
       
   661 		(aEvent==EBegunHangingUp && aLastEvent!=EBegunHangingUp) ||
       
   662 		(aEvent==EBecomeIdle && aLastEvent!=EBecomeIdle))
       
   663 		{
       
   664 		RCall::TStatus coreStatus;
       
   665 		REINTERPRET_CAST(CLineHayes*,iTelObject)->GetLineStatus(coreStatus);
       
   666 		//*iStatus = static_cast<RMobileCall::TMobileCallStatus>(coreStatus);
       
   667 		*iStatus = (RMobileCall::TMobileCallStatus)coreStatus;
       
   668 		LOGTEXT2(_L8("Event %d:\tMobile Line Status Change Notification completed"),aEvent);
       
   669 		iTelObject->ReqCompleted(iReqHandle,KErrNone);
       
   670 		return ETrue;
       
   671 		}
       
   672 	return EFalse;
       
   673 	}
       
   674 
       
   675 TBool CNotifyMobileLineStatusChange::CheckAndCompleteNotification(CCallBase* aCallObject,TEvent aEvent,TEvent aLastEvent)
       
   676 	{
       
   677 	if (iTelObject == REINTERPRET_CAST(CLineHayes*,aCallObject->Owner()))
       
   678 		return CheckAndCompleteNotification(STATIC_CAST(CTelObject*,aCallObject),aEvent,aLastEvent);
       
   679 	else 
       
   680 		return EFalse;
       
   681 	}
       
   682 
       
   683 //
       
   684 // CNotifyLineNewCallAdded
       
   685 //
       
   686 CNotifyLineNewCallAdded* CNotifyLineNewCallAdded::NewL(TDes* aName,TTsyReqHandle aReqHandle,CTelObject* aTelObject)
       
   687 	{
       
   688 	return new(ELeave) CNotifyLineNewCallAdded(aName,aReqHandle,aTelObject);
       
   689 	}
       
   690 
       
   691 CNotifyLineNewCallAdded::CNotifyLineNewCallAdded(TDes* aName,TTsyReqHandle aReqHandle,CTelObject* aTelObject)
       
   692 	 : CNotifyBase(aReqHandle,aTelObject),iName(aName)
       
   693 	{}
       
   694 	
       
   695 CNotifyLineNewCallAdded::~CNotifyLineNewCallAdded()
       
   696 	{}
       
   697 
       
   698 TBool CNotifyLineNewCallAdded::CheckAndCompleteNotification(CTelObject* aTelObject,TEvent aEvent,TEvent /*aLastEvent*/)
       
   699 //
       
   700 //	No need to check here whether the last event for this TelObject was Call Added, because this
       
   701 //	notification should complete every time a new call is added, irrespective of what has
       
   702 //	happened inbetween times.
       
   703 //
       
   704 	{
       
   705 	if (aEvent==ECallAdded && iTelObject==aTelObject)
       
   706 		{
       
   707 		REINTERPRET_CAST(CLineHayes*,iTelObject)->GetLastCallName(*iName);
       
   708 		LOGTEXT2(_L8("Event %d:\tNew Call Added Notification completed"),aEvent);
       
   709 		iTelObject->ReqCompleted(iReqHandle,KErrNone);
       
   710 		return ETrue;
       
   711 		}
       
   712 	return EFalse;
       
   713 	}
       
   714 
       
   715 //
       
   716 // CNotifyCallStatusChange
       
   717 //
       
   718 CNotifyCallStatusChange* CNotifyCallStatusChange::NewL(RCall::TStatus* aStatus,TTsyReqHandle aReqHandle,CTelObject* aTelObject)
       
   719 	{
       
   720 	return new(ELeave) CNotifyCallStatusChange(aStatus,aReqHandle,aTelObject);
       
   721 	}
       
   722 
       
   723 CNotifyCallStatusChange::CNotifyCallStatusChange(RCall::TStatus* aStatus,TTsyReqHandle aReqHandle,CTelObject* aTelObject)
       
   724 	 : CNotifyBase(aReqHandle,aTelObject),iStatus(aStatus)
       
   725 	{}
       
   726 
       
   727 CNotifyCallStatusChange::~CNotifyCallStatusChange()
       
   728 	{}
       
   729 
       
   730 /*
       
   731 TBool CNotifyCallStatusChange::CheckAndCompleteNotification(CTelObject* aTelObject,TEvent aEvent,TEvent aLastEvent)
       
   732 //
       
   733 //	All calls are set ringing if a RING occurs
       
   734 //
       
   735 	{
       
   736 	if (aEvent==ERingOccurred && aLastEvent!=ERingOccurred) 
       
   737 		{	
       
   738 		*iStatus = RCall::EStatusRinging;
       
   739 		LOGTEXT2(_L8("Event %d:\tCall Status Change Notification completed from non-call-derived object"),aEvent);
       
   740 		iTelObject->ReqCompleted(iReqHandle,KErrNone);
       
   741 		return ETrue;
       
   742 		}
       
   743 	return EFalse;
       
   744 	}
       
   745 */
       
   746 
       
   747 TBool CNotifyCallStatusChange::CheckAndCompleteNotification(CCallBase* aCallObject,TEvent aEvent,TEvent aLastEvent)
       
   748 	{
       
   749 	if ((aEvent==ERingOccurred && aLastEvent!=ERingOccurred) ||
       
   750 		(aEvent==EBegunConnecting && aLastEvent!=EBegunConnecting) ||
       
   751 		(aEvent==EConnected && aLastEvent!=EConnected) ||
       
   752 		(aEvent==EBegunHangingUp && aLastEvent!=EBegunHangingUp) ||
       
   753 		(aEvent==EBecomeIdle && aLastEvent!=EBecomeIdle))
       
   754 		{
       
   755 		if (iTelObject == aCallObject)
       
   756 					// correct call
       
   757 			{
       
   758 			LOGTEXT2(_L8("Event %d:\tCall Status Change Notification completed"),aEvent);
       
   759 			RMobileCall::TMobileCallStatus callStatus = REINTERPRET_CAST(CCallHayes*,aCallObject)->CallInfo()->iMobileStatus;
       
   760 			*iStatus = (RCall::TStatus)callStatus;  // should really call a proper conversion function here
       
   761 			iTelObject->ReqCompleted(iReqHandle,KErrNone);
       
   762 			return ETrue;
       
   763 			}
       
   764 		}
       
   765 	return EFalse;
       
   766 	}
       
   767 
       
   768 
       
   769 //
       
   770 // CNotifyMobileCallStatusChange
       
   771 //
       
   772 CNotifyMobileCallStatusChange* CNotifyMobileCallStatusChange::NewL(RMobileCall::TMobileCallStatus* aStatus,TTsyReqHandle aReqHandle,CTelObject* aTelObject)
       
   773 	{
       
   774 	return new(ELeave) CNotifyMobileCallStatusChange(aStatus,aReqHandle,aTelObject);
       
   775 	}
       
   776 
       
   777 CNotifyMobileCallStatusChange::CNotifyMobileCallStatusChange(RMobileCall::TMobileCallStatus* aStatus,TTsyReqHandle aReqHandle,CTelObject* aTelObject)
       
   778 	 : CNotifyBase(aReqHandle,aTelObject),iStatus(aStatus)
       
   779 	{}
       
   780 
       
   781 CNotifyMobileCallStatusChange::~CNotifyMobileCallStatusChange()
       
   782 	{}
       
   783 
       
   784 TBool CNotifyMobileCallStatusChange::CheckAndCompleteNotification(CCallBase* aCallObject,TEvent aEvent,TEvent aLastEvent)
       
   785 	{
       
   786 	if ((aEvent==ERingOccurred && aLastEvent!=ERingOccurred) ||
       
   787 		(aEvent==EBegunConnecting && aLastEvent!=EBegunConnecting) ||
       
   788 		(aEvent==EConnected && aLastEvent!=EConnected) ||
       
   789 		(aEvent==EBegunHangingUp && aLastEvent!=EBegunHangingUp) ||
       
   790 		(aEvent==EBecomeIdle && aLastEvent!=EBecomeIdle))
       
   791 		{
       
   792 		if (iTelObject == aCallObject)
       
   793 					// correct call
       
   794 			{
       
   795 			LOGTEXT2(_L8("Event %d:\tNotify Mobile Call Status Change completed"),aEvent);
       
   796 			*iStatus = REINTERPRET_CAST(CCallHayes*,aCallObject)->CallInfo()->iMobileStatus;
       
   797 			iTelObject->ReqCompleted(iReqHandle,KErrNone);
       
   798 			return ETrue;
       
   799 			}
       
   800 		}
       
   801 	return EFalse;
       
   802 	}
       
   803 
       
   804 //
       
   805 // CNotifyCallDurationChange
       
   806 //
       
   807 CNotifyCallDurationChange* CNotifyCallDurationChange::NewL(TTimeIntervalSeconds* aTime,TTsyReqHandle aReqHandle,CTelObject* aTelObject)
       
   808 	{
       
   809 	return new(ELeave) CNotifyCallDurationChange(aTime,aReqHandle,aTelObject);
       
   810 	}
       
   811 	
       
   812 CNotifyCallDurationChange::CNotifyCallDurationChange(TTimeIntervalSeconds* aTime,TTsyReqHandle aReqHandle,CTelObject* aTelObject)
       
   813 	 : CNotifyBase(aReqHandle,aTelObject),iTime(aTime)
       
   814 	{}
       
   815 
       
   816 CNotifyCallDurationChange::~CNotifyCallDurationChange()
       
   817 	{}
       
   818 
       
   819 TBool CNotifyCallDurationChange::CheckAndCompleteNotification(CCallBase* aCallObject,TEvent aEvent,TEvent /*aLastEvent*/)
       
   820 	{
       
   821 	if (iTelObject != aCallObject)
       
   822 		return EFalse;
       
   823 	if (aEvent==ETimePeriodElapsed)
       
   824 		{
       
   825 		REINTERPRET_CAST(CCallHayes*,aCallObject)->GetCallDuration(*iTime);
       
   826 		iTelObject->ReqCompleted(iReqHandle,KErrNone);
       
   827 		return ETrue;
       
   828 		}
       
   829 	return EFalse;
       
   830 	}
       
   831 
       
   832 //
       
   833 // CNotifyCallCaps 
       
   834 //
       
   835 CNotifyCallCaps* CNotifyCallCaps::NewL(RCall::TCaps* aCaps,TTsyReqHandle aReqHandle,CTelObject* aTelObject)
       
   836 	{
       
   837 	return new(ELeave) CNotifyCallCaps(aCaps,aReqHandle,aTelObject);
       
   838 	}
       
   839 	
       
   840 CNotifyCallCaps::CNotifyCallCaps(RCall::TCaps* aCaps,TTsyReqHandle aReqHandle,CTelObject* aTelObject)
       
   841 	 : CNotifyBase(aReqHandle,aTelObject),iCaps(aCaps)
       
   842 	{}
       
   843 
       
   844 CNotifyCallCaps::~CNotifyCallCaps()
       
   845 	{}
       
   846 
       
   847 TBool CNotifyCallCaps::CheckAndCompleteNotification(CTelObject* /*aTelObject*/,TEvent aEvent,TEvent aLastEvent)
       
   848 //
       
   849 // Dynamic call caps change when :
       
   850 //	(a) Call starts to connect - cannot dial/answer/hangup
       
   851 //	(b) Call has connected - cannot dial/answer. Can hangup/loan data port
       
   852 //	(c) Data port is loaned - cannot dial/answer/hang up/loan dataport. Can Recover data port.
       
   853 //	(d) Call begins to hang up - cannot do anything.
       
   854 //	(e) Call is in idle state - depends if any other call is being used to connect.
       
   855 //
       
   856 	{
       
   857 	if (aEvent==aLastEvent && aEvent!=ECallAdded)
       
   858 		return EFalse;
       
   859 	if (aEvent==EPhoneDetected || aEvent==EPhoneNotDetected ||
       
   860 		aEvent==EBegunConnecting || aEvent==EConnected ||
       
   861 		aEvent==EBegunHangingUp || aEvent==EBecomeIdle ||
       
   862 		aEvent==EDataPortLoaned || aEvent==EDataPortRecovered)
       
   863 		{
       
   864 		TBool changed = REINTERPRET_CAST(CCallHayes*,iTelObject)->CollateCurrentCoreCaps(iReqHandle, reinterpret_cast<TUint32*>(&iCaps->iFlags));
       
   865 		if (changed)
       
   866 			{
       
   867 			iTelObject->ReqCompleted(iReqHandle,KErrNone);
       
   868 			return ETrue;
       
   869 			}
       
   870 		}
       
   871 	return EFalse;
       
   872 	}
       
   873 
       
   874 TBool CNotifyCallCaps::CheckAndCompleteNotification(CCallBase* aCallObject,TEvent aEvent,TEvent aLastEvent)
       
   875 	{
       
   876 //	if (iTelObject == aCallObject)
       
   877 		return CheckAndCompleteNotification(STATIC_CAST(CTelObject*,aCallObject),aEvent,aLastEvent);
       
   878 //	else 
       
   879 //		return EFalse;
       
   880 	}
       
   881 
       
   882 //
       
   883 // CNotifyMobileCallCaps 
       
   884 //
       
   885 CNotifyMobileCallCaps* CNotifyMobileCallCaps::NewL(TDes8* aCaps,TTsyReqHandle aReqHandle,CTelObject* aTelObject)
       
   886 	{
       
   887 	return new(ELeave) CNotifyMobileCallCaps(aCaps,aReqHandle,aTelObject);
       
   888 	}
       
   889 	
       
   890 CNotifyMobileCallCaps::CNotifyMobileCallCaps(TDes8* aCaps,TTsyReqHandle aReqHandle,CTelObject* aTelObject)
       
   891 	 : CNotifyBase(aReqHandle,aTelObject)
       
   892 	{
       
   893 	iCapsPckg = REINTERPRET_CAST(RMobileCall::TMobileCallCapsV1Pckg *,aCaps);
       
   894 	}
       
   895 
       
   896 CNotifyMobileCallCaps::~CNotifyMobileCallCaps()
       
   897 	{}
       
   898 
       
   899 TBool CNotifyMobileCallCaps::CheckAndCompleteNotification(CTelObject* /*aTelObject*/,TEvent aEvent,TEvent aLastEvent)
       
   900 //
       
   901 // Dynamic call caps change when :
       
   902 //	(a) Call starts to connect - cannot dial/answer/hangup
       
   903 //	(b) Call has connected - cannot dial/answer. Can hangup/loan data port
       
   904 //	(c) Data port is loaned - cannot dial/answer/hang up/loan dataport. Can Recover data port.
       
   905 //	(d) Call begins to hang up - cannot do anything.
       
   906 //	(e) Call is in idle state - depends if any other call is being used to connect.
       
   907 //
       
   908 	{
       
   909 	if (aEvent==aLastEvent && aEvent!=ECallAdded)
       
   910 		return EFalse;
       
   911 	if (aEvent==EPhoneDetected || aEvent==EPhoneNotDetected ||
       
   912 		aEvent==EBegunConnecting || aEvent==EConnected ||
       
   913 		aEvent==EBegunHangingUp || aEvent==EBecomeIdle ||
       
   914 		aEvent==EDataPortLoaned || aEvent==EDataPortRecovered)
       
   915 		{
       
   916 		RMobileCall::TMobileCallCapsV1& caps = (*iCapsPckg)();
       
   917 		TBool changed = REINTERPRET_CAST(CCallHayes*,iTelObject)->CollateCurrentMobileCaps(iReqHandle, &(caps.iCallControlCaps));
       
   918 		if (changed)
       
   919 			{
       
   920 			iTelObject->ReqCompleted(iReqHandle,KErrNone);
       
   921 			return ETrue;
       
   922 			}
       
   923 		}
       
   924 	return EFalse;
       
   925 	}
       
   926 
       
   927 TBool CNotifyMobileCallCaps::CheckAndCompleteNotification(CCallBase* aCallObject,TEvent aEvent,TEvent aLastEvent)
       
   928 	{
       
   929 	return CheckAndCompleteNotification(STATIC_CAST(CTelObject*,aCallObject),aEvent,aLastEvent);
       
   930 	}
       
   931 
       
   932 //
       
   933 // CNotifyFaxReadOrWrite 
       
   934 //
       
   935 CNotifyFaxReadOrWrite* CNotifyFaxReadOrWrite::NewL(TTsyReqHandle aReqHandle,CTelObject* aTelObject)
       
   936 	{
       
   937 	return new(ELeave) CNotifyFaxReadOrWrite(aReqHandle,aTelObject);
       
   938 	}
       
   939 
       
   940 CNotifyFaxReadOrWrite::CNotifyFaxReadOrWrite(TTsyReqHandle aReqHandle,CTelObject* aTelObject)
       
   941 	 : CNotifyBase(aReqHandle,aTelObject)
       
   942 	{}
       
   943 
       
   944 CNotifyFaxReadOrWrite::~CNotifyFaxReadOrWrite()
       
   945 	{}
       
   946 
       
   947 TBool CNotifyFaxReadOrWrite::CheckAndCompleteNotification(CFaxSession* /*aETelFaxObject*/,TEvent aEvent,TInt aError,TAny* /*aParams*/)
       
   948 	{
       
   949 	if (aEvent==EFaxReadOrWriteCompleted || aEvent==EFaxSessionTerminated)
       
   950 		{
       
   951 		iTelObject->ReqCompleted(iReqHandle,aError);
       
   952 		return ETrue;
       
   953 		}
       
   954 	return EFalse;
       
   955 	}
       
   956 
       
   957 //
       
   958 // CNotifyEndOfFaxPage
       
   959 //
       
   960 CNotifyFaxEndOfPage* CNotifyFaxEndOfPage::NewL(TTsyReqHandle aReqHandle,CTelObject* aTelObject)
       
   961 	{
       
   962 	return new(ELeave) CNotifyFaxEndOfPage(aReqHandle,aTelObject);
       
   963 	}
       
   964 
       
   965 CNotifyFaxEndOfPage::CNotifyFaxEndOfPage(TTsyReqHandle aReqHandle,CTelObject* aTelObject)
       
   966 	 : CNotifyBase(aReqHandle,aTelObject)
       
   967 	{}
       
   968 
       
   969 CNotifyFaxEndOfPage::~CNotifyFaxEndOfPage()
       
   970 	{}
       
   971 
       
   972 TBool CNotifyFaxEndOfPage::CheckAndCompleteNotification(CFaxSession* /*aETelFaxObject*/,TEvent aEvent,TInt aError,TAny* /*aParams*/)
       
   973 	{
       
   974 	if (aEvent==EEndOfFaxPageCompleted || aEvent==EFaxSessionTerminated)
       
   975 		{
       
   976 		LOGTEXT2(_L8("Event %d:\tFax End Of Page Notification completed"),aEvent);
       
   977 		iTelObject->ReqCompleted(iReqHandle,aError);
       
   978 		return ETrue;
       
   979 		}
       
   980 	return EFalse;
       
   981 	}
       
   982 
       
   983