1 // Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies). |
1 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). |
2 // All rights reserved. |
2 // All rights reserved. |
3 // This component and the accompanying materials are made available |
3 // This component and the accompanying materials are made available |
4 // under the terms of "Eclipse Public License v1.0" |
4 // under the terms of "Eclipse Public License v1.0" |
5 // which accompanies this distribution, and is available |
5 // which accompanies this distribution, and is available |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
17 |
17 |
18 /** |
18 /** |
19 @file |
19 @file |
20 */ |
20 */ |
21 |
21 |
22 |
|
23 |
|
24 #include "OstTraceDefinitions.h" |
|
25 #ifdef OST_TRACE_COMPILER_IN_USE |
|
26 #include "CSimPhoneSmartCardAppTraces.h" |
|
27 #endif |
|
28 |
|
29 #include <testconfigfileparser.h> |
22 #include <testconfigfileparser.h> |
30 #include <etelmmerr.h> |
23 #include <etelmmerr.h> |
31 #include "CSimPhone.h" |
24 #include "CSimPhone.h" |
|
25 #include "Simlog.h" |
32 |
26 |
33 // |
27 // |
34 // CSimPhoneSmartCardApp |
28 // CSimPhoneSmartCardApp |
35 // |
29 // |
36 |
30 |
65 * Constructs all the member data and retrieves all the data from the config file specific to this class. |
59 * Constructs all the member data and retrieves all the data from the config file specific to this class. |
66 * |
60 * |
67 * @leave Leaves due to not enough memory or if any data member does not construct for any reason. |
61 * @leave Leaves due to not enough memory or if any data member does not construct for any reason. |
68 */ |
62 */ |
69 { |
63 { |
70 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPHONESMARTCARDAPP_CONSTRUCTL_1, "Starting to parse Phone Smart Card applications additional config parameters..."); |
64 LOGPHONE1("Starting to parse Phone Smart Card applications additional config parameters..."); |
71 ParseSmartCardApplicationInfoL(); |
65 ParseSmartCardApplicationInfoL(); |
72 ParseSmartCardFileInfoL(); |
66 ParseSmartCardFileInfoL(); |
73 MapUSimAppsL(); |
67 MapUSimAppsL(); |
74 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPHONESMARTCARDAPP_CONSTRUCTL_2, "Finished parsing Phone Smart Card applications additional config parameters..."); |
68 LOGPHONE1("Finished parsing Phone Smart Card applications additional config parameters..."); |
75 } |
69 } |
76 |
70 |
77 |
71 |
78 CSimPhoneSmartCardApp::~CSimPhoneSmartCardApp() |
72 CSimPhoneSmartCardApp::~CSimPhoneSmartCardApp() |
79 /** |
73 /** |
299 case EMobilePhoneNotifyUSimApplicationsInfoChange: |
293 case EMobilePhoneNotifyUSimApplicationsInfoChange: |
300 case EMobilePhoneNotifySmartCardApplicationInfoChange: |
294 case EMobilePhoneNotifySmartCardApplicationInfoChange: |
301 numberOfSlots = KDefaultNumberOfSlots; |
295 numberOfSlots = KDefaultNumberOfSlots; |
302 break; |
296 break; |
303 default: |
297 default: |
304 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPHONESMARTCARDAPP_NUMBEROFSLOTSL_1, "CSimPhoneSmartCardApp: Number of Slots error, unknown IPC"); |
298 LOGPHONE1("CSimPhoneSmartCardApp: Number of Slots error, unknown IPC"); |
305 User::Leave(KErrNotSupported); |
299 User::Leave(KErrNotSupported); |
306 break; |
300 break; |
307 } |
301 } |
308 return numberOfSlots; |
302 return numberOfSlots; |
309 } |
303 } |
377 * Returns a pointer to the config file section |
371 * Returns a pointer to the config file section |
378 * |
372 * |
379 * @return CTestConfigSection a pointer to the configuration file data section |
373 * @return CTestConfigSection a pointer to the configuration file data section |
380 */ |
374 */ |
381 { |
375 { |
382 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPHONESMARTCARDAPP_CFGFILE_1, ">>CSimPhoneSmartCardApp::CfgFile"); |
376 LOGPHONE1(">>CSimPhoneSmartCardApp::CfgFile"); |
383 return iPhone->CfgFile(); |
377 return iPhone->CfgFile(); |
384 } |
378 } |
385 |
379 |
386 void CSimPhoneSmartCardApp::TimerCallBack(TInt /*aId*/) |
380 void CSimPhoneSmartCardApp::TimerCallBack(TInt /*aId*/) |
387 /** |
381 /** |
490 } |
484 } |
491 |
485 |
492 //check that the client has specified a valid start offset |
486 //check that the client has specified a valid start offset |
493 else if(aFilePathOffsets.iStartOffset < 1 || aFilePathOffsets.iStartOffset > iNumberRecords) |
487 else if(aFilePathOffsets.iStartOffset < 1 || aFilePathOffsets.iStartOffset > iNumberRecords) |
494 { |
488 { |
495 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPHONESMARTCARDAPP_TCYCLICSMARTCARDFILE_READFILE_1, "ERROR: File start offset information invalid."); |
489 LOGPHONE1("ERROR: File start offset information invalid."); |
496 return KErrMMEtelScRecordNotFound; |
490 return KErrMMEtelScRecordNotFound; |
497 } |
491 } |
498 |
492 |
499 else |
493 else |
500 { |
494 { |
589 } |
583 } |
590 |
584 |
591 //check that the client has specified a valid start offset |
585 //check that the client has specified a valid start offset |
592 else if(aFilePathOffsets.iStartOffset < 1 || aFilePathOffsets.iStartOffset > iNumberRecords) |
586 else if(aFilePathOffsets.iStartOffset < 1 || aFilePathOffsets.iStartOffset > iNumberRecords) |
593 { |
587 { |
594 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPHONESMARTCARDAPP_TLINEARSMARTCARDFILE_READFILE_1, "ERROR: File start offset information invalid."); |
588 LOGPHONE1("ERROR: File start offset information invalid."); |
595 return KErrMMEtelScRecordNotFound; |
589 return KErrMMEtelScRecordNotFound; |
596 } |
590 } |
597 else |
591 else |
598 { |
592 { |
599 TInt filePointer = (aFilePathOffsets.iStartOffset - 1) * iRecordLength; |
593 TInt filePointer = (aFilePathOffsets.iStartOffset - 1) * iRecordLength; |
630 } |
624 } |
631 |
625 |
632 //check that the client has specified a valid start offset |
626 //check that the client has specified a valid start offset |
633 else if(aFilePathOffsets.iStartOffset < 1 || aFilePathOffsets.iStartOffset > iNumberRecords) |
627 else if(aFilePathOffsets.iStartOffset < 1 || aFilePathOffsets.iStartOffset > iNumberRecords) |
634 { |
628 { |
635 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPHONESMARTCARDAPP_TLINEARSMARTCARDFILE_UPDATEFILE_1, "ERROR: File start offset information invalid."); |
629 LOGPHONE1("ERROR: File start offset information invalid."); |
636 return KErrMMEtelScRecordNotFound; |
630 return KErrMMEtelScRecordNotFound; |
637 } |
631 } |
638 else |
632 else |
639 { |
633 { |
640 TInt filePointer = (aFilePathOffsets.iStartOffset - 1) * iRecordLength; |
634 TInt filePointer = (aFilePathOffsets.iStartOffset - 1) * iRecordLength; |
669 } |
663 } |
670 |
664 |
671 //check that the client has specified a valid start offset |
665 //check that the client has specified a valid start offset |
672 else if(aFilePathOffsets.iStartOffset >= (TUint)iTotalLength) |
666 else if(aFilePathOffsets.iStartOffset >= (TUint)iTotalLength) |
673 { |
667 { |
674 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPHONESMARTCARDAPP_TTRANSPARENTSMARTCARDFILE_READFILE_1, "ERROR: File start offset information invalid."); |
668 LOGPHONE1("ERROR: File start offset information invalid."); |
675 return KErrMMEtelScReferencedDataNotFound; |
669 return KErrMMEtelScReferencedDataNotFound; |
676 } |
670 } |
677 |
671 |
678 //check the client is not requesting to read too many bytes, resulting in reading |
672 //check the client is not requesting to read too many bytes, resulting in reading |
679 //off the end of the file |
673 //off the end of the file |
680 else if((bytesToRead + filePointer) > iTotalLength) |
674 else if((bytesToRead + filePointer) > iTotalLength) |
681 { |
675 { |
682 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPHONESMARTCARDAPP_TTRANSPARENTSMARTCARDFILE_READFILE_2, "ERROR: Path offset information results in reading off the end of the file"); |
676 LOGPHONE1("ERROR: Path offset information results in reading off the end of the file"); |
683 return KErrMMEtelScEofReached; |
677 return KErrMMEtelScEofReached; |
684 } |
678 } |
685 else |
679 else |
686 { |
680 { |
687 aReadBuffer->SetLength(bytesToRead); |
681 aReadBuffer->SetLength(bytesToRead); |
721 } |
715 } |
722 |
716 |
723 //check that the client has specified a valid start offset |
717 //check that the client has specified a valid start offset |
724 else if(aFilePathOffsets.iStartOffset >= (TUint)iTotalLength) |
718 else if(aFilePathOffsets.iStartOffset >= (TUint)iTotalLength) |
725 { |
719 { |
726 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPHONESMARTCARDAPP_TTRANSPARENTSMARTCARDFILE_UPDATEFILE_1, "ERROR: File start offset information invalid."); |
720 LOGPHONE1("ERROR: File start offset information invalid."); |
727 return KErrMMEtelScReferencedDataNotFound; |
721 return KErrMMEtelScReferencedDataNotFound; |
728 } |
722 } |
729 |
723 |
730 //check the client is not requesting to write too many bytes, resulting in writing |
724 //check the client is not requesting to write too many bytes, resulting in writing |
731 //off the end of the file |
725 //off the end of the file |
732 else if((bytesToWrite + filePointer) > iTotalLength) |
726 else if((bytesToWrite + filePointer) > iTotalLength) |
733 { |
727 { |
734 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPHONESMARTCARDAPP_TTRANSPARENTSMARTCARDFILE_UPDATEFILE_2, "ERROR: Path offset information results in reading off the end of the file"); |
728 LOGPHONE1("ERROR: Path offset information results in reading off the end of the file"); |
735 return KErrMMEtelScEofReached; |
729 return KErrMMEtelScEofReached; |
736 } |
730 } |
737 else |
731 else |
738 { |
732 { |
739 for(index = 0; index < bytesToWrite; index++) |
733 for(index = 0; index < bytesToWrite; index++) |
1358 * @param aFilePathId Used to specify path of the file for which information should be retrieved |
1352 * @param aFilePathId Used to specify path of the file for which information should be retrieved |
1359 * @param aInfo Used to return the retrieved file information |
1353 * @param aInfo Used to return the retrieved file information |
1360 */ |
1354 */ |
1361 { |
1355 { |
1362 |
1356 |
1363 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPHONESMARTCARDAPP_GETSCFILEINFO_1, "CSimPhoneSmartCardApp::GetScFileInfo called"); |
1357 LOGPHONE1("CSimPhoneSmartCardApp::GetScFileInfo called"); |
1364 |
1358 |
1365 RMobilePhone::TScFileInfoV5Pckg *scFileInfoPckg = reinterpret_cast<RMobilePhone::TScFileInfoV5Pckg*>(aInfo); |
1359 RMobilePhone::TScFileInfoV5Pckg *scFileInfoPckg = reinterpret_cast<RMobilePhone::TScFileInfoV5Pckg*>(aInfo); |
1366 RMobilePhone::TScFileInfoV5 &scFileInfo = (*scFileInfoPckg)(); |
1360 RMobilePhone::TScFileInfoV5 &scFileInfo = (*scFileInfoPckg)(); |
1367 |
1361 |
1368 // Check that the data structure is supported by the simulated TSY version |
1362 // Check that the data structure is supported by the simulated TSY version |
1495 TSmartCardApplication appInfo; |
1489 TSmartCardApplication appInfo; |
1496 |
1490 |
1497 TRAP_IGNORE(iTimer=CSimTimer::NewL(iPhone)); |
1491 TRAP_IGNORE(iTimer=CSimTimer::NewL(iPhone)); |
1498 |
1492 |
1499 |
1493 |
1500 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPHONESMARTCARDAPP_PARSESMARTCARDAPPLICATIONINFOL_1, "Starting to Parse MaxActiveSmartCardApp Info"); |
1494 LOGPHONE1("Starting to Parse MaxActiveSmartCardApp Info"); |
1501 iMaxActiveSmartCardApps = CfgFile()->ItemValue(KMaxActiveSmartCardApps ,KDefaultMaxActiveSmartCardApps); |
1495 iMaxActiveSmartCardApps = CfgFile()->ItemValue(KMaxActiveSmartCardApps ,KDefaultMaxActiveSmartCardApps); |
1502 |
1496 |
1503 |
1497 |
1504 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPHONESMARTCARDAPP_PARSESMARTCARDAPPLICATIONINFOL_2, "Starting to Parse ActiveUSIMApp Info"); |
1498 LOGPHONE1("Starting to Parse ActiveUSIMApp Info"); |
1505 activeUSimApp.Set(CfgFile()->ItemValue(KActiveUSIMApp, KEmptyString)); |
1499 activeUSimApp.Set(CfgFile()->ItemValue(KActiveUSIMApp, KEmptyString)); |
1506 if(activeUSimApp.Length() == 0) |
1500 if(activeUSimApp.Length() == 0) |
1507 { |
1501 { |
1508 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPHONESMARTCARDAPP_PARSESMARTCARDAPPLICATIONINFOL_3, "ERROR IN CONFIGURATION FILE PARSING: ACTIVE USIM APP NOT SPECIFIED!"); |
1502 LOGPHONE1("ERROR IN CONFIGURATION FILE PARSING: ACTIVE USIM APP NOT SPECIFIED!"); |
1509 } |
1503 } |
1510 |
1504 |
1511 |
1505 |
1512 TInt count = CfgFile()->ItemCount(KSmartCardAppInfo); |
1506 TInt count = CfgFile()->ItemCount(KSmartCardAppInfo); |
1513 iSmartCardAppList=new(ELeave) CArrayFixFlat<TSmartCardApplication>(count+1); |
1507 iSmartCardAppList=new(ELeave) CArrayFixFlat<TSmartCardApplication>(count+1); |
1514 |
1508 |
1515 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPHONESMARTCARDAPP_PARSESMARTCARDAPPLICATIONINFOL_4, "Starting to Load and Parse Smart Card Application Info"); |
1509 LOGPHONE1("Starting to Load and Parse Smart Card Application Info"); |
1516 for(index=0;index<count;index++) |
1510 for(index=0;index<count;index++) |
1517 { |
1511 { |
1518 item=CfgFile()->Item(KSmartCardAppInfo,index); |
1512 item=CfgFile()->Item(KSmartCardAppInfo,index); |
1519 if(!item) |
1513 if(!item) |
1520 { |
1514 { |
1522 } |
1516 } |
1523 |
1517 |
1524 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,0,aid); |
1518 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,0,aid); |
1525 if(ret!=KErrNone) |
1519 if(ret!=KErrNone) |
1526 { |
1520 { |
1527 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPHONESMARTCARDAPP_PARSESMARTCARDAPPLICATIONINFOL_5, "ERROR IN CONFIGURATION FILE PARSING: BAD SMARTCARD APP INFO TAG"); |
1521 LOGPHONE1("ERROR IN CONFIGURATION FILE PARSING: BAD SMARTCARD APP INFO TAG"); |
1528 continue; |
1522 continue; |
1529 } |
1523 } |
1530 else |
1524 else |
1531 { |
1525 { |
1532 appInfo.iAID.Copy(aid); |
1526 appInfo.iAID.Copy(aid); |
1533 } |
1527 } |
1534 |
1528 |
1535 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,1,label); |
1529 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,1,label); |
1536 if(ret!=KErrNone) |
1530 if(ret!=KErrNone) |
1537 { |
1531 { |
1538 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPHONESMARTCARDAPP_PARSESMARTCARDAPPLICATIONINFOL_6, "ERROR IN CONFIGURATION FILE PARSING: BAD SMARTCARD APP INFO TAG"); |
1532 LOGPHONE1("ERROR IN CONFIGURATION FILE PARSING: BAD SMARTCARD APP INFO TAG"); |
1539 continue; |
1533 continue; |
1540 } |
1534 } |
1541 else |
1535 else |
1542 { |
1536 { |
1543 appInfo.iLabel.Copy(label); |
1537 appInfo.iLabel.Copy(label); |
1544 } |
1538 } |
1545 |
1539 |
1546 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,2,type); |
1540 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,2,type); |
1547 if(ret!=KErrNone) |
1541 if(ret!=KErrNone) |
1548 { |
1542 { |
1549 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPHONESMARTCARDAPP_PARSESMARTCARDAPPLICATIONINFOL_7, "ERROR IN CONFIGURATION FILE PARSING: BAD SMARTCARD APP INFO TAG"); |
1543 LOGPHONE1("ERROR IN CONFIGURATION FILE PARSING: BAD SMARTCARD APP INFO TAG"); |
1550 continue; |
1544 continue; |
1551 } |
1545 } |
1552 else |
1546 else |
1553 { |
1547 { |
1554 appInfo.iAppType = (TSmartCardAppType)type; |
1548 appInfo.iAppType = (TSmartCardAppType)type; |
1567 } |
1561 } |
1568 |
1562 |
1569 ret = CTestConfig::GetElement(item->Value(), KStdDelimiter, 3, eap); |
1563 ret = CTestConfig::GetElement(item->Value(), KStdDelimiter, 3, eap); |
1570 if (ret != KErrNone) |
1564 if (ret != KErrNone) |
1571 { |
1565 { |
1572 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPHONESMARTCARDAPP_PARSESMARTCARDAPPLICATIONINFOL_8, "CONFIGURATION FILE PARSING: BAD OR NO (OPTIONAL) EAP LIST @ SMARTCARD APP INFO TAG [%d]", index); |
1566 LOGPHONE2("CONFIGURATION FILE PARSING: BAD OR NO (OPTIONAL) EAP LIST @ SMARTCARD APP INFO TAG [%d]", index); |
1573 _LIT8(emptyEapList, ""); |
1567 _LIT8(emptyEapList, ""); |
1574 eap.Set(emptyEapList); |
1568 eap.Set(emptyEapList); |
1575 } |
1569 } |
1576 // Append empty string if no info is given |
1570 // Append empty string if no info is given |
1577 appInfo.iEapList.Copy(eap); |
1571 appInfo.iEapList.Copy(eap); |
1580 iFoundScAppTags = ETrue; |
1574 iFoundScAppTags = ETrue; |
1581 }//end of FOR loop |
1575 }//end of FOR loop |
1582 |
1576 |
1583 if(iActiveUSimApp.Length() == 0) |
1577 if(iActiveUSimApp.Length() == 0) |
1584 { |
1578 { |
1585 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPHONESMARTCARDAPP_PARSESMARTCARDAPPLICATIONINFOL_9, "ERROR IN CONFIGURATION FILE PARSING: AID FOR ACTIVE USIM APP NOT FOUND!"); |
1579 LOGPHONE1("ERROR IN CONFIGURATION FILE PARSING: AID FOR ACTIVE USIM APP NOT FOUND!"); |
1586 } |
1580 } |
1587 |
1581 |
1588 |
1582 |
1589 count=CfgFile()->ItemCount(KSmartCardAppEvent); |
1583 count=CfgFile()->ItemCount(KSmartCardAppEvent); |
1590 iSmartCardAppEventList=new(ELeave) CArrayFixFlat<TSmartCardAppEvent>(count+1); |
1584 iSmartCardAppEventList=new(ELeave) CArrayFixFlat<TSmartCardAppEvent>(count+1); |
1591 TSmartCardAppEvent appEvent; |
1585 TSmartCardAppEvent appEvent; |
1592 TInt duration, action; |
1586 TInt duration, action; |
1593 |
1587 |
1594 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPHONESMARTCARDAPP_PARSESMARTCARDAPPLICATIONINFOL_10, "Starting to Load and Parse Smart Card Application Event Info"); |
1588 LOGPHONE1("Starting to Load and Parse Smart Card Application Event Info"); |
1595 |
1589 |
1596 for(index=0;index<count;index++) |
1590 for(index=0;index<count;index++) |
1597 { |
1591 { |
1598 item=CfgFile()->Item(KSmartCardAppEvent,index); |
1592 item=CfgFile()->Item(KSmartCardAppEvent,index); |
1599 if(!item) |
1593 if(!item) |
1602 } |
1596 } |
1603 |
1597 |
1604 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,0, duration); |
1598 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,0, duration); |
1605 if(ret!=KErrNone) |
1599 if(ret!=KErrNone) |
1606 { |
1600 { |
1607 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPHONESMARTCARDAPP_PARSESMARTCARDAPPLICATIONINFOL_11, "ERROR IN CONFIGURATION FILE PARSING: BAD SMART CARD APP EVENT TAG"); |
1601 LOGPHONE1("ERROR IN CONFIGURATION FILE PARSING: BAD SMART CARD APP EVENT TAG"); |
1608 continue; |
1602 continue; |
1609 } |
1603 } |
1610 else |
1604 else |
1611 { |
1605 { |
1612 appEvent.iDuration=duration; |
1606 appEvent.iDuration=duration; |
1613 } |
1607 } |
1614 |
1608 |
1615 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,1, aid); |
1609 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,1, aid); |
1616 if(ret!=KErrNone) |
1610 if(ret!=KErrNone) |
1617 { |
1611 { |
1618 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPHONESMARTCARDAPP_PARSESMARTCARDAPPLICATIONINFOL_12, "ERROR IN CONFIGURATION FILE PARSING; BAD SMART CARD APP EVENT TAG"); |
1612 LOGPHONE1("ERROR IN CONFIGURATION FILE PARSING; BAD SMART CARD APP EVENT TAG"); |
1619 continue; |
1613 continue; |
1620 } |
1614 } |
1621 else |
1615 else |
1622 { |
1616 { |
1623 appEvent.iAID.Copy(aid); |
1617 appEvent.iAID.Copy(aid); |
1624 } |
1618 } |
1625 |
1619 |
1626 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,2, action); |
1620 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,2, action); |
1627 if(ret!=KErrNone) |
1621 if(ret!=KErrNone) |
1628 { |
1622 { |
1629 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPHONESMARTCARDAPP_PARSESMARTCARDAPPLICATIONINFOL_13, "ERROR IN CONFIGURATION FILE PARSING; BAD SMART CARD APP EVENT TAG"); |
1623 LOGPHONE1("ERROR IN CONFIGURATION FILE PARSING; BAD SMART CARD APP EVENT TAG"); |
1630 continue; |
1624 continue; |
1631 } |
1625 } |
1632 else |
1626 else |
1633 { |
1627 { |
1634 appEvent.iAction = (RMobilePhone::TSmartCardApplicationAction)action; |
1628 appEvent.iAction = (RMobilePhone::TSmartCardApplicationAction)action; |
1649 TInt ret=KErrNone; |
1643 TInt ret=KErrNone; |
1650 TPtrC8 fileId, filePath, fileData; |
1644 TPtrC8 fileId, filePath, fileData; |
1651 TInt aidIndex, fileType, fileLength, recordLength, numRecords, index; |
1645 TInt aidIndex, fileType, fileLength, recordLength, numRecords, index; |
1652 TSmartCardFile* file = NULL; |
1646 TSmartCardFile* file = NULL; |
1653 |
1647 |
1654 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPHONESMARTCARDAPP_PARSESMARTCARDFILEINFOL_1, "Starting to Parse Smart Card File Info"); |
1648 LOGPHONE1("Starting to Parse Smart Card File Info"); |
1655 TInt count = CfgFile()->ItemCount(KSmartCardFile); |
1649 TInt count = CfgFile()->ItemCount(KSmartCardFile); |
1656 iSmartCardFileList = new(ELeave) CArrayPtrFlat<TSmartCardFile>(count+1); |
1650 iSmartCardFileList = new(ELeave) CArrayPtrFlat<TSmartCardFile>(count+1); |
1657 |
1651 |
1658 for(index=0;index<count;index++) |
1652 for(index=0;index<count;index++) |
1659 { |
1653 { |
1665 |
1659 |
1666 //Get the file's type information |
1660 //Get the file's type information |
1667 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,0,fileType); |
1661 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,0,fileType); |
1668 if(ret!=KErrNone) |
1662 if(ret!=KErrNone) |
1669 { |
1663 { |
1670 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPHONESMARTCARDAPP_PARSESMARTCARDFILEINFOL_2, "ERROR IN CONFIGURATION FILE PARSING: BAD SMARTCARD FILE TAG"); |
1664 LOGPHONE1("ERROR IN CONFIGURATION FILE PARSING: BAD SMARTCARD FILE TAG"); |
1671 continue; |
1665 continue; |
1672 } |
1666 } |
1673 else |
1667 else |
1674 { |
1668 { |
1675 switch ((RMobilePhone::TScFileType)fileType) |
1669 switch ((RMobilePhone::TScFileType)fileType) |
1682 break; |
1676 break; |
1683 case RMobilePhone::ETransparent: |
1677 case RMobilePhone::ETransparent: |
1684 file = new(ELeave) TTransparentSmartCardFile; |
1678 file = new(ELeave) TTransparentSmartCardFile; |
1685 break; |
1679 break; |
1686 default: |
1680 default: |
1687 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPHONESMARTCARDAPP_PARSESMARTCARDFILEINFOL_3, "ERROR IN CONFIGURATION FILE PARSING:"); |
1681 LOGPHONE1("ERROR IN CONFIGURATION FILE PARSING:"); |
1688 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPHONESMARTCARDAPP_PARSESMARTCARDFILEINFOL_4, "ENCOUNTERED UNKNOWN SMART CARD FILE TYPE."); |
1682 LOGPHONE1("ENCOUNTERED UNKNOWN SMART CARD FILE TYPE."); |
1689 continue; |
1683 continue; |
1690 } |
1684 } |
1691 file->iType = (RMobilePhone::TScFileType)fileType; |
1685 file->iType = (RMobilePhone::TScFileType)fileType; |
1692 } |
1686 } |
1693 |
1687 |
1694 //Get the FID of the file |
1688 //Get the FID of the file |
1695 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,1,fileId); |
1689 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,1,fileId); |
1696 if(ret!=KErrNone) |
1690 if(ret!=KErrNone) |
1697 { |
1691 { |
1698 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPHONESMARTCARDAPP_PARSESMARTCARDFILEINFOL_5, "ERROR IN CONFIGURATION FILE PARSING: BAD SMARTCARD FILE TAG"); |
1692 LOGPHONE1("ERROR IN CONFIGURATION FILE PARSING: BAD SMARTCARD FILE TAG"); |
1699 delete file; |
1693 delete file; |
1700 continue; |
1694 continue; |
1701 } |
1695 } |
1702 //check that the FID is precisely 4 bytes long |
1696 //check that the FID is precisely 4 bytes long |
1703 else if(fileId.Length() != KMaxHexFIDLen) |
1697 else if(fileId.Length() != KMaxHexFIDLen) |
1704 { |
1698 { |
1705 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPHONESMARTCARDAPP_PARSESMARTCARDFILEINFOL_6, "ERROR IN CONFIGURATION FILE PARSING: BAD SMARTCARD FILE FID"); |
1699 LOGPHONE1("ERROR IN CONFIGURATION FILE PARSING: BAD SMARTCARD FILE FID"); |
1706 delete file; |
1700 delete file; |
1707 continue; |
1701 continue; |
1708 } |
1702 } |
1709 else |
1703 else |
1710 { |
1704 { |
1715 |
1709 |
1716 //Get the Index of the AID of the application the file belongs to |
1710 //Get the Index of the AID of the application the file belongs to |
1717 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,2,aidIndex); |
1711 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,2,aidIndex); |
1718 if(ret!=KErrNone) |
1712 if(ret!=KErrNone) |
1719 { |
1713 { |
1720 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPHONESMARTCARDAPP_PARSESMARTCARDFILEINFOL_7, "ERROR IN CONFIGURATION FILE PARSING: BAD SMARTCARD FILE TAG"); |
1714 LOGPHONE1("ERROR IN CONFIGURATION FILE PARSING: BAD SMARTCARD FILE TAG"); |
1721 delete file; |
1715 delete file; |
1722 continue; |
1716 continue; |
1723 } |
1717 } |
1724 else |
1718 else |
1725 { |
1719 { |
1728 |
1722 |
1729 //Get the file's path information |
1723 //Get the file's path information |
1730 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,3,filePath); |
1724 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,3,filePath); |
1731 if(ret!=KErrNone) |
1725 if(ret!=KErrNone) |
1732 { |
1726 { |
1733 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPHONESMARTCARDAPP_PARSESMARTCARDFILEINFOL_8, "ERROR IN CONFIGURATION FILE PARSING: BAD SMARTCARD FILE TAG"); |
1727 LOGPHONE1("ERROR IN CONFIGURATION FILE PARSING: BAD SMARTCARD FILE TAG"); |
1734 delete file; |
1728 delete file; |
1735 continue; |
1729 continue; |
1736 } |
1730 } |
1737 else |
1731 else |
1738 { |
1732 { |
1741 |
1735 |
1742 //Get the information about the total length of the file |
1736 //Get the information about the total length of the file |
1743 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,4,fileLength); |
1737 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,4,fileLength); |
1744 if(ret!=KErrNone) |
1738 if(ret!=KErrNone) |
1745 { |
1739 { |
1746 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPHONESMARTCARDAPP_PARSESMARTCARDFILEINFOL_9, "ERROR IN CONFIGURATION FILE PARSING: BAD SMARTCARD FILE TAG"); |
1740 LOGPHONE1("ERROR IN CONFIGURATION FILE PARSING: BAD SMARTCARD FILE TAG"); |
1747 delete file; |
1741 delete file; |
1748 continue; |
1742 continue; |
1749 } |
1743 } |
1750 else |
1744 else |
1751 { |
1745 { |
1754 |
1748 |
1755 //Get information about the length of each record in the file |
1749 //Get information about the length of each record in the file |
1756 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,5,recordLength); |
1750 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,5,recordLength); |
1757 if(ret!=KErrNone) |
1751 if(ret!=KErrNone) |
1758 { |
1752 { |
1759 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPHONESMARTCARDAPP_PARSESMARTCARDFILEINFOL_10, "ERROR IN CONFIGURATION FILE PARSING: BAD SMARTCARD FILE TAG"); |
1753 LOGPHONE1("ERROR IN CONFIGURATION FILE PARSING: BAD SMARTCARD FILE TAG"); |
1760 delete file; |
1754 delete file; |
1761 continue; |
1755 continue; |
1762 } |
1756 } |
1763 else |
1757 else |
1764 { |
1758 { |
1767 |
1761 |
1768 //Get information about the number of records in the file |
1762 //Get information about the number of records in the file |
1769 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,6,numRecords); |
1763 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,6,numRecords); |
1770 if(ret!=KErrNone) |
1764 if(ret!=KErrNone) |
1771 { |
1765 { |
1772 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPHONESMARTCARDAPP_PARSESMARTCARDFILEINFOL_11, "ERROR IN CONFIGURATION FILE PARSING: BAD SMARTCARD FILE TAG"); |
1766 LOGPHONE1("ERROR IN CONFIGURATION FILE PARSING: BAD SMARTCARD FILE TAG"); |
1773 delete file; |
1767 delete file; |
1774 continue; |
1768 continue; |
1775 } |
1769 } |
1776 else |
1770 else |
1777 { |
1771 { |
1780 |
1774 |
1781 //If the file is Cyclic or Linear record based file... |
1775 //If the file is Cyclic or Linear record based file... |
1782 //Check that record Length * number of records = Total length of file |
1776 //Check that record Length * number of records = Total length of file |
1783 if((fileType != RMobilePhone::ETransparent) && ((recordLength*numRecords) != fileLength)) |
1777 if((fileType != RMobilePhone::ETransparent) && ((recordLength*numRecords) != fileLength)) |
1784 { |
1778 { |
1785 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPHONESMARTCARDAPP_PARSESMARTCARDFILEINFOL_12, "ERROR IN CONFIGURATION FILE PARSING:..."); |
1779 LOGPHONE1("ERROR IN CONFIGURATION FILE PARSING:..."); |
1786 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPHONESMARTCARDAPP_PARSESMARTCARDFILEINFOL_13, "...Record Length * Number of Records != File Length"); |
1780 LOGPHONE1("...Record Length * Number of Records != File Length"); |
1787 delete file; |
1781 delete file; |
1788 continue; |
1782 continue; |
1789 } |
1783 } |
1790 |
1784 |
1791 //Get file data |
1785 //Get file data |
1792 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,7,fileData); |
1786 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,7,fileData); |
1793 if(ret!=KErrNone) |
1787 if(ret!=KErrNone) |
1794 { |
1788 { |
1795 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPHONESMARTCARDAPP_PARSESMARTCARDFILEINFOL_14, "ERROR IN CONFIGURATION FILE PARSING: BAD SMARTCARD FILE TAG"); |
1789 LOGPHONE1("ERROR IN CONFIGURATION FILE PARSING: BAD SMARTCARD FILE TAG"); |
1796 delete file; |
1790 delete file; |
1797 continue; |
1791 continue; |
1798 } |
1792 } |
1799 else if((fileData.Length() % 2 ) != 0) |
1793 else if((fileData.Length() % 2 ) != 0) |
1800 { |
1794 { |
1801 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPHONESMARTCARDAPP_PARSESMARTCARDFILEINFOL_15, "ERROR IN CONFIGURATION FILE PARSING: BAD SMARTCARD FILE DATA"); |
1795 LOGPHONE1("ERROR IN CONFIGURATION FILE PARSING: BAD SMARTCARD FILE DATA"); |
1802 continue; |
1796 continue; |
1803 } |
1797 } |
1804 else |
1798 else |
1805 { |
1799 { |
1806 TBuf8<KMaxFileSize> fileDataBuffer; |
1800 TBuf8<KMaxFileSize> fileDataBuffer; |
1807 TextToBin(fileData, fileDataBuffer); |
1801 TextToBin(fileData, fileDataBuffer); |
1808 if(fileDataBuffer.Length() != fileLength) |
1802 if(fileDataBuffer.Length() != fileLength) |
1809 { |
1803 { |
1810 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPHONESMARTCARDAPP_PARSESMARTCARDFILEINFOL_16, "ERROR IN CONFIGURATION FILE PARSING:INCONSISTANT DATA FILE LENGTH"); |
1804 LOGPHONE1("ERROR IN CONFIGURATION FILE PARSING:INCONSISTANT DATA FILE LENGTH"); |
1811 delete file; |
1805 delete file; |
1812 continue; |
1806 continue; |
1813 } |
1807 } |
1814 file->iFileData = fileDataBuffer; |
1808 file->iFileData = fileDataBuffer; |
1815 } |
1809 } |
1944 |
1938 |
1945 else |
1939 else |
1946 { |
1940 { |
1947 if(smartCardApp->iAppStatus == CSimPhoneSmartCardApp::EActive) |
1941 if(smartCardApp->iAppStatus == CSimPhoneSmartCardApp::EActive) |
1948 { |
1942 { |
1949 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPHONESMARTCARDAPP_ACTIVATESMARTCARDAPP_1, "REACTIVATING AN ALREADY ACTIVE APPLICATION"); |
1943 LOGPHONE1("REACTIVATING AN ALREADY ACTIVE APPLICATION"); |
1950 return KErrNone; |
1944 return KErrNone; |
1951 } |
1945 } |
1952 else |
1946 else |
1953 { |
1947 { |
1954 //iMaxActiveSmartCardApps will be exceeded |
1948 //iMaxActiveSmartCardApps will be exceeded |
1955 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPHONESMARTCARDAPP_ACTIVATESMARTCARDAPP_2, "WARNING: CANNOT PROCESS ACTIVATING APPLICATION"); |
1949 LOGPHONE1("WARNING: CANNOT PROCESS ACTIVATING APPLICATION"); |
1956 return KErrMMEtelScMaxApplicationsActive; |
1950 return KErrMMEtelScMaxApplicationsActive; |
1957 } |
1951 } |
1958 } |
1952 } |
1959 |
1953 |
1960 } |
1954 } |
1961 }//end for loop |
1955 }//end for loop |
1962 |
1956 |
1963 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPHONESMARTCARDAPP_ACTIVATESMARTCARDAPP_3, "WARNING: AID NOT FOUND. CANNOT PROCESS EVENT"); |
1957 LOGPHONE1("WARNING: AID NOT FOUND. CANNOT PROCESS EVENT"); |
1964 return KErrNotFound; |
1958 return KErrNotFound; |
1965 } |
1959 } |
1966 |
1960 |
1967 |
1961 |
1968 TInt CSimPhoneSmartCardApp::TerminateSmartCardApp(const RMobilePhone::TAID aAID, TBool& aTerminatedUSimApp) |
1962 TInt CSimPhoneSmartCardApp::TerminateSmartCardApp(const RMobilePhone::TAID aAID, TBool& aTerminatedUSimApp) |
1992 |
1986 |
1993 return KErrNone; |
1987 return KErrNone; |
1994 } |
1988 } |
1995 else |
1989 else |
1996 { |
1990 { |
1997 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPHONESMARTCARDAPP_TERMINATESMARTCARDAPP_1, "ATTEMPTED TO TERMINATE NON-ACTIVE APPLICATION"); |
1991 LOGPHONE1("ATTEMPTED TO TERMINATE NON-ACTIVE APPLICATION"); |
1998 return KErrMMEtelScApplicationNotActive; |
1992 return KErrMMEtelScApplicationNotActive; |
1999 } |
1993 } |
2000 } |
1994 } |
2001 |
1995 |
2002 }//end for loop |
1996 }//end for loop |
2003 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPHONESMARTCARDAPP_TERMINATESMARTCARDAPP_2, "WARNING: AID NOT FOUND. CANNOT PROCESS EVENT"); |
1997 LOGPHONE1("WARNING: AID NOT FOUND. CANNOT PROCESS EVENT"); |
2004 return KErrNotFound; |
1998 return KErrNotFound; |
2005 } |
1999 } |
2006 |
2000 |
2007 |
2001 |
2008 void CSimPhoneSmartCardApp::TextToBin(const TDesC8& aSrc, TDes8& aDst) |
2002 void CSimPhoneSmartCardApp::TextToBin(const TDesC8& aSrc, TDes8& aDst) |