bluetooth/btexample/test/cit/ROMConfig/src/testserversymbianexcludebt.cpp
changeset 0 29b1cd4cb562
equal deleted inserted replaced
-1:000000000000 0:29b1cd4cb562
       
     1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #include "testserversymbianexcludebt.h"
       
    17 #include <e32std.h>
       
    18 #include <rsshared.h>
       
    19 
       
    20 // Put all of the test step header files here...
       
    21 #include "cteststepbtromconfigrsocketserv001.h"
       
    22 #include "cteststepbtromconfigrsocketserv002.h"
       
    23 #include "cteststepbtromconfigrsocketserv003.h"
       
    24 #include "cteststepbtromconfigrsocket001.h"
       
    25 #include "cteststepbtromconfigrhostresolver001.h"
       
    26 #include "cteststepbtromconfigrcommserv001.h"
       
    27 #include "cteststepbtromconfiguser001.h"
       
    28 #include "cteststepbtromconfiguser002.h"
       
    29 #include "cteststepbtromconfiguser003.h"
       
    30 #include "cteststepbtromconfiguser004.h"
       
    31 #include "cteststepbtromconfigmanager001.h"
       
    32 #include "cteststepbtromconfigmanager002.h"
       
    33 #include "cteststepbtromconfigsdp001.h"
       
    34 #include "cteststepbtromconfigSdpAgent001.h"
       
    35 #include "cteststepbtromconfigremcon001.h"
       
    36 #include "cteststepbtromconfigremcon002.h"
       
    37 #include "cteststepbtromconfigpan001.h"
       
    38 #include "cteststepbtromconfigrbtphylnkAdapt001.h"
       
    39 
       
    40 _LIT(KServerName,"TestServerSymbianExcludeBt");
       
    41 
       
    42 TInt LoadDrivers()
       
    43 	{
       
    44 #ifdef __WINS__
       
    45 	#define KPDDName _L("ECDRV")
       
    46 	#define KLDDName _L("ECOMM")
       
    47 #else
       
    48 	#define KPDDName _L("EUART1")
       
    49 	#define KLDDName _L("ECOMM")
       
    50 #endif
       
    51 	TInt rerr = KErrNone;
       
    52 
       
    53 	rerr = StartC32();
       
    54 	if (rerr != KErrNone && rerr != KErrAlreadyExists)
       
    55 		{
       
    56 		return rerr;
       
    57 		}
       
    58 
       
    59 	rerr = User::LoadPhysicalDevice(KPDDName);
       
    60 	if (rerr != KErrNone && rerr != KErrAlreadyExists)
       
    61 		{
       
    62 		return rerr;
       
    63 		}
       
    64 
       
    65 	rerr = User::LoadLogicalDevice(KLDDName);
       
    66 	if (rerr != KErrNone && rerr != KErrAlreadyExists)
       
    67 		{
       
    68 		return rerr;
       
    69 		}
       
    70 	return KErrNone;
       
    71 	}
       
    72 
       
    73 /**
       
    74 Called inside the MainL() function to create and start the test
       
    75 @return Instance of the test server
       
    76 */
       
    77 CTestServerSymbianExcludeBt* CTestServerSymbianExcludeBt::NewL()
       
    78 	{
       
    79 	CTestServerSymbianExcludeBt* server(new (ELeave)CTestServerSymbianExcludeBt);
       
    80 	CleanupStack::PushL(server);
       
    81 	server->ConstructL(KServerName);
       
    82 	CleanupStack::Pop(server);
       
    83 	return server;
       
    84 	}
       
    85 
       
    86 LOCAL_C void MainL()
       
    87 	{
       
    88 	CActiveScheduler* sched(new (ELeave) CActiveScheduler);
       
    89 	CleanupStack::PushL(sched);
       
    90 	CActiveScheduler::Install(sched);
       
    91 
       
    92 	// this registers the server with the active scheduler and calls SetActive
       
    93 	CTestServerSymbianExcludeBt* server(CTestServerSymbianExcludeBt::NewL());
       
    94 
       
    95 	// signal to the client that we are ready by
       
    96 	// rendevousing process
       
    97 	RProcess::Rendezvous(KErrNone);
       
    98 
       
    99 	// run the active scheduler
       
   100 	sched->Start();
       
   101 
       
   102 	// clean up
       
   103 	delete server;
       
   104 	CleanupStack::PopAndDestroy(sched);
       
   105 	}
       
   106 
       
   107 /**
       
   108 @return Standard Epoc error code on exit
       
   109 */
       
   110 GLDEF_C TInt E32Main()
       
   111 	{
       
   112 	const TInt rerr(LoadDrivers());
       
   113 	if (rerr != KErrNone)
       
   114 		{
       
   115 		return rerr;
       
   116 		}
       
   117 
       
   118 	__UHEAP_MARK;
       
   119 	CTrapCleanup* cleanup(CTrapCleanup::New());
       
   120 
       
   121 	if (cleanup == NULL)
       
   122 		{
       
   123 		return KErrNoMemory;
       
   124 		}
       
   125 
       
   126 	TRAPD(err, MainL());
       
   127 
       
   128 	delete cleanup;
       
   129 	__UHEAP_MARKEND;
       
   130 	return err;
       
   131 	}
       
   132 
       
   133 /**
       
   134 Implementation of CTestServer pure virtual
       
   135 @return A CTestStep derived instance
       
   136 */
       
   137 CTestStep* CTestServerSymbianExcludeBt::CreateTestStep(const TDesC& aStepName)
       
   138 	{
       
   139 	if ( aStepName == KTestNameRSocketServ001 )
       
   140 		{
       
   141 		return CTestStepBtRomConfigRSocketServ001::New(*this);
       
   142 		}
       
   143 	if ( aStepName == KTestNameRSocketServ002 )
       
   144 		{
       
   145 		return CTestStepBtRomConfigRSocketServ002::New(*this);
       
   146 		}
       
   147 	if ( aStepName == KTestNameRSocketServ003 )
       
   148 		{
       
   149 		return CTestStepBtRomConfigRSocketServ003::New(*this);
       
   150 		}
       
   151 	if ( aStepName == KTestNameRSocket001 )
       
   152 		{
       
   153 		return CTestStepBtRomConfigRSocket001::New(*this);
       
   154 		}
       
   155 	if ( aStepName == KTestNameRHostResolver001 )
       
   156 		{
       
   157 		return CTestStepBtRomConfigRHostResolver001::New(*this);
       
   158 		}
       
   159 	if ( aStepName == KTestNameRCommServ001 )
       
   160 		{
       
   161 		return CTestStepBtRomConfigRCommServ001::New(*this);
       
   162 		}									
       
   163 	if ( aStepName == KTestNameUser001 )
       
   164 		{
       
   165 		return CTestStepBtRomConfigUser001::New(*this);
       
   166 		}
       
   167 	if ( aStepName == KTestNameUser002 )
       
   168 		{
       
   169 		return CTestStepBtRomConfigUser002::New(*this);
       
   170 		}
       
   171 	if ( aStepName == KTestNameUser003 )
       
   172 		{
       
   173 		return CTestStepBtRomConfigUser003::New(*this);
       
   174 		}
       
   175 	if ( aStepName == KTestNameUser004 )
       
   176 		{
       
   177 		return CTestStepBtRomConfigUser004::New(*this);
       
   178 		}
       
   179 	if ( aStepName == KTestNameManager001 )
       
   180 		{
       
   181 		return CTestStepBtRomConfigManager001::New(*this);
       
   182 		}
       
   183 	if ( aStepName == KTestNameManager002 )
       
   184 		{
       
   185 		return CTestStepBtRomConfigManager002::New(*this);
       
   186 		}
       
   187 	if ( aStepName == KTestNameSdp001 )
       
   188 		{
       
   189 		return CTestStepBtRomConfigSdp001::New(*this);
       
   190 		}
       
   191 	if ( aStepName == KTestNameSdpAgent001 )
       
   192 		{
       
   193 		return CTestStepBtRomConfigSdpAgent001::New(*this);
       
   194 		}
       
   195 	if ( aStepName == KTestNameRemCon001 )
       
   196 		{
       
   197 		return CTestStepBtRomConfigRemCon001::New(*this);
       
   198 		}
       
   199 	if ( aStepName == KTestNameRemCon002 )
       
   200 		{
       
   201 		return CTestStepBtRomConfigRemCon002::New(*this);
       
   202 		}
       
   203 	if ( aStepName == KTestNamePan001 )
       
   204 		{
       
   205 		return CTestStepBtRomConfigPan001::New(*this);
       
   206 		}
       
   207 	if ( aStepName == KTestNameRBtPhyLnkAdapt001 )
       
   208 		{
       
   209 		return CTestStepBtRomConfigRBtPhyLnkAdapt001::New(*this);
       
   210 		}
       
   211 	return NULL;
       
   212 	}
       
   213 
       
   214 // EOF