218 // Constructs Data to read entry from SIM |
205 // Constructs Data to read entry from SIM |
219 // ----------------------------------------------------------------------------- |
206 // ----------------------------------------------------------------------------- |
220 // |
207 // |
221 TInt CMmPhoneBookOperationRead::USimPbReqRead |
208 TInt CMmPhoneBookOperationRead::USimPbReqRead |
222 ( |
209 ( |
223 TInt aRecordNo |
210 TInt aRecordNo, |
|
211 TUint8 aTransId |
224 ) |
212 ) |
225 { |
213 { |
226 TFLOGSTRING("TSY: CMmPhoneBookOperationRead::USimPbReqRead"); |
214 TFLOGSTRING("TSY: CMmPhoneBookOperationRead::USimPbReqRead"); |
227 OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONREAD_USIMPBREQREAD, "CMmPhoneBookOperationRead::USimPbReqRead" ); |
215 OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONREAD_USIMPBREQREAD, "CMmPhoneBookOperationRead::USimPbReqRead" ); |
228 |
216 |
229 TInt ret( KErrNone ); |
217 TInt ret( KErrNone ); |
230 // Get phonebook type from transactionId and convert it to USim pbtype |
|
231 TUint16 simPhonebookType( ConvertToSimPhoneBookType( |
|
232 iTransactionId & KMaskPhonebookType ) ); // Service type |
|
233 |
|
234 // get the index to be read from phonebook |
218 // get the index to be read from phonebook |
235 TInt index( iIndexToRead ); |
219 TInt index( iIndexToRead ); |
236 |
220 |
237 TUiccReadLinearFixed cmdParams; |
221 TUiccReadLinearFixed cmdParams; |
238 //cmdParams.messHandlerPtr = static_cast<MUiccOperationBase*> iMmPhoneBookStoreMessHandler; |
222 cmdParams.messHandlerPtr = static_cast<MUiccOperationBase*> |
239 |
223 ( iMmPhoneBookStoreMessHandler ); |
240 cmdParams.filePath.Append(static_cast<TUint8>( MF_FILE >> 8 )); |
224 |
241 cmdParams.filePath.Append(static_cast<TUint8>( MF_FILE )); |
225 cmdParams.filePath.Append( static_cast<TUint8>( MF_FILE >> 8 )); |
242 //cmdParams.filePath.Copy(aApplFieldId); |
226 cmdParams.filePath.Append( static_cast<TUint8>( MF_FILE )); |
243 cmdParams.filePath.Append(static_cast<TUint8>( DF_PHONEBOOK >> 8 )); |
227 cmdParams.filePath.Append( APPL_FILE_ID>>8); |
244 cmdParams.filePath.Append(static_cast<TUint8>( DF_PHONEBOOK )); |
228 cmdParams.filePath.Append( APPL_FILE_ID); |
245 |
229 cmdParams.filePath.Append( static_cast<TUint8>( DF_PHONEBOOK >> 8 )); |
|
230 cmdParams.filePath.Append( static_cast<TUint8>( DF_PHONEBOOK )); |
|
231 cmdParams.serviceType = UICC_APPL_READ_LINEAR_FIXED; |
|
232 cmdParams.record = aRecordNo; |
|
233 cmdParams.trId = static_cast<TUiccTrId>( aTransId ); |
|
234 // Convert Phone Book name to file id |
|
235 TUint16 fileIdExt ( 0x0000 ); |
|
236 TUint16 pbFileId = ConvertToPBfileId( iPhoneBookTypeName, fileIdExt ); |
|
237 TUint8 arrayIndex = ConvertToConfArrayIndex( pbFileId ); |
|
238 |
246 // get the corect Location to be read from phone book |
239 // get the corect Location to be read from phone book |
247 if( PB_MBDN_FID == simPhonebookType) |
240 if( PB_MBDN_FID == pbFileId) |
248 { |
241 { |
249 // Index to be read contains two types of information. |
242 // Index to be read contains two types of information. |
250 // The least significant byte contains the profile number |
243 // The least significant byte contains the profile number |
251 // and the most significant byte contains the type. |
244 // and the most significant byte contains the type. |
252 index = index || 0x0100; // Only subscriber profile number 1 is supported |
245 index = index || 0x0100; // Only subscriber profile number 1 is supported |
|
246 |
|
247 if ( EMailboxIdRead == iTypeOfReading ) |
|
248 { |
|
249 iTypeOfReading = EBasicEfRead; |
|
250 } |
|
251 else |
|
252 { |
|
253 iTypeOfReading = EMailboxIdRead; |
|
254 } |
253 } |
255 } |
254 |
256 |
255 // Read phonebook elementary file to get the Entry information |
257 // Check for Extension Data is Present or not |
256 if( !iExtensionRead ) |
258 if ( EBasicEfRead == iTypeOfReading ) |
257 { |
259 { |
258 cmdParams.trId = ETrIdPbRead; |
260 cmdParams.fileId = pbFileId; |
259 cmdParams.fileId = simPhonebookType; |
261 // Check for the record Number to be read is valid record number |
260 |
262 if( iIndexToRead <= iMmPhoneBookStoreMessHandler-> |
261 if( iServiceType == UICC_APPL_READ_LINEAR_FIXED ) |
263 iPBStoreConf[arrayIndex].iNoOfRecords) |
262 { |
264 { |
|
265 // Check for Number of Slots To be Read |
|
266 if( iNumOfEntriesToRead > 0) |
|
267 { |
|
268 // Check for Valid PhoneBook Entry no. |
|
269 if( iIndexToRead > 0) |
|
270 { |
|
271 // Read Request to read that index |
|
272 cmdParams.serviceType = UICC_APPL_READ_LINEAR_FIXED; |
|
273 cmdParams.record = iIndexToRead; |
|
274 // till End of Record |
|
275 cmdParams.dataAmount = 0; |
|
276 // Start from begining of record |
|
277 cmdParams.dataOffset = 0; |
|
278 } |
|
279 else |
|
280 { |
|
281 // Start from first location and Search for First Valid |
|
282 // Entry in the Stored List and if some Entry is invalid |
|
283 // then Read From Sim and Check the Staus its Free |
|
284 // or not till Number of slots to be read equals to 0 |
|
285 |
|
286 // Read Request to read that index |
|
287 cmdParams.serviceType = UICC_APPL_READ_LINEAR_FIXED; |
|
288 // read First record |
|
289 iIndexToRead = 1; |
|
290 cmdParams.record = iIndexToRead; |
|
291 // till End of Record |
|
292 cmdParams.dataAmount = 0; |
|
293 // Start from begining of record |
|
294 cmdParams.dataOffset = 0; |
|
295 |
|
296 // Set Flag for first valid Entry location Search |
|
297 iLocationSearch = ETrue; |
|
298 } |
|
299 } |
|
300 } |
|
301 else |
|
302 { |
|
303 // return error for invalid Entry (Out of max range idf entries) |
|
304 ret = KErrArgument; |
|
305 } |
|
306 }// end of if case for checking extension data |
|
307 else if ( EExtensionRead == iTypeOfReading ) |
|
308 { |
|
309 // Send Request to Read Extension Data |
|
310 // Check for UST Table supports for EXT File |
|
311 if ( iMmPhoneBookStoreMessHandler->iPBStoreConf[arrayIndex].iExtension ) |
|
312 { |
|
313 // Check for Extension data record in valid |
|
314 if ( iMmPhoneBookStoreMessHandler-> |
|
315 iPBStoreConf[arrayIndex].iExtNoOfRec >= aRecordNo ) |
|
316 { |
|
317 // Read Request to read that index |
|
318 cmdParams.fileId = fileIdExt; |
|
319 cmdParams.serviceType = UICC_APPL_READ_LINEAR_FIXED; |
|
320 cmdParams.record = aRecordNo; |
|
321 // till End of Record |
|
322 cmdParams.dataAmount = 0; |
|
323 // Start from begining of record |
|
324 cmdParams.dataOffset = 0; |
|
325 } |
|
326 else |
|
327 { |
|
328 ret = KErrGeneral; |
|
329 } |
|
330 } |
|
331 else |
|
332 { |
|
333 ret = KErrGeneral; |
|
334 } |
|
335 } |
|
336 |
|
337 else |
|
338 { |
|
339 // Read mailbox ID |
|
340 if ( iMmPhoneBookStoreMessHandler-> |
|
341 iPBStoreConf[arrayIndex].iExtNoOfRec >= aRecordNo ) |
|
342 { |
|
343 // Read Request to read MBI file |
|
344 cmdParams.fileId = PB_MBI_FID; |
263 cmdParams.serviceType = UICC_APPL_READ_LINEAR_FIXED; |
345 cmdParams.serviceType = UICC_APPL_READ_LINEAR_FIXED; |
264 // Least significant byte gives the actual record no. to be read |
|
265 cmdParams.record = aRecordNo; |
346 cmdParams.record = aRecordNo; |
266 } |
347 // till End of Record |
267 else if(iServiceType == UICC_APPL_FILE_INFO) |
348 cmdParams.dataAmount = 0; |
268 { |
349 // Start from begining of record |
269 cmdParams.serviceType = UICC_APPL_FILE_INFO; |
350 cmdParams.dataOffset = 0; |
|
351 } |
|
352 else |
|
353 { |
|
354 ret = KErrGeneral; |
270 } |
355 } |
271 } |
356 } |
272 else |
357 |
273 { |
358 if( KErrNone == ret ) |
274 switch( simPhonebookType ) |
359 { |
275 { |
360 ret = iMmPhoneBookStoreMessHandler->UiccMessHandler()-> |
276 case PB_ADN_FID: |
361 CreateUiccApplCmdReq( cmdParams ); |
277 { |
362 TFLOGSTRING2("TSY: CreateUiccApplCmdReq returns %d", ret); |
278 // For 2G ADN Phonebook EXT1 will be the extension number store |
363 OstTrace1( TRACE_NORMAL, DUP2_CMMPHONEBOOKOPERATIONREAD_USIMPBREQREAD, "CMmPhoneBookOperationRead::USimPbReqRead;ret=%d", ret ); |
279 cmdParams.trId = ETrIdPbRead; |
|
280 cmdParams.fileId = PB_EXT1_FID; |
|
281 |
|
282 if( UICC_APPL_READ_LINEAR_FIXED == iServiceType ) |
|
283 { |
|
284 cmdParams.serviceType = UICC_APPL_READ_LINEAR_FIXED; |
|
285 cmdParams.record = aRecordNo; |
|
286 } |
|
287 else if( UICC_APPL_FILE_INFO == iServiceType ) |
|
288 { |
|
289 cmdParams.serviceType = UICC_APPL_FILE_INFO; |
|
290 } |
|
291 break; |
|
292 } |
|
293 case PB_FDN_FID: |
|
294 { |
|
295 // For FDN Phonebook EXT2 will be the extension number store |
|
296 cmdParams.trId = ETrIdPbRead; |
|
297 cmdParams.fileId = PB_EXT2_FID; |
|
298 |
|
299 if( UICC_APPL_READ_LINEAR_FIXED == iServiceType ) |
|
300 { |
|
301 cmdParams.serviceType = UICC_APPL_READ_LINEAR_FIXED; |
|
302 cmdParams.record = aRecordNo; |
|
303 } |
|
304 else if( UICC_APPL_FILE_INFO == iServiceType ) |
|
305 { |
|
306 cmdParams.serviceType = UICC_APPL_FILE_INFO; |
|
307 } |
|
308 break; |
|
309 } |
|
310 case PB_SDN_FID: |
|
311 { |
|
312 // For SDN Phonebook EXT3 will be the extension number store |
|
313 cmdParams.trId = ETrIdPbRead; |
|
314 cmdParams.fileId = PB_EXT3_FID; |
|
315 |
|
316 if( UICC_APPL_READ_LINEAR_FIXED == iServiceType ) |
|
317 { |
|
318 cmdParams.serviceType = UICC_APPL_READ_LINEAR_FIXED; |
|
319 cmdParams.record = aRecordNo; |
|
320 } |
|
321 else if( UICC_APPL_FILE_INFO == iServiceType ) |
|
322 { |
|
323 cmdParams.serviceType = UICC_APPL_FILE_INFO; |
|
324 } |
|
325 break; |
|
326 } |
|
327 case PB_BDN_FID: |
|
328 { |
|
329 // For BDN Phonebook EXT4 will be the extension number store |
|
330 cmdParams.trId = ETrIdPbRead; |
|
331 cmdParams.fileId = PB_EXT4_FID; |
|
332 |
|
333 if( UICC_APPL_READ_LINEAR_FIXED == iServiceType ) |
|
334 { |
|
335 cmdParams.serviceType = UICC_APPL_READ_LINEAR_FIXED; |
|
336 cmdParams.record = aRecordNo; |
|
337 } |
|
338 else if( UICC_APPL_FILE_INFO == iServiceType ) |
|
339 { |
|
340 cmdParams.serviceType = UICC_APPL_FILE_INFO; |
|
341 } |
|
342 break; |
|
343 } |
|
344 case PB_MBDN_FID: |
|
345 { |
|
346 // For MBDN Phonebook EXT6 will be the extension number store |
|
347 cmdParams.trId = ETrIdPbRead; |
|
348 cmdParams.fileId = PB_EXT6_FID; |
|
349 |
|
350 if( UICC_APPL_READ_LINEAR_FIXED == iServiceType ) |
|
351 { |
|
352 cmdParams.serviceType = UICC_APPL_READ_LINEAR_FIXED; |
|
353 cmdParams.record = aRecordNo; |
|
354 } |
|
355 else if( UICC_APPL_FILE_INFO == iServiceType ) |
|
356 { |
|
357 cmdParams.serviceType = UICC_APPL_FILE_INFO; |
|
358 } |
|
359 break; |
|
360 } |
|
361 case PB_MSISDN_FID: |
|
362 { |
|
363 // For MSISDN Phonebook EXT5 will be the extension number store |
|
364 cmdParams.trId = ETrIdPbRead; |
|
365 cmdParams.fileId = PB_EXT5_FID; |
|
366 |
|
367 if( UICC_APPL_READ_LINEAR_FIXED == iServiceType ) |
|
368 { |
|
369 cmdParams.serviceType = UICC_APPL_READ_LINEAR_FIXED; |
|
370 cmdParams.record = aRecordNo; |
|
371 } |
|
372 else if( UICC_APPL_FILE_INFO == iServiceType ) |
|
373 { |
|
374 cmdParams.serviceType = UICC_APPL_FILE_INFO; |
|
375 } |
|
376 break; |
|
377 } |
|
378 case PB_VMBX_FID: |
|
379 { |
|
380 // For VMBX Phonebook EXT2 will be the extension number store |
|
381 cmdParams.trId = ETrIdPbRead; |
|
382 cmdParams.fileId = PB_EXT2_FID; |
|
383 |
|
384 if( UICC_APPL_READ_LINEAR_FIXED == iServiceType ) |
|
385 { |
|
386 cmdParams.serviceType = UICC_APPL_READ_LINEAR_FIXED; |
|
387 cmdParams.record = aRecordNo; |
|
388 } |
|
389 else if( UICC_APPL_FILE_INFO == iServiceType ) |
|
390 { |
|
391 cmdParams.serviceType = UICC_APPL_FILE_INFO; |
|
392 } |
|
393 break; |
|
394 } |
|
395 } |
|
396 } |
364 } |
397 |
365 |
398 ret = iMmPhoneBookStoreMessHandler->UiccMessHandler()-> |
|
399 CreateUiccApplCmdReq( cmdParams ); |
|
400 TFLOGSTRING2("TSY: CreateUiccApplCmdReq returns %d", ret); |
|
401 return ret; |
366 return ret; |
402 } |
367 } |
403 |
368 |
404 |
369 |
405 |
370 |
406 |
371 |
407 |
372 |
408 |
373 |
409 // ----------------------------------------------------------------------------- |
374 // ----------------------------------------------------------------------------- |
410 // CMmPhoneBookOperationRead::CreateReq |
375 // CMmPhoneBookOperationRead::HandleUICCPbRespL |
411 // Separate request |
376 // Separate request |
412 // ----------------------------------------------------------------------------- |
377 // ----------------------------------------------------------------------------- |
413 // |
378 // |
414 TInt CMmPhoneBookOperationRead::HandleUICCPbRespL |
379 TBool CMmPhoneBookOperationRead::HandleUICCPbRespL |
415 ( |
380 ( |
416 TBool & /*aComplete*/, |
|
417 TInt aStatus, |
381 TInt aStatus, |
|
382 TUint8 /*aDetails*/, |
418 const TDesC8 &aFileData, |
383 const TDesC8 &aFileData, |
419 TInt aTransId |
384 TInt aTransId |
420 ) |
385 ) |
421 { |
386 { |
422 TFLOGSTRING("TSY: CMmPhoneBookOperationRead::HandleUICCPbRespL"); |
387 TFLOGSTRING("TSY: CMmPhoneBookOperationRead::HandleUICCPbRespL"); |
423 OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONREAD_HANDLEUICCPBRESPL, "CMmPhoneBookOperationRead::HandleUICCPbRespL" ); |
388 OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONREAD_HANDLEUICCPBRESPL, "CMmPhoneBookOperationRead::HandleUICCPbRespL" ); |
424 |
389 |
|
390 TBool complete( EFalse ); |
425 TInt ret(KErrNone); |
391 TInt ret(KErrNone); |
|
392 TInt retExt(KErrNone); |
426 // Initialize Application file ID to send in next request |
393 // Initialize Application file ID to send in next request |
427 TBuf8<2> applFieldId; |
394 TBuf8<2> applFieldId; |
428 applFieldId.Append(0x7F); |
395 |
429 applFieldId.Append(0x10); |
|
430 |
|
431 // Check for Error if returned from UICC Server |
|
432 |
396 |
433 // Handle possible error case |
397 // Handle possible error case |
434 if ( UICC_STATUS_OK != aStatus ) |
398 if ( UICC_STATUS_OK != aStatus ) |
435 { |
399 { |
436 TFLOGSTRING("TSY: CMmPhoneBookOperationRead::HandleUICCPbRespRead-\ |
400 TFLOGSTRING("TSY: CMmPhoneBookOperationRead::HandleUICCPbRespL-Unsuccessfully completed by UICC"); |
437 Unsuccessfully completed by SIMSON"); |
401 OstTrace0( TRACE_NORMAL, DUP2_CMMPHONEBOOKOPERATIONREAD_HANDLEUICCPBRESPL, "CMmPhoneBookOperationRead::HandleUICCPbRespL. Unsuccessfully completed by UICC" ); |
438 //OstTrace0( TRACE_NORMAL, DUP1_CMMPHONEBOOKOPERATIONREAD_HANDLEUICCPBRESPL, "CMmPhoneBookOperationRead::HandleUICCPbRespL, Unsuccessfully completed by UICC Server" ); |
402 |
439 ret = CMmStaticUtility::UICCCSCauseToEpocError(aStatus ); |
403 ret = CMmStaticUtility::UICCCSCauseToEpocError(aStatus ); |
440 } |
404 } |
441 |
405 |
442 |
406 // Convert Phone Book name to file id |
443 // Get phonebook type from transactionId and convert it to USim pbtype |
407 TUint16 fileIdExt( 0x0000 ); |
444 TUint16 simPhonebookType( ConvertToSimPhoneBookType( |
408 TUint16 pbFileId = ConvertToPBfileId( iPhoneBookTypeName, fileIdExt ); |
445 iTransactionId & KMaskPhonebookType ) ); // Service type |
409 TUint8 arrayIndex = ConvertToConfArrayIndex( pbFileId ); |
446 |
410 |
447 if(UICC_STATUS_OK == aStatus) |
411 if ( UICC_STATUS_OK == aStatus ) |
448 { |
412 { |
449 switch(aTransId) |
413 if ( EBasicEfRead == iTypeOfReading ) |
450 { |
414 { |
451 case ETrIdPbReadADN: |
415 iStoreEntry = new ( ELeave ) TPBEntry(); |
452 { |
416 // update Entry Data |
453 // handle USIM ADN phonebook read |
417 iStoreEntry->iEntryIndex = iIndexToRead; |
454 //HandleUICC3gADNRespL(aStatus, aFileData, aTransId); |
418 |
455 } |
419 // check if Entry is valid Entry or Empty Entry |
456 break; |
420 TInt retval = EmptyEntryCheck(aFileData); |
457 case ETrIdPbRead: // Same Read for all phonebook Type extension EF's |
421 |
458 { |
422 // if Entry is not empty |
459 if(!iExtensionRead) |
423 if( KErrNone == retval) |
460 { |
424 { |
461 if(iServiceType == UICC_APPL_FILE_INFO) |
425 // Update Entry Status |
|
426 iStoreEntry->iEntryPresent = ETrue; |
|
427 |
|
428 // Reset Flag for location Search when first Entry is found |
|
429 iLocationSearch = EFalse; |
|
430 |
|
431 // Seperate Entry data form UICC Server response message |
|
432 // Case: <Data available to be filled into array> |
|
433 iMmPhoneBookStoreMessHandler-> |
|
434 iPBStoreConf[arrayIndex].GetPBEntryFromUICCData( aFileData, |
|
435 iNumberBuf, |
|
436 iNameBuf); |
|
437 |
|
438 // Check for Is there any extension data |
|
439 // And the Extension data record number is valid |
|
440 // Index to read Extension file Data is Alpha string Length + 14 |
|
441 // minus 1 is for Array index Calculation (it starts from 0) |
|
442 |
|
443 if ( 0xFF == aFileData[ iMmPhoneBookStoreMessHandler-> |
|
444 iPBStoreConf[arrayIndex].iAlphaStringlength+ 13] ) |
|
445 { |
|
446 // Append Entry to list |
|
447 iMmPhoneBookStoreMessHandler->StoreEntryToPhoneBookList( |
|
448 iStoreEntry, |
|
449 arrayIndex ); |
|
450 |
|
451 // Decrement the number of entries to be read when it is |
|
452 // stored in commonTSY Array |
|
453 iNumOfEntriesToRead--; |
|
454 |
|
455 // the there is no extension data |
|
456 CPhoneBookStoreEntry* phoneBookStoreMsg = |
|
457 new( ELeave ) CPhoneBookStoreEntry; |
|
458 CleanupStack::PushL( phoneBookStoreMsg ); |
|
459 phoneBookStoreMsg->ConstructL(); |
|
460 iMmPhoneBookStoreMessHandler->StorePhonebookEntryL( |
|
461 iNameBuf, |
|
462 iNumberBuf, |
|
463 *phoneBookStoreMsg, |
|
464 pbFileId, |
|
465 iIndexToRead, |
|
466 iMailboxIdExist ); |
|
467 TF_ASSERT( NULL != iPhoneBookStoreCacheArray ); |
|
468 |
|
469 iPhoneBookStoreCacheArray->AppendL( phoneBookStoreMsg ); |
|
470 CleanupStack::Pop( phoneBookStoreMsg ); |
|
471 iNumOfEntriesFilled++; |
|
472 TFLOGSTRING2("TSY: CMmPhoneBookOperationRead::HandleUSimPbRespL - Append entries into array %i",iNumOfEntriesFilled); |
|
473 OstTrace1( TRACE_NORMAL, DUP4_CMMPHONEBOOKOPERATIONREAD_HANDLEUICCPBRESPL, "CMmPhoneBookOperationRead::HandleUICCPbRespL;iNumOfEntriesFilled=%d", iNumOfEntriesFilled ); |
|
474 } // End of if Ext Data is not Present |
|
475 else |
|
476 { |
|
477 iTypeOfReading = EExtensionRead; |
|
478 // Record no to be read from EXT File |
|
479 TInt recordNo = aFileData[iMmPhoneBookStoreMessHandler-> |
|
480 iPBStoreConf[arrayIndex].iAlphaStringlength + 13]; |
|
481 |
|
482 // Append EXT record no. |
|
483 iStoreEntry->PBEntryExtRecord.Append( recordNo ); |
|
484 |
|
485 retExt = USimPbReqRead( recordNo, aTransId ); |
|
486 // if while reading EXT error comes (for invalid Entry)than |
|
487 // read next entry |
|
488 if(( KErrNone != retExt )) |
462 { |
489 { |
463 // Check for the record no. to read is valid or not |
490 iNumOfEntriesToRead--; |
464 TInt offSet ( aFileData.Find(&KTagFCIFileDescriptor,1) ); |
491 iTypeOfReading = EBasicEfRead; |
465 if(KErrNotFound != offSet ) |
|
466 { |
|
467 // Number of entries is 1 byte long |
|
468 iNumOfPhoneBookRecords = aFileData[offSet + UICC_FCI_EF_FDESC_OFFSET_NUM_ENTR]; |
|
469 // Get the record length |
|
470 // -14 is for data other than alpha string |
|
471 //Get16bit(iRecordLength, aFileData, (offSet+4) ); |
|
472 |
|
473 if((iNumOfPhoneBookRecords*255) >= (iIndexToRead & 0x00FF)) |
|
474 { |
|
475 // read that entry no |
|
476 iServiceType = UICC_APPL_UPDATE_LINEAR_FIXED; |
|
477 if(iNumOfEntriesToRead > 0) |
|
478 { |
|
479 // Mask iIndexToRead lower byte to get the entry no need to be read |
|
480 USimPbReqRead( iIndexToRead && 0x00FF ); |
|
481 } |
|
482 else |
|
483 { |
|
484 ret = KErrNotSupported; |
|
485 } |
|
486 } |
|
487 else |
|
488 { |
|
489 // invalid location to read |
|
490 ret = KErrGeneral; |
|
491 } |
|
492 } |
|
493 } |
492 } |
494 else if(iServiceType == UICC_APPL_UPDATE_LINEAR_FIXED) |
493 } |
495 { |
494 } |
496 // to read next record |
495 else |
497 iIndexToRead++; |
496 { |
498 iNumOfEntriesToRead--; |
497 //Update Entry Status |
499 // Seperate Entry data form UICC Server response message |
498 iStoreEntry->iEntryPresent = EFalse; |
500 // Case: <Data available to be filled into array> |
499 // Reset Entry andd Append to the List |
501 if ( UICC_STATUS_OK == aStatus ) |
500 iMmPhoneBookStoreMessHandler->StoreEntryToPhoneBookList( |
502 { |
501 iStoreEntry, |
503 TInt retval ( SeparatePhoneBookEntryFromUiccMsgL( |
502 arrayIndex ); |
504 aFileData, |
503 |
505 iNameBuf, |
504 // Entry is Empty read next Entry |
506 simPhonebookType) ); |
505 if(!iLocationSearch) |
507 |
506 { |
508 if ( 0xFF == aFileData[iRecordLength] ) // Check for Is there any extension data |
507 // Decrement the no of Entries to be read |
509 { |
508 iNumOfEntriesToRead--; |
510 // the there is no extension data |
|
511 CPhoneBookStoreEntry* phoneBookStoreMsg = |
|
512 new( ELeave ) CPhoneBookStoreEntry; |
|
513 CleanupStack::PushL( phoneBookStoreMsg ); |
|
514 phoneBookStoreMsg->ConstructL(); |
|
515 |
|
516 if(KErrNone == retval) |
|
517 { |
|
518 StorePhonebookEntry(iNameBuf,iNumberBuf,*phoneBookStoreMsg); |
|
519 TF_ASSERT( NULL != iPhoneBookStoreCacheArray ); |
|
520 iPhoneBookStoreCacheArray->AppendL( phoneBookStoreMsg ); |
|
521 CleanupStack::Pop( phoneBookStoreMsg ); |
|
522 iNumOfEntriesFilled++; |
|
523 TFLOGSTRING2("TSY: CMmPhoneBookOperationRead::HandleUSimPbRespL - Append entries into array %i",iNumOfEntriesFilled); |
|
524 } |
|
525 else |
|
526 { |
|
527 CleanupStack::PopAndDestroy( phoneBookStoreMsg ); |
|
528 } |
|
529 |
|
530 // Check for Extension number present or not |
|
531 } |
|
532 else |
|
533 { |
|
534 USimPbReqRead( aFileData[iRecordLength] ); |
|
535 iExtensionRead = ETrue; |
|
536 iServiceType = UICC_APPL_READ_LINEAR_FIXED; |
|
537 } |
|
538 } |
|
539 } |
|
540 } |
509 } |
541 else // Handling for Extension Numbers |
510 } |
542 { |
511 |
543 if(UICC_APPL_UPDATE_LINEAR_FIXED == iServiceType) |
512 // to read next record |
544 { |
513 iIndexToRead++; |
545 if(0xFF != aFileData[13]) // Check for next extension data record |
514 |
546 { |
515 }// End of without EXT File Data Case |
547 // Store Number upto last byte |
516 |
548 iNumberBuf.Append(aFileData.Mid(1,11)); |
517 // Handling for Extension Numbers |
549 // Again Send request to read next record number and appenf it in number |
518 else if ( EExtensionRead == iTypeOfReading ) |
550 iServiceType = UICC_APPL_READ_LINEAR_FIXED; |
519 { |
551 USimPbReqRead( aFileData[13] ); |
520 // Check for next extension data record |
552 } |
521 if ( 0xFF != aFileData[UICC_EXT_REC_NO_OFFSET] ) |
553 else |
522 { |
554 { |
523 // Again Append the EXT no to Array |
555 // Check for length upto which no is stored |
524 iStoreEntry->PBEntryExtRecord.Append( |
556 TInt offset = aFileData.Find(&KTagUnusedbyte,1); |
525 aFileData[UICC_EXT_REC_NO_OFFSET] ); |
557 // store Data |
526 |
558 iNumberBuf.Append(aFileData.Mid(1,offset)); |
527 |
559 |
528 // Store Number upto last byte |
560 // the there is no extension data |
529 iNumberBuf.Append(aFileData.Mid(1,11)); |
561 CPhoneBookStoreEntry* phoneBookStoreMsg = |
530 // Again Send request to read next record number and appenf it |
562 new( ELeave ) CPhoneBookStoreEntry; |
531 // in number |
563 CleanupStack::PushL( phoneBookStoreMsg ); |
532 retExt = USimPbReqRead( |
564 phoneBookStoreMsg->ConstructL(); |
533 aFileData[UICC_EXT_REC_NO_OFFSET], aTransId ); |
565 |
534 if( KErrNone != retExt) |
566 StorePhonebookEntry(iNameBuf,iNumberBuf,*phoneBookStoreMsg); |
535 { |
567 |
536 iNumOfEntriesToRead--; |
568 TF_ASSERT( NULL != iPhoneBookStoreCacheArray ); |
537 iTypeOfReading = EBasicEfRead; |
569 iPhoneBookStoreCacheArray->AppendL( phoneBookStoreMsg ); |
|
570 CleanupStack::Pop( phoneBookStoreMsg ); |
|
571 iNumOfEntriesFilled++; |
|
572 TFLOGSTRING2("TSY: CMmPhoneBookOperationRead::HandleUSimPbRespL - \ |
|
573 Append entries into array %i",iNumOfEntriesFilled); |
|
574 //OstTrace1( TRACE_NORMAL, DUP2_CMMPHONEBOOKOPERATIONREAD_HANDLEUSIMPBRESPL, "CMmPhoneBookOperationRead::HandleUSimPbRespL;Append entries into array=%d", iNumOfEntriesFilled ); |
|
575 |
|
576 |
|
577 } |
|
578 } |
|
579 } |
538 } |
580 } |
539 } |
581 break; |
540 else |
582 default: |
541 { |
583 // There is no such phonebook exist |
542 // Append Entry to list and reset all the EXT data |
584 ret = KErrGeneral; |
543 iMmPhoneBookStoreMessHandler->StoreEntryToPhoneBookList( |
585 break; |
544 iStoreEntry, |
|
545 arrayIndex ); |
|
546 |
|
547 // Reset Extension File record |
|
548 iExtensionRead = EFalse; |
|
549 |
|
550 // Check for Extended Data is Addition number |
|
551 if( 0x02 == aFileData[0]) |
|
552 { |
|
553 // Check for length upto which no is stored |
|
554 TInt offset = aFileData.Find(&KTagUnusedbyte,1); |
|
555 // store Data |
|
556 iNumberBuf.Append(aFileData.Mid(1,( offset - 1 ))); |
|
557 // Decrement no of Entries to be read after Storing it to |
|
558 // CommonTSY Array in EXT data case |
|
559 iNumOfEntriesToRead--; |
|
560 |
|
561 // the there is extension data |
|
562 CPhoneBookStoreEntry* phoneBookStoreMsg = |
|
563 new( ELeave ) CPhoneBookStoreEntry; |
|
564 CleanupStack::PushL( phoneBookStoreMsg ); |
|
565 phoneBookStoreMsg->ConstructL(); |
|
566 |
|
567 iMmPhoneBookStoreMessHandler->StorePhonebookEntryL( |
|
568 iNameBuf, |
|
569 iNumberBuf, |
|
570 *phoneBookStoreMsg, |
|
571 pbFileId, |
|
572 iIndexToRead, |
|
573 iMailboxIdExist ); |
|
574 |
|
575 TF_ASSERT( NULL != iPhoneBookStoreCacheArray ); |
|
576 iPhoneBookStoreCacheArray->AppendL( phoneBookStoreMsg ); |
|
577 CleanupStack::Pop( phoneBookStoreMsg ); |
|
578 iNumOfEntriesFilled++; |
|
579 TFLOGSTRING2("TSY: CMmPhoneBookOperationRead::HandleUSimPbRespL - Append entries into array %i",iNumOfEntriesFilled); |
|
580 OstTrace1( TRACE_NORMAL, DUP5_CMMPHONEBOOKOPERATIONREAD_HANDLEUICCPBRESPL, "CMmPhoneBookOperationRead::HandleUICCPbRespL;iNumOfEntriesFilled=%d", iNumOfEntriesFilled ); |
|
581 |
|
582 } |
|
583 } |
|
584 } |
|
585 else |
|
586 { |
|
587 // Read mailbox ID |
|
588 |
|
589 // There are 4 bytes describing mailbox id and one of them can |
|
590 // be valid at a time |
|
591 // 1 Mailbox Dialling Number Identifier – Voicemail |
|
592 // 2 Mailbox Dialling Number Identifier – Fax |
|
593 // 3 Mailbox Dialling Number Identifier – Electronic Mail |
|
594 // 4 Mailbox Dialling Number Identifier – Other |
|
595 |
|
596 for ( TUint8 i( 0 ); i < 4; i++ ) |
|
597 { |
|
598 iMailboxIdExist = EFalse; |
|
599 if ( 0 != aFileData[i] ) |
|
600 { |
|
601 iMailboxIdExist = ETrue; |
|
602 iIndexToRead = aFileData[i]; |
|
603 break; |
|
604 } |
|
605 } |
|
606 |
|
607 TFLOGSTRING2("TSY: CMmPhoneBookOperationRead::HandleUSimPbRespL - Append entries into array %i",iNumOfEntriesFilled); |
|
608 } |
|
609 |
|
610 if( ( ( EBasicEfRead == iTypeOfReading ) || |
|
611 ( EMailboxIdRead == iTypeOfReading ) ) && |
|
612 ( 0 != iNumOfEntriesToRead ) ) |
|
613 { |
|
614 ret = USimPbReqRead( iIndexToRead, aTransId ); |
586 } |
615 } |
587 } |
616 } |
588 |
617 |
589 // Case: <complete request> |
618 // Complete request |
590 if ( KErrNone != ret || 0 == iNumOfEntriesToRead ) |
619 if( ( KErrNone != ret )|| ( 0 == iNumOfEntriesToRead )) |
591 { |
620 { |
592 // If no entries found |
621 // Check fo Any Entries Found |
593 if ( 0 == iNumOfEntriesFilled ) |
622 if( ( UICC_STATUS_OK == aStatus )&& ( 0 == iNumOfEntriesFilled ) ) |
594 { |
623 { |
595 ret = KErrNotFound; |
624 ret = KErrNotFound; |
596 } |
625 } |
597 |
626 |
598 TName phoneBookName; |
627 CPhoneBookDataPackage phoneBookData; |
599 CPhoneBookDataPackage phoneBookData; |
628 phoneBookData.SetPhoneBookName( iPhoneBookTypeName ); |
600 |
629 iNumOfEntriesFilled = 0; |
601 // Convert number of phonebook type to Sim pbtype |
630 iMmPhoneBookStoreMessHandler->MessageRouter()->Complete( |
602 ConvertToPBname( aTransId, phoneBookName ); |
631 iSavedIPCForComplete, |
603 phoneBookData.SetPhoneBookName( phoneBookName ); |
632 &phoneBookData, |
604 iNumOfEntriesFilled = 0; |
633 ret ); |
605 iMmPhoneBookStoreMessHandler->MessageRouter()->Complete( |
634 |
606 EMmTsyPhoneBookStoreReadIPC, |
635 iPhoneBookStoreCacheArray = NULL; |
607 &phoneBookData, |
636 // Set flag to indicate that we can remove this operation from array |
608 ret ); |
637 complete = ETrue; |
609 |
638 } |
610 iPhoneBookStoreCacheArray = NULL; |
639 |
611 // Set flag to indicate that we can remove this operation from array |
640 return complete; |
612 } |
|
613 return ret; |
|
614 } |
641 } |
615 |
642 |
616 |
643 |
617 // End of File |
644 // End of File |