232 cmdParams.filePath.Append( static_cast<TUint8>( DF_PHONEBOOK >> 8 )); |
255 cmdParams.filePath.Append( static_cast<TUint8>( DF_PHONEBOOK >> 8 )); |
233 cmdParams.filePath.Append( static_cast<TUint8>( DF_PHONEBOOK )); |
256 cmdParams.filePath.Append( static_cast<TUint8>( DF_PHONEBOOK )); |
234 } |
257 } |
235 |
258 |
236 cmdParams.serviceType = UICC_APPL_READ_LINEAR_FIXED; |
259 cmdParams.serviceType = UICC_APPL_READ_LINEAR_FIXED; |
237 cmdParams.record = aRecordNo; |
|
238 cmdParams.trId = static_cast<TUiccTrId>( aTransId ); |
260 cmdParams.trId = static_cast<TUiccTrId>( aTransId ); |
239 // Convert Phone Book name to file id |
261 |
240 TUint16 fileIdExt ( 0x0000 ); |
|
241 TUint16 pbFileId = ConvertToPBfileId( iPhoneBookTypeName, fileIdExt, iMmUiccMessHandler->GetCardType() ); |
|
242 TUint8 arrayIndex = ConvertToConfArrayIndex( pbFileId ); |
|
243 |
|
244 // get the corect Location to be read from phone book |
262 // get the corect Location to be read from phone book |
245 if( PB_MBDN_FID == pbFileId) |
263 if( ( PB_MBDN_FID == iFileId ) && |
246 { |
264 ( EStartRead == iTypeOfReading ) ) |
247 // Index to be read contains two types of information. |
265 { |
248 // The least significant byte contains the profile number |
266 // Check id MBI file index is valid |
249 // and the most significant byte contains the type. |
267 if( ( iIndexToRead <= iMmPhoneBookStoreMessHandler-> |
250 index = index || 0x0100; // Only subscriber profile number 1 is supported |
268 iPBStoreConf[iArrayIndex].iMbiRecLen ) && |
251 |
269 ( iIndexToRead >= 0 ) ) |
252 if ( EMailboxIdRead == iTypeOfReading ) |
270 { |
|
271 // Send request to read MBI File |
|
272 cmdParams.fileId = PB_MBI_FID; |
|
273 cmdParams.dataAmount = 1; |
|
274 |
|
275 cmdParams.dataOffset = iIndexToRead; |
|
276 cmdParams.record = 1; // only first profile number is supported |
|
277 |
|
278 // Set TYpe od reading |
|
279 iTypeOfReading = EMailboxIdRead; |
|
280 } |
|
281 else |
|
282 { |
|
283 ret = KErrArgument; |
|
284 } |
|
285 } |
|
286 else |
|
287 { |
|
288 if( EStartRead == iTypeOfReading ) |
253 { |
289 { |
254 iTypeOfReading = EBasicEfRead; |
290 iTypeOfReading = EBasicEfRead; |
255 } |
291 } // no else |
256 else |
292 // till End of Record |
257 { |
293 cmdParams.dataAmount = 0; |
258 iTypeOfReading = EMailboxIdRead; |
294 // Start from begining of record |
259 } |
295 cmdParams.dataOffset = 0; |
260 } |
296 // Check for Extension Data is Present or not |
261 |
297 if ( EBasicEfRead == iTypeOfReading ) |
262 // Check for Extension Data is Present or not |
298 { |
263 if ( EBasicEfRead == iTypeOfReading ) |
299 cmdParams.fileId = iFileId; |
264 { |
300 ret = AddParamToReadReq( cmdParams ); |
265 cmdParams.fileId = pbFileId; |
301 }// end of if case for checking extension data |
266 // Check for the record Number to be read is valid record number |
302 else if ( EExtensionRead == iTypeOfReading ) |
267 if( iIndexToRead <= iMmPhoneBookStoreMessHandler-> |
303 { |
268 iPBStoreConf[arrayIndex].iNoOfRecords) |
304 // Send Request to Read Extension Data |
269 { |
305 // Check for UST Table supports for EXT File |
270 // Check for Number of Slots To be Read |
306 if ( ( iMmPhoneBookStoreMessHandler-> |
271 if( iNumOfEntriesToRead > 0) |
307 iPBStoreConf[iArrayIndex].iExtension )&& |
272 { |
308 ( iMmPhoneBookStoreMessHandler-> |
273 // Check for Valid PhoneBook Entry no. |
309 iPBStoreConf[iArrayIndex].iExtNoOfRec >= aRecordNo ) && |
274 if( iIndexToRead > 0) |
310 ( aRecordNo > 0 ) ) |
275 { |
|
276 // Read Request to read that index |
|
277 cmdParams.serviceType = UICC_APPL_READ_LINEAR_FIXED; |
|
278 cmdParams.record = iIndexToRead; |
|
279 // till End of Record |
|
280 cmdParams.dataAmount = 0; |
|
281 // Start from begining of record |
|
282 cmdParams.dataOffset = 0; |
|
283 } |
|
284 else |
|
285 { |
|
286 // Start from first location and Search for First Valid |
|
287 // Entry in the Stored List and if some Entry is invalid |
|
288 // then Read From Sim and Check the Staus its Free |
|
289 // or not till Number of slots to be read equals to 0 |
|
290 |
|
291 // Read Request to read that index |
|
292 cmdParams.serviceType = UICC_APPL_READ_LINEAR_FIXED; |
|
293 // read First record |
|
294 iIndexToRead = 1; |
|
295 cmdParams.record = iIndexToRead; |
|
296 // till End of Record |
|
297 cmdParams.dataAmount = 0; |
|
298 // Start from begining of record |
|
299 cmdParams.dataOffset = 0; |
|
300 |
|
301 // Set Flag for first valid Entry location Search |
|
302 iLocationSearch = ETrue; |
|
303 } |
|
304 } |
|
305 } |
|
306 else |
|
307 { |
|
308 // return error for invalid Entry (Out of max range idf entries) |
|
309 ret = KErrArgument; |
|
310 } |
|
311 }// end of if case for checking extension data |
|
312 else if ( EExtensionRead == iTypeOfReading ) |
|
313 { |
|
314 // Send Request to Read Extension Data |
|
315 // Check for UST Table supports for EXT File |
|
316 if ( iMmPhoneBookStoreMessHandler->iPBStoreConf[arrayIndex].iExtension ) |
|
317 { |
|
318 // Check for Extension data record in valid |
|
319 if ( iMmPhoneBookStoreMessHandler-> |
|
320 iPBStoreConf[arrayIndex].iExtNoOfRec >= aRecordNo ) |
|
321 { |
311 { |
322 // Read Request to read that index |
312 // Read Request to read that index |
323 cmdParams.fileId = fileIdExt; |
313 cmdParams.fileId = iExtFileId; |
324 cmdParams.serviceType = UICC_APPL_READ_LINEAR_FIXED; |
|
325 cmdParams.record = aRecordNo; |
314 cmdParams.record = aRecordNo; |
326 // till End of Record |
|
327 cmdParams.dataAmount = 0; |
|
328 // Start from begining of record |
|
329 cmdParams.dataOffset = 0; |
|
330 } |
315 } |
331 else |
316 else |
332 { |
317 { |
333 ret = KErrGeneral; |
318 ret = KErrGeneral; |
334 } |
319 } |
335 } |
320 } // no else |
336 else |
321 } |
337 { |
|
338 ret = KErrGeneral; |
|
339 } |
|
340 } |
|
341 |
|
342 else |
|
343 { |
|
344 // Read mailbox ID |
|
345 if ( iMmPhoneBookStoreMessHandler-> |
|
346 iPBStoreConf[arrayIndex].iExtNoOfRec >= aRecordNo ) |
|
347 { |
|
348 // Read Request to read MBI file |
|
349 cmdParams.fileId = PB_MBI_FID; |
|
350 cmdParams.serviceType = UICC_APPL_READ_LINEAR_FIXED; |
|
351 cmdParams.record = aRecordNo; |
|
352 // till End of Record |
|
353 cmdParams.dataAmount = 0; |
|
354 // Start from begining of record |
|
355 cmdParams.dataOffset = 0; |
|
356 } |
|
357 else |
|
358 { |
|
359 ret = KErrGeneral; |
|
360 } |
|
361 } |
|
362 |
|
363 if( KErrNone == ret ) |
322 if( KErrNone == ret ) |
364 { |
323 { |
365 ret = iMmPhoneBookStoreMessHandler->UiccMessHandler()-> |
324 ret = iMmPhoneBookStoreMessHandler->UiccMessHandler()-> |
366 CreateUiccApplCmdReq( cmdParams ); |
325 CreateUiccApplCmdReq( cmdParams ); |
367 TFLOGSTRING2("TSY: CreateUiccApplCmdReq returns %d", ret); |
326 TFLOGSTRING2("TSY: CreateUiccApplCmdReq returns %d", ret); |
368 OstTrace1( TRACE_NORMAL, DUP2_CMMPHONEBOOKOPERATIONREAD_USIMPBREQREAD, "CMmPhoneBookOperationRead::USimPbReqRead;ret=%d", ret ); |
327 OstTrace1( TRACE_NORMAL, DUP2_CMMPHONEBOOKOPERATIONREAD_USIMPBREQREAD, "CMmPhoneBookOperationRead::USimPbReqRead;ret=%d", ret ); |
369 } |
328 } // no else |
370 |
329 |
371 return ret; |
330 return ret; |
372 } |
331 } |
373 |
332 |
374 |
333 |
375 |
334 |
376 |
335 |
|
336 // ----------------------------------------------------------------------------- |
|
337 // CMmPhoneBookOperationRead::USimReadWriteSizeReq |
|
338 // Send Request to Get Read and Write size |
|
339 // ----------------------------------------------------------------------------- |
|
340 // |
|
341 TInt CMmPhoneBookOperationRead::USimReadWriteSizeReq( TUint8 aTransId ) |
|
342 { |
|
343 TFLOGSTRING("TSY: CMmPhoneBookOperationRead::USimReadWriteSizeReq"); |
|
344 OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONREAD_USIMREADWRITESIZEREQ, "CMmPhoneBookOperationRead::USimReadWriteSizeReq" ); |
|
345 |
|
346 TInt ret( KErrNone ); |
|
347 |
|
348 TUiccReadLinearFixed cmdParams; |
|
349 cmdParams.messHandlerPtr = static_cast<MUiccOperationBase*> |
|
350 ( iMmPhoneBookStoreMessHandler ); |
|
351 |
|
352 cmdParams.filePath.Append( static_cast<TUint8>( MF_FILE >> 8 )); |
|
353 cmdParams.filePath.Append( static_cast<TUint8>( MF_FILE )); |
|
354 cmdParams.filePath.Append( APPL_FILE_ID>>8); |
|
355 cmdParams.filePath.Append( APPL_FILE_ID); |
|
356 |
|
357 if( UICC_CARD_TYPE_UICC == iMmUiccMessHandler->GetCardType() ) |
|
358 { |
|
359 cmdParams.filePath.Append( static_cast<TUint8>( DF_PHONEBOOK >> 8 )); |
|
360 cmdParams.filePath.Append( static_cast<TUint8>( DF_PHONEBOOK )); |
|
361 } |
|
362 |
|
363 cmdParams.fileId = PB_MSISDN_FID; |
|
364 cmdParams.serviceType = UICC_APPL_FILE_INFO; |
|
365 cmdParams.trId = static_cast<TUiccTrId>( aTransId ); |
|
366 |
|
367 ret = iMmPhoneBookStoreMessHandler->UiccMessHandler()->CreateUiccApplCmdReq( cmdParams ); |
|
368 |
|
369 return ret; |
|
370 } |
|
371 |
|
372 |
|
373 |
|
374 // ----------------------------------------------------------------------------- |
|
375 // CMmPhoneBookOperationRead::CreateReqToReadEntry |
|
376 // Append parametes to request |
|
377 // ----------------------------------------------------------------------------- |
|
378 // |
|
379 TInt CMmPhoneBookOperationRead::AddParamToReadReq( TUiccReadLinearFixed& aParams ) |
|
380 { |
|
381 TFLOGSTRING("TSY: CMmPhoneBookOperationRead::AddParamToReadReq"); |
|
382 OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONREAD_ADDPARAMTOREADREQ, "CMmPhoneBookOperationRead::AddParamToReadReq" ); |
|
383 |
|
384 TInt ret( KErrNone ); |
|
385 // Check for the record Number to be read is valid record number |
|
386 if( iIndexToRead <= iMmPhoneBookStoreMessHandler-> |
|
387 iPBStoreConf[iArrayIndex].iNoOfRecords ) |
|
388 { |
|
389 // Check for Valid PhoneBook Entry no. |
|
390 if( iIndexToRead > 0) |
|
391 { |
|
392 aParams.record = iIndexToRead; |
|
393 } |
|
394 else |
|
395 { |
|
396 // Start from first location and Search for First Valid |
|
397 // Entry in the Stored List and if some Entry is invalid |
|
398 // then Read From Sim and Check the Staus its Free |
|
399 // or not till Number of slots to be read equals to 0 |
|
400 |
|
401 // read First record |
|
402 iIndexToRead = 1; |
|
403 aParams.record = iIndexToRead; |
|
404 |
|
405 // Set Flag for first valid Entry location Search |
|
406 iLocationSearch = ETrue; |
|
407 } |
|
408 } |
|
409 else |
|
410 { |
|
411 // return error for invalid Entry (Out of max range idf entries) |
|
412 ret = KErrArgument; |
|
413 } |
|
414 return ret; |
|
415 } |
377 |
416 |
378 |
417 |
379 // ----------------------------------------------------------------------------- |
418 // ----------------------------------------------------------------------------- |
380 // CMmPhoneBookOperationRead::HandleUICCPbRespL |
419 // CMmPhoneBookOperationRead::HandleUICCPbRespL |
381 // Separate request |
420 // Separate request |
406 OstTrace0( TRACE_NORMAL, DUP2_CMMPHONEBOOKOPERATIONREAD_HANDLEUICCPBRESPL, "CMmPhoneBookOperationRead::HandleUICCPbRespL. Unsuccessfully completed by UICC" ); |
444 OstTrace0( TRACE_NORMAL, DUP2_CMMPHONEBOOKOPERATIONREAD_HANDLEUICCPBRESPL, "CMmPhoneBookOperationRead::HandleUICCPbRespL. Unsuccessfully completed by UICC" ); |
407 |
445 |
408 ret = CMmStaticUtility::UICCCSCauseToEpocError(aStatus ); |
446 ret = CMmStaticUtility::UICCCSCauseToEpocError(aStatus ); |
409 } |
447 } |
410 |
448 |
411 // Convert Phone Book name to file id |
449 switch( iSavedIPCForComplete ) |
412 TUint16 fileIdExt( 0x0000 ); |
450 { |
413 TUint16 pbFileId = ConvertToPBfileId( iPhoneBookTypeName, fileIdExt, iMmUiccMessHandler->GetCardType() ); |
451 case EMmTsyPhoneBookStoreReadIPC: |
414 TUint8 arrayIndex = ConvertToConfArrayIndex( pbFileId ); |
452 case EMmTsyONStoreReadIPC: |
415 |
453 case EMmTsyONStoreReadEntryIPC: |
|
454 { |
|
455 complete = USimPbReadRespL( ret, |
|
456 aTransId, |
|
457 aFileData ); |
|
458 break; |
|
459 } |
|
460 case EMmTsyONStoreReadSizeIPC: |
|
461 case EMmTsyONStoreWriteSizeIPC: |
|
462 { |
|
463 complete = USimReadWriteSizeResp( aFileData, ret ); |
|
464 break; |
|
465 } |
|
466 default: |
|
467 { |
|
468 // Nothing to do here |
|
469 TFLOGSTRING2("TSY: CMmPhoneBookOperationRead::HandleUICCPbRespL - Unknown IPC: %d", iSavedIPCForComplete); |
|
470 OstTrace1( TRACE_NORMAL, DUP1_CMMPHONEBOOKOPERATIONREAD_HANDLEUICCPBRESPL, "CMmPhoneBookOperationRead::HandleUICCPbRespL - Unknown Ipc : %d", iSavedIPCForComplete ); |
|
471 break; |
|
472 } |
|
473 } |
|
474 |
|
475 |
|
476 return complete; |
|
477 } |
|
478 |
|
479 |
|
480 |
|
481 |
|
482 // ----------------------------------------------------------------------------- |
|
483 // CMmPhoneBookOperationRead::USimPbReadRespL |
|
484 // Handles Response for all phone book read |
|
485 // ----------------------------------------------------------------------------- |
|
486 // |
|
487 TBool CMmPhoneBookOperationRead:: USimPbReadRespL( TInt aStatus, |
|
488 TUint8 aTransId, |
|
489 const TDesC8 &aFileData ) |
|
490 { |
|
491 TFLOGSTRING("TSY: CMmPhoneBookOperationRead::USimPbReadRespL"); |
|
492 OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONREAD_USIMPBREADRESPL, "CMmPhoneBookOperationRead::USimPbReadRespL" ); |
|
493 |
|
494 TInt ret ( aStatus ); |
|
495 TBool complete( EFalse ); |
|
496 TBool entryStored( EFalse ); |
|
497 TInt emptyEntry( KErrNone ); |
|
498 |
416 if ( UICC_STATUS_OK == aStatus ) |
499 if ( UICC_STATUS_OK == aStatus ) |
417 { |
500 { |
418 if ( EBasicEfRead == iTypeOfReading ) |
501 if ( EBasicEfRead == iTypeOfReading ) |
419 { |
502 { |
420 iStoreEntry = new ( ELeave ) TPBEntry(); |
503 HandleReadResp( aFileData, aTransId, emptyEntry, entryStored ); |
421 // update Entry Data |
504 }// End of without EXT File Data Case |
422 iStoreEntry->iEntryIndex = iIndexToRead; |
505 |
423 |
506 // Handling for Extension Numbers |
424 // check if Entry is valid Entry or Empty Entry |
507 else if ( EExtensionRead == iTypeOfReading ) |
425 TInt retval = EmptyEntryCheck(aFileData); |
508 { |
|
509 HandleExtReadResp( aFileData, aTransId, entryStored ); |
|
510 } |
|
511 else |
|
512 { |
|
513 TInt mbdnRecNo( aFileData[0] ); |
426 |
514 |
427 // if Entry is not empty |
515 iTypeOfReading = EBasicEfRead; |
428 if( KErrNone == retval) |
516 ret = USimPbReqRead( mbdnRecNo, aTransId ); |
429 { |
517 } |
430 // Update Entry Status |
518 } |
431 iStoreEntry->iEntryPresent = ETrue; |
519 |
432 |
520 if( ( entryStored ) && |
433 // Reset Flag for location Search when first Entry is found |
521 ( 0 != iNumOfEntriesToRead) ) |
434 iLocationSearch = EFalse; |
522 { |
435 |
523 iTypeOfReading = EStartRead; |
436 // Seperate Entry data form UICC Server response message |
524 ret = USimPbReqRead( iIndexToRead, aTransId ); |
437 // Case: <Data available to be filled into array> |
525 } // no else |
438 iMmPhoneBookStoreMessHandler-> |
526 |
439 iPBStoreConf[arrayIndex].GetPBEntryFromUICCData( aFileData, |
527 // Complete request |
440 iNumberBuf, |
528 if( ( KErrNone != ret )|| ( 0 == iNumOfEntriesToRead )) |
441 iNameBuf); |
529 { |
442 |
530 // Check fo Any Entries Found |
443 // Check for Is there any extension data |
531 if( ( UICC_STATUS_OK == aStatus )&& ( 0 == iNumOfEntriesFilled ) ) |
444 // And the Extension data record number is valid |
532 { |
445 // Index to read Extension file Data is Alpha string Length + 14 |
533 ret = KErrNotFound; |
446 // minus 1 is for Array index Calculation (it starts from 0) |
534 } |
447 |
535 |
448 if ( 0xFF == aFileData[ iMmPhoneBookStoreMessHandler-> |
536 if( ( EMmTsyONStoreReadEntryIPC != iSavedIPCForComplete ) && |
449 iPBStoreConf[arrayIndex].iAlphaStringlength+ 13] ) |
537 ( EMmTsyONStoreReadIPC != iSavedIPCForComplete ) ) |
450 { |
538 { |
451 // Append Entry to list |
539 CPhoneBookDataPackage phoneBookData; |
452 iMmPhoneBookStoreMessHandler->StoreEntryToPhoneBookList( |
540 phoneBookData.SetPhoneBookName( iPhoneBookTypeName ); |
453 iStoreEntry, |
541 iNumOfEntriesFilled = 0; |
454 arrayIndex ); |
542 iMmPhoneBookStoreMessHandler->MessageRouter()->Complete( |
455 |
543 iSavedIPCForComplete, |
456 // Decrement the number of entries to be read when it is |
544 &phoneBookData, |
457 // stored in commonTSY Array |
545 ret ); |
458 iNumOfEntriesToRead--; |
546 |
459 |
547 iPhoneBookStoreCacheArray = NULL; |
460 // the there is no extension data |
548 } |
461 CPhoneBookStoreEntry* phoneBookStoreMsg = |
549 else |
462 new( ELeave ) CPhoneBookStoreEntry; |
550 { |
463 CleanupStack::PushL( phoneBookStoreMsg ); |
551 // Store own number Entry and complete the ipc |
464 phoneBookStoreMsg->ConstructL(); |
552 StoreAndCompleteOwnNumber( ret, emptyEntry ); |
465 iMmPhoneBookStoreMessHandler->StorePhonebookEntryL( |
553 } |
466 iNameBuf, |
554 |
467 iNumberBuf, |
555 // Set flag to indicate that we can remove this operation from array |
468 *phoneBookStoreMsg, |
556 complete = ETrue; |
469 pbFileId, |
557 } |
470 iIndexToRead, |
558 |
471 iMailboxIdExist ); |
559 return complete; |
472 TF_ASSERT( NULL != iPhoneBookStoreCacheArray ); |
560 } |
473 |
561 |
474 iPhoneBookStoreCacheArray->AppendL( phoneBookStoreMsg ); |
562 |
475 CleanupStack::Pop( phoneBookStoreMsg ); |
563 |
476 iNumOfEntriesFilled++; |
564 // ----------------------------------------------------------------------------- |
|
565 // CMmPhoneBookOperationRead::HandleReadResp |
|
566 // Handles Main Entry file read resp |
|
567 // ----------------------------------------------------------------------------- |
|
568 // |
|
569 void CMmPhoneBookOperationRead::HandleReadResp( |
|
570 const TDesC8 &aFileData, |
|
571 TUint8 aTransId, |
|
572 TInt &aEmptyEntry, |
|
573 TBool &aEntryStore ) |
|
574 { |
|
575 TFLOGSTRING("TSY: CMmPhoneBookOperationRead::HandleReadResp"); |
|
576 OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONREAD_HANDLEREADRESP, "CMmPhoneBookOperationRead::HandleReadResp" ); |
|
577 |
|
578 iStoreEntry = new ( ELeave ) TPBEntry(); |
|
579 // update Entry Data |
|
580 iStoreEntry->iEntryIndex = iIndexToRead; |
|
581 |
|
582 // check if Entry is valid Entry or Empty Entry |
|
583 aEmptyEntry = EmptyEntryCheck(aFileData); |
|
584 |
|
585 // if Entry is not empty |
|
586 if( KErrNone == aEmptyEntry ) |
|
587 { |
|
588 // Update Entry Status |
|
589 iStoreEntry->iEntryPresent = ETrue; |
|
590 |
|
591 // Reset Flag for location Search when first Entry is found |
|
592 iLocationSearch = EFalse; |
|
593 |
|
594 // Seperate Entry data form UICC Server response message |
|
595 // Case: <Data available to be filled into array> |
|
596 if( iArrayIndex < EPhonebookTypeUnknown ) |
|
597 { |
|
598 iMmPhoneBookStoreMessHandler-> |
|
599 iPBStoreConf[iArrayIndex].GetPBEntryFromUICCData( aFileData, |
|
600 iNumberBuf, |
|
601 iNameBuf); |
|
602 } |
|
603 |
|
604 HandleEntryPresentResp( aFileData, aTransId, aEntryStore ); |
|
605 } |
|
606 else |
|
607 { |
|
608 //Update Entry Status |
|
609 iStoreEntry->iEntryPresent = EFalse; |
|
610 // Reset Entry andd Append to the List |
|
611 iMmPhoneBookStoreMessHandler->StoreEntryToPhoneBookList( |
|
612 iStoreEntry, |
|
613 iArrayIndex ); |
|
614 |
|
615 aEntryStore = ETrue; |
|
616 // Entry is Empty read next Entry |
|
617 if(!iLocationSearch) |
|
618 { |
|
619 // Decrement the no of Entries to be read |
|
620 iNumOfEntriesToRead--; |
|
621 } |
|
622 } |
|
623 |
|
624 // to read next record |
|
625 iIndexToRead++; |
|
626 } |
|
627 |
|
628 |
|
629 |
|
630 |
|
631 // ----------------------------------------------------------------------------- |
|
632 // CMmPhoneBookOperationRead::HandleEntryPresentResp |
|
633 // Handles main Entry read resp When Entry is Present |
|
634 // ----------------------------------------------------------------------------- |
|
635 // |
|
636 void CMmPhoneBookOperationRead::HandleEntryPresentResp( |
|
637 const TDesC8 &aFileData, |
|
638 TUint8 aTransId, |
|
639 TBool &aEntryStore ) |
|
640 { |
|
641 TFLOGSTRING("TSY: CMmPhoneBookOperationRead::HandleEntryPresentResp"); |
|
642 OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONREAD_HANDLEENTRYPRESENTRESP, "CMmPhoneBookOperationRead::HandleEntryPresentResp" ); |
|
643 |
|
644 // Check for Is there any extension data |
|
645 // And the Extension data record number is valid |
|
646 // Index to read Extension file Data is Alpha string Length + 14 |
|
647 // minus 1 is for Array index Calculation (it starts from 0) |
|
648 |
|
649 if ( 0xFF == aFileData[ iMmPhoneBookStoreMessHandler-> |
|
650 iPBStoreConf[iArrayIndex].iAlphaStringlength+ 13] ) |
|
651 { |
|
652 if( ( EMmTsyONStoreReadEntryIPC != iSavedIPCForComplete ) && |
|
653 ( EMmTsyONStoreReadIPC != iSavedIPCForComplete ) ) |
|
654 { |
|
655 StoreEntryToListL( aEntryStore ); |
|
656 } |
|
657 else |
|
658 { |
|
659 // decment for own number read entry |
|
660 iNumOfEntriesToRead--; |
|
661 iNumOfEntriesFilled++; |
|
662 } |
477 TFLOGSTRING2("TSY: CMmPhoneBookOperationRead::HandleUSimPbRespL - Append entries into array %i",iNumOfEntriesFilled); |
663 TFLOGSTRING2("TSY: CMmPhoneBookOperationRead::HandleUSimPbRespL - Append entries into array %i",iNumOfEntriesFilled); |
478 OstTrace1( TRACE_NORMAL, DUP4_CMMPHONEBOOKOPERATIONREAD_HANDLEUICCPBRESPL, "CMmPhoneBookOperationRead::HandleUICCPbRespL;iNumOfEntriesFilled=%d", iNumOfEntriesFilled ); |
664 OstTrace1( TRACE_NORMAL, DUP4_CMMPHONEBOOKOPERATIONREAD_HANDLEUICCPBRESPL, "CMmPhoneBookOperationRead::HandleUICCPbRespL;iNumOfEntriesFilled=%d", iNumOfEntriesFilled ); |
479 } // End of if Ext Data is not Present |
665 } // End of if Ext Data is not Present |
480 else |
666 else |
481 { |
667 { |
482 iTypeOfReading = EExtensionRead; |
668 iTypeOfReading = EExtensionRead; |
483 // Record no to be read from EXT File |
669 // Record no to be read from EXT File |
484 TInt recordNo = aFileData[iMmPhoneBookStoreMessHandler-> |
670 TInt recordNo = aFileData[iMmPhoneBookStoreMessHandler-> |
485 iPBStoreConf[arrayIndex].iAlphaStringlength + 13]; |
671 iPBStoreConf[iArrayIndex].iAlphaStringlength + 13]; |
486 |
672 |
487 // Append EXT record no. |
673 // Append EXT record no. |
488 iStoreEntry->PBEntryExtRecord.Append( recordNo ); |
674 iStoreEntry->PBEntryExtRecord.Append( recordNo ); |
489 |
675 |
490 retExt = USimPbReqRead( recordNo, aTransId ); |
676 // if while reading EXT error comes (for invalid Entry)than |
491 // if while reading EXT error comes (for invalid Entry)than |
677 // read next entry |
492 // read next entry |
678 if( ( KErrNone != USimPbReqRead( recordNo, aTransId ) ) ) |
493 if(( KErrNone != retExt )) |
679 { |
494 { |
680 iNumOfEntriesToRead--; |
495 iNumOfEntriesToRead--; |
681 iTypeOfReading = EStartRead; |
496 iTypeOfReading = EBasicEfRead; |
682 } // no else |
497 } |
683 } |
498 } |
684 } |
|
685 |
|
686 |
|
687 |
|
688 // ----------------------------------------------------------------------------- |
|
689 // CMmPhoneBookOperationRead::HandleExtReadResp |
|
690 // Handles Ext file read resp |
|
691 // ----------------------------------------------------------------------------- |
|
692 // |
|
693 void CMmPhoneBookOperationRead::HandleExtReadResp( |
|
694 const TDesC8 &aFileData, |
|
695 TUint8 aTransId, |
|
696 TBool &aEntryStored ) |
|
697 { |
|
698 TFLOGSTRING("TSY: CMmPhoneBookOperationRead::HandleExtReadResp"); |
|
699 OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONREAD_HANDLEEXTREADRESP, "CMmPhoneBookOperationRead::HandleExtReadResp" ); |
|
700 |
|
701 // Check for next extension data record |
|
702 if ( 0xFF != aFileData[UICC_EXT_REC_NO_OFFSET] ) |
|
703 { |
|
704 // Again Append the EXT no to Array |
|
705 iStoreEntry->PBEntryExtRecord.Append( |
|
706 aFileData[UICC_EXT_REC_NO_OFFSET] ); |
|
707 |
|
708 // Store Number upto last byte |
|
709 iNumberBuf.Append(aFileData.Mid(1,11)); |
|
710 // Again Send request to read next record number and appenf it |
|
711 // in number |
|
712 if( KErrNone != USimPbReqRead( |
|
713 aFileData[UICC_EXT_REC_NO_OFFSET], aTransId ) ) |
|
714 { |
|
715 iNumOfEntriesToRead--; |
|
716 iTypeOfReading = EStartRead; |
|
717 } // no else |
|
718 } |
|
719 else |
|
720 { |
|
721 // Reset Extension File record |
|
722 iExtensionRead = EFalse; |
|
723 |
|
724 // Check for Extended Data is Addition number |
|
725 if( 0x02 == aFileData[0]) |
|
726 { |
|
727 // Check for length upto which no is stored |
|
728 TInt offset = aFileData.Find(&KTagUnusedbyte,1); |
|
729 // store Data |
|
730 iNumberBuf.Append(aFileData.Mid(1,( offset - 1 ))); |
|
731 |
|
732 if( ( EMmTsyONStoreReadEntryIPC == iSavedIPCForComplete ) && |
|
733 ( EMmTsyONStoreReadIPC == iSavedIPCForComplete ) ) |
|
734 { |
|
735 StoreEntryToListL( aEntryStored ); |
499 } |
736 } |
500 else |
737 else |
501 { |
738 { |
502 //Update Entry Status |
739 // decment for own number read entry |
503 iStoreEntry->iEntryPresent = EFalse; |
740 iNumOfEntriesToRead--; |
504 // Reset Entry andd Append to the List |
741 iNumOfEntriesFilled++; |
505 iMmPhoneBookStoreMessHandler->StoreEntryToPhoneBookList( |
|
506 iStoreEntry, |
|
507 arrayIndex ); |
|
508 |
|
509 // Entry is Empty read next Entry |
|
510 if(!iLocationSearch) |
|
511 { |
|
512 // Decrement the no of Entries to be read |
|
513 iNumOfEntriesToRead--; |
|
514 } |
|
515 } |
742 } |
516 |
|
517 // to read next record |
|
518 iIndexToRead++; |
|
519 |
|
520 }// End of without EXT File Data Case |
|
521 |
|
522 // Handling for Extension Numbers |
|
523 else if ( EExtensionRead == iTypeOfReading ) |
|
524 { |
|
525 // Check for next extension data record |
|
526 if ( 0xFF != aFileData[UICC_EXT_REC_NO_OFFSET] ) |
|
527 { |
|
528 // Again Append the EXT no to Array |
|
529 iStoreEntry->PBEntryExtRecord.Append( |
|
530 aFileData[UICC_EXT_REC_NO_OFFSET] ); |
|
531 |
|
532 |
|
533 // Store Number upto last byte |
|
534 iNumberBuf.Append(aFileData.Mid(1,11)); |
|
535 // Again Send request to read next record number and appenf it |
|
536 // in number |
|
537 retExt = USimPbReqRead( |
|
538 aFileData[UICC_EXT_REC_NO_OFFSET], aTransId ); |
|
539 if( KErrNone != retExt) |
|
540 { |
|
541 iNumOfEntriesToRead--; |
|
542 iTypeOfReading = EBasicEfRead; |
|
543 } |
|
544 } |
|
545 else |
|
546 { |
|
547 // Append Entry to list and reset all the EXT data |
|
548 iMmPhoneBookStoreMessHandler->StoreEntryToPhoneBookList( |
|
549 iStoreEntry, |
|
550 arrayIndex ); |
|
551 |
|
552 // Reset Extension File record |
|
553 iExtensionRead = EFalse; |
|
554 |
|
555 // Check for Extended Data is Addition number |
|
556 if( 0x02 == aFileData[0]) |
|
557 { |
|
558 // Check for length upto which no is stored |
|
559 TInt offset = aFileData.Find(&KTagUnusedbyte,1); |
|
560 // store Data |
|
561 iNumberBuf.Append(aFileData.Mid(1,( offset - 1 ))); |
|
562 // Decrement no of Entries to be read after Storing it to |
|
563 // CommonTSY Array in EXT data case |
|
564 iNumOfEntriesToRead--; |
|
565 |
|
566 // the there is extension data |
|
567 CPhoneBookStoreEntry* phoneBookStoreMsg = |
|
568 new( ELeave ) CPhoneBookStoreEntry; |
|
569 CleanupStack::PushL( phoneBookStoreMsg ); |
|
570 phoneBookStoreMsg->ConstructL(); |
|
571 |
|
572 iMmPhoneBookStoreMessHandler->StorePhonebookEntryL( |
|
573 iNameBuf, |
|
574 iNumberBuf, |
|
575 *phoneBookStoreMsg, |
|
576 pbFileId, |
|
577 iIndexToRead, |
|
578 iMailboxIdExist ); |
|
579 |
|
580 TF_ASSERT( NULL != iPhoneBookStoreCacheArray ); |
|
581 iPhoneBookStoreCacheArray->AppendL( phoneBookStoreMsg ); |
|
582 CleanupStack::Pop( phoneBookStoreMsg ); |
|
583 iNumOfEntriesFilled++; |
|
584 TFLOGSTRING2("TSY: CMmPhoneBookOperationRead::HandleUSimPbRespL - Append entries into array %i",iNumOfEntriesFilled); |
743 TFLOGSTRING2("TSY: CMmPhoneBookOperationRead::HandleUSimPbRespL - Append entries into array %i",iNumOfEntriesFilled); |
585 OstTrace1( TRACE_NORMAL, DUP5_CMMPHONEBOOKOPERATIONREAD_HANDLEUICCPBRESPL, "CMmPhoneBookOperationRead::HandleUICCPbRespL;iNumOfEntriesFilled=%d", iNumOfEntriesFilled ); |
744 OstTrace1( TRACE_NORMAL, DUP5_CMMPHONEBOOKOPERATIONREAD_HANDLEUICCPBRESPL, "CMmPhoneBookOperationRead::HandleUICCPbRespL;iNumOfEntriesFilled=%d", iNumOfEntriesFilled ); |
586 |
745 } |
587 } |
746 } |
588 } |
747 } |
|
748 |
|
749 |
|
750 |
|
751 // ----------------------------------------------------------------------------- |
|
752 // CMmPhoneBookOperationRead::USimReadWriteSizeResp |
|
753 // Send Request to Get Read and Write size |
|
754 // ----------------------------------------------------------------------------- |
|
755 // |
|
756 TBool CMmPhoneBookOperationRead::USimReadWriteSizeResp( const TDesC8 &aFileData, |
|
757 TInt aStatus ) |
|
758 { |
|
759 TFLOGSTRING("TSY: CMmPhoneBookOperationRead::USimReadWriteSizeResp"); |
|
760 OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONREAD_USIMREADWRITESIZERESP, "CMmPhoneBookOperationRead::USimReadWriteSizeResp" ); |
|
761 |
|
762 TInt ret( aStatus ); |
|
763 TInt numOfEntries(0); |
|
764 |
|
765 if(UICC_STATUS_OK == aStatus) |
|
766 { |
|
767 // get the record length and number of entries |
|
768 TFci fci( aFileData ); |
|
769 numOfEntries = fci.GetNumberOfRecords(); |
|
770 |
|
771 // Update it in Internal Buffer |
|
772 iMmPhoneBookStoreMessHandler-> |
|
773 iPBStoreConf[EPhonebookTypeMSISDN].iNoOfRecords = numOfEntries; |
|
774 } |
|
775 else |
|
776 { |
|
777 TFLOGSTRING("TSY: CMmPhoneBookOperationRead::USimReadWriteSizeResp - FileInfo read Fail"); |
|
778 OstTrace0( TRACE_NORMAL, DUP1_CMMPHONEBOOKOPERATIONREAD_USIMREADWRITESIZERESP, "CMmPhoneBookOperationRead::USimReadWriteSizeResp - FileInfo Read Fail" ); |
|
779 |
|
780 ret = KErrArgument; |
|
781 } |
|
782 |
|
783 |
|
784 // Create data package |
|
785 CMmDataPackage numberData; |
|
786 // complete request |
|
787 numberData.PackData( &numOfEntries ); |
|
788 iMmPhoneBookStoreMessHandler->MessageRouter()->Complete( |
|
789 iSavedIPCForComplete, |
|
790 &numberData, |
|
791 ret ); |
|
792 |
|
793 return ETrue; |
|
794 } |
|
795 |
|
796 |
|
797 |
|
798 // ----------------------------------------------------------------------------- |
|
799 // CMmPhoneBookOperationRead::StoreEntryToListL |
|
800 // StoreEntry to internal list and Cache Array |
|
801 // ----------------------------------------------------------------------------- |
|
802 // |
|
803 void CMmPhoneBookOperationRead::StoreEntryToListL( TBool &aEntryStored ) |
|
804 { |
|
805 TFLOGSTRING("TSY: CMmPhoneBookOperationRead::StoreEntryToList"); |
|
806 OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONREAD_STOREENTRYTOLIST, "CMmPhoneBookOperationRead::StoreEntryToList" ); |
|
807 |
|
808 iMmPhoneBookStoreMessHandler->StoreEntryToPhoneBookList( |
|
809 iStoreEntry, |
|
810 iArrayIndex ); |
|
811 |
|
812 // Decrement the number of entries to be read when it is |
|
813 // stored in commonTSY Array |
|
814 iNumOfEntriesToRead--; |
|
815 |
|
816 // the there is no extension data |
|
817 CPhoneBookStoreEntry* phoneBookStoreEntry = |
|
818 new( ELeave ) CPhoneBookStoreEntry; |
|
819 CleanupStack::PushL( phoneBookStoreEntry ); |
|
820 phoneBookStoreEntry->ConstructL(); |
|
821 iMmPhoneBookStoreMessHandler->StorePhonebookEntryL( |
|
822 iNameBuf, |
|
823 iNumberBuf, |
|
824 *phoneBookStoreEntry, |
|
825 iFileId, |
|
826 iIndexToRead ); |
|
827 TF_ASSERT( NULL != iPhoneBookStoreCacheArray ); |
|
828 |
|
829 iPhoneBookStoreCacheArray->AppendL( phoneBookStoreEntry ); |
|
830 CleanupStack::Pop( phoneBookStoreEntry ); |
|
831 iNumOfEntriesFilled++; |
|
832 aEntryStored = ETrue; |
|
833 } |
|
834 |
|
835 |
|
836 |
|
837 |
|
838 |
|
839 // ----------------------------------------------------------------------------- |
|
840 // CMmPhoneBookOperationRead::StoreOwnNumber |
|
841 // StoreEntry to internal list and shared buffer for own number |
|
842 // ----------------------------------------------------------------------------- |
|
843 // |
|
844 void CMmPhoneBookOperationRead::StoreAndCompleteOwnNumber( TInt aRet , TInt aEmptyEntry) |
|
845 { |
|
846 TFLOGSTRING("TSY: CMmPhoneBookOperationRead::StoreAndCompleteOwnNumber"); |
|
847 OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONREAD_STOREANDCOMPLETEOWNNUMBER, "CMmPhoneBookOperationRead::StoreAndCompleteOwnNumber" ); |
|
848 |
|
849 if( ( EMmTsyONStoreReadEntryIPC == iSavedIPCForComplete ) && |
|
850 ( ( KErrNone != aEmptyEntry ) || ( KErrNone != aRet ) ) ) |
|
851 { |
|
852 // complete ipc with null |
|
853 iMmPhoneBookStoreMessHandler->MessageRouter()->Complete( |
|
854 iSavedIPCForComplete, |
|
855 NULL, |
|
856 aRet ); |
|
857 } |
|
858 else |
|
859 { |
|
860 // Append Entry to list |
|
861 iMmPhoneBookStoreMessHandler->StoreEntryToPhoneBookList( |
|
862 iStoreEntry, |
|
863 iArrayIndex ); |
|
864 |
|
865 // Decrement the number of entries to be read when it is |
|
866 // stored in commonTSY Array |
|
867 iNumOfEntriesToRead--; |
|
868 |
|
869 // Create ON store structure |
|
870 TONStoreMsg* oNStoreMsg = new ( ELeave ) TONStoreMsg(); |
|
871 |
|
872 // Push oNStoreMsg into CleanupStack |
|
873 CleanupStack::PushL( oNStoreMsg ); |
|
874 |
|
875 // Save Name |
|
876 |
|
877 TBuf8<UICC_EF_MAX_NAME_LEN> aNameString; |
|
878 // Convert String to 8 bit format |
|
879 CMmStaticUtility::ConvertGsmDataToUcs2(iNameBuf, iNameBuf.Length() , aNameString ); |
|
880 TIsiUtility::CopyFromBigEndian( |
|
881 aNameString, |
|
882 oNStoreMsg->iName ); |
|
883 |
|
884 // Convert Number to Ascii Code |
|
885 // Save Number |
|
886 iMmPhoneBookStoreMessHandler->ConvertToUcs2FromBCD(iNumberBuf, oNStoreMsg->iTelNumber,PB_MBDN_FID ); |
|
887 |
|
888 // Set location index |
|
889 // Map location to client world (increase value by one) |
|
890 oNStoreMsg->iLocation = iStoreEntry->iEntryIndex ; |
|
891 |
|
892 // Create data package |
|
893 CMmDataPackage numberData; |
|
894 if( EMmTsyONStoreReadIPC == iSavedIPCForComplete ) |
|
895 { |
|
896 // Complete response with ret |
|
897 // Pack the data for sending to the manager |
|
898 numberData.PackData( &oNStoreMsg ); |
589 } |
899 } |
590 else |
900 else |
591 { |
901 { |
592 // Read mailbox ID |
902 numberData.PackData( oNStoreMsg ); |
593 |
903 } |
594 // There are 4 bytes describing mailbox id and one of them can |
904 iMmPhoneBookStoreMessHandler->MessageRouter()->Complete( |
595 // be valid at a time |
905 iSavedIPCForComplete, |
596 // 1 Mailbox Dialling Number Identifier – Voicemail |
906 &numberData, |
597 // 2 Mailbox Dialling Number Identifier – Fax |
907 aRet ); |
598 // 3 Mailbox Dialling Number Identifier – Electronic Mail |
908 // Delete oNStoreMsg structure |
599 // 4 Mailbox Dialling Number Identifier – Other |
909 CleanupStack::PopAndDestroy( oNStoreMsg ); |
600 |
910 |
601 for ( TUint8 i( 0 ); i < 4; i++ ) |
911 // Reset current IPC. |
602 { |
912 iSavedIPCForComplete = 0; |
603 iMailboxIdExist = EFalse; |
913 iNumOfEntriesFilled++; |
604 if ( 0 != aFileData[i] ) |
914 } |
605 { |
|
606 iMailboxIdExist = ETrue; |
|
607 iIndexToRead = aFileData[i]; |
|
608 break; |
|
609 } |
|
610 } |
|
611 |
|
612 TFLOGSTRING2("TSY: CMmPhoneBookOperationRead::HandleUSimPbRespL - Append entries into array %i",iNumOfEntriesFilled); |
|
613 } |
|
614 |
|
615 if( ( ( EBasicEfRead == iTypeOfReading ) || |
|
616 ( EMailboxIdRead == iTypeOfReading ) ) && |
|
617 ( 0 != iNumOfEntriesToRead ) ) |
|
618 { |
|
619 ret = USimPbReqRead( iIndexToRead, aTransId ); |
|
620 } |
|
621 } |
|
622 |
|
623 // Complete request |
|
624 if( ( KErrNone != ret )|| ( 0 == iNumOfEntriesToRead )) |
|
625 { |
|
626 // Check fo Any Entries Found |
|
627 if( ( UICC_STATUS_OK == aStatus )&& ( 0 == iNumOfEntriesFilled ) ) |
|
628 { |
|
629 ret = KErrNotFound; |
|
630 } |
|
631 |
|
632 CPhoneBookDataPackage phoneBookData; |
|
633 phoneBookData.SetPhoneBookName( iPhoneBookTypeName ); |
|
634 iNumOfEntriesFilled = 0; |
|
635 iMmPhoneBookStoreMessHandler->MessageRouter()->Complete( |
|
636 iSavedIPCForComplete, |
|
637 &phoneBookData, |
|
638 ret ); |
|
639 |
|
640 iPhoneBookStoreCacheArray = NULL; |
|
641 // Set flag to indicate that we can remove this operation from array |
|
642 complete = ETrue; |
|
643 } |
|
644 |
|
645 return complete; |
|
646 } |
915 } |
647 |
916 |
648 |
917 |
649 // End of File |
918 // End of File |