satengine/SatServer/Engine/inc/CSatSSimSubscriberId.h
author Pat Downey <patd@symbian.org>
Wed, 01 Sep 2010 12:15:03 +0100
branchRCL_3
changeset 20 987c9837762f
parent 0 ff3b6d0fd310
permissions -rw-r--r--
Revert incorrect RCL_3 drop: Revision: 201033 Kit: 201035

/*
* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). 
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description:  This is the handler for the SIM Application Toolkit
*                to dedect the SIM card subscriber id.
*
*/


#ifndef CSATSSIMSUBSCRIBERID_H
#define CSATSSIMSUBSCRIBERID_H

#include <etelsat.h>
#include "CSatSServer.h"
#include "MSatSSimSubscriberId.h"

class TSatEventMediator;
class CSatSActiveWrapper;
class MSatMultiModeApi;

/**
*  This is the handler for the SIM card status.
*  This active objects is registered to listen SIM card status,
*  especially SIM card removed status.
*/

class CSatSSimSubscriberId : public CActive,
                             public MSatSSimSubscriberId
    {
    public: // Constructors and destructor

        /**
        * Two-phased constructor.
        * @param aPhone a reference to MSatMultiModeApi
        * @param aEventMediator Event handler class
        * @return a pointer to the newly created active object.
        */
        static CSatSSimSubscriberId* NewL(
            MSatMultiModeApi& aPhone,
            TSatEventMediator& aEventMediator );

        /**
        * Destructor.
        */
        virtual ~CSatSSimSubscriberId();

    public: // New functions

        /**
        * Starts the handler.
        */
        void Start();

    protected: // Functions from base classes

        /**
        * From CActive, handles the request completion.
        */
        void RunL();

        /**
        * From CActive, implements the cancel protocol.
        */
        void DoCancel();

    private: // Constructors

        /**
        * C++ default constructor.
        * @param aPhone a reference to MSatMultiModeApi.
        * @param aEventMediator Event handler class.
        */
        CSatSSimSubscriberId(
            MSatMultiModeApi& aPhone,
            TSatEventMediator& aEventMediator );

        /**
        * By default Symbian 2nd phase constructor is private.
        */
        void ConstructL();

    private: // New functions

        /**
        * Starts listening for the SIM card subscriber id.
        */
        void DoStart();

        /**
        * Checks whether special SIM is being used.
        * @return TBool indicating special SIM.
        */
        TBool IsCmccSIM() const;

    private: // Data

        // MSatMultiModeApi instance.
        MSatMultiModeApi& iPhone;

        // Event mediator.
        TSatEventMediator& iEventMediator;

        // Indicates whether subscriber id below is successfully read.
        TBool iSubscriberIdValid;

        // Subscriber ID data.
        RMobilePhone::TMobilePhoneSubscriberId iSubscriberId;

        // Provides asynchronous timer for thread suspension.
        CSatSActiveWrapper* iWrapper;

        // Counter to limít subscriber id read retries.
        TInt iRetryCounter;

    };

#endif      // CSATSSIMSUBSCRIBERID_H