First public contribution.
2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
18 #include "T_SerialDriverServer.h"
19 #include "T_RBusDevCommData.h"
20 #include "T_TCommCapsV03Data.h"
21 #include "T_TCommConfigV02Data.h"
24 _LIT(KT_RBusDevComm, "RBusDevComm");
25 _LIT(KT_TCommCapsV01, "TCommCapsV01");
26 _LIT(KT_TCommCapsV02, "TCommCapsV02");
27 _LIT(KT_TCommCapsV03, "TCommCapsV03");
28 _LIT(KT_TCommConfigV01, "TCommConfigV01");
29 _LIT(KT_TCommConfigV02, "TCommConfigV02");
32 CT_SerialDriverServer* CT_SerialDriverServer::NewL()
34 * @return - Instance of the test server
35 * Same code for Secure and non-secure variants
36 * Called inside the MainL() function to create and start the
37 * CTestServer derived server.
40 CT_SerialDriverServer* server = new (ELeave) CT_SerialDriverServer();
41 CleanupStack::PushL(server);
43 CleanupStack::Pop(server);
51 * Much simpler, uses the new Rendezvous() call to sync with the client
54 #if (defined __DATA_CAGING__)
55 RProcess().DataCaging(RProcess::EDataCagingOn);
56 RProcess().SecureApi(RProcess::ESecureApiOn);
58 CActiveScheduler* sched=NULL;
59 sched=new(ELeave) CActiveScheduler;
60 CActiveScheduler::Install(sched);
61 CT_SerialDriverServer* server = NULL;
63 // Create the CTestServer derived server
64 TRAPD(err,server = CT_SerialDriverServer::NewL());
67 // Sync with the client and enter the active scheduler
68 RProcess::Rendezvous(KErrNone);
77 GLDEF_C TInt E32Main()
79 * @return - Standard Epoc error code on process exit
81 * Process entry point. Called by client using RProcess API
85 CTrapCleanup* cleanup = CTrapCleanup::New();
91 #if (defined TRAP_IGNORE)
102 CDataWrapper* CT_SerialDriverServer::CT_SerialDriverBlock::CreateDataL(const TDesC& aData)
104 CDataWrapper* wrapper=NULL;
106 if( aData==KT_RBusDevComm() )
108 wrapper=CT_RBusDevCommData::NewL();
110 else if ( aData==KT_TCommCapsV01 )
112 wrapper=new (ELeave) CT_TCommCapsV01Data();
114 else if ( aData==KT_TCommCapsV02 )
116 wrapper=new (ELeave) CT_TCommCapsV02Data();
118 else if ( aData==KT_TCommCapsV03 )
120 wrapper=new (ELeave) CT_TCommCapsV03Data();
122 else if ( aData==KT_TCommConfigV01 )
124 wrapper=new (ELeave) CT_TCommConfigV01Data();
126 else if ( aData==KT_TCommConfigV02 )
128 wrapper=new (ELeave) CT_TCommConfigV02Data();