telutils/phoneparser/src/PhoneGsmParser.cpp
branchRCL_3
changeset 20 987c9837762f
parent 19 7d48bed6ce0c
equal deleted inserted replaced
19:7d48bed6ce0c 20:987c9837762f
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 
    18 
    19 // INCLUDE FILES
    19 // INCLUDE FILES
    20 #include    "phonegsmparser.h" 
    20 #include    "PhoneGsmParser.h"
    21 #include    "cphonegsmparser.h" 
    21 #include    "CPhoneGsmParser.h"
    22 #include    "cphonegsmparserbase.h" 
    22 #include    "CPhoneGsmParserBase.h"
    23 #include    "cphonegsmparserresult.h" 
    23 #include    "CPhoneGsmParserResult.h"
    24 #include    "cphonegsmoptioncontainer.h" 
    24 #include    "CPhoneGsmOptionContainer.h"
    25 
    25 
    26 #include    "cphonegsmparsercontainer.h" 
    26 #include    "CPhoneGsmParserContainer.h"
    27 #include    "cphonegsmssparser.h" 
    27 #include    "CPhoneGsmSsParser.h"
    28 #include    "cphonegsmsimcontrolparser.h" 
    28 #include    "CPhoneGsmSimControlParser.h"
    29 #include    "cphonegsmphonenumberparser.h" 
    29 #include    "CPhoneGsmPhoneNumberParser.h"
    30 #include    "cphonegsmsscallparser.h" 
    30 #include    "CPhoneGsmSsCallParser.h"
    31 #include    "cphonegsmmanufacturerparser.h" 
    31 #include    "CPhoneGsmManufacturerParser.h"
    32 #include    "cphonegsmpcnprocedureparser.h" 
    32 #include    "CPhoneGsmPcnProcedureParser.h"
    33 #include    "cphonegsmmanufacturerhandler.h" 
    33 #include    "CPhoneGsmManufacturerHandler.h"
    34 #include    "cphonegsmemergencynumberparser.h" 
    34 #include    "CPhoneGsmEmergencyNumberParser.h"
    35 #include    "cphoneparserfeatures.h" 
    35 #include    "CPhoneParserFeatures.h"
    36 #include    "cphonevoipnumberparser.h" 
    36 #include    "CPhoneVoipNumberParser.h"
       
    37 #include    "CPhoneGsmImeiParser.h"
       
    38 
    37 
    39 
    38 // CONSTANTS
    40 // CONSTANTS
    39 const TInt KPhoneParserResultParameterReserver = 10;
    41 const TInt KPhoneParserResultParameterReserver = 10;
    40 _LIT( KPhoneParserPanic, "PhoneParser" );
    42 _LIT( KPhoneParserPanic, "PhoneParser" );
    41 
    43 
    42 // Software version display code
    44 // Software version display code
       
    45 _LIT( KPhoneCodeSwVersion, "*#0000#" );
    43 _LIT( KPhoneCodeBadPinChange, "**04*" );
    46 _LIT( KPhoneCodeBadPinChange, "**04*" );
    44 _LIT( KPhoneCodeBadPin2Change, "**042*" );
    47 _LIT( KPhoneCodeBadPin2Change, "**042*" );
    45 _LIT( KPhoneCodeBadPinUnblock, "**05*" );
    48 _LIT( KPhoneCodeBadPinUnblock, "**05*" );
    46 _LIT( KPhoneCodeBadPin2Unblock, "**052*" );
    49 _LIT( KPhoneCodeBadPin2Unblock, "**052*" );
    47 _LIT( KPhoneCodeActivateRfsNormal, "*#7780#" );
    50 _LIT( KPhoneCodeActivateRfsNormal, "*#7780#" );
    48 _LIT( KPhoneCodeActivateRfsDeep, "*#7370#" );
    51 _LIT( KPhoneCodeActivateRfsDeep, "*#7370#" );
    49 _LIT( KPhoneCodeBtAddress, "*#2820#" );
    52 _LIT( KPhoneCodeBtAddress, "*#2820#" );
       
    53 _LIT( KPhoneCodeLifeTimer, "*#92702689#" );
    50 _LIT( KPhoneCodeRFLoopback, "*#9990#" );
    54 _LIT( KPhoneCodeRFLoopback, "*#9990#" );
    51 _LIT( KPhoneCodeWLANMAC, "*#62209526#" );
    55 _LIT( KPhoneCodeWLANMAC, "*#62209526#" );
    52 _LIT( KPhoneCodeBtDebugMode, "*#2873#" );
    56 _LIT( KPhoneCodeBtDebugMode, "*#2873#" );
    53                   
    57                   
    54 // ============================= LOCAL FUNCTIONS ===============================
    58 // ============================= LOCAL FUNCTIONS ===============================
    93         
    97         
    94     // 6. VOIP NUMBER PARSER TO STACK
    98     // 6. VOIP NUMBER PARSER TO STACK
    95     CPhoneGsmParserBase* voipNumberParser =
    99     CPhoneGsmParserBase* voipNumberParser =
    96         CPhoneVoipNumberParser::NewLC();
   100         CPhoneVoipNumberParser::NewLC();
    97     
   101     
       
   102     // 7. IMEI PARSER TO STACK
       
   103     CPhoneGsmParserBase* imeiParser =
       
   104         CPhoneGsmImeiParser::NewLC();
       
   105     
    98     CPhoneGsmParser* parser = 
   106     CPhoneGsmParser* parser = 
    99         CPhoneGsmParser::NewL(
   107         CPhoneGsmParser::NewL(
   100             ssContainer, 
   108             ssContainer, 
   101             simControlProcedure,
   109             simControlProcedure,
   102             phoneNumber,
   110             phoneNumber,
   103             manufacturerSpecific,
   111             manufacturerSpecific,
   104             emergencyNumberParser,
   112             emergencyNumberParser,
   105             voipNumberParser);
   113             voipNumberParser,
   106 
   114             imeiParser );
   107     CleanupStack::Pop( 6, ssContainer );
   115 
       
   116     CleanupStack::Pop( 7, ssContainer );
   108 
   117 
   109     return parser;
   118     return parser;
   110     }
   119     }
   111 
   120 
   112 // -----------------------------------------------------------------------------
   121 // -----------------------------------------------------------------------------
   222     {  
   231     {  
   223     TUint32 uid = aResult.Uid();
   232     TUint32 uid = aResult.Uid();
   224     
   233     
   225     // Allowed:
   234     // Allowed:
   226     //      0 SEND
   235     //      0 SEND
   227     //      All manufacturer codes
   236     //      IMEI
       
   237     //      All manufacturer codes (incl. SW version)
   228     //      All sim control procedures
   238     //      All sim control procedures
   229     //      All pcn procedures
   239     //      All pcn procedures
   230     
   240     
   231     return ( uid == KPhoneUidCommand0 ||
   241     return ( uid == KPhoneUidCommand0 ||
       
   242              uid == KPhoneUidIMEI ||
   232              uid == KPhoneUidManufacturerDebugCode ||
   243              uid == KPhoneUidManufacturerDebugCode ||
   233              uid == KPhoneUidManufacturerCode || 
   244              uid == KPhoneUidManufacturerCode || 
   234              PHONE_EXTRACT_MAIN( uid ) == KPhoneGsmUidSimControlProcedure ||
   245              PHONE_EXTRACT_MAIN( uid ) == KPhoneGsmUidSimControlProcedure ||
   235              PHONE_EXTRACT_MAIN( uid ) == KPhoneGsmUidPcnProcedures );
   246              PHONE_EXTRACT_MAIN( uid ) == KPhoneGsmUidPcnProcedures );
   236     }
   247     }
   245     TUint32 uid = aResult.Uid();
   256     TUint32 uid = aResult.Uid();
   246     TUint aux = aResult.AuxInformation();
   257     TUint aux = aResult.AuxInformation();
   247 
   258 
   248     // Allowed:
   259     // Allowed:
   249     //      DialEmergency
   260     //      DialEmergency
   250     //      Some manufacturer codes
   261     //      IMEI
       
   262     //      Some manufacturer codes (incl. SW version)
   251     //      All sim control procedures
   263     //      All sim control procedures
   252     //      All pcn procedures
   264     //      All pcn procedures
   253     
   265     
   254     return ( uid == KPhoneUidEmergencyNumber ||
   266     return ( uid == KPhoneUidEmergencyNumber ||
       
   267              uid == KPhoneUidIMEI ||
   255              uid == KPhoneUidManufacturerDebugCode ||
   268              uid == KPhoneUidManufacturerDebugCode ||
   256              ( uid == KPhoneUidManufacturerCode && 
   269              ( uid == KPhoneUidManufacturerCode && 
   257                ( aux == CPhoneGsmManufacturerHandler::EBadPinChange ||
   270                ( aux == CPhoneGsmManufacturerHandler::EShowVersion ||
       
   271                  aux == CPhoneGsmManufacturerHandler::ELifeTimer ||
       
   272                  aux == CPhoneGsmManufacturerHandler::EBadPinChange ||
   258                  aux == CPhoneGsmManufacturerHandler::EBadPin2Change ||
   273                  aux == CPhoneGsmManufacturerHandler::EBadPin2Change ||
   259                  aux == CPhoneGsmManufacturerHandler::EBadPinUnblock ||
   274                  aux == CPhoneGsmManufacturerHandler::EBadPinUnblock ||
   260                  aux == CPhoneGsmManufacturerHandler::EBadPin2Unblock ) ) ||
   275                  aux == CPhoneGsmManufacturerHandler::EBadPin2Unblock ) ) ||
   261 
   276 
   262              PHONE_EXTRACT_MAIN( uid ) == KPhoneGsmUidSimControlProcedure ||
   277              PHONE_EXTRACT_MAIN( uid ) == KPhoneGsmUidSimControlProcedure ||
   309     CPhoneGsmManufacturerParser* manuCodes =
   324     CPhoneGsmManufacturerParser* manuCodes =
   310         CPhoneGsmManufacturerParser::NewLC();
   325         CPhoneGsmManufacturerParser::NewLC();
   311     manufacturer->AddL( *manuCodes );
   326     manufacturer->AddL( *manuCodes );
   312     CleanupStack::Pop( manuCodes );
   327     CleanupStack::Pop( manuCodes );
   313 
   328 
       
   329     manuCodes->AddStringL(
       
   330         KPhoneCodeSwVersion, 
       
   331         CPhoneGsmManufacturerParser::EFlagCode,
       
   332         CPhoneGsmManufacturerHandler::EShowVersion );
       
   333 
   314     manuCodes->AddStringL( 
   334     manuCodes->AddStringL( 
   315         KPhoneCodeBadPinChange,
   335         KPhoneCodeBadPinChange,
   316         CPhoneGsmManufacturerParser::EFlagCode + 
   336         CPhoneGsmManufacturerParser::EFlagCode + 
   317         CPhoneGsmManufacturerParser::EFlagPrefix,
   337         CPhoneGsmManufacturerParser::EFlagPrefix,
   318         CPhoneGsmManufacturerHandler::EBadPinChange );
   338         CPhoneGsmManufacturerHandler::EBadPinChange );
   353 
   373 
   354     manuCodes->AddStringL(
   374     manuCodes->AddStringL(
   355         KPhoneCodeWLANMAC, 
   375         KPhoneCodeWLANMAC, 
   356         CPhoneGsmManufacturerParser::EFlagCode,
   376         CPhoneGsmManufacturerParser::EFlagCode,
   357         CPhoneGsmManufacturerHandler::EShowWlanMac,
   377         CPhoneGsmManufacturerHandler::EShowWlanMac,
   358         KFeatureIdProtocolWlan );       
   378         KFeatureIdProtocolWlan );		
       
   379 
       
   380     if ( CPhoneParserFeatures::LifeTimerEnabled())
       
   381         {
       
   382         manuCodes->AddStringL( 
       
   383             KPhoneCodeLifeTimer,
       
   384             CPhoneGsmManufacturerParser::EFlagCode,
       
   385             CPhoneGsmManufacturerHandler::ELifeTimer );
       
   386         }
   359 
   387 
   360     manuCodes->AddStringL( 
   388     manuCodes->AddStringL( 
   361         KPhoneCodeRFLoopback,
   389         KPhoneCodeRFLoopback,
   362         CPhoneGsmManufacturerParser::EFlagCode,
   390         CPhoneGsmManufacturerParser::EFlagCode,
   363         CPhoneGsmManufacturerHandler::EBTLoopback,
   391         CPhoneGsmManufacturerHandler::EBTLoopback,