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