multimediacommsengine/tsrc/MMCTestDriver/MCETester/src/CTcMCEContext.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:    Implementation.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #include "TesterConstants.h"
       
    22 #include "tcuid.h"
       
    23 #include "TcLog.h"
       
    24 #include <flogger.h>
       
    25 #include "CTcCTRLCodec.h"
       
    26 
       
    27 #include <sip.h>
       
    28 
       
    29 #include "CTcMCEContext.h"
       
    30 #include "MCEConstants.h"
       
    31 #include "TTcMceCommandBase.h"
       
    32 #include "CTcMCEFactory.h"
       
    33 #include "CTcMCEReceiveQueue.h"
       
    34 #include "CTcMCEReceived.h"
       
    35 #include "CTcMCEProfileContainer.h"
       
    36 #include "CTcMCEMultimediaAPIObserver.h"
       
    37 #include "CTcMCEFloorControlObserver.h"
       
    38 #include "CTcMCEEventAPIObserver.h"
       
    39 
       
    40 #include "CommandIndex.h"
       
    41 
       
    42 
       
    43 const TUid KUidMCEtestUI = { 0x10203355 }; // UID of the ECOM implementation
       
    44 
       
    45 CTcMCEContext* CTcMCEContext::NewLC( CTcCTRLCodec& aCodec,
       
    46 									 TInt aIAPId )
       
    47 	{
       
    48 	CTcMCEContext* self = new( ELeave ) CTcMCEContext( aCodec );
       
    49 
       
    50 	CleanupStack::PushL( self );
       
    51 	self->ConstructL( aIAPId );
       
    52 
       
    53 	return self;
       
    54 	}
       
    55 
       
    56 CTcMCEContext::~CTcMCEContext()
       
    57 	{	
       
    58 	
       
    59 	delete iSipProfile;
       
    60 	
       
    61     // Deleting manager before session and events should be possible.
       
    62     // At this moment (29.8.2005) it is not, so we have to clean up
       
    63     // the object registry before deleting MCEManager. So next line is 
       
    64     // not needed, when MMCE is fixed.
       
    65     iRegistry.DestroyAll(); 
       
    66 
       
    67 	delete iFCObserver;
       
    68 	delete iFC;
       
    69 		
       
    70 	delete iEventObserver;
       
    71 	delete iMMObserver;
       
    72 	delete iMCEManager; 
       
    73     	
       
    74 	delete iSip;
       
    75 
       
    76 	}
       
    77 
       
    78 CTcMCEContext::CTcMCEContext( CTcCTRLCodec& aCodec )
       
    79 	: CTcContextBase( aCodec )
       
    80 	{
       
    81 	}
       
    82 
       
    83 void CTcMCEContext::ConstructL( TInt /*aIAPId*/ )
       
    84 	{
       
    85 
       
    86     //iIAPId = aIAPId;
       
    87     iSip = CSIP::NewL( TUid::Null(), *this ); 
       
    88 	iSipProfile = CTcMCEProfileContainer::NewL( *this, *iSip );
       
    89 
       
    90 	
       
    91 	iMCEManager = CMceManager::NewL( KUidMCEtestUI, &iDataContainer );	
       
    92 	
       
    93 	iMMObserver = CTcMCEMultimediaAPIObserver::NewL( *this );
       
    94 	iMCEManager->SetSessionObserver( iMMObserver );
       
    95 	iMCEManager->SetInSessionObserver( iMMObserver );
       
    96 	iMCEManager->SetMediaObserver( iMMObserver );
       
    97 	iMCEManager->SetRtpObserver( iMMObserver );
       
    98 	iMCEManager->SetTransactionObserver( iMMObserver );
       
    99 	iMCEManager->SetInTransactionObserver( iMMObserver );
       
   100 
       
   101 	iEventObserver = CTcMCEEventAPIObserver::NewL( *this );
       
   102 	iMCEManager->SetEventObserver( iEventObserver );
       
   103 	iMCEManager->SetInEventObserver( iEventObserver );
       
   104 	iMCEManager->SetReferObserver( iEventObserver);
       
   105 	iMCEManager->SetInReferObserver( iEventObserver );
       
   106 	
       
   107 	iFCObserver = CTcMCEFloorControlObserver::NewL( *this );
       
   108 	iFC = CMceFcMsgExchange::NewL( *iMCEManager, KFCTypeTBCP );
       
   109 
       
   110 	}
       
   111 
       
   112 // -- CTcContextBase functions ------------------------------------------------
       
   113 
       
   114 TTcCommandBase* CTcMCEContext::CreateCommandL( TTcIdentifier& aId,
       
   115 											   MTcTestContext& aContext )
       
   116 	{
       
   117 	// Use base class to actually create commands. Just provide the command
       
   118 	// array and its size. This creates a command instance.
       
   119 	return CTcContextBase::CreateCommandL( KTcSscCommands,
       
   120 										   sizeof( KTcSscCommands ),
       
   121 										   aId, aContext );
       
   122 	}
       
   123 
       
   124 
       
   125 // -- Received queue handling -------------------------------------------------
       
   126 
       
   127 
       
   128 CTcMCEReceived& CTcMCEContext::ReceivedSessionItemL( TInt aTimeout )
       
   129 	{
       
   130 	return iMMObserver->ReceivedSessionItemL( aTimeout );	
       
   131 	}
       
   132 
       
   133 CTcMCEReceived& CTcMCEContext::ReceivedUpdatedSessionItemL( TInt aTimeout )
       
   134 	{
       
   135 	return iMMObserver->ReceivedUpdatedSessionItemL( aTimeout );	
       
   136 	}
       
   137 
       
   138 CTcMCEReceived& CTcMCEContext::ReceivedStreamItemL( TInt aTimeout )
       
   139 	{
       
   140 	return iMMObserver->ReceivedStreamItemL( aTimeout );	
       
   141 	}
       
   142 
       
   143 CTcMCEReceived& CTcMCEContext::ReceivedRTPItemL( TInt aTimeout )
       
   144 	{
       
   145 	return iMMObserver->ReceivedRTPItemL( aTimeout );	
       
   146 	}	
       
   147 
       
   148 CTcMCEReceived& CTcMCEContext::ReceivedEventItemL( TInt aTimeout )
       
   149 	{
       
   150 	return iEventObserver->ReceivedEventItemL( aTimeout );	
       
   151 	}
       
   152 
       
   153 CTcMCEReceived& CTcMCEContext::ReceivedFCItemL( TInt aTimeout )
       
   154 	{
       
   155 	return iFCObserver->ReceivedFCItemL( aTimeout );	
       
   156 	}
       
   157 	
       
   158 	
       
   159 // -- from SIPObserver ---------------------------------------------------------
       
   160 
       
   161 void CTcMCEContext::IncomingRequest(
       
   162 			TUint32 /*aIapId*/,
       
   163 			CSIPServerTransaction* /*aTransaction*/)
       
   164 	{
       
   165 		// NOP, dummy
       
   166 	}
       
   167 
       
   168 void CTcMCEContext::TimedOut(CSIPServerTransaction& /*aTransaction*/)
       
   169     {
       
   170     	// NOP, dummy
       
   171     }