1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/boardsupport/haitest/bspsvs/suite/bsp/lcd/src/T_ScreenDriverServer.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,105 @@
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_ScreenDriverServer.h"
1.22 +#include "T_ScreenDriverData.h"
1.23 +
1.24 +/*@{*/
1.25 +_LIT(KT_ScreenDriver, "LCD");
1.26 +/*@}*/
1.27 +
1.28 +CT_ScreenDriverServer* CT_ScreenDriverServer::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_ScreenDriverServer* server = new (ELeave) CT_ScreenDriverServer();
1.37 + CleanupStack::PushL(server);
1.38 + server->ConstructL();
1.39 + CleanupStack::Pop(server);
1.40 + return server;
1.41 + }
1.42 +
1.43 +
1.44 +LOCAL_C void MainL()
1.45 +/**
1.46 + * Secure variant
1.47 + * Much simpler, uses the new Rendezvous() call to sync with the client
1.48 + */
1.49 + {
1.50 +#if (defined __DATA_CAGING__)
1.51 + RProcess().DataCaging(RProcess::EDataCagingOn);
1.52 + RProcess().SecureApi(RProcess::ESecureApiOn);
1.53 +#endif
1.54 + CActiveScheduler* sched=NULL;
1.55 + sched=new(ELeave) CActiveScheduler;
1.56 + CActiveScheduler::Install(sched);
1.57 + CT_ScreenDriverServer* server = NULL;
1.58 +
1.59 + // Create the CTestServer derived server
1.60 + TRAPD(err,server = CT_ScreenDriverServer::NewL());
1.61 + if(!err)
1.62 + {
1.63 + // Sync with the client and enter the active scheduler
1.64 + RProcess::Rendezvous(KErrNone);
1.65 + sched->Start();
1.66 + }
1.67 +
1.68 + delete server;
1.69 + delete sched;
1.70 + }
1.71 +
1.72 +
1.73 +GLDEF_C TInt E32Main()
1.74 +/**
1.75 + * @return - Standard Epoc error code on process exit
1.76 + * Secure variant only
1.77 + * Process entry point. Called by client using RProcess API
1.78 + */
1.79 + {
1.80 + __UHEAP_MARK;
1.81 + CTrapCleanup* cleanup = CTrapCleanup::New();
1.82 + if(cleanup == NULL)
1.83 + {
1.84 + return KErrNoMemory;
1.85 + }
1.86 +
1.87 +#if (defined TRAP_IGNORE)
1.88 + TRAP_IGNORE(MainL());
1.89 +#else
1.90 + TRAPD(err,MainL());
1.91 +#endif
1.92 +
1.93 + delete cleanup;
1.94 + __UHEAP_MARKEND;
1.95 + return KErrNone;
1.96 + }
1.97 +
1.98 +CDataWrapper* CT_ScreenDriverServer::CT_ScreenDriverBlock::CreateDataL(const TDesC& aData)
1.99 + {
1.100 + CDataWrapper* wrapper=NULL;
1.101 +
1.102 + if( KT_ScreenDriver() == aData )
1.103 + {
1.104 + wrapper=CT_ScreenDriverData::NewL();
1.105 + }
1.106 +
1.107 + return wrapper;
1.108 + }