901 iPreAlloc->iCallHayes->ResetIsForIncomingCall(); |
901 iPreAlloc->iCallHayes->ResetIsForIncomingCall(); |
902 } |
902 } |
903 } |
903 } |
904 } |
904 } |
905 |
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 |
906 |
1044 CCallEntry* CCallEntry::NewL(CCallHayes* aCallHayes) |
907 CCallEntry* CCallEntry::NewL(CCallHayes* aCallHayes) |
1045 // |
908 // |
1046 // Call Entry has a pointer to the call, and makes up an entry in the linked list iCalls |
909 // Call Entry has a pointer to the call, and makes up an entry in the linked list iCalls |
1047 // |
910 // |