telutils/phoneparser/inc/CPhoneGsmSimControlParser.h
changeset 0 ff3b6d0fd310
child 19 7d48bed6ce0c
equal deleted inserted replaced
-1:000000000000 0:ff3b6d0fd310
       
     1 /*
       
     2 * Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  It is parser for SIM control procedures.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CPHONEGSMSIMCONTROLPARSER_H
       
    20 #define CPHONEGSMSIMCONTROLPARSER_H
       
    21 
       
    22 // INCLUDES
       
    23 #include    "CPhoneGsmParserBase.h"
       
    24 
       
    25 // CONSTANTS
       
    26 
       
    27 /**
       
    28 * SIM CONTROL UIDS
       
    29 */
       
    30 
       
    31 const TUint32 KPhoneUidPinChange = 
       
    32     PHONE_MAKE_UID( KPhoneGsmUidSimControlProcedure, 1 );
       
    33 const TUint32 KPhoneUidPin2Change = 
       
    34     PHONE_MAKE_UID( KPhoneGsmUidSimControlProcedure, 2 );
       
    35 const TUint32 KPhoneUidPinUnblock = 
       
    36     PHONE_MAKE_UID( KPhoneGsmUidSimControlProcedure, 3 );
       
    37 const TUint32 KPhoneUidPin2Unblock = 
       
    38     PHONE_MAKE_UID( KPhoneGsmUidSimControlProcedure, 4 );
       
    39 
       
    40 // CLASS DECLARATION
       
    41 
       
    42 /**
       
    43 * It parses sim control procedures.
       
    44 *
       
    45 * @since 1.0
       
    46 * @lib phoneparser.lib
       
    47 */
       
    48 NONSHARABLE_CLASS( CPhoneGsmSimControlParser )
       
    49     : public CPhoneGsmParserBase
       
    50     {
       
    51     public:  // Constructors and destructor      
       
    52         
       
    53         /**
       
    54         * Two-phased constructor.
       
    55         */
       
    56         static CPhoneGsmSimControlParser* NewLC();
       
    57 
       
    58     public: // Functions from base classes
       
    59 
       
    60         /**
       
    61         * From CPhoneGsmParserBase, parses sim control procedures.
       
    62         *
       
    63         * @param aString It is string to be parsed.
       
    64         * @param aResult It will contain result.
       
    65         * @param aSendOperation It indicates if it would be SEND operation.
       
    66         * @return It returns boolean value indicating success of parsing.
       
    67         */    
       
    68         TBool ParseL( 
       
    69             const TDesC& aString,
       
    70             CPhoneGsmParserResult& aResult,
       
    71             CPhoneGsmOptionContainerBase& aOptions );
       
    72         
       
    73     private:
       
    74 
       
    75         /**
       
    76         * It is type of parameter checking procedures.
       
    77         *
       
    78         * @param aDesc It is the parameter.
       
    79         * @return Returns if the parameter is acceptable.
       
    80         */ 
       
    81         typedef TBool (*TParameterValidationFunction)( const TDesC& aParam );
       
    82 
       
    83         /**
       
    84         * C++ default constructor.
       
    85         */
       
    86         CPhoneGsmSimControlParser();
       
    87 
       
    88         /**
       
    89         * Parse sim control procedures.
       
    90         */
       
    91         TBool DoParseL(
       
    92             const TDesC& aString,
       
    93             CPhoneGsmParserResult& aResult,
       
    94             TBool aSendOperation,
       
    95             TBool aInCall );
       
    96 
       
    97         /**
       
    98         * Handle pin operations (pin change, unblock)
       
    99         */
       
   100         TBool HandlePinOperationsL( 
       
   101             TLex& aInput, 
       
   102             CPhoneGsmParserResult& aResult );
       
   103 
       
   104         /**
       
   105         * Check that there is '**' in the beginning of input.
       
   106         */
       
   107         TBool HandlePinPrefix( 
       
   108             TLex& aInput,
       
   109             CPhoneGsmParserResult& aResult );
       
   110 
       
   111         /**
       
   112         * Handle pin change code.
       
   113         */
       
   114         TBool HandlePinChangeL(
       
   115             TLex& aInput,
       
   116             CPhoneGsmParserResult& aResult );
       
   117 
       
   118         /**
       
   119         * Handle pin unblock code.
       
   120         */
       
   121         TBool HandlePinUnblockL(
       
   122             TLex& aInput,
       
   123             CPhoneGsmParserResult& aResult );
       
   124 
       
   125         /**
       
   126         * Handle no more parameters (only hash).
       
   127         */
       
   128         TBool HandleNoParameters(
       
   129             TLex& aInput,
       
   130             CPhoneGsmParserResult& aResult );
       
   131 
       
   132         /**
       
   133         * Handle pin password.
       
   134         */
       
   135         TBool HandlePinL(
       
   136             TLex& aInput,
       
   137             CPhoneGsmParserResult& aResult );
       
   138 
       
   139         /**
       
   140         * Handle pin unblocking key.
       
   141         */
       
   142         TBool HandlePukL(
       
   143             TLex& aInput, 
       
   144             CPhoneGsmParserResult& aResult );
       
   145 
       
   146         /**
       
   147         * Handle parameters.
       
   148         */
       
   149         TBool HandleParameterL( 
       
   150             TLex& aInput,
       
   151             CPhoneGsmParserResult& aResult,
       
   152             TParameterValidationFunction aFunc );
       
   153 
       
   154         /**
       
   155         * Returns number.
       
   156         */
       
   157         TPtrC NextNumber( TLex& aInput );
       
   158 
       
   159         /**
       
   160         * Validate syntax of pin.
       
   161         */
       
   162         static TBool ValidatePin( const TDesC& aParam );
       
   163 
       
   164         /**
       
   165         * Validate syntax of puk.
       
   166         */
       
   167         static TBool ValidatePuk( const TDesC& aParam );
       
   168 
       
   169     };
       
   170 
       
   171 #endif      // CPHONEGSMSIMCONTROLPARSER_H
       
   172             
       
   173 // End of File