phoneapp/phonemediatorcenter/inc/cphonemediatorfactory.h
changeset 37 ba76fc04e6c2
child 51 f39ed5e045e0
equal deleted inserted replaced
36:2eacb6118286 37:ba76fc04e6c2
       
     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: 
       
    15 *     Factory for creating different kind of Mediator related objects.
       
    16 *     This factory itself is a Singleton.
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 #ifndef CPHONEMEDIATORFACTORY_H
       
    22 #define CPHONEMEDIATORFACTORY_H
       
    23 
       
    24 // INCLUDES
       
    25 #include <e32base.h>
       
    26 #include <coemain.h>
       
    27 
       
    28 // FORWARD DECLARATIONS
       
    29 class CPhoneMediatorSender;
       
    30 class CPhoneMediatorCommandListener;
       
    31 class MPhoneMenuAndCbaEvents;
       
    32 class MPhoneEngineMessageSender;
       
    33 class MPEEngineInfo;
       
    34 class MPhoneMediatorMessage;
       
    35 
       
    36 // CLASS DECLARATION
       
    37 
       
    38 class CPhoneMediatorFactory : public CCoeStatic
       
    39     {
       
    40     public:  
       
    41 
       
    42         /**
       
    43         * First call initializes the singleton object. Subsequent calls return
       
    44         * instance.
       
    45         * @param None.
       
    46         * @return Pointer to the one and only instance of Phone Mediator 
       
    47         *         Sender -object.
       
    48         */
       
    49         IMPORT_C static CPhoneMediatorFactory* Instance();
       
    50 
       
    51         /**
       
    52          * Destructor.
       
    53          */
       
    54         virtual ~CPhoneMediatorFactory();
       
    55         
       
    56         /**
       
    57         * Creates and returns instance of Mediator Sender for sending Mediator
       
    58         * Commands and Events.
       
    59         * @return pointer to CPhoneMediatorSender.
       
    60         */
       
    61         IMPORT_C CPhoneMediatorSender* Sender();
       
    62         
       
    63         /**
       
    64         * Returns instance of Mediator Command Listener.
       
    65         * When called for the very first time parameters are needed to construct
       
    66         * the Singleton object. After that providing parameters aren't needed.
       
    67         */
       
    68         IMPORT_C CPhoneMediatorCommandListener* CommandListener( 
       
    69             MPhoneMenuAndCbaEvents* aMenuAndCbaEventHandler = NULL,
       
    70             MPhoneEngineMessageSender* aMessageSender = NULL,
       
    71             MPEEngineInfo* aEngineInfo = NULL );
       
    72 
       
    73         /**
       
    74         * Returns instance of Mediator Message.         
       
    75         * @param aMessage - Message from Phone Engine (EPEMessage).
       
    76         * @param aCallId - Caller id
       
    77         * @return MPhoneMediatorMessage object.
       
    78         */
       
    79         IMPORT_C MPhoneMediatorMessage* MediatorMessage(
       
    80             const TInt aMessage, TInt aCallId );
       
    81         
       
    82 
       
    83     private:
       
    84 
       
    85         /**
       
    86         * Instantiates this class and returns a pointer to us
       
    87         */
       
    88         static CPhoneMediatorFactory* NewL();
       
    89 
       
    90         /**    
       
    91          * Protected constructor because of Singleton Pattern
       
    92          */    
       
    93         CPhoneMediatorFactory();  
       
    94         
       
    95         /**
       
    96          * By default EPOC constructor is private.
       
    97          */
       
    98         void ConstructL();
       
    99         
       
   100              
       
   101     private:
       
   102         
       
   103         // Not owned
       
   104         MPhoneMenuAndCbaEvents* iMenuAndCbaEvents;
       
   105         
       
   106         // Not owned
       
   107         MPhoneEngineMessageSender* iMessageSender;
       
   108         
       
   109         // Not owned
       
   110         MPEEngineInfo* iEngineInfo;
       
   111 
       
   112     };
       
   113     
       
   114 #endif // CPHONEMEDIATORFACTORY_H
       
   115 
       
   116 // End of File