multimediacommsengine/tsrc/MCETestUI/MCETestUIEngine/src/CMCETestUIEngineEvent.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 <MCEEvent.h>
       
    25 
       
    26 #include "MCETestUIEngineDefaultValues.h"
       
    27 
       
    28 #include "CMCETestUIEngine.h"
       
    29 #include "CMCETestUIEngineEvent.h"
       
    30 
       
    31 #include "TMCETestUIEngineCmdTerminateEvent.h"
       
    32 //#include "TMCETestUIEngineCmdUpdateSession.h"
       
    33 #include "TMCETestUIEngineCmdDeleteEvent.h"
       
    34 #include "TMCETestUIEngineCmdCreateEvent.h"
       
    35 
       
    36 
       
    37 // ============================ MEMBER FUNCTIONS ===============================
       
    38 
       
    39 
       
    40 // -----------------------------------------------------------------------------
       
    41 // CMCETestUIEngineEvent::CMCETestUIEngineEvent
       
    42 // -----------------------------------------------------------------------------
       
    43 //
       
    44 CMCETestUIEngineEvent::CMCETestUIEngineEvent( 
       
    45                 CMCETestUIEngine& aEngine )
       
    46     : iEngine( aEngine )
       
    47     {
       
    48     }
       
    49 
       
    50 // -----------------------------------------------------------------------------
       
    51 // CMCETestUIEngineEvent::BaseConstructL()
       
    52 // -----------------------------------------------------------------------------
       
    53 //
       
    54 void CMCETestUIEngineEvent::BaseConstructL()
       
    55     {
       
    56     }
       
    57 
       
    58 
       
    59 // -----------------------------------------------------------------------------
       
    60 // CMCETestUIEngineEvent::~CMCETestUIEngineEvent
       
    61 // -----------------------------------------------------------------------------
       
    62 //
       
    63 EXPORT_C CMCETestUIEngineEvent::~CMCETestUIEngineEvent()
       
    64     {
       
    65     iCommands.ResetAndDestroy();
       
    66     }
       
    67 
       
    68 // -----------------------------------------------------------------------------
       
    69 // CMCETestUIEngineEvent::Event
       
    70 // -----------------------------------------------------------------------------
       
    71 //
       
    72 CMceEvent& CMCETestUIEngineEvent::Event()
       
    73     {
       
    74     return *iEvent;
       
    75     }
       
    76 
       
    77 
       
    78 // -----------------------------------------------------------------------------
       
    79 // CMCETestUIEngineEvent::GetCommands
       
    80 // -----------------------------------------------------------------------------
       
    81 //
       
    82 const RPointerArray<TMCETestUIEngineCmdBase>& 
       
    83             CMCETestUIEngineEvent::GetCommandsL()
       
    84     {
       
    85     User::LeaveIfError( iEvent ? KErrNone : KErrNotReady );
       
    86 
       
    87     TInt state = iEvent->State();
       
    88     
       
    89 
       
    90 	switch( state ) 
       
    91 		{
       
    92 		case CMceEvent::EIdle: 
       
    93 		    {	
       
    94 		      
       
    95 		    break;
       
    96 		    }
       
    97 		case CMceEvent::EPending: 
       
    98 		    {	
       
    99 		     
       
   100 		    break;
       
   101 		    }    
       
   102 	   	case CMceEvent::EActive:
       
   103 		    {		         
       
   104 		    iCommands.Append( new (ELeave) 
       
   105 		        TMCETestUIEngineCmdTerminateEvent( iEngine, *this ) );
       
   106 		   	iCommands.Append( new (ELeave) 
       
   107 		        TMCETestUIEngineCmdCreateReferEvent( iEngine, *this ) );
       
   108 		       
       
   109 		    break;
       
   110 		    }
       
   111 		case CMceEvent::ETerminated: 
       
   112 		    {	
       
   113 		    iCommands.Append( new (ELeave) 
       
   114 		        TMCETestUIEngineCmdDeleteEvent( iEngine, *this ) );	    
       
   115 		    break;
       
   116 		    }
       
   117 		default: 
       
   118 		    {    
       
   119 		    break;
       
   120 		    }
       
   121 		}  
       
   122 		  
       
   123     return iCommands; 
       
   124     }
       
   125 
       
   126 // -----------------------------------------------------------------------------
       
   127 // CMCETestUIEngineEvent::State
       
   128 // -----------------------------------------------------------------------------
       
   129 //
       
   130 EXPORT_C const TDesC& CMCETestUIEngineEvent::State() 
       
   131     {
       
   132     if ( !iEvent ) 
       
   133         {
       
   134         User::Panic( _L16("CMCETestUIEngine"), 0 );
       
   135         }
       
   136         
       
   137     TInt state = iEvent->State();
       
   138 
       
   139 	switch( state ) 
       
   140 		{
       
   141 		case CMceEvent::EIdle: 
       
   142 		    return KEventStateIdle; 
       
   143 		    break;
       
   144 		case CMceEvent::EPending: 
       
   145 		    return KEventStatePending; 
       
   146 		    break;
       
   147 		case CMceEvent::EActive: 
       
   148 		    return KEventStateActive; 
       
   149 		    break;
       
   150 		case CMceEvent::ETerminated: 
       
   151 		    return KEventStateTerminated; 
       
   152 		    break;
       
   153 		default: 
       
   154 		    return KEventStateUnknown; 
       
   155 		    break;
       
   156 		}    
       
   157     }
       
   158