multimediacommsengine/tsrc/MCETestUI/MCETestUIEngine/src/CMCETestUIEngineInRefer.cpp
changeset 0 1bce908db942
equal deleted inserted replaced
-1:000000000000 0:1bce908db942
       
     1 /*
       
     2 * Copyright (c) 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:    
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 // MCE API
       
    22 
       
    23 #include <MCEManager.h>
       
    24 #include <MCERefer.h>
       
    25 #include <MCEInRefer.h>
       
    26 #include "MCETestUIEngineDefaultValues.h"
       
    27 
       
    28 #include "CMCETestUIEngine.h"
       
    29 #include "CMCETestUIEngineRefer.h"
       
    30 #include "CMCETestUIEngineInRefer.h"
       
    31 #include "TMCETestUIEngineCmdAcceptEvent.h"
       
    32 #include "TMCETestUIEngineCmdRejectEvent.h"
       
    33 #include "TMCETestUIEngineCmdDeleteEvent.h"
       
    34 
       
    35 
       
    36 // ============================ MEMBER FUNCTIONS ===============================
       
    37 
       
    38 // -----------------------------------------------------------------------------
       
    39 // CMCETestUIEngineInRefer::NewL()
       
    40 // -----------------------------------------------------------------------------
       
    41 //
       
    42 CMCETestUIEngineInRefer* CMCETestUIEngineInRefer::NewL(
       
    43             CMCETestUIEngine& aEngine,
       
    44             CMceInRefer* aInRefer ) 
       
    45     {
       
    46     CMCETestUIEngineInRefer* self = 
       
    47         new (ELeave) CMCETestUIEngineInRefer( aEngine, aInRefer );
       
    48     CleanupStack::PushL( self );
       
    49     self->ConstructL();
       
    50     CleanupStack::Pop( self );
       
    51     return self;  
       
    52     }
       
    53 
       
    54 // -----------------------------------------------------------------------------
       
    55 // CMCETestUIEngineInRefer::CMCETestUIEngineInRefer
       
    56 // -----------------------------------------------------------------------------
       
    57 //
       
    58 CMCETestUIEngineInRefer::CMCETestUIEngineInRefer(
       
    59             CMCETestUIEngine& aEngine,
       
    60             CMceInRefer* aInRefer )
       
    61     :CMCETestUIEngineRefer( aEngine ),
       
    62      iInRefer( aInRefer ),
       
    63      iId( 0 )
       
    64     {
       
    65     }
       
    66      
       
    67 
       
    68 // -----------------------------------------------------------------------------
       
    69 // CMCETestUIEngineInRefer::ConstructL()
       
    70 // -----------------------------------------------------------------------------
       
    71 //
       
    72 void CMCETestUIEngineInRefer::ConstructL()
       
    73     {
       
    74     User::LeaveIfError( iInRefer ? KErrNone : KErrArgument );
       
    75      
       
    76     BaseConstructL();
       
    77     iRefer = iInRefer;
       
    78     
       
    79        
       
    80     // Get identity
       
    81     iId = iEngine.NextInReferId();
       
    82     }
       
    83 
       
    84 
       
    85 // -----------------------------------------------------------------------------
       
    86 // CMCETestUIEngineInRefer::~CMCETestUIEngineInRefer
       
    87 // -----------------------------------------------------------------------------
       
    88 //
       
    89 EXPORT_C CMCETestUIEngineInRefer::~CMCETestUIEngineInRefer()
       
    90     {
       
    91     delete iInRefer;
       
    92     }
       
    93 
       
    94 // -----------------------------------------------------------------------------
       
    95 // CMCETestUIEngineInEvent::GetCommands
       
    96 // -----------------------------------------------------------------------------
       
    97 //
       
    98 const RPointerArray<TMCETestUIEngineCmdBase>& 
       
    99             CMCETestUIEngineInRefer::GetCommandsL()
       
   100     {
       
   101     iCommands.ResetAndDestroy();
       
   102 
       
   103     // Get base class commands
       
   104     CMCETestUIEngineRefer::GetCommandsL();
       
   105 
       
   106     // Get own commands
       
   107     TInt state = iInRefer->State();
       
   108 
       
   109 	switch( state ) 
       
   110 		{
       
   111 		case CMceRefer::EIdle: 
       
   112 		    {
       
   113 		  
       
   114             iCommands.Append( new (ELeave) 
       
   115 		        TMCETestUIEngineCmdAcceptRefer( iEngine, *this ) );
       
   116 		    iCommands.Append( new (ELeave) 
       
   117 		        TMCETestUIEngineCmdRejectRefer( iEngine, *this ) );	  
       
   118 		    iCommands.Append( new (ELeave) 
       
   119 		        TMCETestUIEngineCmdRespondRefer( iEngine, *this ) );
       
   120 		 		                                                                 		            
       
   121 		    break;
       
   122 		    }
       
   123 	   	case CMceRefer::EPending: 
       
   124 	   		{
       
   125 	   	/*	 
       
   126 		  */  break;   
       
   127 	   		}
       
   128 	   	case CMceRefer::EAccepted:
       
   129 		    {		         
       
   130 		    
       
   131 		    break;
       
   132 		    }
       
   133 		default:
       
   134 		    {		     
       
   135 		    break;
       
   136 		    }
       
   137 		}  
       
   138 		  
       
   139     return iCommands; 
       
   140     }
       
   141 
       
   142 // -----------------------------------------------------------------------------
       
   143 // CMCETestUIEngineInRefer::Id
       
   144 // -----------------------------------------------------------------------------
       
   145 //
       
   146 EXPORT_C TInt CMCETestUIEngineInRefer::Id() const
       
   147     {
       
   148     return iId;
       
   149     }
       
   150 
       
   151 // -----------------------------------------------------------------------------
       
   152 // CMCETestUIEngineInRefer::InSession
       
   153 // -----------------------------------------------------------------------------
       
   154 //
       
   155 CMceInRefer& CMCETestUIEngineInRefer::InRefer()
       
   156     {
       
   157     return *iInRefer;
       
   158     }
       
   159 
       
   160 
       
   161