telutils/telephonyservice/inc/ctelsrvbase.h
changeset 0 ff3b6d0fd310
equal deleted inserted replaced
-1:000000000000 0:ff3b6d0fd310
       
     1 /*
       
     2 * Copyright (c) 2008-2009 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 base class for telephonyservice API implementation classes.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef CTELSRVBASE_H
       
    19 #define CTELSRVBASE_H
       
    20 
       
    21 // INCLUDES
       
    22 #include <e32std.h>
       
    23 #include <e32base.h>
       
    24 
       
    25 #include "cmediatorservice.h"
       
    26 
       
    27 // CLASS DECLARATION
       
    28 
       
    29 /**
       
    30  *  CTelSrvBase
       
    31  * 
       
    32  */
       
    33 NONSHARABLE_CLASS( CTelSrvBase ) : public CBase,
       
    34                                    public MMediatorServiceObserver 
       
    35     {
       
    36 public:
       
    37     // Constructors and destructor
       
    38 
       
    39     /**
       
    40      * Destructor.
       
    41      */
       
    42     ~CTelSrvBase();    
       
    43     
       
    44 // from base class MMediatorServiceObserver
       
    45         
       
    46     /**
       
    47      * From MMediatorEventObserver.     
       
    48      * Template method for handling a response to a Mediator Service command.
       
    49      *
       
    50      * @since S60 v5.1
       
    51      * @param aData      The parameters of the response.
       
    52      */
       
    53     void CommandResponseL( const TDesC8& aData );      
       
    54           
       
    55     /**
       
    56      * From MMediatorEventObserver.
       
    57      * Template method for handling a Mediator Service event.     
       
    58      *
       
    59      * @since S60 v5.1     
       
    60      * @param aData      The parameters of the event.
       
    61      * @return None.
       
    62      */
       
    63     virtual void MediatorEventL( const TDesC8& aData );
       
    64     
       
    65 protected:
       
    66     
       
    67     /**
       
    68      * Constructor for performing 1st stage construction
       
    69      */
       
    70     CTelSrvBase();
       
    71     
       
    72     /**
       
    73      * EPOC default constructor for performing 2nd stage construction
       
    74      */    
       
    75     void BaseConstructL( CMediatorService* aMediatorService );
       
    76     
       
    77     /**
       
    78      * Get the current info through Mediator. 
       
    79      * Takes care about the situation that Mediator command must be re-send.
       
    80      *
       
    81      * @since S60 v5.1      
       
    82      */
       
    83     void Initialize();  
       
    84     
       
    85     /**
       
    86      * Abstract method to be implemented by concrete subclass. 
       
    87      * 
       
    88      *
       
    89      * @since S60 v5.1      
       
    90      */
       
    91     virtual void DoHandleCommandResponseL( const TDesC8& aData ) = 0;
       
    92     
       
    93     /**
       
    94      * Abstract method to be implemented by concrete subclass. 
       
    95      * 
       
    96      *
       
    97      * @since S60 v5.1      
       
    98      */
       
    99     virtual void DoHandleMediatorEventL( const TDesC8& aData ) = 0;
       
   100     
       
   101     /**
       
   102      * Starts re-sending mediator command.
       
   103      *
       
   104      * @since S60 v5.1       
       
   105      */
       
   106     static TInt DoReSendCommand(TAny* aPtr);
       
   107     
       
   108     /**
       
   109      * Subscribe to Mediator Event.
       
   110      *
       
   111      * @since S60 v5.1       
       
   112      */
       
   113     virtual void SubscribeMediatorEventL(); 
       
   114 
       
   115 protected: //data
       
   116     
       
   117     // Ownded: Mediator service proxy, must be created by by concrete sublass. 
       
   118     CMediatorService* iMediatorService;
       
   119     
       
   120 private: //data    
       
   121     /**
       
   122      * To synchronize construction.
       
   123      * Own.
       
   124      */
       
   125     CActiveSchedulerWait* iWaitForCommandResponse;    
       
   126      
       
   127     /**
       
   128      * idle object handling of re-sending mediator command.
       
   129      * Own.
       
   130      */
       
   131     CIdle*            iCommandBuffer; 
       
   132 
       
   133     };
       
   134 
       
   135 #endif // CTELSRVBASE_H