multimediacommsengine/tsrc/MCETestUI/MCETestUIEngine/src/CMCETestUIEngineInEvent.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 #include <MCEInEvent.h>
       
    26 #include "MCETestUIEngineDefaultValues.h"
       
    27 
       
    28 #include "CMCETestUIEngine.h"
       
    29 #include "CMCETestUIEngineEvent.h"
       
    30 #include "CMCETestUIEngineInEvent.h"
       
    31 
       
    32 #include "TMCETestUIEngineCmdAcceptEvent.h"
       
    33 #include "TMCETestUIEngineCmdRejectEvent.h"
       
    34 #include "TMCETestUIEngineCmdNotifyEvent.h"
       
    35 #include "TMCETestUIEngineCmdDeleteEvent.h"
       
    36 
       
    37 
       
    38 // ============================ MEMBER FUNCTIONS ===============================
       
    39 
       
    40 // -----------------------------------------------------------------------------
       
    41 // CMCETestUIEngineInEvent::NewL()
       
    42 // -----------------------------------------------------------------------------
       
    43 //
       
    44 CMCETestUIEngineInEvent* CMCETestUIEngineInEvent::NewL(
       
    45             CMCETestUIEngine& aEngine,
       
    46             CMceInEvent* aInEvent ) 
       
    47     {
       
    48     CMCETestUIEngineInEvent* self = 
       
    49         new (ELeave) CMCETestUIEngineInEvent( aEngine, aInEvent );
       
    50     CleanupStack::PushL( self );
       
    51     self->ConstructL();
       
    52     CleanupStack::Pop( self );
       
    53     return self;  
       
    54     }
       
    55 
       
    56 // -----------------------------------------------------------------------------
       
    57 // CMCETestUIEngineInEvent::CMCETestUIEngineInEvent
       
    58 // -----------------------------------------------------------------------------
       
    59 //
       
    60 CMCETestUIEngineInEvent::CMCETestUIEngineInEvent(
       
    61             CMCETestUIEngine& aEngine,
       
    62             CMceInEvent* aInEvent )
       
    63     :CMCETestUIEngineEvent( aEngine ),
       
    64      iInEvent( aInEvent ),
       
    65      iId( 0 )
       
    66     {
       
    67     }
       
    68      
       
    69 
       
    70 // -----------------------------------------------------------------------------
       
    71 // CMCETestUIEngineInEvent::ConstructL()
       
    72 // -----------------------------------------------------------------------------
       
    73 //
       
    74 void CMCETestUIEngineInEvent::ConstructL()
       
    75     {
       
    76   //  User::LeaveIfError( iInEvent ? KErrNone : KErrArgument );
       
    77      
       
    78     BaseConstructL();
       
    79     iEvent = iInEvent;
       
    80     
       
    81        
       
    82     // Get identity
       
    83     iId = iEngine.NextInEventId();
       
    84     }
       
    85 
       
    86 
       
    87 // -----------------------------------------------------------------------------
       
    88 // CMCETestUIEngineInEvent::~CMCETestUIEngineInEvent
       
    89 // -----------------------------------------------------------------------------
       
    90 //
       
    91 EXPORT_C CMCETestUIEngineInEvent::~CMCETestUIEngineInEvent()
       
    92     {
       
    93     delete iInEvent;
       
    94     }
       
    95 
       
    96 // -----------------------------------------------------------------------------
       
    97 // CMCETestUIEngineInEvent::GetCommands
       
    98 // -----------------------------------------------------------------------------
       
    99 //
       
   100 const RPointerArray<TMCETestUIEngineCmdBase>& 
       
   101             CMCETestUIEngineInEvent::GetCommandsL()
       
   102     {
       
   103     iCommands.ResetAndDestroy();
       
   104 
       
   105     // Get base class commands
       
   106     CMCETestUIEngineEvent::GetCommandsL();
       
   107 
       
   108     // Get own commands
       
   109     TInt state = iInEvent->State();
       
   110 
       
   111 	switch( state ) 
       
   112 		{
       
   113 		case CMceEvent::EIdle: 
       
   114 		    {
       
   115 		    iCommands.Append( new (ELeave) TMCETestUIEngineCmdAcceptEvent( 
       
   116                                 iEngine, *this ) );
       
   117 			iCommands.Append( new (ELeave) TMCETestUIEngineCmdRejectEvent( 
       
   118                                 iEngine, *this ) );
       
   119 			iCommands.Append( new (ELeave) TMCETestUIEngineCmdNotifyEvent( 
       
   120                                 iEngine, *this ) );  
       
   121             iCommands.Append( new (ELeave) 
       
   122 		        TMCETestUIEngineCmdDeleteEvent( iEngine, *this ) );	                                                               		            
       
   123 		    break;
       
   124 		    }
       
   125 	   	case CMceEvent::EPending: 
       
   126 	   		{
       
   127 	   		iCommands.Append( new (ELeave) TMCETestUIEngineCmdAcceptEvent( 
       
   128                                 iEngine, *this ) );
       
   129 			iCommands.Append( new (ELeave) TMCETestUIEngineCmdRejectEvent( 
       
   130                                 iEngine, *this ) );
       
   131 			iCommands.Append( new (ELeave) TMCETestUIEngineCmdNotifyEvent( 
       
   132                                 iEngine, *this ) );  
       
   133             iCommands.Append( new (ELeave) 
       
   134 		        TMCETestUIEngineCmdDeleteEvent( iEngine, *this ) );	  
       
   135 		    break;   
       
   136 	   		}
       
   137 	   	case CMceEvent::EActive:
       
   138 		    {
       
   139 		    iCommands.Append( new (ELeave) TMCETestUIEngineCmdNotifyEvent( 
       
   140                                 iEngine, *this ) );  		         
       
   141 		    iCommands.Append( new (ELeave) 
       
   142 		        TMCETestUIEngineCmdDeleteEvent( iEngine, *this ) );	    
       
   143 		    break;
       
   144 		    }
       
   145 		default:
       
   146 		    {		     
       
   147 		    break;
       
   148 		    }
       
   149 		}  
       
   150 		  
       
   151     return iCommands; 
       
   152     }
       
   153 
       
   154 // -----------------------------------------------------------------------------
       
   155 // CMCETestUIEngineInEvent::Id
       
   156 // -----------------------------------------------------------------------------
       
   157 //
       
   158 EXPORT_C TInt CMCETestUIEngineInEvent::Id() const
       
   159     {
       
   160     return iId;
       
   161     }
       
   162 
       
   163 // -----------------------------------------------------------------------------
       
   164 // CMCETestUIEngineInEvent::InSession
       
   165 // -----------------------------------------------------------------------------
       
   166 //
       
   167 CMceInEvent& CMCETestUIEngineInEvent::InEvent()
       
   168     {
       
   169     return *iInEvent;
       
   170     }
       
   171 
       
   172 
       
   173