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