telephonyserverplugins/multimodetsy/hayes/PHONE.CPP
changeset 20 244d7c5f118e
parent 0 3553901f7fa8
child 24 6638e7f4bd8f
child 66 07a122eea281
equal deleted inserted replaced
19:1f776524b15c 20:244d7c5f118e
   280 		iDataLine=CLineMobileData::NewL(iIo,iInit,iPhoneGlobals,aName);
   280 		iDataLine=CLineMobileData::NewL(iIo,iInit,iPhoneGlobals,aName);
   281 		if (iPhoneGlobals->iPhoneStatus.iLineStatus == RCall::EStatusUnknown)
   281 		if (iPhoneGlobals->iPhoneStatus.iLineStatus == RCall::EStatusUnknown)
   282 			iPhoneGlobals->iPhoneStatus.iLineStatus = RCall::EStatusIdle;
   282 			iPhoneGlobals->iPhoneStatus.iLineStatus = RCall::EStatusIdle;
   283 		return iDataLine;
   283 		return iDataLine;
   284 		}
   284 		}
   285 	else if (!aName.CompareF(KFaxLineName))
       
   286 		{
       
   287 		__ASSERT_ALWAYS(iFaxLine==NULL,Panic(ELineAlreadyExists));
       
   288 		iFaxLine=CLineMobileFax::NewL(iIo,iInit,iPhoneGlobals,aName);
       
   289 		if (iPhoneGlobals->iPhoneStatus.iLineStatus == RCall::EStatusUnknown)
       
   290 			iPhoneGlobals->iPhoneStatus.iLineStatus = RCall::EStatusIdle;
       
   291 		return iFaxLine;
       
   292 		}
       
   293 	
   285 	
   294 	else if (!aName.CompareF(KVoiceLineName)) //Added for Java Demo 4.4.99
   286 	else if (!aName.CompareF(KVoiceLineName)) //Added for Java Demo 4.4.99
   295 		{
   287 		{
   296 		__ASSERT_ALWAYS(iVoiceLine==NULL,Panic(ELineAlreadyExists));
   288 		__ASSERT_ALWAYS(iVoiceLine==NULL,Panic(ELineAlreadyExists));
   297 		iVoiceLine=CLineMobileVoice::NewL(iIo,iInit,iPhoneGlobals,aName);
   289 		iVoiceLine=CLineMobileVoice::NewL(iIo,iInit,iPhoneGlobals,aName);
   465 //	TLineInfoIndex specifies which of the two lines' info is requested. If that line has not
   457 //	TLineInfoIndex specifies which of the two lines' info is requested. If that line has not
   466 //	been created yet, default info is passed back.
   458 //	been created yet, default info is passed back.
   467 //
   459 //
   468 	{
   460 	{
   469 	LOGTEXT(_L8("Phone:\tGet Line Info"));
   461 	LOGTEXT(_L8("Phone:\tGet Line Info"));
   470 	if (aParams->iIndex==KFaxLineIndex)
   462 	 if (aParams->iIndex==KDataLineIndex)
   471 		{
       
   472 		if (iFaxLine!=NULL)
       
   473 			{
       
   474 			aParams->iInfo.iStatus = iPhoneGlobals->iPhoneStatus.iLineStatus;
       
   475 			aParams->iInfo.iName = iFaxLine->iLineName;
       
   476 			aParams->iInfo.iLineCapsFlags = (RLine::KCapsFax|RLine::KCapsEventIncomingCall);
       
   477 			}
       
   478 		else
       
   479 			{
       
   480 			aParams->iInfo = iDefaultFaxLineInfo;
       
   481 			}
       
   482 		ReqCompleted(aTsyReqHandle,KErrNone);
       
   483 		}
       
   484 	else if (aParams->iIndex==KDataLineIndex)
       
   485 		{
   463 		{
   486 		if (iDataLine!=NULL)
   464 		if (iDataLine!=NULL)
   487 			{
   465 			{
   488 			aParams->iInfo.iStatus = iPhoneGlobals->iPhoneStatus.iLineStatus;
   466 			aParams->iInfo.iStatus = iPhoneGlobals->iPhoneStatus.iLineStatus;
   489 			aParams->iInfo.iName = iDataLine->iLineName;
   467 			aParams->iInfo.iName = iDataLine->iLineName;
   521 //	When a line closes, it calls this to remove its pointer from CPhoneHayes
   499 //	When a line closes, it calls this to remove its pointer from CPhoneHayes
   522 //
   500 //
   523 	{
   501 	{
   524 	if (aLineHayes == iDataLine)
   502 	if (aLineHayes == iDataLine)
   525 		iDataLine=NULL;
   503 		iDataLine=NULL;
   526 	if (aLineHayes == iFaxLine)
       
   527 		iFaxLine=NULL;
       
   528 	if (aLineHayes == iVoiceLine)
   504 	if (aLineHayes == iVoiceLine)
   529 		iVoiceLine=NULL;
   505 		iVoiceLine=NULL;
   530 	}
   506 	}
   531 
   507 
   532 void CPhoneHayes::StartWaitForRing()
   508 void CPhoneHayes::StartWaitForRing()
   549 	if((!nokiaPhone)||(aIndex==KVoiceLineIndex)||(aIndex==KFaxLineIndex))
   525 	if((!nokiaPhone)||(aIndex==KVoiceLineIndex)||(aIndex==KFaxLineIndex))
   550 		{
   526 		{
   551 		CLineHayes* line=NULL;
   527 		CLineHayes* line=NULL;
   552 		switch (aIndex)
   528 		switch (aIndex)
   553 			{
   529 			{
   554 		case KFaxLineIndex:
       
   555 			line=iFaxLine;
       
   556 			break;
       
   557 		case KDataLineIndex:
   530 		case KDataLineIndex:
   558 			line=iDataLine;
   531 			line=iDataLine;
   559 			break;
   532 			break;
   560 		case KVoiceLineIndex:
   533 		case KVoiceLineIndex:
   561 			line=iVoiceLine;
   534 			line=iVoiceLine;
   597 	if((iDataLine)&&(iDataLine->AnswerIfPossible()))	// First priority: if we're waiting for a Data call, answer it
   570 	if((iDataLine)&&(iDataLine->AnswerIfPossible()))	// First priority: if we're waiting for a Data call, answer it
   598 		{
   571 		{
   599 		LOGTEXT(_L8("SetAmbiguousDataFaxCallRinging()\tInterpretting as data call"));
   572 		LOGTEXT(_L8("SetAmbiguousDataFaxCallRinging()\tInterpretting as data call"));
   600 		return;
   573 		return;
   601 		}
   574 		}
   602 	if((iFaxLine)&&(iFaxLine->AnswerIfPossible()))		// Second priority: if we're waiting for a Fax call, answer it
   575 	// So both lines MIGHT exist.  It's then down to Notify on incoming call notifications,
   603 		{
       
   604 		LOGTEXT(_L8("SetAmbiguousDataFaxCallRinging()\tInterpretting as fax call"));
       
   605 		return;
       
   606 		}
       
   607 // If there are no "answer an incoming call" requests, then see if we can determine it from the lines that are open...
       
   608 	if(!iFaxLine && iDataLine)	
       
   609 		{
       
   610 		LOGTEXT(_L8("SetAmbiguousDataFaxCallRinging()\tLine object creation: SetPreAllocCall on DataLine"));
       
   611 		iDataLine->SetPreAllocCall();
       
   612 		return;
       
   613 		}
       
   614 	if(!iDataLine && iFaxLine)
       
   615 		{
       
   616 		LOGTEXT(_L8("SetAmbiguousDataFaxCallRinging()\tLine object creation: SetPreAllocCall on FaxLine"));
       
   617 		iFaxLine->SetPreAllocCall();
       
   618 		return;
       
   619 		}
       
   620 // So both lines MIGHT exist.  It's then down to Notify on incoming call notifications,
       
   621 // and we'll make a priority call in favour of data...
   576 // and we'll make a priority call in favour of data...
   622 // First ensure that either a Data line or a Fax line does exist (Nokia 7110 fix: returns
   577 // First ensure that either a Data line or a Fax line does exist (Nokia 7110 fix: returns
   623 // +CRING: REL ASYNC for a voice call (hence a voice line is created). This response
   578 // +CRING: REL ASYNC for a voice call (hence a voice line is created). This response
   624 // however, is correctly treated as an incoming indication for a Data or Fax call).
   579 // however, is correctly treated as an incoming indication for a Data or Fax call).
   625 	if (iDataLine)
   580 	if (iDataLine)
   626 		{
   581 		{
   627 		LOGTEXT(_L8("SetAmbiguousDataFaxCallRinging()\tA DataLine has been found. Now checking for an outstanding Notification"));
   582 		LOGTEXT(_L8("SetAmbiguousDataFaxCallRinging()\tA DataLine has been found. Now checking for an outstanding Notification"));
   628 		
   583 		
   629 		if((iDataLine->IsNotifyIncomingCallOutstanding())&&
   584 		if(iDataLine->IsNotifyIncomingCallOutstanding())
   630 		   (!iFaxLine->IsNotifyIncomingCallOutstanding()))
       
   631 			{
   585 			{
   632 			LOGTEXT(_L8("SetAmbiguousDataFaxCallRinging()\tNotify: SetPreAllocCall on DataLine"));
   586 			LOGTEXT(_L8("SetAmbiguousDataFaxCallRinging()\tNotify: SetPreAllocCall on DataLine"));
   633 			iDataLine->SetPreAllocCall();
   587 			iDataLine->SetPreAllocCall();
   634 			}
   588 			}
   635 		}
   589 		}
   636 	else 
   590 	else 
   637 		LOGTEXT(_L8("SetAmbiguousDataFaxCallRinging()\tNo DataLine has been found; this may be a voice call"));
   591 		LOGTEXT(_L8("SetAmbiguousDataFaxCallRinging()\tNo DataLine has been found; this may be a voice call"));
   638 	if (iFaxLine)
       
   639 		{
       
   640 		LOGTEXT(_L8("SetAmbiguousDataFaxCallRinging()\tA FaxLine has been found. Now checking for an outstanding Notification"));
       
   641 		if ((iFaxLine->IsNotifyIncomingCallOutstanding()) &&
       
   642 			(!iDataLine->IsNotifyIncomingCallOutstanding()))
       
   643 			{	
       
   644 			LOGTEXT(_L8("SetAmbiguousDataFaxCallRinging()\tNotify: SetPreAllocCall on FaxLine"));
       
   645 			iFaxLine->SetPreAllocCall();
       
   646 			}
       
   647 		}
       
   648 	else 
       
   649 		LOGTEXT(_L8("SetAmbiguousDataFaxCallRinging()\tNo FaxLine has been found; this may be a voice call"));
       
   650 	}
   592 	}
   651 
   593 
   652 void CPhoneHayes::StopRinging()
   594 void CPhoneHayes::StopRinging()
   653 	{
   595 	{
   654 	if (iDataLine)
   596 	if (iDataLine)
   656 		(void)iDataLine->StopMyCallRinging();
   598 		(void)iDataLine->StopMyCallRinging();
   657 		iDataLine->ResetPreAllocCall();	// this may not revert the call to PreAlloc status as
   599 		iDataLine->ResetPreAllocCall();	// this may not revert the call to PreAlloc status as
   658 										// the call may have been opened by a client but not
   600 										// the call may have been opened by a client but not
   659 										// answered.
   601 										// answered.
   660 		}
   602 		}
   661 	if (iFaxLine)
       
   662 		{
       
   663 		(void)iFaxLine->StopMyCallRinging();
       
   664 		iFaxLine->ResetPreAllocCall();	// ditto
       
   665 		}
       
   666 	if (iVoiceLine)
   603 	if (iVoiceLine)
   667 		{
   604 		{
   668 		(void)iVoiceLine->StopMyCallRinging();
   605 		(void)iVoiceLine->StopMyCallRinging();
   669 		iVoiceLine->ResetPreAllocCall();	// ditto
   606 		iVoiceLine->ResetPreAllocCall();	// ditto
   670 		}
   607 		}
   678 
   615 
   679 void CPhoneHayes::SetHookStatus(RCall::THookStatus aHookStatus)
   616 void CPhoneHayes::SetHookStatus(RCall::THookStatus aHookStatus)
   680 	{
   617 	{
   681 	if (iDataLine)
   618 	if (iDataLine)
   682 		iDataLine->SetCallsHookStatus(aHookStatus);
   619 		iDataLine->SetCallsHookStatus(aHookStatus);
   683 	if (iFaxLine)
   620 	
   684 		iFaxLine->SetCallsHookStatus(aHookStatus);
       
   685 	}
   621 	}
   686 
   622 
   687 TBool CPhoneHayes::CheckForOutstandingAnswer() const
   623 TBool CPhoneHayes::CheckForOutstandingAnswer() const
   688 //
   624 //
   689 //	Returns TRUE if any call in the system has AnswerIncomingCall() outstanding on it.
   625 //	Returns TRUE if any call in the system has AnswerIncomingCall() outstanding on it.
   690 //
   626 //
   691 	{
   627 	{
   692 	TBool check=EFalse;
   628 	TBool check=EFalse;
   693 	if (iDataLine)
   629 	if (iDataLine)
   694 		check = iDataLine->CheckForOutstandingAnswer();
   630 		check = iDataLine->CheckForOutstandingAnswer();
   695 	if (!check && iFaxLine)
   631 	
   696 		check = iFaxLine->CheckForOutstandingAnswer();
       
   697 	if (!check && iVoiceLine)
   632 	if (!check && iVoiceLine)
   698 		check = iVoiceLine->CheckForOutstandingAnswer();
   633 		check = iVoiceLine->CheckForOutstandingAnswer();
   699 	return check;
   634 	return check;
   700 	}
   635 	}
   701 
   636 
   702 void CPhoneHayes::CancelOtherRingingCall(CLineHayes* aLine) const
   637 void CPhoneHayes::CancelOtherRingingCall(CLineHayes* aLine) const
   703 	{
   638 	{
   704 	if (iFaxLine && aLine!=iFaxLine)
       
   705 		{
       
   706 		(void)iFaxLine->StopMyCallRinging();
       
   707 		iFaxLine->ResetPreAllocCall();	
       
   708 		}
       
   709 
       
   710 	if (iDataLine && aLine!=iDataLine)
   639 	if (iDataLine && aLine!=iDataLine)
   711 		{
   640 		{
   712 		(void)iDataLine->StopMyCallRinging();
   641 		(void)iDataLine->StopMyCallRinging();
   713 		iDataLine->ResetPreAllocCall();	
   642 		iDataLine->ResetPreAllocCall();	
   714 		}
   643 		}