os/boardsupport/haitest/bspsvs/suite/bsp/sound/src/t_sounddriverserver.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     1 /*
     2 * Copyright (c) 2005-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 #include "t_sounddriverserver.h"
    19 /**
    20 * @return - Instance of the test server
    21 * Same code for Secure and non-secure variants
    22 * Called inside the MainL() function to create and start the
    23 * CTestServer derived server.
    24 */
    25 CT_SoundDriverServer* CT_SoundDriverServer::NewL()
    26 	{
    27 	CT_SoundDriverServer* server = new (ELeave) CT_SoundDriverServer();
    28 	CleanupStack::PushL(server);
    29 	server->ConstructL();
    30 	CleanupStack::Pop(server);
    31 	return server;
    32 	}
    33 
    34 /**
    35  * Secure variant
    36  * Much simpler, uses the new Rendezvous() call to sync with the client
    37  */
    38 LOCAL_C void MainL()
    39 	{
    40 #if (defined __DATA_CAGING__)
    41 	RProcess().DataCaging(RProcess::EDataCagingOn);
    42 	RProcess().SecureApi(RProcess::ESecureApiOn);
    43 #endif
    44 	CActiveScheduler* sched=NULL;
    45 	sched=new(ELeave) CActiveScheduler;
    46 	CActiveScheduler::Install(sched);
    47 	CT_SoundDriverServer* server = NULL;
    48 	TRAPD(err, server = CT_SoundDriverServer::NewL());
    49 	if(!err)
    50 		{
    51 		RProcess::Rendezvous(KErrNone);
    52 		sched->Start();
    53 		}
    54 	delete server;
    55 	delete sched;
    56 	}
    57 
    58 /**
    59  * @return - Standard Epoc error code on process exit
    60  * Secure variant only
    61  * Process entry point. Called by client using RProcess API
    62  */
    63 GLDEF_C TInt E32Main()
    64 	{
    65 	CTrapCleanup* cleanup = CTrapCleanup::New();
    66 	if(cleanup == NULL)
    67 		{
    68 		return KErrNoMemory;
    69 		}
    70 #if (defined TRAP_IGNORE)
    71 	TRAP_IGNORE(MainL());
    72 #else
    73 	TRAPD(err,MainL());
    74 #endif
    75 	delete cleanup;
    76 	return KErrNone;
    77 	}