phoneclientserver/EnPolicy/Inc/SosEnPolicy/CSOSEmergencyNumberPolicyHandler.h
changeset 46 2fa1fa551b0b
parent 42 35488577e233
child 48 78df25012fda
equal deleted inserted replaced
42:35488577e233 46:2fa1fa551b0b
     1 /*
       
     2 * Copyright (c) 2004-2005 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:  Provides SOS emergency number policy API implementation.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CSOSEMERGENCYNUMBERPOLICYHANDLER_H
       
    21 #define CSOSEMERGENCYNUMBERPOLICYHANDLER_H
       
    22 
       
    23 // INCLUDES
       
    24 #include    "csosemergencynumberpolicymanager.h" 
       
    25 #include    "csosenpolicysimstatusmonitor.h" 
       
    26 #include    "csosenpolicyenlisthandler.h" 
       
    27 #include    <mmretrieve.h>
       
    28 #include    <e32property.h>
       
    29 
       
    30 // DATA TYPES
       
    31 /*
       
    32 *   EEnPolicyPanicSystemAgentConnectionFailure     System agent failure.
       
    33 */
       
    34     enum TEnPolicyPanic
       
    35         {
       
    36         EEnPolicyPanicCentralRepositoryConnectionFailure = 0
       
    37         };
       
    38 
       
    39 // FORWARD DECLARATIONS
       
    40 class CSosEnPolicySimStatusMonitor;
       
    41 class CSosEnPolicyENListHandler;
       
    42 class CRepository;
       
    43 class RSatSession;
       
    44 class RSatRefresh;
       
    45 
       
    46 // CLASS DECLARATION
       
    47 
       
    48 /**
       
    49 *  Active object to handle the Publish&Subscriber notify
       
    50 *  
       
    51 *  @since Series 60 Series60_2.8
       
    52 */
       
    53 NONSHARABLE_CLASS( CSosEnPolicyActive ) : public CActive
       
    54     {
       
    55     public: // Constructors and destructor
       
    56         /**
       
    57         * Constructor.
       
    58         */
       
    59         CSosEnPolicyActive( 
       
    60             CSosEmergencyNumberPolicyHandler& aEmergNumHandler );
       
    61 
       
    62         /**
       
    63         * Destructor.
       
    64         */
       
    65         ~CSosEnPolicyActive();
       
    66 
       
    67     private: // Derived from CActive
       
    68 
       
    69         /** 
       
    70         * @see CActive::DoCancel()
       
    71         */
       
    72         void DoCancel();
       
    73 
       
    74         /**
       
    75         * @see CActive::RunL()
       
    76         */
       
    77         void RunL();
       
    78 
       
    79     private: // Data
       
    80         CSosEmergencyNumberPolicyHandler&   iEmergNumHandler;
       
    81 
       
    82     };
       
    83 
       
    84 
       
    85 /**
       
    86 *  CSosEmergencyNumberPolicyHandler
       
    87 *  Description: Defines SOS emergency number policy.
       
    88 *
       
    89 *  @since Series60_2.6
       
    90 */
       
    91 NONSHARABLE_CLASS( CSosEmergencyNumberPolicyHandler ) : 
       
    92     public CActive
       
    93     {
       
    94     public:  // Constructors and destructor
       
    95       
       
    96         /**
       
    97         * Two-phased constructor.
       
    98         * @param aETelServer a reference of RTelServer.
       
    99         * @return a instance of SOS emergency number policy handler.
       
   100         */
       
   101         static CSosEmergencyNumberPolicyHandler* NewL( 
       
   102             RTelServer& aETelServer );
       
   103 
       
   104         /**
       
   105         * Destructor.
       
   106         */
       
   107         ~CSosEmergencyNumberPolicyHandler();
       
   108 
       
   109     public: // New
       
   110         /**
       
   111         * Emergency number check.
       
   112         * @param aTelNumber a telephone number to be checked.
       
   113         * @param aMode a check mode, Normal/Advanced.
       
   114         * @param aIsEmergencyNumber  return True if the number is emergency.
       
   115         * @return error code.
       
   116         */
       
   117         TInt IsEmergencyNumber( 
       
   118                                 TPhCltTelephoneNumber& aTelNumber, 
       
   119                                 TPhCltEmergencyNumberQueryMode aMode,
       
   120                                 TBool& aIsEmergencyNumber );
       
   121 
       
   122         /**
       
   123         * SIM Emergency numbers action status.
       
   124         */
       
   125         enum TSosEnPolicySimEmergencyNumberAction 
       
   126             {
       
   127             // Reads emergency numbers from SIM
       
   128             ESosEnPolicySimEmergencyNumberRead,
       
   129             // Clears emergency numbers in SIM
       
   130             ESosEnPolicySimEmergencyNumberClear
       
   131             };
       
   132 
       
   133         /**
       
   134         * Observer for SIM status changes.
       
   135         *
       
   136         * @param aAction Action to be handled.
       
   137         */
       
   138         void CpsssmHandleSimStatusEvent( 
       
   139             TSosEnPolicySimEmergencyNumberAction aAction );
       
   140 
       
   141     private:  // Functions from base classes
       
   142 
       
   143         /** 
       
   144         * @see CActive::DoCancel()
       
   145         */
       
   146         void DoCancel();
       
   147 
       
   148         /**
       
   149         * @see CActive::RunL()
       
   150         */
       
   151         void RunL();
       
   152 
       
   153         /**
       
   154         * From CActive
       
   155         */
       
   156         TInt RunError( TInt aError );
       
   157 
       
   158     private:
       
   159 
       
   160         /** 
       
   161         * Initializes values to Central Repository list.
       
   162         */
       
   163         void InitializeCentralRepositoryList();
       
   164 
       
   165     private:
       
   166         /**
       
   167         * C++ default constructor.
       
   168         */
       
   169         CSosEmergencyNumberPolicyHandler();
       
   170 
       
   171         /**
       
   172         * Symbian 2nd phase constructor is private.
       
   173         * @param aETelServer a reference of RTelServer.
       
   174         */
       
   175         void ConstructL( RTelServer& aETelServer );
       
   176 
       
   177     private:// Data
       
   178 
       
   179         // The RMobilePhone instance.
       
   180         /*****************************************************
       
   181         *   Series 60 Customer / ETel
       
   182         *   Series 60  ETel API
       
   183         *****************************************************/
       
   184         RMobilePhone                    iMobilePhone;
       
   185 
       
   186         // SIM status monitor
       
   187         CSosEnPolicySimStatusMonitor*   iSimMonitor;
       
   188 
       
   189         // Emergency Number list handler
       
   190         CSosEnPolicyENListHandler*  iENListHandler;
       
   191 
       
   192         // Reads Emergency Number list from the phone or SIM store.
       
   193         /*****************************************************
       
   194         *   Series 60 Customer / ETel
       
   195         *   Series 60  ETel API
       
   196         *****************************************************/
       
   197         CRetrieveMobilePhoneENList*     iSimEnRetriver;
       
   198 
       
   199         // Storage for emergency number read.
       
   200         /*****************************************************
       
   201         *   Series 60 Customer / ETel
       
   202         *   Series 60  ETel API
       
   203         *****************************************************/
       
   204         RMobileENStore                  iENStore;
       
   205 
       
   206         // Central repository instance.
       
   207         CRepository*                    iCenRepSession;
       
   208 
       
   209         // Sat refresh listener
       
   210         CSosEnPolicySatRefresh* iSatRefresh;
       
   211         
       
   212         //Sim state
       
   213         TInt iSimState;
       
   214         
       
   215     };
       
   216 
       
   217 #endif  // CSOSEMERGENCYNUMBERPOLICYHANDLER_H
       
   218 // End of File