adaptationlayer/tsy/nokiatsy_dll/inc/tssparser.h
changeset 0 63b37f68c1ce
equal deleted inserted replaced
-1:000000000000 0:63b37f68c1ce
       
     1 /*
       
     2 * Copyright (c) 2007-2008 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 the License "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: 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef TSSPARSER_H
       
    21 #define TSSPARSER_H
       
    22 
       
    23 // INCLUDES
       
    24 #include <tisi.h>  // isi message related functions
       
    25 #include <ss_wmisi.h> // SS ISI message definitions
       
    26 
       
    27 // CONSTANTS
       
    28 // SS operation types
       
    29 _LIT(KSsOperationErasure, "##" );
       
    30 _LIT(KSsOperationInterrogation, "*#" );
       
    31 _LIT(KSsOperationRegistration, "**" );
       
    32 _LIT(KSsOperationActivation, "*" );
       
    33 _LIT(KSsOperationDeactivation, "#" );
       
    34 
       
    35 static const TInt SS_OPERATION_UNDEFINED( 0xFF );
       
    36 static const TInt SS_CODE_UNDEFINED( 0xFF );
       
    37 static const TInt MAX_NUM_OF_SUPPLEMENTARY_INFOS( 3 );
       
    38 // max length of service string (from 3GPP TS 22.030)
       
    39 static const TInt MAX_LENGTH_OF_SERVICE_STRING( 40 );
       
    40 
       
    41 // DATA TYPES
       
    42 //
       
    43 enum TCharacter
       
    44     {
       
    45     ECharacterSeparator = 0, // '*'
       
    46     ECharacterEndMark, // '#'
       
    47     ECharacterIllegal
       
    48     };
       
    49 
       
    50 // CLASS DECLARATION
       
    51 
       
    52 /**
       
    53 * Parser class for SS service string received from client (SAT server):
       
    54 * Parsers SS service string: operation, service code and service information
       
    55 */
       
    56 class TSsParser
       
    57     {
       
    58 
       
    59     public: // New functions
       
    60 
       
    61         /**
       
    62         * Constructor
       
    63         */
       
    64         TSsParser();
       
    65 
       
    66         /**
       
    67         * Parses a SS string
       
    68         * @param const TDesC& aServiceString: SS string to be parsed
       
    69         * @return TInt: error
       
    70         */
       
    71         TInt Parse( const TDesC& aServiceString );
       
    72 
       
    73         /**
       
    74         * Gets SS operation type
       
    75         * @param TUint8& aSsOperation: SS operation type
       
    76         * @return void
       
    77         */
       
    78         void GetSsOperation( TUint8& aSsOperation ) const;
       
    79 
       
    80         /**
       
    81         * Gets SS code
       
    82         * @param TUint16& aServiceCode: SS code
       
    83         * @return void
       
    84         */
       
    85         void GetServiceCode( TUint16& aServiceCode ) const;
       
    86 
       
    87         /**
       
    88         * Gets service infos a, b and c. If SS info does not exist, empty
       
    89         * descriptor is returned
       
    90         * @param TPtrC& aSupplementaryInfoA: SS info A
       
    91         * @param TPtrC& aSupplementaryInfoB: SS info B
       
    92         * @param TPtrC& aSupplementaryInfoC: SS info C
       
    93         * @return void
       
    94         */
       
    95         void GetServiceInfo(
       
    96             TPtrC& aSupplementaryInfoA,
       
    97             TPtrC& aSupplementaryInfoB,
       
    98             TPtrC& aSupplementaryInfoC ) const;
       
    99 
       
   100         /**
       
   101         * Converts descriptor to integer
       
   102         * @param const TDesC& aString: descriptor to be converted
       
   103         * @return TInt: converted value
       
   104         */
       
   105         TInt GetInt( const TDesC& aString );
       
   106 
       
   107     private:
       
   108 
       
   109         /**
       
   110         * Extracts operation type from service string
       
   111         * @return TUint8: operation type
       
   112         */
       
   113         TUint8 ExtractSsOperation( );
       
   114 
       
   115         /**
       
   116         * Extracts parts from service string
       
   117         * @return void
       
   118         */
       
   119         void ExtractPart( TPtrC& aPart );
       
   120 
       
   121         /**
       
   122         * Extracts separator marks ( *, # ) from service string
       
   123         * @return TCharacter: separator mark
       
   124         */
       
   125         TCharacter ExtractSeparator( );
       
   126 
       
   127 
       
   128     private:    // Data
       
   129 
       
   130         TUint8 iSsOperation; // operation type, e.g. activation
       
   131         TUint16 iServiceCode; // supplementary service code
       
   132         TPtrC iServiceString; // ss string to be parsed
       
   133         TPtrC iSupplementaryInfoA; // service information A, defined in 3GPP TS 22-030
       
   134         TPtrC iSupplementaryInfoB; // service information B  defined in 3GPP TS 22-030
       
   135         TPtrC iSupplementaryInfoC; // service information C, defined in 3GPP TS 22-030
       
   136     };
       
   137 
       
   138 #endif      // TSSPARSER_H
       
   139 
       
   140 // End of File