1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/boardsupport/haitest/bspsvs/suite/bsp/sound/src/t_sounddriverserver.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,77 @@
1.4 +/*
1.5 +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
1.6 +* All rights reserved.
1.7 +* This component and the accompanying materials are made available
1.8 +* under the terms of "Eclipse Public License v1.0"
1.9 +* which accompanies this distribution, and is available
1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.11 +*
1.12 +* Initial Contributors:
1.13 +* Nokia Corporation - initial contribution.
1.14 +*
1.15 +* Contributors:
1.16 +*
1.17 +* Description:
1.18 +*
1.19 +*/
1.20 +
1.21 +#include "t_sounddriverserver.h"
1.22 +/**
1.23 +* @return - Instance of the test server
1.24 +* Same code for Secure and non-secure variants
1.25 +* Called inside the MainL() function to create and start the
1.26 +* CTestServer derived server.
1.27 +*/
1.28 +CT_SoundDriverServer* CT_SoundDriverServer::NewL()
1.29 + {
1.30 + CT_SoundDriverServer* server = new (ELeave) CT_SoundDriverServer();
1.31 + CleanupStack::PushL(server);
1.32 + server->ConstructL();
1.33 + CleanupStack::Pop(server);
1.34 + return server;
1.35 + }
1.36 +
1.37 +/**
1.38 + * Secure variant
1.39 + * Much simpler, uses the new Rendezvous() call to sync with the client
1.40 + */
1.41 +LOCAL_C void MainL()
1.42 + {
1.43 +#if (defined __DATA_CAGING__)
1.44 + RProcess().DataCaging(RProcess::EDataCagingOn);
1.45 + RProcess().SecureApi(RProcess::ESecureApiOn);
1.46 +#endif
1.47 + CActiveScheduler* sched=NULL;
1.48 + sched=new(ELeave) CActiveScheduler;
1.49 + CActiveScheduler::Install(sched);
1.50 + CT_SoundDriverServer* server = NULL;
1.51 + TRAPD(err, server = CT_SoundDriverServer::NewL());
1.52 + if(!err)
1.53 + {
1.54 + RProcess::Rendezvous(KErrNone);
1.55 + sched->Start();
1.56 + }
1.57 + delete server;
1.58 + delete sched;
1.59 + }
1.60 +
1.61 +/**
1.62 + * @return - Standard Epoc error code on process exit
1.63 + * Secure variant only
1.64 + * Process entry point. Called by client using RProcess API
1.65 + */
1.66 +GLDEF_C TInt E32Main()
1.67 + {
1.68 + CTrapCleanup* cleanup = CTrapCleanup::New();
1.69 + if(cleanup == NULL)
1.70 + {
1.71 + return KErrNoMemory;
1.72 + }
1.73 +#if (defined TRAP_IGNORE)
1.74 + TRAP_IGNORE(MainL());
1.75 +#else
1.76 + TRAPD(err,MainL());
1.77 +#endif
1.78 + delete cleanup;
1.79 + return KErrNone;
1.80 + }