telephonyserverplugins/multimodetsy/hayes/LINE.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 "PHONE.H"
       
    17 #include "LINE.H"
       
    18 #include "CALL.H"
       
    19 #include "mSLOGGER.H"
       
    20 #include "ATINIT.H"
       
    21 #include "NOTIFY.H"
       
    22 #include "et_struct.h"
       
    23 
       
    24 //
       
    25 // Dummy function is necessary so that compiler knows how to expand a TPckg<RLine::TLineInfo>
       
    26 //
       
    27 
       
    28 void CLineHayes::Dummy1()
       
    29 	{
       
    30 	RLine::TLineInfo dummy0;
       
    31 	TPckg<RLine::TLineInfo> dummy1(dummy0);
       
    32 	dummy1.Zero();
       
    33 	}
       
    34 
       
    35 //
       
    36 // CLineHayes
       
    37 // General Line Functionality
       
    38 //
       
    39 void CLineHayes::CloseLine(TAny* aObj)
       
    40 //
       
    41 // Utility func for cleanup stack
       
    42 //
       
    43 	{
       
    44 	((CObject*)aObj)->Close();
       
    45 	}
       
    46 
       
    47 CLineHayes::CLineHayes(CATIO* aATIO,CATInit* aInit,CPhoneGlobals* aPhoneGlobals) : iIo(aATIO)
       
    48 													,iInit(aInit),iPhoneGlobals(aPhoneGlobals)
       
    49 	{}
       
    50 
       
    51 void CLineHayes::ConstructL(const TName& aName)
       
    52 	{
       
    53 	LOGTEXT(_L8("CLineHayes::ConstructL()"));
       
    54 	iLineName = aName;
       
    55 	iCalls.SetOffset(_FOFF(CCallEntry,iLink));
       
    56 	iSizeOfMemberData = new(ELeave) CArrayFixFlat<TInt>(4);
       
    57 	}
       
    58 
       
    59 void CLineHayes::AppendNewCallL(CCallHayes* aNewCall)
       
    60 	{
       
    61 	CCallEntry* entry = CCallEntry::NewL(aNewCall);
       
    62 	iCalls.AddLast(*entry);
       
    63 	}
       
    64 
       
    65 CLineHayes::~CLineHayes()
       
    66 	{
       
    67 	LOGTEXT(_L8("CLineHayes Destructor"));
       
    68 	if (Owner())
       
    69 		((CPhoneHayes*)Owner())->RemoveLine(this);
       
    70 	iPhoneGlobals->iNotificationStore->RemoveClientFromLastEvents(this);
       
    71 	if (iSizeOfMemberData!=NULL)
       
    72 		iSizeOfMemberData->Reset();
       
    73 	delete iSizeOfMemberData;
       
    74 
       
    75 	CCallEntry* callEntry;
       
    76 	TDblQueIter<CCallEntry> iter(iCalls);
       
    77 	if (!(iCalls.IsEmpty()))
       
    78 		{
       
    79 		while (callEntry=iter++, callEntry)
       
    80 			{
       
    81 			if (callEntry->iCallHayes->IsOwnedByTSY())
       
    82 				{
       
    83 				callEntry->Deque();
       
    84 				callEntry->iCallHayes->Close();
       
    85 				delete callEntry;
       
    86 				__ASSERT_ALWAYS(iCalls.IsEmpty(),Panic(ECalls_Remaining));
       
    87 				return;	// there should not be an iPreAlloc if one of the calls in the list was still
       
    88 						// owned by the TSY (ie no client had taken a handle on it)
       
    89 				}
       
    90 			}
       
    91 		}
       
    92 	if (iPreAlloc)
       
    93 		{
       
    94 		__ASSERT_ALWAYS(iPreAlloc,Panic(EPreAllocatedCallDoesNotExist));
       
    95 		iPreAlloc->iCallHayes->Close();
       
    96 		delete iPreAlloc;
       
    97 		}
       
    98 	}
       
    99 
       
   100 CTelObject::TReqMode CLineHayes::ReqModeL(const TInt aIpc)
       
   101 	{
       
   102 	TReqMode reqMode = CLineBase::ReqModeL(aIpc);
       
   103 	if ((reqMode & KReqModeFlowControlObeyed) && iPhoneGlobals->iPhoneStatus.iDataPortLoaned)
       
   104 		{
       
   105 		LOGTEXT2(_L8("ReqModeL Leaving with KErrInUse as data port is loaned (aIpc=%d)"),aIpc);
       
   106 		User::Leave(KErrInUse);
       
   107 		}
       
   108 	return reqMode;
       
   109 	}
       
   110 
       
   111 TInt CLineHayes::RegisterNotification(const TInt /*aIpc*/)
       
   112 	{
       
   113 	return KErrNone;
       
   114 	}
       
   115 
       
   116 TInt CLineHayes::DeregisterNotification(const TInt /*aIpc*/)
       
   117 	{
       
   118 	return KErrNone;
       
   119 	}
       
   120 
       
   121 void CLineHayes::Init()
       
   122 	{}
       
   123 
       
   124 TInt CLineHayes::NotifyIncomingCall(const TTsyReqHandle aTsyReqHandle, TName* aName)
       
   125 	{
       
   126 	iPhoneGlobals->iNotificationStore->RegisterNotification(EIncomingCall,aTsyReqHandle,this,aName);
       
   127 	LOGTEXT(_L8("Line:\tIncoming Call Notification lodged"));
       
   128 	iNotifyIncomingCallOutstanding=ETrue;
       
   129 
       
   130 	CCallEntry* callEntry;
       
   131 	TDblQueIter<CCallEntry> iter(iCalls);
       
   132 	while (callEntry=iter++, callEntry)
       
   133 		{
       
   134 		if ((callEntry->iCallHayes->CallInfo())->iMobileStatus==RMobileCall::EStatusRinging)
       
   135 			{
       
   136 			iPhoneGlobals->iNotificationStore->CheckNotification(callEntry->iCallHayes,ERingOccurred);
       
   137 			break;
       
   138 			}
       
   139 		}
       
   140 	if (iPhoneGlobals->iPhoneStatus.iInitStatus==EPhoneNotInitialised)
       
   141 		{
       
   142 		FlowControlSuspend();
       
   143 		iInit->SpecialStart();
       
   144 		}
       
   145 	return KErrNone;
       
   146 	}
       
   147 
       
   148 TInt CLineHayes::NotifyIncomingCallCancel(const TTsyReqHandle aTsyReqHandle)
       
   149 	{
       
   150 	LOGTEXT(_L8("Line:\tIncoming Call Notification cancelled"));
       
   151 	ResetNotifyIncomingCall();
       
   152 	iPhoneGlobals->iNotificationStore->RemoveNotification(aTsyReqHandle);
       
   153 	return KErrNone;
       
   154 	}
       
   155 
       
   156 TInt CLineHayes::NotifyHookChange(const TTsyReqHandle aTsyReqHandle, RCall::THookStatus* aHookStatus)
       
   157 	{
       
   158 	LOGTEXT(_L8("Line:\tHook Change Notification lodged"));
       
   159 	iPhoneGlobals->iNotificationStore->RegisterNotification(ELineHookChange,aTsyReqHandle,this,aHookStatus);
       
   160 	return KErrNone;
       
   161 	}
       
   162 
       
   163 TInt CLineHayes::NotifyHookChangeCancel(const TTsyReqHandle aTsyReqHandle)
       
   164 	{
       
   165 	LOGTEXT(_L8("Line:\tHook Change Notification cancelled"));
       
   166 	iPhoneGlobals->iNotificationStore->RemoveNotification(aTsyReqHandle);
       
   167 	return KErrNone;
       
   168 	}
       
   169 
       
   170 TInt CLineHayes::NotifyStatusChange(const TTsyReqHandle aTsyReqHandle, RCall::TStatus* aStatus)
       
   171 	{
       
   172 	LOGTEXT(_L8("Line:\tStatus Change Notification lodged"));
       
   173 	iPhoneGlobals->iNotificationStore->RegisterNotification(ELineStatusChange,aTsyReqHandle,this,aStatus);
       
   174 	return KErrNone;
       
   175 	}
       
   176 
       
   177 TInt CLineHayes::NotifyStatusChangeCancel(const TTsyReqHandle aTsyReqHandle)
       
   178 	{
       
   179 	LOGTEXT(_L8("Line:\tStatus Change Notification cancelled"));
       
   180 	iPhoneGlobals->iNotificationStore->RemoveNotification(aTsyReqHandle);
       
   181 	return KErrNone;
       
   182 	}
       
   183 
       
   184 TInt CLineHayes::NotifyCallAdded(const TTsyReqHandle aTsyReqHandle,TName* aName)
       
   185 	{
       
   186 	LOGTEXT(_L8("Line:\tCall Added Notification lodged"));
       
   187 	iPhoneGlobals->iNotificationStore->RegisterNotification(ENewCallAdded,aTsyReqHandle,this,aName);
       
   188 	return KErrNone;
       
   189 	}
       
   190 
       
   191 TInt CLineHayes::NotifyCallAddedCancel(const TTsyReqHandle aTsyReqHandle)
       
   192 	{
       
   193 	LOGTEXT(_L8("Line:\tCall Added Notification cancelled"));
       
   194 	iPhoneGlobals->iNotificationStore->RemoveNotification(aTsyReqHandle);
       
   195 	return KErrNone;
       
   196 	}
       
   197 
       
   198 TInt CLineHayes::NotifyCapsChange(const TTsyReqHandle aTsyReqHandle, RLine::TCaps* /*aCaps*/)
       
   199 	{
       
   200 	ReqCompleted(aTsyReqHandle,KErrNotSupported);
       
   201 	return KErrNone;
       
   202 	}
       
   203 
       
   204 TInt CLineHayes::NotifyCapsChangeCancel(const TTsyReqHandle aTsyReqHandle)
       
   205 	{
       
   206 	ReqCompleted(aTsyReqHandle,KErrCancel);
       
   207 	return KErrNone;
       
   208 	}
       
   209 
       
   210 CCallEntry* CLineHayes::CheckNewObject(const TDesC& aName) 
       
   211 //
       
   212 //	Server should have caught any identical names and treated them as new handles on existing 
       
   213 //  objects, and not calling OpenNewObjectL() on the TSY. So panic if there is an identical name,
       
   214 //  unless it is the name of the pre-allocated call owned by the line in which case the server
       
   215 //  would not have been aware of it.
       
   216 	{
       
   217 	CCallEntry* callEntry;
       
   218 	TDblQueIter<CCallEntry> iter(iCalls);
       
   219 	while(callEntry=iter++, callEntry!=NULL)
       
   220 		{
       
   221 		if(callEntry->iCallHayes->CheckName(aName))
       
   222 			{
       
   223 			if (callEntry->iCallHayes->IsOwnedByTSY())
       
   224 				return callEntry;
       
   225 			else
       
   226 				Panic(ECallNameAlreadyExists);
       
   227 			}
       
   228 		}
       
   229 	return NULL;
       
   230 	}
       
   231 
       
   232 TInt CLineHayes::GetInfo(const TTsyReqHandle aTsyReqHandle, RLine::TLineInfo* aLineInfo)
       
   233 	{
       
   234 	aLineInfo->iHookStatus = RCall::EHookStatusOn;
       
   235 	aLineInfo->iStatus = RCall::EStatusIdle;
       
   236 	CCallEntry* callEntry;
       
   237 	TDblQueIter<CCallEntry> iter(iCalls);
       
   238 	while (callEntry=iter++, callEntry)
       
   239 		{
       
   240 		TCallInfoTSY* infoTSY = callEntry->iCallHayes->CallInfo();
       
   241 		if (infoTSY->iHookStatus == RCall::EHookStatusOff)
       
   242 			{
       
   243 			aLineInfo->iHookStatus = RCall::EHookStatusOff;
       
   244 			}
       
   245 		if (callEntry->iCallHayes->GetCoreCallStatus() == iPhoneGlobals->iPhoneStatus.iLineStatus)
       
   246 			{
       
   247 			aLineInfo->iStatus = iPhoneGlobals->iPhoneStatus.iLineStatus;
       
   248 			}
       
   249 		}
       
   250 	GetLastCallName(aLineInfo->iNameOfLastCallAdded);
       
   251 	ReqCompleted(aTsyReqHandle,KErrNone);
       
   252 	return KErrNone;
       
   253 	}
       
   254 
       
   255 TInt CLineHayes::GetStatus(const TTsyReqHandle aTsyReqHandle,RCall::TStatus* aLineStatus)
       
   256 //
       
   257 //	This line may not be the one on which a call is being made, so check to see if any of
       
   258 //  the calls on this line have the same status as the 'global' line status and if so, this
       
   259 //  can be assumed to be that line
       
   260 //
       
   261 	{
       
   262 	CCallEntry* callEntry;
       
   263 	TDblQueIter<CCallEntry> iter(iCalls);
       
   264 	while(callEntry=iter++, callEntry!=NULL)
       
   265 		{
       
   266 		if (callEntry->iCallHayes->GetCoreCallStatus() == iPhoneGlobals->iPhoneStatus.iLineStatus)
       
   267 			{
       
   268 			*aLineStatus = iPhoneGlobals->iPhoneStatus.iLineStatus;
       
   269 			ReqCompleted(aTsyReqHandle,KErrNone);
       
   270 			return KErrNone;
       
   271 			}
       
   272 		}
       
   273 	*aLineStatus = RCall::EStatusIdle;
       
   274 	ReqCompleted(aTsyReqHandle,KErrNone);
       
   275 	return KErrNone;
       
   276 	}
       
   277 
       
   278 TInt CLineHayes::EnumerateCall(const TTsyReqHandle aTsyReqHandle,TInt* aParams)
       
   279 //
       
   280 //	Enumerate calls
       
   281 //
       
   282 	{
       
   283 	LOGTEXT(_L8("Line:\tEnumerate Calls"));
       
   284 	TInt count=0;
       
   285 	TDblQueIter<CCallEntry> iter(iCalls);
       
   286 	while (iter++)
       
   287 		{
       
   288 		count++;
       
   289 		}
       
   290 	*aParams = count;
       
   291 	ReqCompleted(aTsyReqHandle,KErrNone);
       
   292 	return KErrNone;
       
   293 	}
       
   294 
       
   295 TInt CLineHayes::GetHookStatus(const TTsyReqHandle aTsyReqHandle,RCall::THookStatus* aHookStatus)
       
   296 //
       
   297 //	Hook is considered ON if no calls exist on this line, or if all calls are idle
       
   298 //	OFF if at least one is not idle. Should not be more than one active call.
       
   299 //
       
   300 	{
       
   301 	LOGTEXT(_L8("Line:\tGet hook status"));
       
   302 	RCall::THookStatus hookStatus = RCall::EHookStatusOn;
       
   303 	CCallEntry* callEntry;
       
   304 	TDblQueIter<CCallEntry> iter(iCalls);
       
   305 	while (callEntry=iter++, callEntry)
       
   306 		{
       
   307 		if (callEntry->iCallHayes->CallInfo()->iHookStatus == RCall::EHookStatusOff)
       
   308 			{
       
   309 			hookStatus = RCall::EHookStatusOff;
       
   310 			break;	// if any calls are active, line hook status is off
       
   311 			}
       
   312 		}
       
   313 	*aHookStatus = hookStatus;
       
   314 	ReqCompleted(aTsyReqHandle,KErrNone);
       
   315 	return KErrNone;
       
   316 	}
       
   317 
       
   318 void CLineHayes::SetCallsHookStatus(RCall::THookStatus aHookStatus)
       
   319 //
       
   320 //	Is it valid to set all calls to a certain hook status at any time?
       
   321 //
       
   322 	{
       
   323 	CCallEntry* callEntry;
       
   324 	TDblQueIter<CCallEntry> iter(iCalls);
       
   325 	while (callEntry=iter++, callEntry)
       
   326 		callEntry->iCallHayes->CallInfo()->iHookStatus = aHookStatus;
       
   327 	}
       
   328 
       
   329 TBool CLineHayes::StopMyCallRinging()
       
   330 	{
       
   331 	CCallEntry* callEntry;
       
   332 	TDblQueIter<CCallEntry> iter(iCalls);
       
   333 	while (callEntry=iter++, callEntry)
       
   334 		{
       
   335 		if (callEntry->iCallHayes->CallInfo()->iMobileStatus==RMobileCall::EStatusRinging)
       
   336 			{
       
   337 			// EStatusIdle always results in KErrNone return
       
   338 			(void)callEntry->iCallHayes->ChangeCallStatus(RMobileCall::EStatusIdle);
       
   339 			return ETrue;
       
   340 			}
       
   341 		}
       
   342 	return EFalse;
       
   343 	}
       
   344 
       
   345 void CLineHayes::GetLineStatus(RCall::TStatus& aLineStatus)
       
   346 	{
       
   347 	aLineStatus=iPhoneGlobals->iPhoneStatus.iLineStatus;
       
   348 	}
       
   349 
       
   350 void CLineHayes::RemoveCall(CCallHayes* aCallHayes)
       
   351 //
       
   352 //	When a call closes, it calls this to remove itself from the array
       
   353 //
       
   354 	{
       
   355 	CCallEntry* callEntry;
       
   356 	TDblQueIter<CCallEntry> iter(iCalls);
       
   357 	while (callEntry=iter++, callEntry)
       
   358 		{
       
   359 		if (callEntry->iCallHayes == aCallHayes)
       
   360 			{
       
   361 			callEntry->Deque();
       
   362 			delete callEntry;	// just deletes list entry, not the call itself
       
   363 			break;
       
   364 			}
       
   365 		}
       
   366 	}
       
   367 
       
   368 void CLineHayes::GetLastCallName(TDes& aName) const
       
   369 	{
       
   370 	TCallInfoIndex callInfo;
       
   371 	if (iCalls.IsEmpty())
       
   372 		{
       
   373 		aName.Zero();
       
   374 		return;
       
   375 		}
       
   376 	CCallEntry* callEntry = iCalls.Last();
       
   377 	__ASSERT_ALWAYS(callEntry,Panic(ENewCallDoesNotExist));
       
   378 	callEntry->iCallHayes->GetCallInfo(&callInfo);
       
   379 	aName = callInfo.iInfo.iCallName;
       
   380 	}
       
   381 
       
   382 void CLineHayes::GetNameOfCallForAnswering(TDes& aName)
       
   383 	{
       
   384 	TCallInfoIndex callInfo;
       
   385 	CCallEntry* callEntry;
       
   386 	TDblQueIter<CCallEntry> iter(iCalls);
       
   387 	while (callEntry=iter++, callEntry)
       
   388 		{
       
   389 		if (callEntry->iCallHayes->IsForIncomingCall() || callEntry->iCallHayes->IsOwnedByTSY())
       
   390 			{
       
   391 			callEntry->iCallHayes->GetCallInfo(&callInfo);
       
   392 			aName = callInfo.iInfo.iCallName;
       
   393 			return;
       
   394 			}
       
   395 		}
       
   396 	aName.Zero();
       
   397 	}
       
   398 
       
   399 TBool CLineHayes::AnswerIfPossible()
       
   400 //
       
   401 //	Finds the call on this line which has been asked to Answer the next incoming call, if it
       
   402 //	exists, and tells it to answer.
       
   403 //
       
   404 	{
       
   405 	CCallEntry* callEntry;
       
   406 	TDblQueIter<CCallEntry> iter(iCalls);
       
   407 	while (callEntry=iter++, callEntry)
       
   408 		{
       
   409 		if ((callEntry->iCallHayes->IsForIncomingCall()))
       
   410 			{
       
   411 			callEntry->iCallHayes->AnswerImmediately();
       
   412 			return ETrue;
       
   413 			}
       
   414 		}
       
   415 	return EFalse;
       
   416 	}
       
   417 
       
   418 TBool CLineHayes::CheckForOutstandingAnswer()
       
   419 	{
       
   420 	CCallEntry* callEntry;
       
   421 	TDblQueIter<CCallEntry> iter(iCalls);
       
   422 	while (callEntry=iter++, callEntry)
       
   423 		{
       
   424 		if (callEntry->iCallHayes->IsForIncomingCall())
       
   425 			return ETrue;
       
   426 		}
       
   427 	return EFalse;
       
   428 	}
       
   429 
       
   430 const CArrayFixFlat<TInt>* CLineHayes::ArrayOfMemberDataSizes(const TInt /*aIpc*/) const
       
   431 	{
       
   432 	return iSizeOfMemberData;
       
   433 	}
       
   434 
       
   435 void CLineHayes::ResetNotifyIncomingCall()
       
   436 	{
       
   437 	iNotifyIncomingCallOutstanding=EFalse;
       
   438 	}
       
   439 
       
   440 TBool CLineHayes::IsNotifyIncomingCallOutstanding()
       
   441 	{
       
   442 	return iNotifyIncomingCallOutstanding;
       
   443 	}
       
   444 
       
   445 //
       
   446 // Unimplemented Line Request Functions
       
   447 //
       
   448 
       
   449 TInt CLineHayes::ExtFunc(const TTsyReqHandle,const TInt, const TDataPackage&)
       
   450 //
       
   451 // Extensions aren't supported in this TSY
       
   452 //
       
   453 	{
       
   454 	return KErrNotSupported;
       
   455 	}
       
   456 
       
   457 
       
   458 /*
       
   459  *  CLineMobile class that implements Multimode ETel Mobile Call requests
       
   460  */
       
   461 
       
   462 CLineMobile::CLineMobile(CATIO* aIo,CATInit* aInit,CPhoneGlobals* aPhoneGlobals) 
       
   463 			: CLineHayes(aIo, aInit, aPhoneGlobals)
       
   464 	{}
       
   465 
       
   466 CLineMobile::~CLineMobile()
       
   467 	{
       
   468 	}
       
   469 
       
   470 CTelObject::TReqMode CLineMobile::ReqModeL(const TInt aIpc)
       
   471 	{
       
   472 	// ReqModeL is called from the server's CTelObject::ReqAnalyserL
       
   473 	// in order to check the type of request it has
       
   474 
       
   475 	CTelObject::TReqMode ret=0;
       
   476 	switch (aIpc)
       
   477 		{
       
   478 //
       
   479 // No Flow Control NOR Multiple Completion
       
   480 //
       
   481 	case EMobileLineGetMobileLineStatus:
       
   482 		break;
       
   483 
       
   484 //
       
   485 // Multiple Completion Services with Immediate Server Repost
       
   486 // (Usually Notifications)
       
   487 //
       
   488 	case EMobileLineNotifyMobileLineStatusChange:
       
   489 		ret=KReqModeMultipleCompletionEnabled | KReqModeRePostImmediately;
       
   490 		break;
       
   491 //
       
   492 // Not Supported
       
   493 //
       
   494 	default:
       
   495 		ret=CLineHayes::ReqModeL(aIpc);
       
   496 		break;
       
   497 		}
       
   498 
       
   499 	return ret;
       
   500 	}
       
   501 
       
   502 
       
   503 TInt CLineMobile::NumberOfSlotsL(const TInt aIpc)
       
   504 	{
       
   505 	// NumberOfSlotsL is called by the server when it is registering a new notification
       
   506 	// It enables the TSY to tell the server how many buffer slots to allocate for
       
   507 	// "repost immediately" notifications that may trigger before clients collect them
       
   508 
       
   509 	TInt numberOfSlots=1;
       
   510 	switch (aIpc)
       
   511 		{
       
   512 	case EMobileLineNotifyMobileLineStatusChange:
       
   513 		LOGTEXT(_L8("CLineMobile: Registered with 5 slots"));
       
   514 		numberOfSlots=5;
       
   515 		break;
       
   516 	default:
       
   517 		numberOfSlots = CLineBase::NumberOfSlotsL(aIpc);
       
   518 		break;
       
   519 		}
       
   520 	return numberOfSlots;
       
   521 	}
       
   522 
       
   523 
       
   524 TInt CLineMobile::ExtFunc(const TTsyReqHandle aTsyReqHandle,const TInt aIpc,
       
   525 					 	  const TDataPackage& aPackage)
       
   526 	{
       
   527 	// ExtFunc is called by the server when it has a "extended", i.e. non-core ETel request 
       
   528 	// for the TSY to process
       
   529 	// A request handle, request type and request data are passed to the TSY
       
   530 
       
   531 	TAny* dataPtr=aPackage.Ptr1();
       
   532 
       
   533 	// The request data has to extracted from TDataPackage and the TAny* pointers have to
       
   534 	// be "cast" to the expected request data type
       
   535 
       
   536 	switch (aIpc)
       
   537 		{
       
   538 //
       
   539 // No Flow Control NOR Multiple Completion
       
   540 //
       
   541 	case EMobileLineGetMobileLineStatus:
       
   542 		return GetMobileLineStatus(aTsyReqHandle,
       
   543 			REINTERPRET_CAST(RMobileCall::TMobileCallStatus*,dataPtr));
       
   544 
       
   545 //
       
   546 // Multiple Completion Services with Immediate Server Repost
       
   547 // (Usually Notifications)
       
   548 //
       
   549 	case EMobileLineNotifyMobileLineStatusChange:
       
   550 		return NotifyMobileLineStatusChange(aTsyReqHandle,
       
   551 			REINTERPRET_CAST(RMobileCall::TMobileCallStatus*, dataPtr));
       
   552 //
       
   553 // Cancels
       
   554 //
       
   555 	case EMobileLineNotifyMobileLineStatusChangeCancel:
       
   556 		return NotifyMobileLineStatusChangeCancel(aTsyReqHandle);
       
   557 	
       
   558 	default:
       
   559 		return KErrNotSupported;
       
   560 		}
       
   561 	}
       
   562 
       
   563 TInt CLineMobile::CancelService(const TInt aIpc, const TTsyReqHandle aTsyReqHandle)
       
   564 	{
       
   565 	// CancelService is called by the server when it is "cleaning-up" any still outstanding
       
   566 	// asynchronous requests before closing a client's sub-session.
       
   567 	// This will happen if a client closes its R-class handle without cancelling outstanding
       
   568 	// asynchronous requests.
       
   569 
       
   570 	switch (aIpc)
       
   571 		{
       
   572 	case EMobileLineNotifyMobileLineStatusChange:
       
   573 		return NotifyMobileLineStatusChangeCancel(aTsyReqHandle);
       
   574 	default:
       
   575 		return CLineBase::CancelService(aIpc,aTsyReqHandle);
       
   576 		}
       
   577 	}
       
   578 
       
   579 TInt CLineMobile::GetMobileLineStatus(const TTsyReqHandle aTsyReqHandle,RMobileCall::TMobileCallStatus* aStatus)
       
   580 	{
       
   581 	LOGTEXT(_L8("CLineMobile::GetMobileLineStatus called"));
       
   582 	CCallEntry* callEntry;
       
   583 	TDblQueIter<CCallEntry> iter(iCalls);
       
   584 	while(callEntry=iter++, callEntry!=NULL)
       
   585 		{
       
   586 		if (callEntry->iCallHayes->GetCoreCallStatus() == iPhoneGlobals->iPhoneStatus.iLineStatus)
       
   587 			{
       
   588 			//*aStatus = static_cast<RMobileCall::TMobileCallStatus>(iPhoneGlobals->iPhoneStatus.iLineStatus);
       
   589 			*aStatus = (RMobileCall::TMobileCallStatus)iPhoneGlobals->iPhoneStatus.iLineStatus;
       
   590 			ReqCompleted(aTsyReqHandle,KErrNone);
       
   591 			return KErrNone;
       
   592 			}
       
   593 		}
       
   594 	*aStatus = RMobileCall::EStatusIdle;
       
   595 	ReqCompleted(aTsyReqHandle,KErrNone);
       
   596 	return KErrNone;
       
   597 	}
       
   598 
       
   599 TInt CLineMobile::NotifyMobileLineStatusChange(const TTsyReqHandle aTsyReqHandle,RMobileCall::TMobileCallStatus* aStatus)
       
   600 	{
       
   601 	LOGTEXT(_L8("CLineMobile::NotifyMobileLineStatusChange lodged"));
       
   602 	iPhoneGlobals->iNotificationStore->RegisterNotification(EMobileLineStatusChange,aTsyReqHandle,this,aStatus);
       
   603 	return KErrNone;
       
   604 	}
       
   605 
       
   606 TInt CLineMobile::NotifyMobileLineStatusChangeCancel(const TTsyReqHandle aTsyReqHandle)
       
   607 	{
       
   608 	LOGTEXT(_L8("CLineMobile::NotifyMobileLineStatusChangeCancel called"));
       
   609 	iPhoneGlobals->iNotificationStore->RemoveNotification(aTsyReqHandle);
       
   610 	return KErrNone;
       
   611 	}
       
   612 
       
   613 
       
   614 //Added for Java Demo 4.4.99
       
   615 //
       
   616 // CLineMobileVoice
       
   617 // Voice Specific Line Functionality
       
   618 //
       
   619 CLineMobileVoice* CLineMobileVoice::NewL(CATIO* aATIO,CATInit* aInit,CPhoneGlobals* aPhoneGlobals,const TName& aName)
       
   620 	{
       
   621 	CLineMobileVoice* voiceLine=new(ELeave) CLineMobileVoice(aATIO,aInit,aPhoneGlobals);
       
   622 	TCleanupItem newLineVoiceHayesClose(CloseLine,voiceLine);
       
   623 	CleanupStack::PushL(newLineVoiceHayesClose);
       
   624 	voiceLine->ConstructL(aName);
       
   625 	CleanupStack::Pop();
       
   626 	return voiceLine;
       
   627 	}
       
   628 
       
   629 CLineMobileVoice::CLineMobileVoice(CATIO* aATIO, CATInit* aInit,CPhoneGlobals* aPhoneGlobals)
       
   630 	:CLineMobile(aATIO,aInit,aPhoneGlobals)
       
   631 	{}
       
   632 
       
   633 void CLineMobileVoice::ConstructL(const TName& aName)
       
   634 	{
       
   635 	CLineHayes::ConstructL(aName);
       
   636 	TName preAllocName;
       
   637 	GenerateName(preAllocName);
       
   638 	CCallMobileVoice* newCall=CCallMobileVoice::NewL(iIo,iInit,iPhoneGlobals,preAllocName);
       
   639 	TCleanupItem newLineClose(CloseLine,newCall);
       
   640 	CleanupStack::PushL(newLineClose); 
       
   641 	newCall->SetNameL(&preAllocName);
       
   642 	newCall->SetOwnedByTSY();
       
   643 	newCall->SetOwner(this);	
       
   644 	iPreAlloc = CCallEntry::NewL(newCall);
       
   645 	CleanupStack::Pop();
       
   646 	}
       
   647 
       
   648 CLineMobileVoice::~CLineMobileVoice()
       
   649 	{}
       
   650 
       
   651 
       
   652 CTelObject* CLineMobileVoice::OpenNewObjectByNameL(const TDesC& aName)
       
   653 //
       
   654 //	Open a voice call by name. This will be called if the user opens a pre-alloc'ed call by name
       
   655 //
       
   656 	{
       
   657 	CCallEntry* entry = NULL;
       
   658 	entry=CheckNewObject(aName); //if found in call list, must be a pre-alloc'ed call
       
   659 	if (!entry)	
       
   660 		{
       
   661 		CCallMobileVoice* newCall=CCallMobileVoice::NewL(iIo,iInit,iPhoneGlobals,aName);
       
   662 		TCleanupItem newLineClose(CloseLine,newCall);
       
   663 		CleanupStack::PushL(newLineClose); 
       
   664 		AppendNewCallL(newCall);
       
   665 		CleanupStack::Pop();
       
   666 		iPhoneGlobals->iNotificationStore->CheckNotification(this,ECallAdded);
       
   667 		return newCall;
       
   668 		}
       
   669 	else  // this is a pre-allocated call
       
   670 		{
       
   671 		TName preAllocatedCallName;	// pre-allocate next call
       
   672 		GenerateName(preAllocatedCallName);
       
   673 		CCallMobileVoice* call=CCallMobileVoice::NewL(iIo,iInit,iPhoneGlobals,preAllocatedCallName);
       
   674 		call->SetOwnedByTSY();
       
   675 		(void)User::LeaveIfError(call->SetName(&preAllocatedCallName));
       
   676 		call->SetOwner(this);
       
   677 		iPreAlloc = CCallEntry::NewL(call);
       
   678 
       
   679 		CCallHayes* oldpreAllocCall = entry->iCallHayes;
       
   680 		oldpreAllocCall->SetUnownedByTSY();
       
   681 		return oldpreAllocCall;
       
   682 		}
       
   683 	}
       
   684 
       
   685 CTelObject* CLineMobileVoice::OpenNewObjectL(TDes& aNewName)
       
   686 //
       
   687 //	Open a voice call and return a name
       
   688 //
       
   689 	{
       
   690 	GenerateName(aNewName);
       
   691 	CCallMobileVoice* newCall=CCallMobileVoice::NewL(iIo,iInit,iPhoneGlobals,aNewName);
       
   692 	TCleanupItem newLineClose(CloseLine,newCall);
       
   693 	CleanupStack::PushL(newLineClose); 
       
   694 	AppendNewCallL(newCall);
       
   695 	CleanupStack::Pop();
       
   696 	iPhoneGlobals->iNotificationStore->CheckNotification(this,ECallAdded);
       
   697 	return newCall;
       
   698 	}
       
   699 
       
   700 void CLineMobileVoice::GenerateName(TDes& aName) 
       
   701 	{
       
   702 	aName.Append(KVoiceCallName);
       
   703 	aName.AppendNum(iNameIndex++);
       
   704 	}
       
   705 
       
   706 TInt CLineMobileVoice::GetCaps(const TTsyReqHandle aTsyReqHandle,RLine::TCaps* aLineCaps)
       
   707 	{
       
   708 	aLineCaps->iFlags = RLine::KCapsEventIncomingCall;
       
   709 	aLineCaps->iFlags |= RLine::KCapsVoice;
       
   710 	ReqCompleted(aTsyReqHandle,KErrNone);
       
   711 	return KErrNone;
       
   712 	}
       
   713 
       
   714 TInt CLineMobileVoice::GetCallInfo(const TTsyReqHandle aTsyReqHandle,TCallInfoIndex* /*aCallInfoIndex*/)
       
   715 //
       
   716 //	Provide info about voice call
       
   717 //
       
   718 	{
       
   719 	ReqCompleted(aTsyReqHandle,KErrNotSupported);
       
   720 	return KErrNone;
       
   721 	}
       
   722 
       
   723 //
       
   724 // CLineMobileData
       
   725 // Data Specific Line Functionality
       
   726 //
       
   727 CLineMobileData* CLineMobileData::NewL(CATIO* aATIO, CATInit* aInit,CPhoneGlobals* aPhoneGlobals,const TName& aName)
       
   728 	{
       
   729 	CLineMobileData* dataLine=new(ELeave) CLineMobileData(aATIO,aInit,aPhoneGlobals);
       
   730 	TCleanupItem newLineDataHayesClose(CloseLine,dataLine);
       
   731 	CleanupStack::PushL(newLineDataHayesClose);
       
   732 	dataLine->ConstructL(aName);
       
   733 	CleanupStack::Pop();
       
   734 	return dataLine;
       
   735 	}
       
   736 
       
   737 CLineMobileData::CLineMobileData(CATIO* aATIO, CATInit* aInit,CPhoneGlobals* aPhoneGlobals)
       
   738 	:CLineMobile(aATIO,aInit,aPhoneGlobals)
       
   739 	{}
       
   740 
       
   741 void CLineMobileData::ConstructL(const TName& aName)
       
   742 //
       
   743 //	Constructs a call which is to be used only when an incoming call arrives
       
   744 //	and no client has designated an existing call to answer it. TSY holds responsibility to close 
       
   745 //	it unless a RING occurs, when the line will add the call to the linked list of calls 
       
   746 //  and alert any interested clients that a "new" call has been created - if any client then
       
   747 //	opens a handle on it, the TSY relinquishes any responsibility to close it in the future
       
   748 //	as the client has that responsibility. When the client opens a handle on it, using OpenByName
       
   749 //	the line will create a new PreAlloc'ed call. If no client opens a handle, when the line 
       
   750 //	stops ringing the line will remove the pre-alloc'ed call from the list and keep the pointer
       
   751 //	to it separately in CLineHayes::iPreAlloc, so any subsequent attempt by a client to 
       
   752 //  open a handle on it will fail with KErrDoesNotExist or something similar. 
       
   753 //
       
   754 	{
       
   755 	CLineHayes::ConstructL(aName);
       
   756 	TName preAllocName;
       
   757 	GenerateName(preAllocName);
       
   758 	CCallMobileData* newCall=CCallMobileData::NewL(iIo,iInit,iPhoneGlobals,preAllocName);
       
   759 	TCleanupItem newLineClose(CloseLine,newCall);
       
   760 	CleanupStack::PushL(newLineClose); 
       
   761 	newCall->SetNameL(&preAllocName);
       
   762 	newCall->SetOwnedByTSY();
       
   763 	newCall->SetOwner(this);	
       
   764 	iPreAlloc = CCallEntry::NewL(newCall);
       
   765 	CleanupStack::Pop();
       
   766 	}
       
   767 
       
   768 CLineMobileData::~CLineMobileData()
       
   769 	{}
       
   770 
       
   771 CTelObject* CLineMobileData::OpenNewObjectByNameL(const TDesC& aName)
       
   772 //
       
   773 //	Open a data call by name. This will be called if the user opens a pre-alloc'ed call by name
       
   774 //
       
   775 	{
       
   776 	CCallEntry* entry = NULL;
       
   777 	entry=CheckNewObject(aName); //if found in call list, must be a pre-alloc'ed call
       
   778 	if (!entry)	
       
   779 		{
       
   780 		CCallMobileData* newCall=CCallMobileData::NewL(iIo,iInit,iPhoneGlobals,aName);
       
   781 		TCleanupItem newLineClose(CloseLine,newCall);
       
   782 		CleanupStack::PushL(newLineClose); 
       
   783 		AppendNewCallL(newCall);
       
   784 		CleanupStack::Pop();
       
   785 		iPhoneGlobals->iNotificationStore->CheckNotification(this,ECallAdded);
       
   786 		return newCall;
       
   787 		}
       
   788 	else  // this is a pre-allocated call
       
   789 		{
       
   790 		TName preAllocatedCallName;	// pre-allocate next call
       
   791 		GenerateName(preAllocatedCallName);
       
   792 		CCallMobileData* call=CCallMobileData::NewL(iIo,iInit,iPhoneGlobals,preAllocatedCallName);
       
   793 		call->SetOwnedByTSY();
       
   794 		(void)User::LeaveIfError(call->SetName(&preAllocatedCallName));
       
   795 		call->SetOwner(this);
       
   796 		iPreAlloc = CCallEntry::NewL(call);
       
   797 
       
   798 		CCallHayes* oldpreAllocCall = entry->iCallHayes;
       
   799 		oldpreAllocCall->SetUnownedByTSY();
       
   800 		return oldpreAllocCall;
       
   801 		}
       
   802 	}
       
   803 
       
   804 CTelObject* CLineMobileData::OpenNewObjectL(TDes& aNewName)
       
   805 //
       
   806 //	Open a data call and return a name
       
   807 //
       
   808 	{
       
   809 	GenerateName(aNewName);
       
   810 	CCallMobileData* newCall=CCallMobileData::NewL(iIo,iInit,iPhoneGlobals,aNewName);
       
   811 	TCleanupItem newLineClose(CloseLine,newCall);
       
   812 	CleanupStack::PushL(newLineClose); 
       
   813 	AppendNewCallL(newCall);
       
   814 	CleanupStack::Pop();
       
   815 	iPhoneGlobals->iNotificationStore->CheckNotification(this,ECallAdded);
       
   816 	return newCall;
       
   817 	}
       
   818 
       
   819 void CLineMobileData::GenerateName(TDes& aName) 
       
   820 	{
       
   821 	aName.Append(KDataCallName);
       
   822 	aName.AppendNum(iNameIndex++);
       
   823 	}
       
   824 
       
   825 TInt CLineMobileData::GetCaps(const TTsyReqHandle aTsyReqHandle,RLine::TCaps* aLineCaps)
       
   826 	{
       
   827 	aLineCaps->iFlags = RLine::KCapsEventIncomingCall;
       
   828 	if (iPhoneGlobals->iPhoneStatus.iDataAndFaxFlags & RPhone::KCapsData)
       
   829 		{
       
   830 		aLineCaps->iFlags |= RLine::KCapsData;
       
   831 		}
       
   832 	ReqCompleted(aTsyReqHandle,KErrNone);
       
   833 	return KErrNone;
       
   834 	}
       
   835 
       
   836 TInt CLineMobileData::GetCallInfo(const TTsyReqHandle aTsyReqHandle,TCallInfoIndex* aCallInfoIndex)
       
   837 //
       
   838 //	Provide info about data call
       
   839 //
       
   840 	{
       
   841 	LOGTEXT(_L8("DataLine:\tGet Data Call Info"));
       
   842 	CCallEntry* callEntry;
       
   843 	TDblQueIter<CCallEntry> iter(iCalls);
       
   844 	iter.SetToFirst();
       
   845 	for (TInt i=0;i<(TInt)(aCallInfoIndex->iIndex);i++)
       
   846 		{
       
   847 		iter++;
       
   848 		}
       
   849 	callEntry=iter;
       
   850 	if (callEntry)
       
   851 		{
       
   852 		callEntry->iCallHayes->GetCallInfo(aCallInfoIndex);
       
   853 		aCallInfoIndex->iInfo.iCallCapsFlags |= RCall::KCapsData;
       
   854 		ReqCompleted(aTsyReqHandle,KErrNone);
       
   855 		}
       
   856 	else
       
   857 		ReqCompleted(aTsyReqHandle,KErrNotFound);
       
   858 	return KErrNone;
       
   859 	}
       
   860 
       
   861 void CLineHayes::SetPreAllocCall()
       
   862 //
       
   863 //	If the incoming call hasn't been answered because there were no client-designated "Answerers"
       
   864 //  on either line, notify any interested client that there is a new call (which is actually the 
       
   865 //	pre-allocated call).
       
   866 //
       
   867 	{
       
   868 	// EStatusRinging always returns KErrNone
       
   869 	(void)iPreAlloc->iCallHayes->ChangeCallStatus(RMobileCall::EStatusRinging);
       
   870 	iCalls.AddLast(*iPreAlloc);		
       
   871 	iPhoneGlobals->iNotificationStore->CheckNotification(iPreAlloc->iCallHayes,ERingOccurred);
       
   872 	iPhoneGlobals->iNotificationStore->CheckNotification(this,ECallAdded);
       
   873 	iPreAlloc = NULL;	// pre-alloc'ed call and "call entry" is now owned by iCalls
       
   874 	}
       
   875 
       
   876 void CLineHayes::FreePreAllocCallIfNecessary()
       
   877 //
       
   878 // Used when answering a call, to check if whether the the answer request has been given on a call object
       
   879 // that is not the preallocated call.  If it has then free up the preallocated call.
       
   880 //
       
   881 	{
       
   882 	if(!iPreAlloc)
       
   883 		{
       
   884 		ResetPreAllocCall();
       
   885 		}
       
   886 	}
       
   887 
       
   888 void CLineHayes::ResetPreAllocCall()
       
   889 //
       
   890 //	Removes the TSY-owned Pre allocated call from the list of calls and returns it to iPreAlloc.
       
   891 //
       
   892 	{
       
   893 	CCallEntry* callEntry;
       
   894 	TDblQueIter<CCallEntry> iter(iCalls);
       
   895 	while (callEntry=iter++, callEntry)
       
   896 		{
       
   897 		if ((callEntry->iCallHayes->IsOwnedByTSY()))
       
   898 			{
       
   899 			callEntry->Deque();
       
   900 			iPreAlloc = callEntry;
       
   901 			iPreAlloc->iCallHayes->ResetIsForIncomingCall();
       
   902 			}
       
   903 		}
       
   904 	}
       
   905 
       
   906 //
       
   907 // CLineMobileFax
       
   908 // Fax Specific Line Functionality
       
   909 //
       
   910 CLineMobileFax* CLineMobileFax::NewL(CATIO* aATIO, CATInit* aInit,CPhoneGlobals* aPhoneGlobals,const TName& aName)
       
   911 	{
       
   912 	CLineMobileFax* FaxLine=new(ELeave) CLineMobileFax(aATIO,aInit,aPhoneGlobals);
       
   913 	TCleanupItem newLineFaxHayesClose(CloseLine,FaxLine);
       
   914 	CleanupStack::PushL(newLineFaxHayesClose);
       
   915 	FaxLine->ConstructL(aName);
       
   916 	CleanupStack::Pop();
       
   917 	return FaxLine;
       
   918 	}
       
   919 
       
   920 CLineMobileFax::CLineMobileFax(CATIO* aATIO, CATInit* aInit,CPhoneGlobals* aPhoneGlobals)
       
   921 	:CLineMobile(aATIO,aInit,aPhoneGlobals)
       
   922 	{}
       
   923 
       
   924 void CLineMobileFax::ConstructL(const TName& aName)
       
   925 //
       
   926 //	Constructs a call which is to be used only when an incoming call arrives
       
   927 //	and no client has designated an existing call to answer it. TSY holds responsibility to close 
       
   928 //	it unless a RING occurs, when the line will add the call to the linked list of calls 
       
   929 //  and alert any interested clients that a "new" call has been created - if any client then
       
   930 //	opens a handle on it, the TSY relinquishes any responsibility to close it in the future
       
   931 //	as the client has that responsibility. When the client opens a handle on it, using OpenByName
       
   932 //	the line will create a new PreAlloc'ed call. If no client opens a handle, when the line 
       
   933 //	stops ringing the line will remove the pre-alloc'ed call from the list and keep the pointer
       
   934 //	to it separately in CLineHayes::iPreAlloc, so any subsequent attempt by a client to 
       
   935 //  open a handle on it will fail with KErrDoesNotExist or something similar. 
       
   936 //
       
   937 	{
       
   938 	CLineHayes::ConstructL(aName);
       
   939 	TName preAllocName;
       
   940 	GenerateName(preAllocName);
       
   941 	CCallMobileFax* newCall=CCallMobileFax::NewL(iIo,iInit,iPhoneGlobals,preAllocName);
       
   942 	TCleanupItem newLineClose(CloseLine,newCall);
       
   943 	CleanupStack::PushL(newLineClose); 
       
   944 	newCall->SetNameL(&preAllocName);
       
   945 	newCall->SetOwnedByTSY();
       
   946 	newCall->SetOwner(this);	
       
   947 	iPreAlloc = CCallEntry::NewL(newCall);
       
   948 	CleanupStack::Pop();
       
   949 	}
       
   950 
       
   951 CLineMobileFax::~CLineMobileFax()
       
   952 	{}
       
   953 
       
   954 void CLineMobileFax::GenerateName(TDes& aName) 
       
   955 	{
       
   956 	aName.Append(KFaxCallName);
       
   957 	aName.AppendNum(iNameIndex++);
       
   958 	}
       
   959 
       
   960 CTelObject* CLineMobileFax::OpenNewObjectByNameL(const TDesC& aName)
       
   961 //
       
   962 //	Open a Fax call 
       
   963 //
       
   964 	{
       
   965 	CCallEntry* entry = NULL;
       
   966 	entry=CheckNewObject(aName); //if found in call list, must be a pre-alloc'ed call
       
   967 	if (!entry)	
       
   968 		{
       
   969 		CCallMobileFax* newCall=CCallMobileFax::NewL(iIo,iInit,iPhoneGlobals,aName);
       
   970 		TCleanupItem newLineClose(CloseLine,newCall);
       
   971 		CleanupStack::PushL(newLineClose); 
       
   972 		AppendNewCallL(newCall);
       
   973 		CleanupStack::Pop();
       
   974 		iPhoneGlobals->iNotificationStore->CheckNotification(this,ECallAdded);
       
   975 		return newCall;
       
   976 		}
       
   977 	else  // this is a pre-allocated call
       
   978 		{
       
   979 		TName preAllocatedCallName;	// pre-allocate next call
       
   980 		GenerateName(preAllocatedCallName);
       
   981 		CCallMobileFax* call=CCallMobileFax::NewL(iIo,iInit,iPhoneGlobals,preAllocatedCallName);
       
   982 		call->SetOwnedByTSY();
       
   983 		(void)User::LeaveIfError(call->SetName(&preAllocatedCallName));
       
   984 		call->SetOwner(this);
       
   985 		iPreAlloc = CCallEntry::NewL(call);
       
   986 
       
   987 		CCallHayes* oldpreAllocCall = entry->iCallHayes;
       
   988 		oldpreAllocCall->SetUnownedByTSY();
       
   989 		return oldpreAllocCall;
       
   990 		}
       
   991 	}
       
   992 
       
   993 CTelObject* CLineMobileFax::OpenNewObjectL(TDes& aNewName)
       
   994 //
       
   995 //	Open a fax call
       
   996 //
       
   997 	{
       
   998 	GenerateName(aNewName);
       
   999 	CCallMobileFax* newCall=CCallMobileFax::NewL(iIo,iInit,iPhoneGlobals,aNewName);
       
  1000 	TCleanupItem newLineClose(CloseLine,newCall);
       
  1001 	CleanupStack::PushL(newLineClose); 
       
  1002 	AppendNewCallL(newCall);
       
  1003 	CleanupStack::Pop();
       
  1004 	iPhoneGlobals->iNotificationStore->CheckNotification(this,ECallAdded);
       
  1005 	return newCall;
       
  1006 	}
       
  1007 
       
  1008 TInt CLineMobileFax::GetCaps(const TTsyReqHandle aTsyReqHandle,RLine::TCaps* aLineCaps)
       
  1009 	{
       
  1010 	aLineCaps->iFlags = RLine::KCapsEventIncomingCall;
       
  1011 	if (iPhoneGlobals->iPhoneStatus.iDataAndFaxFlags & KFaxCaps)
       
  1012 		{
       
  1013 		aLineCaps->iFlags |= RLine::KCapsFax;
       
  1014 		}
       
  1015 	ReqCompleted(aTsyReqHandle,KErrNone);
       
  1016 	return KErrNone;
       
  1017 	}
       
  1018 
       
  1019 TInt CLineMobileFax::GetCallInfo(const TTsyReqHandle aTsyReqHandle,TCallInfoIndex* aCallInfoIndex)
       
  1020 //
       
  1021 //	Provide info about fax call
       
  1022 //
       
  1023 	{
       
  1024 	LOGTEXT(_L8("FaxLine:\tGet Fax Call Info"));
       
  1025 	CCallEntry* callEntry;
       
  1026 	TDblQueIter<CCallEntry> iter(iCalls);
       
  1027 	iter.SetToFirst();
       
  1028 	for (TInt i=0;i<(TInt)(aCallInfoIndex->iIndex);i++)
       
  1029 		{
       
  1030 		iter++;
       
  1031 		}
       
  1032 	callEntry=iter;
       
  1033 	if (callEntry)
       
  1034 		{
       
  1035 		callEntry->iCallHayes->GetCallInfo(aCallInfoIndex);
       
  1036 		aCallInfoIndex->iInfo.iCallCapsFlags |= RCall::KCapsFax;
       
  1037 		ReqCompleted(aTsyReqHandle,KErrNone);
       
  1038 		}
       
  1039 	else
       
  1040 		ReqCompleted(aTsyReqHandle,KErrNotFound);
       
  1041 	return KErrNone;
       
  1042 	}
       
  1043 
       
  1044 CCallEntry* CCallEntry::NewL(CCallHayes* aCallHayes)
       
  1045 //
       
  1046 //	Call Entry has a pointer to the call, and makes up an entry in the linked list iCalls
       
  1047 //
       
  1048 	{
       
  1049 	return new(ELeave) CCallEntry(aCallHayes);
       
  1050 	}
       
  1051 
       
  1052 CCallEntry::CCallEntry(CCallHayes* aCallHayes)
       
  1053 //
       
  1054 //	CCallEntry constructor
       
  1055 //
       
  1056 	: iCallHayes(aCallHayes)
       
  1057 	{}
       
  1058 
       
  1059 CCallEntry::~CCallEntry()
       
  1060 //
       
  1061 //	CCallEntry destructor
       
  1062 //
       
  1063 	{}
       
  1064 
       
  1065 void CCallEntry::Deque()
       
  1066 //
       
  1067 //	Deque CCallEntry list
       
  1068 //
       
  1069 	{
       
  1070 	iLink.Deque();
       
  1071 	iLink.iPrev=iLink.iNext=NULL;
       
  1072 	}