telephonyserverplugins/multimodetsy/hayes/LINE.CPP
branchRCL_3
changeset 20 07a122eea281
parent 19 630d2f34d719
--- a/telephonyserverplugins/multimodetsy/hayes/LINE.CPP	Tue Aug 31 16:23:08 2010 +0300
+++ b/telephonyserverplugins/multimodetsy/hayes/LINE.CPP	Wed Sep 01 12:40:21 2010 +0100
@@ -903,6 +903,143 @@
 		}
 	}
 
+//
+// CLineMobileFax
+// Fax Specific Line Functionality
+//
+CLineMobileFax* CLineMobileFax::NewL(CATIO* aATIO, CATInit* aInit,CPhoneGlobals* aPhoneGlobals,const TName& aName)
+	{
+	CLineMobileFax* FaxLine=new(ELeave) CLineMobileFax(aATIO,aInit,aPhoneGlobals);
+	TCleanupItem newLineFaxHayesClose(CloseLine,FaxLine);
+	CleanupStack::PushL(newLineFaxHayesClose);
+	FaxLine->ConstructL(aName);
+	CleanupStack::Pop();
+	return FaxLine;
+	}
+
+CLineMobileFax::CLineMobileFax(CATIO* aATIO, CATInit* aInit,CPhoneGlobals* aPhoneGlobals)
+	:CLineMobile(aATIO,aInit,aPhoneGlobals)
+	{}
+
+void CLineMobileFax::ConstructL(const TName& aName)
+//
+//	Constructs a call which is to be used only when an incoming call arrives
+//	and no client has designated an existing call to answer it. TSY holds responsibility to close 
+//	it unless a RING occurs, when the line will add the call to the linked list of calls 
+//  and alert any interested clients that a "new" call has been created - if any client then
+//	opens a handle on it, the TSY relinquishes any responsibility to close it in the future
+//	as the client has that responsibility. When the client opens a handle on it, using OpenByName
+//	the line will create a new PreAlloc'ed call. If no client opens a handle, when the line 
+//	stops ringing the line will remove the pre-alloc'ed call from the list and keep the pointer
+//	to it separately in CLineHayes::iPreAlloc, so any subsequent attempt by a client to 
+//  open a handle on it will fail with KErrDoesNotExist or something similar. 
+//
+	{
+	CLineHayes::ConstructL(aName);
+	TName preAllocName;
+	GenerateName(preAllocName);
+	CCallMobileFax* newCall=CCallMobileFax::NewL(iIo,iInit,iPhoneGlobals,preAllocName);
+	TCleanupItem newLineClose(CloseLine,newCall);
+	CleanupStack::PushL(newLineClose); 
+	newCall->SetNameL(&preAllocName);
+	newCall->SetOwnedByTSY();
+	newCall->SetOwner(this);	
+	iPreAlloc = CCallEntry::NewL(newCall);
+	CleanupStack::Pop();
+	}
+
+CLineMobileFax::~CLineMobileFax()
+	{}
+
+void CLineMobileFax::GenerateName(TDes& aName) 
+	{
+	aName.Append(KFaxCallName);
+	aName.AppendNum(iNameIndex++);
+	}
+
+CTelObject* CLineMobileFax::OpenNewObjectByNameL(const TDesC& aName)
+//
+//	Open a Fax call 
+//
+	{
+	CCallEntry* entry = NULL;
+	entry=CheckNewObject(aName); //if found in call list, must be a pre-alloc'ed call
+	if (!entry)	
+		{
+		CCallMobileFax* newCall=CCallMobileFax::NewL(iIo,iInit,iPhoneGlobals,aName);
+		TCleanupItem newLineClose(CloseLine,newCall);
+		CleanupStack::PushL(newLineClose); 
+		AppendNewCallL(newCall);
+		CleanupStack::Pop();
+		iPhoneGlobals->iNotificationStore->CheckNotification(this,ECallAdded);
+		return newCall;
+		}
+	else  // this is a pre-allocated call
+		{
+		TName preAllocatedCallName;	// pre-allocate next call
+		GenerateName(preAllocatedCallName);
+		CCallMobileFax* call=CCallMobileFax::NewL(iIo,iInit,iPhoneGlobals,preAllocatedCallName);
+		call->SetOwnedByTSY();
+		(void)User::LeaveIfError(call->SetName(&preAllocatedCallName));
+		call->SetOwner(this);
+		iPreAlloc = CCallEntry::NewL(call);
+
+		CCallHayes* oldpreAllocCall = entry->iCallHayes;
+		oldpreAllocCall->SetUnownedByTSY();
+		return oldpreAllocCall;
+		}
+	}
+
+CTelObject* CLineMobileFax::OpenNewObjectL(TDes& aNewName)
+//
+//	Open a fax call
+//
+	{
+	GenerateName(aNewName);
+	CCallMobileFax* newCall=CCallMobileFax::NewL(iIo,iInit,iPhoneGlobals,aNewName);
+	TCleanupItem newLineClose(CloseLine,newCall);
+	CleanupStack::PushL(newLineClose); 
+	AppendNewCallL(newCall);
+	CleanupStack::Pop();
+	iPhoneGlobals->iNotificationStore->CheckNotification(this,ECallAdded);
+	return newCall;
+	}
+
+TInt CLineMobileFax::GetCaps(const TTsyReqHandle aTsyReqHandle,RLine::TCaps* aLineCaps)
+	{
+	aLineCaps->iFlags = RLine::KCapsEventIncomingCall;
+	if (iPhoneGlobals->iPhoneStatus.iDataAndFaxFlags & KFaxCaps)
+		{
+		aLineCaps->iFlags |= RLine::KCapsFax;
+		}
+	ReqCompleted(aTsyReqHandle,KErrNone);
+	return KErrNone;
+	}
+
+TInt CLineMobileFax::GetCallInfo(const TTsyReqHandle aTsyReqHandle,TCallInfoIndex* aCallInfoIndex)
+//
+//	Provide info about fax call
+//
+	{
+	LOGTEXT(_L8("FaxLine:\tGet Fax Call Info"));
+	CCallEntry* callEntry;
+	TDblQueIter<CCallEntry> iter(iCalls);
+	iter.SetToFirst();
+	for (TInt i=0;i<(TInt)(aCallInfoIndex->iIndex);i++)
+		{
+		iter++;
+		}
+	callEntry=iter;
+	if (callEntry)
+		{
+		callEntry->iCallHayes->GetCallInfo(aCallInfoIndex);
+		aCallInfoIndex->iInfo.iCallCapsFlags |= RCall::KCapsFax;
+		ReqCompleted(aTsyReqHandle,KErrNone);
+		}
+	else
+		ReqCompleted(aTsyReqHandle,KErrNotFound);
+	return KErrNone;
+	}
 
 CCallEntry* CCallEntry::NewL(CCallHayes* aCallHayes)
 //