telutils/phoneparser/inc/CPhoneGsmManufacturerParser.h
changeset 46 2fa1fa551b0b
parent 42 35488577e233
child 48 78df25012fda
equal deleted inserted replaced
42:35488577e233 46:2fa1fa551b0b
     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 class for manufacturer specific codes.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CPHONEGSMMANUFACTURERPARSER_H
       
    20 #define CPHONEGSMMANUFACTURERPARSER_H
       
    21 
       
    22 // INCLUDES
       
    23 #include    "cphonegsmparserbase.h" 
       
    24 
       
    25 // FORWARD DECLARATIONS
       
    26 class CPhoneGsmOptionContainer;
       
    27 
       
    28 // CONSTANTS
       
    29 
       
    30 /*
       
    31 * MANUFACTURER CODE UIDS
       
    32 */
       
    33 
       
    34 const TUint32 KPhoneUidManufacturerCode = 
       
    35     PHONE_MAKE_UID( KPhoneGsmUidManufacturer, 0 );
       
    36 
       
    37 const TUint32 KPhoneUidManufacturerDebugCode =
       
    38     PHONE_MAKE_UID( KPhoneGsmUidManufacturer, 1 );
       
    39 
       
    40 // MACROS
       
    41 
       
    42 // This definition enables parsing of debug code. 
       
    43 //#define PHONEPARSER_PARSE_DEBUG_CODE
       
    44 
       
    45 // CLASS DECLARATION
       
    46 
       
    47 /**
       
    48 * It is parser for manufacturer specific codes.
       
    49 *
       
    50 * @since 1.0
       
    51 * @lib phoneparser.lib
       
    52 */
       
    53 NONSHARABLE_CLASS( CPhoneGsmManufacturerParser )
       
    54     : public CPhoneGsmParserBase
       
    55     {
       
    56     public:  // Constructors and destructor      
       
    57         
       
    58         /**
       
    59         * Two-phased constructor.
       
    60         */
       
    61         static CPhoneGsmManufacturerParser* NewLC();
       
    62         
       
    63         /**
       
    64         * Destructor.
       
    65         */
       
    66         ~CPhoneGsmManufacturerParser();
       
    67 
       
    68     public: // New functions
       
    69 
       
    70         /**
       
    71         * Enumerates all flags.
       
    72         *
       
    73         * EFlagCode       - string is a code, checked only when # is pressed.
       
    74         * EFlagSend       - SEND key must be pressed.
       
    75         * EFlagPrefix     - string is just a prefix.
       
    76         * EFlagNotInIdle   - not in from idle state.
       
    77         * EFlagNotInInCall - not in during incall.
       
    78         */
       
    79         enum TFlags
       
    80             {
       
    81             EFlagCode = 0x01,        
       
    82             EFlagSend = 0x02,        
       
    83             EFlagPrefix = 0x04,
       
    84             EFlagNotInIdle = 0x08,
       
    85             EFlagNotInInCall = 0x10
       
    86             };
       
    87 
       
    88         /**
       
    89         * Add string to the set of manufacturer specific codes.
       
    90         *
       
    91         * Note that string must exist as long as the instance.
       
    92         *
       
    93         * @param aString string
       
    94         * @param aFlags flags, see TFlags
       
    95         * @param aCommand command id
       
    96         * @param aFeatureId feature manager id.
       
    97         */
       
    98         void AddStringL( 
       
    99             const TDesC& aString, 
       
   100             TInt aFlags, 
       
   101             TUint aCommand,
       
   102             TInt aFeatureId = 0 );
       
   103 
       
   104     public: // Functions from base classes
       
   105 
       
   106         /**
       
   107         * From CPhoneGsmParserBase.
       
   108         * Parse string.
       
   109         *
       
   110         * @param aString It is string to be parsed.
       
   111         * @param aResult It will contain result.
       
   112         * @param aSendOperation It indicates if it would be SEND operation.
       
   113         * @return It returns boolean value indicating success of parsing.
       
   114         */
       
   115         TBool ParseL( 
       
   116             const TDesC& aString,
       
   117             CPhoneGsmParserResult& aResult,
       
   118             CPhoneGsmOptionContainerBase& aOptions );
       
   119 
       
   120     private:
       
   121 
       
   122         class TCodeInfo;
       
   123 
       
   124         /**
       
   125         * C++ default constructor.
       
   126         */
       
   127         CPhoneGsmManufacturerParser();
       
   128 
       
   129         /**
       
   130         * Symbian OS constructor.
       
   131         */
       
   132         void ConstructL();
       
   133 
       
   134         /**
       
   135         * Checks code.
       
   136         *
       
   137         * @param aString string to be checked.
       
   138         * @param aInfo code information.
       
   139         * @param aOptions options.
       
   140         */
       
   141         TBool CheckCode( 
       
   142             const TDesC& aString, 
       
   143             const TCodeInfo& aInfo,
       
   144             CPhoneGsmOptionContainerBase& aOptions );
       
   145 
       
   146         /**
       
   147         * Is situation ok for string.
       
   148         */
       
   149         TBool CheckSituation( 
       
   150             const TDesC& aString,
       
   151             TInt aFlags,
       
   152             CPhoneGsmOptionContainerBase& aOptions );
       
   153             
       
   154     private:    // Data
       
   155 
       
   156         /**
       
   157         * It defines structure that contains information of single code.
       
   158         */
       
   159         class TCodeInfo
       
   160             {
       
   161             public:
       
   162                 TPtrC iString;
       
   163                 TInt iFlags;
       
   164                 TUint iCommand;
       
   165                 TInt iFeatureId;
       
   166             };
       
   167         
       
   168         // Type definition for code array.
       
   169         typedef CArrayFixFlat< TCodeInfo > CCodeArray;
       
   170 
       
   171         // Owned array of codes.
       
   172         CCodeArray* iArray;
       
   173 
       
   174     };
       
   175 
       
   176 #endif      // CPHONEGSMMANUFACTURERPARSER_H
       
   177             
       
   178 // End of File