satengine/SatServer/Engine/inc/CSatSSimSubscriberId.h
changeset 46 2fa1fa551b0b
parent 42 35488577e233
child 48 78df25012fda
equal deleted inserted replaced
42:35488577e233 46:2fa1fa551b0b
     1 /*
       
     2 * Copyright (c) 2002-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 "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:  This is the handler for the SIM Application Toolkit
       
    15 *                to dedect the SIM card subscriber id.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef CSATSSIMSUBSCRIBERID_H
       
    21 #define CSATSSIMSUBSCRIBERID_H
       
    22 
       
    23 #include <etelsat.h>
       
    24 #include "CSatSServer.h"
       
    25 #include "MSatSSimSubscriberId.h"
       
    26 
       
    27 class TSatEventMediator;
       
    28 class CSatSActiveWrapper;
       
    29 class MSatMultiModeApi;
       
    30 
       
    31 /**
       
    32 *  This is the handler for the SIM card status.
       
    33 *  This active objects is registered to listen SIM card status,
       
    34 *  especially SIM card removed status.
       
    35 */
       
    36 
       
    37 class CSatSSimSubscriberId : public CActive,
       
    38                              public MSatSSimSubscriberId
       
    39     {
       
    40     public: // Constructors and destructor
       
    41 
       
    42         /**
       
    43         * Two-phased constructor.
       
    44         * @param aPhone a reference to MSatMultiModeApi
       
    45         * @param aEventMediator Event handler class
       
    46         * @return a pointer to the newly created active object.
       
    47         */
       
    48         static CSatSSimSubscriberId* NewL(
       
    49             MSatMultiModeApi& aPhone,
       
    50             TSatEventMediator& aEventMediator );
       
    51 
       
    52         /**
       
    53         * Destructor.
       
    54         */
       
    55         virtual ~CSatSSimSubscriberId();
       
    56 
       
    57     public: // New functions
       
    58 
       
    59         /**
       
    60         * Starts the handler.
       
    61         */
       
    62         void Start();
       
    63 
       
    64     protected: // Functions from base classes
       
    65 
       
    66         /**
       
    67         * From CActive, handles the request completion.
       
    68         */
       
    69         void RunL();
       
    70 
       
    71         /**
       
    72         * From CActive, implements the cancel protocol.
       
    73         */
       
    74         void DoCancel();
       
    75 
       
    76     private: // Constructors
       
    77 
       
    78         /**
       
    79         * C++ default constructor.
       
    80         * @param aPhone a reference to MSatMultiModeApi.
       
    81         * @param aEventMediator Event handler class.
       
    82         */
       
    83         CSatSSimSubscriberId(
       
    84             MSatMultiModeApi& aPhone,
       
    85             TSatEventMediator& aEventMediator );
       
    86 
       
    87         /**
       
    88         * By default Symbian 2nd phase constructor is private.
       
    89         */
       
    90         void ConstructL();
       
    91 
       
    92     private: // New functions
       
    93 
       
    94         /**
       
    95         * Starts listening for the SIM card subscriber id.
       
    96         */
       
    97         void DoStart();
       
    98 
       
    99         /**
       
   100         * Checks whether special SIM is being used.
       
   101         * @return TBool indicating special SIM.
       
   102         */
       
   103         TBool IsCmccSIM() const;
       
   104 
       
   105     private: // Data
       
   106 
       
   107         // MSatMultiModeApi instance.
       
   108         MSatMultiModeApi& iPhone;
       
   109 
       
   110         // Event mediator.
       
   111         TSatEventMediator& iEventMediator;
       
   112 
       
   113         // Indicates whether subscriber id below is successfully read.
       
   114         TBool iSubscriberIdValid;
       
   115 
       
   116         // Subscriber ID data.
       
   117         RMobilePhone::TMobilePhoneSubscriberId iSubscriberId;
       
   118 
       
   119         // Provides asynchronous timer for thread suspension.
       
   120         CSatSActiveWrapper* iWrapper;
       
   121 
       
   122         // Counter to limít subscriber id read retries.
       
   123         TInt iRetryCounter;
       
   124 
       
   125     };
       
   126 
       
   127 #endif      // CSATSSIMSUBSCRIBERID_H