commsconfig/commsdatabaseshim/TE_commdb/te_cdma2000Settings/src/te_cdmacommdbsettingssvr.cpp
changeset 72 ae47d0499bee
equal deleted inserted replaced
68:5da8188e392b 72:ae47d0499bee
       
     1 //
       
     2 //
       
     3 // Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     4 // All rights reserved.
       
     5 // This component and the accompanying materials are made available
       
     6 // under the terms of "Eclipse Public License v1.0"
       
     7 // which accompanies this distribution, and is available
       
     8 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     9 //
       
    10 // Initial Contributors:
       
    11 // Nokia Corporation - initial contribution.
       
    12 //
       
    13 // Contributors:
       
    14 //
       
    15 // Description:
       
    16 //
       
    17 //
       
    18 //
       
    19 
       
    20 /**
       
    21  @file 
       
    22  @internalComponent
       
    23  
       
    24  Implementation of CTeCdma2000settingsServer class
       
    25  
       
    26  for (WINS && !EKA2) versions will be xxxServer.Dll and require a thread to be started
       
    27  in the process of the client. The client initialises the server by calling the
       
    28  one and only ordinal.
       
    29  */
       
    30 
       
    31 
       
    32 
       
    33 #include "Cdma2000settingsstep.h"
       
    34 #include "te_cdmacommdbsettingssvr.h"
       
    35 
       
    36 using namespace te_Cdma2000CommDbSettings;
       
    37 
       
    38 _LIT(KServerName,"te_cdmacommdbsettingssvr");
       
    39 
       
    40 CTe_Cdma2000CommdbSettingsSvr* CTe_Cdma2000CommdbSettingsSvr::NewL()
       
    41 /**
       
    42  * @return - Instance of the test server
       
    43  * Called inside the MainL() function to create and start the
       
    44  * CTestServer derived server.
       
    45  */
       
    46 	{
       
    47 	CTe_Cdma2000CommdbSettingsSvr * server = new (ELeave)CTe_Cdma2000CommdbSettingsSvr;
       
    48 	CleanupStack::PushL(server);
       
    49 	
       
    50 	// Either use a StartL or ConstructL, the latter will permit
       
    51 	// Server Logging.
       
    52 
       
    53 	//server->StartL(KServerName); 
       
    54 	server-> ConstructL(KServerName);
       
    55 	CleanupStack::Pop(server);
       
    56 	return server;
       
    57 	}
       
    58 
       
    59 // EKA2 much simpler
       
    60 // Just an E32Main and a MainL()
       
    61 LOCAL_C void MainL()
       
    62 /**
       
    63  * Much simpler, uses the new Rendezvous() call to sync with the client
       
    64  */
       
    65 	{
       
    66 	// Leave the hooks in for platform security
       
    67 #if (defined __DATA_CAGING__)
       
    68 	RProcess().DataCaging(RProcess::EDataCagingOn);
       
    69 	RProcess().SecureApi(RProcess::ESecureApiOn);
       
    70 #endif
       
    71 	CActiveScheduler* sched=NULL;
       
    72 	sched=new(ELeave) CActiveScheduler;
       
    73 	CActiveScheduler::Install(sched);
       
    74 	CTe_Cdma2000CommdbSettingsSvr* server = NULL;
       
    75 	// Create the CTestServer derived server
       
    76 	TRAPD(err,server = CTe_Cdma2000CommdbSettingsSvr::NewL());
       
    77 	if(!err)
       
    78 		{
       
    79 		// Sync with the client and enter the active scheduler
       
    80 		RProcess::Rendezvous(KErrNone);
       
    81 		sched->Start();
       
    82 		}
       
    83 	delete server;
       
    84 	delete sched;
       
    85 	}
       
    86 
       
    87 // Only a DLL on emulator for typhoon and earlier
       
    88 
       
    89 GLDEF_C TInt E32Main()
       
    90 /**
       
    91  * @return - Standard Epoc error code on exit
       
    92  */
       
    93 	{
       
    94 	CTrapCleanup* cleanup = CTrapCleanup::New();
       
    95 	if(cleanup == NULL)
       
    96 		{
       
    97 		return KErrNoMemory;
       
    98 		}
       
    99 	TRAP_IGNORE(MainL());
       
   100 	delete cleanup;
       
   101 	return KErrNone;
       
   102     }
       
   103 
       
   104 // Create a thread in the calling process
       
   105 // Emulator typhoon and earlier
       
   106 
       
   107 CTestStep* CTe_Cdma2000CommdbSettingsSvr::CreateTestStep(const TDesC& aStepName)
       
   108 /**
       
   109  * @return - A CTestStep derived instance
       
   110  * Implementation of CTestServer pure virtual
       
   111  */
       
   112 	{	
       
   113 	CTestStep* testStep = NULL;
       
   114 	
       
   115 	if(aStepName == KCdma2000SettingsStep)  
       
   116 		{
       
   117 		testStep = new CCdma2000SettingsTestStep;
       
   118 		}
       
   119 
       
   120 	
       
   121 	return testStep;
       
   122 	}
       
   123