phoneengine/phonemodel/inc/cpesimstatemonitor.h
changeset 37 ba76fc04e6c2
child 51 f39ed5e045e0
equal deleted inserted replaced
36:2eacb6118286 37:ba76fc04e6c2
       
     1 /*
       
     2 * Copyright (c) 2003 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:  Sim monitoring class definition
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CPESIMSTATEMONITOR_H
       
    21 #define CPESIMSTATEMONITOR_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include "pevirtualengine.h"
       
    25 #include <e32base.h>
       
    26 #include <e32property.h>
       
    27 #include <startupdomainpskeys.h>
       
    28 
       
    29 
       
    30 // FORWARD DECLARATIONS
       
    31 class MPEPhoneModelInternal;
       
    32 
       
    33 // CLASS DECLARATION
       
    34 
       
    35 /**
       
    36 *  This class monitors Sim state changes from System Agent.
       
    37 *
       
    38 *  @lib PhoneEngine.lib
       
    39 *  @since Series60_4.0
       
    40 */
       
    41 NONSHARABLE_CLASS( CPESimStateMonitor ) : public CActive
       
    42     {
       
    43 
       
    44     public: // Constants and data types
       
    45 
       
    46     // Monitored Sim event given to constructor
       
    47     enum TEvent
       
    48         {
       
    49         EEventSimStatus,
       
    50         EEventSimChanged
       
    51         };
       
    52 
       
    53     public: // Constructors and destructor
       
    54 
       
    55         /**
       
    56         * Two-phased constructor.
       
    57         */
       
    58         static CPESimStateMonitor* NewL( 
       
    59             MPEPhoneModelInternal& aModel, 
       
    60             const TEvent aEvent );
       
    61 
       
    62         /**
       
    63         * Destructor.
       
    64         */
       
    65         virtual ~CPESimStateMonitor();
       
    66 
       
    67     public: // New functions
       
    68 
       
    69         /**
       
    70         * Gets Sim state.
       
    71         * @since Series60_4.0
       
    72         * @return Sim state
       
    73         */
       
    74         TPESimState SimState( ) const;
       
    75 
       
    76         /**
       
    77         * Completes this monitor for initialization purposes and starts monitoring
       
    78         * @since Series60_4.0
       
    79         */
       
    80         void Start();
       
    81 
       
    82     private: // Constructors 
       
    83 
       
    84         /**
       
    85         * C++ default constructor.
       
    86         */
       
    87         CPESimStateMonitor( MPEPhoneModelInternal& aModel, const TEvent aEvent );
       
    88 
       
    89         /**
       
    90         * By default EPOC constructor is private.
       
    91         */
       
    92         void ConstructL();
       
    93 
       
    94     private: // New functions
       
    95 
       
    96          /**
       
    97         * Converts and saves Sim state
       
    98         * @since Series60_4.0
       
    99         * @param aState Sim state from System Agent
       
   100         * @return result of checking valid values.
       
   101         */
       
   102         TBool SaveSimState( const TInt aState );
       
   103 
       
   104         /**
       
   105         * Starts monitoring
       
   106         * @since Series60_4.0
       
   107         */
       
   108         void StartMonitoring( );
       
   109 
       
   110     private: // From CActive
       
   111 
       
   112         /**
       
   113         * Implements cancellation of an outstanding request.
       
   114         */
       
   115         void DoCancel();
       
   116 
       
   117         /**
       
   118         * Handles request completion event.
       
   119         */
       
   120         void RunL();
       
   121 
       
   122     private: // Data
       
   123 
       
   124         // To send messages
       
   125         MPEPhoneModelInternal&  iModel;
       
   126         // The interface to Publish And Subscribe.
       
   127         RProperty iProperty;
       
   128         // To maintain Sim property
       
   129         TInt iSimState;
       
   130         // To handle startup logic, init value ETrue
       
   131         TBool iStartUp;
       
   132         // Select Sim property of interest
       
   133         TUint iPropertyKey;
       
   134     };
       
   135 
       
   136 #endif // CPESIMSTATEMONITOR_H
       
   137 
       
   138 // End of File
       
   139