1 /* |
1 /* |
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This component and the accompanying materials are made available |
4 * This component and the accompanying materials are made available |
5 * under the terms of the License "Eclipse Public License v1.0" |
5 * under the terms of the License "Eclipse Public License v1.0" |
6 * which accompanies this distribution, and is available |
6 * which accompanies this distribution, and is available |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
31 #include "cmmphonebookoperationinit.h" |
31 #include "cmmphonebookoperationinit.h" |
32 #include "cmmphonebookoperationinit3g_adn.h" |
32 #include "cmmphonebookoperationinit3g_adn.h" |
33 #include "cmmphonebookoperationread.h" |
33 #include "cmmphonebookoperationread.h" |
34 #include "cmmphonebookoperationread3g_adn.h" |
34 #include "cmmphonebookoperationread3g_adn.h" |
35 #include "cmmphonebookoperationcache.h" |
35 #include "cmmphonebookoperationcache.h" |
|
36 #include "cmmphonebookoperationcache3g_adn.h" |
36 #include "cmmphonebookoperationwrite.h" |
37 #include "cmmphonebookoperationwrite.h" |
|
38 #include "cmmphonebookoperationwrite3g_adn.h" |
37 #include "cmmphonebookoperationdelete.h" |
39 #include "cmmphonebookoperationdelete.h" |
38 #include "cmmphonebookstoreoperationlist.h" |
40 #include "cmmphonebookstoreoperationlist.h" |
39 #include "cmmphonebookstoreoperationbase.h" |
41 #include "cmmphonebookstoreoperationbase.h" |
40 #include "cmmmessagerouter.h" |
42 #include "cmmmessagerouter.h" |
41 #include "OstTraceDefinitions.h" |
43 #include "OstTraceDefinitions.h" |
95 // --------------------------------------------------------------------------- |
98 // --------------------------------------------------------------------------- |
96 // TPrimitiveInitInfo::GetPBEntryFromUICCData |
99 // TPrimitiveInitInfo::GetPBEntryFromUICCData |
97 // Separate phonebook entry from ISI message |
100 // Separate phonebook entry from ISI message |
98 // --------------------------------------------------------------------------- |
101 // --------------------------------------------------------------------------- |
99 // |
102 // |
100 |
|
101 void TPrimitiveInitInfo::GetPBEntryFromUICCData( |
103 void TPrimitiveInitInfo::GetPBEntryFromUICCData( |
102 const TDesC8& aFileData, |
104 const TDesC8& aFileData, |
103 TDes8& aNumber, |
105 TDes8& aNumber, |
104 TDes8& aName) |
106 TDes8& aName) |
105 { |
107 { |
106 TUint8 nameLength (0); |
108 TUint8 nameLength( iAlphaStringlength ); |
107 TUint8 numLength(0); |
109 TUint8 numLength( 0 ); |
108 |
110 |
109 // Maximum record length will be RecordLength -14 |
111 if ( iAlphaStringlength ) |
110 // Actual string length can be find the first FF , which indicates that after |
112 { |
111 // that its empty |
113 // If actual alpha string is shorter than defined in entry structure, |
112 nameLength = aFileData.Find(&KTagUnusedbyte,1); |
114 // copy it until the first 'FF' |
113 // Check if MAX length is smaller than the MAX alpha string length |
115 TInt endOfAlphaString( aFileData.Find( &KTagUnusedbyte, 1 ) ); |
114 if( iAlphaStringlength < nameLength) |
116 if ( endOfAlphaString > 0 && endOfAlphaString < iAlphaStringlength ) |
115 { |
117 { |
116 // Max lenght wil be the valid alpha string Length |
118 nameLength = endOfAlphaString; |
117 nameLength = iAlphaStringlength; |
119 } |
118 } |
|
119 |
|
120 numLength = aFileData[iAlphaStringlength]; |
|
121 |
|
122 // Chekc for number Length also |
|
123 if( iNumlength < numLength) |
|
124 { |
|
125 numLength = iNumlength; |
|
126 } |
|
127 |
|
128 // Save name |
|
129 if ( KMinLength < nameLength ) |
|
130 { |
|
131 TFLOGSTRING("TSY: TPrimitiveInitInfo::GetPBEntryFromUICCData. Saving name."); |
120 TFLOGSTRING("TSY: TPrimitiveInitInfo::GetPBEntryFromUICCData. Saving name."); |
132 OstTrace0( TRACE_NORMAL, TPRIMITIVEINITINFO_GETPBENTRYFROMUICCDATA, "TPrimitiveInitInfo::GetPBEntryFromUICCData. Saving Name" ); |
121 OstTrace0( TRACE_NORMAL, TPRIMITIVEINITINFO_GETPBENTRYFROMUICCDATA, "TPrimitiveInitInfo::GetPBEntryFromUICCData. Saving Name" ); |
133 |
122 aName.Copy( aFileData.Mid( 0, nameLength ) ); |
134 aName.Copy(aFileData.Mid(0,nameLength)); |
123 } |
135 } |
124 // No else. Alpha string length is 0 and it is not copied |
136 //no else |
125 |
|
126 numLength = aFileData[iAlphaStringlength]; |
|
127 |
|
128 // Check for number Length also |
|
129 if( iNumlength < numLength) |
|
130 { |
|
131 numLength = iNumlength; |
|
132 } |
|
133 // no else |
137 // Save number |
134 // Save number |
138 if ( KMinLength < numLength ) |
135 if ( KMinLength < numLength ) |
139 { |
136 { |
140 TFLOGSTRING("TSY: TPrimitiveInitInfo::GetPBEntryFromUICCData. Saving number."); |
137 TFLOGSTRING("TSY: TPrimitiveInitInfo::GetPBEntryFromUICCData. Saving number."); |
141 OstTrace0( TRACE_NORMAL, DUP1_TPRIMITIVEINITINFO_GETPBENTRYFROMUICCDATA, "TPrimitiveInitInfo::GetPBEntryFromUICCData. Save Number" ); |
138 OstTrace0( TRACE_NORMAL, DUP1_TPRIMITIVEINITINFO_GETPBENTRYFROMUICCDATA, "TPrimitiveInitInfo::GetPBEntryFromUICCData. Save Number" ); |
455 if( UICC_CARD_TYPE_ICC == iMmUiccMessHandler->GetCardType()) |
452 if( UICC_CARD_TYPE_ICC == iMmUiccMessHandler->GetCardType()) |
456 { |
453 { |
457 //call CmmPhonebookOperationWrite |
454 //call CmmPhonebookOperationWrite |
458 pointer = CMmPhoneBookOperationWrite::NewL( |
455 pointer = CMmPhoneBookOperationWrite::NewL( |
459 this, |
456 this, |
|
457 iMmUiccMessHandler, |
460 aDataPackage ); |
458 aDataPackage ); |
461 } |
459 } |
462 else if( UICC_CARD_TYPE_UICC == iMmUiccMessHandler->GetCardType() ) |
460 else if( UICC_CARD_TYPE_UICC == iMmUiccMessHandler->GetCardType() ) |
463 { |
461 { |
464 //call CmmPhonebookOperationWrite |
462 // needs to be changed after 3g ADN implmentation |
465 pointer = CMmPhoneBookOperationWrite::NewL( |
463 // to be implemented for 3G |
|
464 pointer = CMmPhoneBookOperationWrite3g_adn::NewL( |
466 this, |
465 this, |
|
466 iMmUiccMessHandler, |
467 aDataPackage ); |
467 aDataPackage ); |
468 } |
468 } |
469 break; |
469 break; |
470 } |
470 } |
471 case EMmTsyPhoneBookStoreDeleteIPC: |
471 case EMmTsyPhoneBookStoreDeleteIPC: |
590 aName.Zero(); |
595 aName.Zero(); |
591 aNumber.Zero(); |
596 aNumber.Zero(); |
592 } |
597 } |
593 |
598 |
594 |
599 |
|
600 // --------------------------------------------------------------------------- |
|
601 // CMmPhoneBookStoreMessHandler::StoreAnrToPbEntry |
|
602 // |
|
603 // --------------------------------------------------------------------------- |
|
604 // |
|
605 |
|
606 void CMmPhoneBookStoreMessHandler::StoreAnrToPhonebookEntryL( |
|
607 TDes8& aAnr, |
|
608 CPhoneBookStoreEntry& aEntry, |
|
609 const TUint16 aFileId ) |
|
610 { |
|
611 TFLOGSTRING("TSY: CMmPhoneBookStoreOperationBase::StoreAnrToPhonebookEntryL."); |
|
612 OstTrace0( TRACE_NORMAL, CMMPHONEBOOKSTOREMESSHANDLER_STOREANRTOPHONEBOOKENTRYL, "CMmPhoneBookStoreMessHandler::StoreAnrToPhonebookEntryL" ); |
|
613 |
|
614 TInt anrLength( aAnr.Length() ); |
|
615 if ( KMaxAnrLength < anrLength ) |
|
616 { |
|
617 aAnr.SetLength( KMaxAnrLength ); |
|
618 } |
|
619 |
|
620 TBufC8<KMaxAnrLength> anrSourceBuf( aAnr ); |
|
621 TBuf16<KMaxAnrLength> anrTargetBuf; |
|
622 |
|
623 // Convert 8-bit number to 16-bit ascii code |
|
624 ConvertToUcs2FromBCD( aAnr, anrTargetBuf, aFileId ); |
|
625 // Add ANR entry to cache |
|
626 aEntry.iAnr->AppendL( anrTargetBuf ); |
|
627 } |
|
628 |
|
629 // --------------------------------------------------------------------------- |
|
630 // CMmPhoneBookStoreMessHandler::StoreSneToPbEntry |
|
631 // |
|
632 // --------------------------------------------------------------------------- |
|
633 // |
|
634 |
|
635 void CMmPhoneBookStoreMessHandler::StoreSneEmailToPbEntryL( |
|
636 TDes8& aString, |
|
637 CPhoneBookStoreEntry& aEntry, |
|
638 TUint8 aFileTypeTag ) |
|
639 { |
|
640 TFLOGSTRING("TSY: CMmPhoneBookStoreOperationBase::StoreSneToPbEntry."); |
|
641 OstTrace0( TRACE_NORMAL, CMMPHONEBOOKSTOREMESSHANDLER_STORESNETOPBENTRY, "CMmPhoneBookStoreMessHandler::StoreSneToPbEntry" ); |
|
642 |
|
643 if ( aString.Length() ) |
|
644 { |
|
645 TBuf16<KMaxSneLength> targetString; // Final SNE/EMAIL for cache |
|
646 TBuf8<KMaxSneLength> outputString; // Temporary for converting |
|
647 |
|
648 CMmStaticUtility::ConvertGsmDataToUcs2( |
|
649 aString, |
|
650 aString.Length(), |
|
651 outputString ); |
|
652 // From 8-bit to 16-bit |
|
653 TIsiUtility::CopyFromBigEndian( outputString, targetString ); |
|
654 |
|
655 if ( UICC_SNE_PRIM_TAG == aFileTypeTag ) |
|
656 { |
|
657 aEntry.iSne->AppendL( targetString ); |
|
658 } |
|
659 else if ( UICC_EMAIL_PRIM_TAG == aFileTypeTag ) |
|
660 { |
|
661 aEntry.iEmail->AppendL( targetString ); |
|
662 } |
|
663 // No else |
|
664 } |
|
665 // No else. If no data, nothing is appended |
|
666 } |
595 |
667 |
596 |
668 |
597 // ----------------------------------------------------------------------------- |
669 // ----------------------------------------------------------------------------- |
598 // CMmPhoneBookStoreMessHandler::CopyToUcs2FromBCD |
670 // CMmPhoneBookStoreMessHandler::CopyToUcs2FromBCD |
599 // Copies unsigned BCD coded digits to Ascii code |
671 // Copies unsigned BCD coded digits to Ascii code |
902 // CMmPhoneBookStoreMessHandler::IndexCheckInPBList |
974 // CMmPhoneBookStoreMessHandler::IndexCheckInPBList |
903 // Gets pointer to CMmMessageRouter object. |
975 // Gets pointer to CMmMessageRouter object. |
904 // --------------------------------------------------------------------------- |
976 // --------------------------------------------------------------------------- |
905 // |
977 // |
906 |
978 |
907 TBool CMmPhoneBookStoreMessHandler::IndexCheckInPBList( TUint8 aIndex, TUint8 aPBIndex, TPBEntry& aEntry ) |
979 TBool CMmPhoneBookStoreMessHandler::IndexCheckInPBList( |
|
980 TUint8 aIndex, |
|
981 TUint8 aPBIndex, |
|
982 TPBEntry& aEntry ) |
908 { |
983 { |
909 TFLOGSTRING("TSY: CMmPhoneBookStoreMessHandler::IndexCheckInPBList"); |
984 TFLOGSTRING("TSY: CMmPhoneBookStoreMessHandler::IndexCheckInPBList"); |
910 OstTrace0( TRACE_NORMAL, CMMPHONEBOOKSTOREMESSHANDLER_INDEXCHECKINPBLIST, "CMmPhoneBookStoreMessHandler::IndexCheckInPBList" ); |
985 OstTrace0( TRACE_NORMAL, CMMPHONEBOOKSTOREMESSHANDLER_INDEXCHECKINPBLIST, "CMmPhoneBookStoreMessHandler::IndexCheckInPBList" ); |
911 |
986 |
912 TBool entryFound( EFalse ); |
987 TBool entryFound( EFalse ); |
926 // CMmPhoneBookStoreMessHandler::GetIndexForPresentEntry |
1001 // CMmPhoneBookStoreMessHandler::GetIndexForPresentEntry |
927 // Gets the index for present entry in the Stored list |
1002 // Gets the index for present entry in the Stored list |
928 // --------------------------------------------------------------------------- |
1003 // --------------------------------------------------------------------------- |
929 // |
1004 // |
930 |
1005 |
931 TInt CMmPhoneBookStoreMessHandler::GetIndexForPresentEntry( TUint8 aIndex, TUint8 aPBIndex ) |
1006 TInt CMmPhoneBookStoreMessHandler::GetIndexForPresentEntry( |
|
1007 TUint8 aIndex, |
|
1008 TUint8 aPBIndex ) |
932 { |
1009 { |
933 TFLOGSTRING("TSY: CMmPhoneBookStoreMessHandler::GetIndexForPresentEntry"); |
1010 TFLOGSTRING("TSY: CMmPhoneBookStoreMessHandler::GetIndexForPresentEntry"); |
934 OstTrace0( TRACE_NORMAL, CMMPHONEBOOKSTOREMESSHANDLER_GETINDEXFORPRESENTENTRY, "CMmPhoneBookStoreMessHandler::GetIndexForPresentEntry" ); |
1011 OstTrace0( TRACE_NORMAL, CMMPHONEBOOKSTOREMESSHANDLER_GETINDEXFORPRESENTENTRY, "CMmPhoneBookStoreMessHandler::GetIndexForPresentEntry" ); |
935 |
1012 |
936 TInt count( -1 ); |
1013 TInt count( -1 ); |
973 // CMmPhoneBookStoreMessHandler::EmptyEntryCheckInPBList |
1050 // CMmPhoneBookStoreMessHandler::EmptyEntryCheckInPBList |
974 // Gets pointer to CMmMessageRouter object. |
1051 // Gets pointer to CMmMessageRouter object. |
975 // --------------------------------------------------------------------------- |
1052 // --------------------------------------------------------------------------- |
976 // |
1053 // |
977 |
1054 |
978 void CMmPhoneBookStoreMessHandler::UpdateEntryFromList( TPBEntry* aEntry, TUint8 aIndex , TUint8 aPBIndex) |
1055 void CMmPhoneBookStoreMessHandler::UpdateEntryFromList( |
|
1056 TPBEntry* aEntry, |
|
1057 TUint8 aIndex , |
|
1058 TUint8 aPBIndex) |
979 { |
1059 { |
980 TFLOGSTRING("TSY: CMmPhoneBookStoreMessHandler::RemoveEntryFromList"); |
1060 TFLOGSTRING("TSY: CMmPhoneBookStoreMessHandler::RemoveEntryFromList"); |
981 OstTrace0( TRACE_NORMAL, CMMPHONEBOOKSTOREMESSHANDLER_REMOVEENTRYFROMLIST, "CMmPhoneBookStoreMessHandler::RemoveEntryFromList" ); |
1061 OstTrace0( TRACE_NORMAL, CMMPHONEBOOKSTOREMESSHANDLER_REMOVEENTRYFROMLIST, "CMmPhoneBookStoreMessHandler::RemoveEntryFromList" ); |
982 |
1062 |
983 iPBEntryList[aPBIndex].iEntryList[aIndex] = aEntry; |
1063 iPBEntryList[aPBIndex].iEntryList[aIndex] = aEntry; |
988 // CMmPhoneBookStoreMessHandler::RemoveExtEntryFromList |
1068 // CMmPhoneBookStoreMessHandler::RemoveExtEntryFromList |
989 // REmove the EXt record form the stored list |
1069 // REmove the EXt record form the stored list |
990 // --------------------------------------------------------------------------- |
1070 // --------------------------------------------------------------------------- |
991 // |
1071 // |
992 |
1072 |
993 void CMmPhoneBookStoreMessHandler::RemoveExtEntryFromList( TUint8 aIndex , TUint8 aPBIndex) |
1073 void CMmPhoneBookStoreMessHandler::RemoveExtEntryFromList( |
|
1074 TUint8 aIndex , |
|
1075 TUint8 aPBIndex) |
994 { |
1076 { |
995 TFLOGSTRING("TSY: CMmPhoneBookStoreMessHandler::RemoveExtEntryFromList"); |
1077 TFLOGSTRING("TSY: CMmPhoneBookStoreMessHandler::RemoveExtEntryFromList"); |
996 OstTrace0( TRACE_NORMAL, CMMPHONEBOOKSTOREMESSHANDLER_REMOVEEXTENTRYFROMLIST, "CMmPhoneBookStoreMessHandler::RemoveExtEntryFromList" ); |
1078 OstTrace0( TRACE_NORMAL, CMMPHONEBOOKSTOREMESSHANDLER_REMOVEEXTENTRYFROMLIST, "CMmPhoneBookStoreMessHandler::RemoveExtEntryFromList" ); |
997 |
1079 |
998 TInt count = iPBEntryList[aPBIndex].iEntryList[aIndex]->PBEntryExtRecord.Count(); |
1080 TInt count = iPBEntryList[aPBIndex].iEntryList[aIndex]->PBEntryExtRecord.Count(); |
1044 OstTrace0( TRACE_NORMAL, CMMPHONEBOOKSTOREMESSHANDLER_PHONETSENDER, "CMmPhoneBookStoreMessHandler::PhoNetSender" ); |
1126 OstTrace0( TRACE_NORMAL, CMMPHONEBOOKSTOREMESSHANDLER_PHONETSENDER, "CMmPhoneBookStoreMessHandler::PhoNetSender" ); |
1045 |
1127 |
1046 return iPhoNetSender; |
1128 return iPhoNetSender; |
1047 } |
1129 } |
1048 |
1130 |
|
1131 // --------------------------------------------------------------------------- |
|
1132 // CMmPhoneBookStoreMessHandler::FindEntryFromPbList |
|
1133 // Finds PB entry from iPBEntryList |
|
1134 // --------------------------------------------------------------------------- |
|
1135 // |
|
1136 TPBEntry* CMmPhoneBookStoreMessHandler::FindEntryFromPbList( |
|
1137 TUint8 aIndex, |
|
1138 TUint8 aRecordNo ) |
|
1139 { |
|
1140 TFLOGSTRING("TSY: CMmPhoneBookStoreMessHandler::FindEntryFromPbList"); |
|
1141 OstTrace0( TRACE_NORMAL, CMMPHONEBOOKSTOREMESSHANDLER_FINDENTRYFROMPBLIST, "CMmPhoneBookStoreMessHandler::FindEntryFromPbList" ); |
|
1142 |
|
1143 TPBEntry* ret( NULL ); |
|
1144 |
|
1145 for( int i = 0; i < iPBEntryList[aIndex].iEntryList.Count(); i++ ) |
|
1146 { |
|
1147 if( aRecordNo == iPBEntryList[aIndex].iEntryList[i]->iEntryIndex ) |
|
1148 { |
|
1149 ret = iPBEntryList[aIndex].iEntryList[i]; |
|
1150 break; |
|
1151 } |
|
1152 } |
|
1153 return ret; |
|
1154 } |
|
1155 |
|
1156 |
|
1157 // --------------------------------------------------------------------------- |
|
1158 // CMmPhoneBookStoreMessHandler::GetEntryForType2FileId |
|
1159 // Finds PB entry from iPBEntryList |
|
1160 // --------------------------------------------------------------------------- |
|
1161 // |
|
1162 void CMmPhoneBookStoreMessHandler::GetEntriesForType2FileId( |
|
1163 const TInt aCurrentType2EfIndex, |
|
1164 const TInt aCurrentRecordNum, |
|
1165 RArray<TInt>& aArray ) |
|
1166 { |
|
1167 TFLOGSTRING("TSY: CMmPhoneBookStoreMessHandler::GetEntryForType2FileId"); |
|
1168 OstTrace0( TRACE_NORMAL, CMMPHONEBOOKSTOREMESSHANDLER_GETENTRYFORTYPE2FILEID, "CMmPhoneBookStoreMessHandler::GetEntryForType2FileId" ); |
|
1169 TInt numOfEntries( iPBEntryList[EPhonebookTypeAdn].iEntryList.Count() ); |
|
1170 |
|
1171 // Loop all entries that have been created |
|
1172 for ( TInt i( 0 ); i < numOfEntries; i++ ) |
|
1173 { |
|
1174 TPBEntry* entry( iPBEntryList[EPhonebookTypeAdn].iEntryList[i] ); |
|
1175 if ( entry ) |
|
1176 { |
|
1177 RArray<TIapInfo> iapInfo( entry->iapInfo ); |
|
1178 // There are as many IAP infos in entry as type 2 files in PBR |
|
1179 // Those have been stored in same order as type 2 files in PBR |
|
1180 // So when elementary file order number is known, corresponding |
|
1181 // IAP info is known. If recored number there is same as current |
|
1182 // record number, this type 2 file belongs to this ADN entry |
|
1183 if ( ( aCurrentType2EfIndex < iapInfo.Count() ) && |
|
1184 ( aCurrentRecordNum == iapInfo[aCurrentType2EfIndex].recordNo) ) |
|
1185 { |
|
1186 aArray.Append( entry->iEntryIndex ); |
|
1187 } |
|
1188 } |
|
1189 } |
|
1190 } |
|
1191 |
1049 |
1192 |
1050 // End of File |
1193 // End of File |