telutils/phoneparser/src/CPhoneGsmImeiParser.cpp
branchRCL_3
changeset 20 987c9837762f
parent 0 ff3b6d0fd310
equal deleted inserted replaced
19:7d48bed6ce0c 20:987c9837762f
       
     1 /*
       
     2 * Copyright (c) 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:  Parser for IMEI.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include    "CPhoneGsmImeiParser.h"
       
    21 #include    "CPhoneGsmParserResult.h"
       
    22 #include    "CPhoneGsmOptionContainer.h"
       
    23 
       
    24 // CONSTANTS
       
    25 
       
    26 // IMEI code
       
    27 _LIT( KPhoneImeiCode, "*#06#" );
       
    28 
       
    29 // ============================ MEMBER FUNCTIONS ===============================
       
    30 
       
    31 // -----------------------------------------------------------------------------
       
    32 // CPhoneGsmImeiParser::CPhoneGsmImeiParser
       
    33 // -----------------------------------------------------------------------------
       
    34 //
       
    35 CPhoneGsmImeiParser::CPhoneGsmImeiParser()
       
    36     {
       
    37     }
       
    38 
       
    39 // -----------------------------------------------------------------------------
       
    40 // CPhoneGsmImeiParser::NewLC
       
    41 // -----------------------------------------------------------------------------
       
    42 //
       
    43 CPhoneGsmImeiParser* CPhoneGsmImeiParser::NewLC()
       
    44     {
       
    45     CPhoneGsmImeiParser* self = 
       
    46         new ( ELeave ) CPhoneGsmImeiParser;
       
    47     
       
    48     CleanupStack::PushL( self );
       
    49         
       
    50     return self;
       
    51     }
       
    52 
       
    53 // -----------------------------------------------------------------------------
       
    54 // CPhoneGsmImeiParser::ParseL
       
    55 //
       
    56 // Parse IMEI string.
       
    57 // -----------------------------------------------------------------------------
       
    58 //
       
    59 TBool CPhoneGsmImeiParser::ParseL( 
       
    60         const TDesC& aString,
       
    61         CPhoneGsmParserResult& aResult,
       
    62         CPhoneGsmOptionContainerBase& aOptions )
       
    63     {
       
    64     aResult.ClearL();
       
    65 
       
    66     if ( !aOptions.FindOptionStatus( KPhoneOptionSend ))
       
    67         {
       
    68         if ( aString == KPhoneImeiCode )
       
    69             {
       
    70             aResult.SetUid( KPhoneUidIMEI );
       
    71             }
       
    72         }
       
    73    
       
    74     return ( aResult.Uid() == KPhoneUidIMEI );
       
    75     }
       
    76 
       
    77 //  End of File