1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/kernelhwsrv/baseapitest/basesvs/validation/f32/sfsrv/src/T_SfSrvServer.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,79 @@
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 +
1.22 +#include "T_SfSrvServer.h"
1.23 +
1.24 +CT_SfSrvServer* CT_SfSrvServer::NewL()
1.25 +/**
1.26 + * @return - Instance of the test server
1.27 + * Same code for Secure and non-secure variants
1.28 + * Called inside the MainL() function to create and start the
1.29 + * CTestServer derived server.
1.30 + */
1.31 + {
1.32 + CT_SfSrvServer* server = new (ELeave) CT_SfSrvServer();
1.33 + CleanupStack::PushL(server);
1.34 + server->ConstructL();
1.35 + CleanupStack::Pop(server);
1.36 + return server;
1.37 + }
1.38 +
1.39 +LOCAL_C void MainL()
1.40 +/**
1.41 + * Secure variant
1.42 + * Much simpler, uses the new Rendezvous() call to sync with the client
1.43 + */
1.44 + {
1.45 +#if (defined __DATA_CAGING__)
1.46 + RProcess().DataCaging(RProcess::EDataCagingOn);
1.47 + RProcess().SecureApi(RProcess::ESecureApiOn);
1.48 +#endif
1.49 + CActiveScheduler* sched=NULL;
1.50 + sched=new(ELeave) CActiveScheduler;
1.51 + CActiveScheduler::Install(sched);
1.52 + CT_SfSrvServer* server = NULL;
1.53 + TRAPD(err, server = CT_SfSrvServer::NewL());
1.54 + if(!err)
1.55 + {
1.56 + RProcess::Rendezvous(KErrNone);
1.57 + sched->Start();
1.58 + }
1.59 + delete server;
1.60 + delete sched;
1.61 + }
1.62 +
1.63 +GLDEF_C TInt E32Main()
1.64 +/**
1.65 + * @return - Standard Epoc error code on process exit
1.66 + * Secure variant only
1.67 + * Process entry point. Called by client using RProcess API
1.68 + */
1.69 + {
1.70 + CTrapCleanup* cleanup = CTrapCleanup::New();
1.71 + if(cleanup == NULL)
1.72 + {
1.73 + return KErrNoMemory;
1.74 + }
1.75 +#if (defined TRAP_IGNORE)
1.76 + TRAP_IGNORE(MainL());
1.77 +#else
1.78 + TRAPD(err,MainL());
1.79 +#endif
1.80 + delete cleanup;
1.81 + return KErrNone;
1.82 + }