cellularsrvapitest/telephonyhaitest/etelmm/src/T_eTelmmServer.cpp
changeset 0 3553901f7fa8
child 24 6638e7f4bd8f
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 /*
       
     2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     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".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 
       
    18 #include "t_etelmmserver.h"
       
    19 #include "t_rmobilecalldata.h"
       
    20 #include "t_rmobileconferencecalldata.h"
       
    21 #include "t_rmmcustomapidata.h"
       
    22 #include "t_rmobilelinedata.h"
       
    23 #include "t_rmobilephonedata.h"
       
    24 #include "t_rtelserverdata.h"
       
    25 
       
    26 /*@{*/
       
    27 _LIT(KT_MobileCall,	"RMobileCall"); 
       
    28 _LIT(KT_ConferenceCall, "RMobileConferenceCall");
       
    29 _LIT(KT_MmCustomApi,	"RMmCustomAPI");
       
    30 _LIT(KT_TelServer,	"RTelServer");
       
    31 _LIT(KT_MobileLine,	"RMobileLine");
       
    32 _LIT(KT_MobilePhone, 	"RMobilePhone");
       
    33 
       
    34 /*@}*/
       
    35 
       
    36 /**
       
    37  * @return - Instance of the test server
       
    38  * Same code for Secure and non-secure variants
       
    39  * Called inside the MainL() function to create and start the
       
    40  * CTestServer derived server.
       
    41  */
       
    42 CeTelmmServer* CeTelmmServer::NewL()
       
    43 	{
       
    44 	CeTelmmServer* server = new (ELeave) CeTelmmServer();
       
    45     CleanupStack::PushL(server);
       
    46     server->ConstructL();
       
    47     CleanupStack::Pop(server);
       
    48     return server;
       
    49     }
       
    50 
       
    51 
       
    52 /**
       
    53  * Secure variant
       
    54  * Much simpler, uses the new Rendezvous() call to sync with the client
       
    55  */
       
    56 LOCAL_C void MainL()
       
    57 	{
       
    58 #if (defined __DATA_CAGING__)
       
    59     RProcess().DataCaging(RProcess::EDataCagingOn);
       
    60     RProcess().SecureApi(RProcess::ESecureApiOn);
       
    61 #endif
       
    62     CActiveScheduler*	sched=NULL;
       
    63     sched=new(ELeave) CActiveScheduler;
       
    64     CActiveScheduler::Install(sched);
       
    65     CeTelmmServer* server = NULL;
       
    66 
       
    67     // Create the CTestServer derived server
       
    68     TRAPD(err,server = CeTelmmServer::NewL());
       
    69     if(!err)
       
    70 	    {
       
    71         // Sync with the client and enter the active scheduler
       
    72         RProcess::Rendezvous(KErrNone);
       
    73         sched->Start();
       
    74         }
       
    75 
       
    76     delete server;
       
    77     delete sched;
       
    78     }
       
    79 
       
    80 
       
    81 /**
       
    82  * @return - Standard Epoc error code on process exit
       
    83  * Secure variant only
       
    84  * Process entry point. Called by client using RProcess API
       
    85  */
       
    86 GLDEF_C TInt E32Main()
       
    87 	{
       
    88     __UHEAP_MARK;
       
    89     CTrapCleanup* cleanup = CTrapCleanup::New();
       
    90     if(cleanup == NULL)
       
    91 	    {
       
    92         return KErrNoMemory;
       
    93         }
       
    94 
       
    95 #if (defined TRAP_IGNORE)
       
    96 	TRAP_IGNORE(MainL());
       
    97 #else
       
    98     TRAPD(err,MainL());
       
    99 #endif
       
   100 
       
   101     delete cleanup;
       
   102     __UHEAP_MARKEND;
       
   103     return KErrNone;
       
   104     }
       
   105 
       
   106 CDataWrapper* CeTelmmServer::CeTelmmBlock::CreateDataL(const TDesC& aData)
       
   107 	{
       
   108 	CDataWrapper*	wrapper=NULL;
       
   109 
       
   110 	if( KT_MobileCall() == aData )
       
   111 		{
       
   112 		wrapper=CT_RMobileCallData::NewL();
       
   113 		}
       
   114 	else if(KT_ConferenceCall() == aData)
       
   115 		{
       
   116 		wrapper=CT_RMobileConferenceCallData::NewL();
       
   117 		}
       
   118 	else if(KT_MmCustomApi() == aData)
       
   119 		{
       
   120 		wrapper=CT_RMmCustomApiData::NewL();
       
   121 		}
       
   122 	else if(KT_TelServer() == aData)
       
   123 		{
       
   124 		wrapper=CT_RTelServerData::NewL();
       
   125 		}
       
   126 	else if(KT_MobileLine() == aData)
       
   127 		{
       
   128 		wrapper=CT_RMobileLineData::NewL();
       
   129 		}
       
   130 	else if(KT_MobilePhone() == aData)
       
   131 		{
       
   132 		wrapper=CT_RMobilePhoneData::NewL();
       
   133 		}
       
   134 
       
   135 	return wrapper;
       
   136 	}