telutils/telephonyservice/inc/cmediatorservice.h
changeset 0 ff3b6d0fd310
child 19 7d48bed6ce0c
equal deleted inserted replaced
-1:000000000000 0:ff3b6d0fd310
       
     1 /*
       
     2 * Copyright (c) 2007-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:  This class is responsible for communication towards Mediator.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CMEDIATORSERVICE_H
       
    20 #define CMEDIATORSERVICE_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <e32std.h>
       
    24 #include <e32base.h>
       
    25 
       
    26 #include <MediatorCommandInitiator.h>
       
    27 #include <MediatorEventConsumer.h>
       
    28 
       
    29 // forward declarations 
       
    30 
       
    31 // CLASS DECLARATION
       
    32 
       
    33 /**
       
    34  *  An observer interface for receiving responses to Mediator Service commands.  
       
    35  * 
       
    36  *  @lib telephonyservice.lib
       
    37  *  @since S60 v5.1
       
    38  */
       
    39 NONSHARABLE_CLASS( MMediatorServiceObserver ) 
       
    40     {
       
    41     public: // Receiving responses
       
    42 
       
    43         /**
       
    44         * A response to a Mediator Service command.
       
    45         *
       
    46         * @since S60 5.1       
       
    47         * @param aData      The parameters of the response.
       
    48         * @return None.
       
    49         */
       
    50         virtual void CommandResponseL( const TDesC8& aData ) = 0;
       
    51         
       
    52         /**
       
    53          * A Mediator Service event.
       
    54          *
       
    55          * @since S60 5.1       
       
    56          * @param aData      The parameters received with the event.
       
    57          * @return None.
       
    58          */
       
    59         virtual void MediatorEventL( const TDesC8& aData ) = 0;
       
    60         
       
    61     };
       
    62 
       
    63 
       
    64 // CLASS DECLARATION
       
    65 
       
    66 /**
       
    67  *  This class is responsible for communication towards Mediator.  
       
    68  * 
       
    69  *  @lib telephonyservice.lib
       
    70  *  @since S60 v5.1
       
    71  */
       
    72 NONSHARABLE_CLASS( CMediatorService ) : public CBase,
       
    73                          public MMediatorCommandResponseObserver,
       
    74                          public MMediatorEventObserver
       
    75     {
       
    76 public:
       
    77     
       
    78     /**
       
    79      * Enumerates service categories provided by CMediatorService.
       
    80      *
       
    81      * ECallInfo - CMediatorService is used for call information commands and events.
       
    82      * ECallRemotePartyInfo - CMediatorService is used for call remote party information
       
    83      *                        commands and events.
       
    84      */
       
    85     enum TServiceCategory
       
    86         {
       
    87         ECallInfo,  
       
    88         ECallRemotePartyInfo        
       
    89         };
       
    90     
       
    91     // Constructors and destructor
       
    92 
       
    93     /**
       
    94      * Destructor.
       
    95      */
       
    96     ~CMediatorService();
       
    97 
       
    98     /**
       
    99      * Two-phased constructor.
       
   100      */
       
   101     static CMediatorService* NewL( TServiceCategory aService );
       
   102 
       
   103     /**
       
   104      * Two-phased constructor.
       
   105      */
       
   106     static CMediatorService* NewLC( TServiceCategory aService );
       
   107     
       
   108     /**
       
   109      * Sets the observer.
       
   110      */
       
   111     void SetObserver( MMediatorServiceObserver* aObserver );    
       
   112     
       
   113     /**
       
   114      * Send mediator command.
       
   115      */
       
   116     virtual TInt SendCommand();
       
   117     
       
   118     /**
       
   119      * Subscribe mediator event.
       
   120      */
       
   121     virtual TInt SubscribeEvent();
       
   122     
       
   123 // from base class MMediatorCommandResponseObserver
       
   124          
       
   125     /**
       
   126      * From MMediatorCommandResponseObserver.
       
   127      * A response to a Mediator Service command.
       
   128      *
       
   129      * @since S60 v3.1
       
   130      * @param aDomain    The identifier of the domain          
       
   131      * @param aCategory  The identifier of the category.
       
   132      * @param aCommandId The identifier of the command.
       
   133      * @param aStatus    Standard Symbian error code indicating the
       
   134      *                   success of the command.
       
   135      * @param aData      The parameters of the response.
       
   136      * @return None.
       
   137      */
       
   138     void CommandResponseL( TUid aDomain,
       
   139                            TUid aCategory, 
       
   140                            TInt aCommandId,
       
   141                            TInt aStatus, 
       
   142                            const TDesC8& aData );
       
   143     
       
   144 // from base class MMediatorEventObserver      
       
   145           
       
   146     /**
       
   147      * From MMediatorEventObserver.
       
   148      * A Mediator Service event.
       
   149      *
       
   150      * @since S60 3.1        
       
   151      * @param aDomain    The identifier of the domain.
       
   152      * @param aCategory  The identifier of the category.
       
   153      * @param aEventId   The identifier of the event.
       
   154      * @param aData      The parameters of the event.
       
   155      * @return None.
       
   156      */
       
   157     void MediatorEventL( TUid aDomain,
       
   158                          TUid aCategory, 
       
   159                          TInt aEventId, 
       
   160                          const TDesC8& aData );    
       
   161 
       
   162 protected:
       
   163 
       
   164     /**
       
   165      * Constructor for performing 1st stage construction
       
   166      */
       
   167     CMediatorService( TServiceCategory aService );
       
   168 
       
   169     /**
       
   170      * EPOC default constructor for performing 2nd stage construction
       
   171      */
       
   172     void ConstructL();
       
   173     
       
   174 private:
       
   175     
       
   176     /**
       
   177      * Sets the parameters used in Mediator commands and events
       
   178      */
       
   179     void SetMediatorParams();
       
   180     
       
   181 private:  //data
       
   182     CMediatorCommandInitiator* iCommandInitiator;
       
   183     CMediatorEventConsumer*    iMediatorEvent;
       
   184     
       
   185     MMediatorServiceObserver*  iObserver;
       
   186     
       
   187     TServiceCategory    iServiceCategory;
       
   188     TUid        iDomain;
       
   189     TUid        iCategory; 
       
   190     TInt        iCommandId;
       
   191     TInt        iEventId;
       
   192     TVersion    iVersion;
       
   193     };
       
   194 
       
   195 #endif // CMEDIATORSERVICE_H