phoneengine/servicehandling/inc/cpeservicehandling.h
changeset 0 5f000ab63145
child 21 92ab7f8d0eab
child 61 41a7f70b3818
equal deleted inserted replaced
-1:000000000000 0:5f000ab63145
       
     1 /*
       
     2 * Copyright (c) 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:  Provides service enabling implementation.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_PESERVICEHANDLING_H
       
    20 #define C_PESERVICEHANDLING_H
       
    21 
       
    22 #include <e32base.h>
       
    23 #include <cch.h>
       
    24 #include "mpeservicehandling.h"
       
    25 
       
    26 class  MPEPhoneModelInternal;
       
    27 
       
    28 /**
       
    29  *  CPEServiceHandling implements the intefaces MPEServiceHandling and 
       
    30  *  thus provides the service enabling imlementation for Phone Engine.
       
    31  *  
       
    32  *  @lib peservicehandling.lib
       
    33  *  @since S60 v5.0
       
    34  */
       
    35 NONSHARABLE_CLASS( CPEServiceHandling ): public CBase,
       
    36                                          public MCchServiceStatusObserver,
       
    37                                          public MPEServiceHandling
       
    38     {
       
    39 
       
    40 	public: // Constructors and destructor
       
    41 
       
    42 	    /**
       
    43 	     * Two-phased constructor.
       
    44 	     */
       
    45 	    IMPORT_C static CPEServiceHandling* NewL( MPEPhoneModelInternal& aModel );
       
    46 
       
    47 	    /**
       
    48 	     * Two-phased constructor.
       
    49 	     */
       
    50 	    IMPORT_C static CPEServiceHandling* NewLC( MPEPhoneModelInternal& aModel );
       
    51 
       
    52 	    /**
       
    53 	     * Destructors.
       
    54 	     */
       
    55 	    IMPORT_C virtual ~CPEServiceHandling();
       
    56 
       
    57 	public: // from MPEServiceHandling
       
    58 	
       
    59         /**
       
    60          * From MPEServiceHandling.
       
    61          * Enables service defined by the given identifier.
       
    62          * This function does the service enabling and service status error checking.
       
    63          * If service is enabled successfully, send message 
       
    64          * (EPEMessageServiceEnabled) to PhoneEngine. 
       
    65          * 
       
    66          * @since   S60 5.0
       
    67          * @param   aServiceId      Identifier of the service.
       
    68          */	                                    
       
    69 	    void EnableServiceL( TInt aServiceId );
       
    70 	   
       
    71         /**
       
    72          * From MPEServiceHandling.
       
    73          * Cancel current service.
       
    74          */ 
       
    75 	    void CancelServiceEnabling() const;
       
    76 	    
       
    77         /**
       
    78          * From MPEServiceHandling.
       
    79          * Disable service.
       
    80          */ 
       
    81         void DisableService() const;
       
    82     
       
    83     public: // from MCchServiceStatusObserver
       
    84         
       
    85         /**
       
    86          * From MCchServiceStatusObserver.
       
    87          * Signaled when service status or error changes.
       
    88          *
       
    89          * @param   aServiceId      Identifier of the service.
       
    90          * @param   aType           Service type.
       
    91          * @param   aServiceStatus  Service status.
       
    92          */
       
    93         void ServiceStatusChanged( TInt aServiceId, 
       
    94                                    const TCCHSubserviceType aType,
       
    95                                    const TCchServiceStatus& aServiceStatus );
       
    96 	private: // Constructors
       
    97 
       
    98         /**
       
    99          * C++ default constructor.
       
   100          */
       
   101         CPEServiceHandling( MPEPhoneModelInternal& aModel );
       
   102         
       
   103         /**
       
   104          * By default Symbian 2nd phase constructor is private.
       
   105          */
       
   106         void ConstructL();
       
   107 	    
       
   108     private: // functions
       
   109     
       
   110         /**
       
   111          * Enable service, if not already enabled.
       
   112          *
       
   113          * @param  aState       Service state.
       
   114          * @param  aService     Service.
       
   115          * @return Error code.
       
   116          */
       
   117         TInt EnableServiceIfNeeded( const TCCHSubserviceState& aState, 
       
   118                                     CCchService& aService );
       
   119         /**
       
   120         * Sends ServiceHandlingError message to PhoneEngine and saves 
       
   121         * errorcode to member variable.
       
   122         * 
       
   123         * @param  aErrorCode, Cch errorcode.
       
   124         */	    
       
   125         void SendErrorMessage( TInt aErrorCode );
       
   126        
       
   127 	private: // data
       
   128 	    
       
   129 	    /**
       
   130 	     * CCH client.
       
   131 	     * Own.
       
   132 	     */
       
   133 	    CCch* iCchClient;
       
   134 
       
   135 	    /**
       
   136 	     * PhoneModel.
       
   137 	     * Not own.
       
   138 	     */
       
   139 	    MPEPhoneModelInternal& iModel;
       
   140 	    
       
   141 	    /**
       
   142 	     * Current service identifier.
       
   143 	     */
       
   144 	    TInt iCurrentServiceId;
       
   145     };
       
   146 
       
   147 #endif // C_PESERVICEHANDLING_H