omxil/xmltestharness/te_xmlomxclient/src/te_xmlomxclient.cpp
branchOpenMAX-IL_SHAI
changeset 16 eedf2dcd43c6
equal deleted inserted replaced
15:c1e808730d6c 16:eedf2dcd43c6
       
     1 /*
       
     2 * Copyright (c) 2009 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 #include "te_xmlomxclient.h"
       
    20 #include "omxxmltestblockcontroller.h"
       
    21 
       
    22 CTe_XmlOmxClient* CTe_XmlOmxClient::NewL()
       
    23 /**
       
    24  * @return - Instance of the test server
       
    25  * Same code for Secure and non-secure variants
       
    26  * Called inside the MainL() function to create and start the
       
    27  * CTestServer derived server.
       
    28  */
       
    29 	{
       
    30 	CTe_XmlOmxClient * server = new (ELeave) CTe_XmlOmxClient();
       
    31 	CleanupStack::PushL(server);
       
    32 	server->ConstructL();
       
    33 	CleanupStack::Pop(server);
       
    34 	return server;
       
    35 	}
       
    36 
       
    37 
       
    38 // Secure variants much simpler
       
    39 // For EKA2, just an E32Main and a MainL()
       
    40 LOCAL_C void MainL()
       
    41 /**
       
    42  * Secure variant
       
    43  * Much simpler, uses the new Rendezvous() call to sync with the client
       
    44  */
       
    45 	{
       
    46 	// Leave the hooks in for platform security
       
    47 #if (defined __DATA_CAGING__)
       
    48 	RProcess().DataCaging(RProcess::EDataCagingOn);
       
    49 	RProcess().DataCaging(RProcess::ESecureApiOn);
       
    50 #endif
       
    51 	CActiveScheduler* sched=NULL;
       
    52 	sched=new(ELeave) CActiveScheduler;
       
    53 	CActiveScheduler::Install(sched);
       
    54 	CTe_XmlOmxClient* server = NULL;
       
    55 	// Create the CTestServer derived server
       
    56 	TRAPD(err,server = CTe_XmlOmxClient::NewL());
       
    57 	if(!err)
       
    58 		{
       
    59 		// Sync with the client and enter the active scheduler
       
    60 		RProcess::Rendezvous(KErrNone);
       
    61 		sched->Start();
       
    62 		}
       
    63 	delete server;
       
    64 	delete sched;
       
    65 	}
       
    66 
       
    67 
       
    68 
       
    69 GLDEF_C TInt E32Main()
       
    70 /**
       
    71  * @return - Standard Epoc error code on process exit
       
    72  * Secure variant only
       
    73  * Process entry point. Called by client using RProcess API
       
    74  */
       
    75 	{
       
    76 	__UHEAP_MARK;
       
    77 	CTrapCleanup* cleanup = CTrapCleanup::New();
       
    78 	if(cleanup == NULL)
       
    79 		{
       
    80 		return KErrNoMemory;
       
    81 		}
       
    82 	TRAPD(err,MainL());
       
    83 	delete cleanup;
       
    84 	__UHEAP_MARKEND;
       
    85 	return err;
       
    86     }
       
    87 
       
    88 
       
    89 CTestStep* CTe_XmlOmxClient::CreateTestStep(const TDesC& /*aStepName*/)
       
    90 /**
       
    91  * @return - A CTestStep derived instance
       
    92  * Secure and non-secure variants
       
    93  * Implementation of CTestServer pure virtual
       
    94  */
       
    95 	{
       
    96 	return NULL;
       
    97 	}
       
    98 
       
    99 CTestBlockController* CTe_XmlOmxClient::CreateTestBlock()
       
   100 	{
       
   101 	CTestBlockController* controller = NULL;
       
   102 	TRAP_IGNORE(controller = COmxXmlTestBlockController::NewL());
       
   103 	return controller;
       
   104 	}