cellularsrvapitest/telephonydevsoundhaitest/src/T_EtelmmDevSoundServer.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_EtelmmDevSoundServer.h"
       
    19 #include "T_RMmCustomAPIData.h"
       
    20 #include "T_RMobileLineData.h"
       
    21 #include "T_RMobilePhoneData.h"
       
    22 #include "T_RTelServerData.h"
       
    23 #include "T_RMobileCallData.h"
       
    24 #include "T_RMobileConferenceCallData.h"
       
    25 #include "T_CMMFDevSoundData.h"
       
    26 #include "T_CRepositoryData.h"
       
    27 #include "T_CAudioInputData.h"
       
    28 #include "T_CAudioOutputData.h"
       
    29 #include "T_CRestrictedAudioOutputData.h"
       
    30 #include "T_CTelephonyAudioRoutingData.h"
       
    31 
       
    32 /*@{*/
       
    33 _LIT(KT_MmCustomApi,	"RMmCustomAPI");
       
    34 _LIT(KT_TelServer,		"RTelServer");
       
    35 _LIT(KT_MobileLine,		"RMobileLine");
       
    36 _LIT(KT_MobilePhone, 	"RMobilePhone");
       
    37 _LIT(KT_MobileCall,		"RMobileCall");
       
    38 _LIT(KT_ConferenceCall,	"RMobileConferenceCall");
       
    39 _LIT(KT_CMMFDevSound, 	"CMMFDevSound");
       
    40 _LIT(KT_CRepository,	"CRepository");
       
    41 _LIT(KT_CRestrictedAudioOutput, "CRestrictedAudioOutput");
       
    42 _LIT(KT_CTelephonyAudioRouting, "CTelephonyAudioRouting");
       
    43 _LIT(KT_CAudioInput, 	"CAudioInput");
       
    44 _LIT(KT_CAudioOutput,	"CAudioOutput");
       
    45 
       
    46 
       
    47 /*@}*/
       
    48 
       
    49 /**
       
    50  * @return - Instance of the test server
       
    51  * Same code for Secure and non-secure variants
       
    52  * Called inside the MainL() function to create and start the
       
    53  * CTestServer derived server.
       
    54  */
       
    55 CT_EtelmmDevSoundServer* CT_EtelmmDevSoundServer::NewL()
       
    56 	{
       
    57     CT_EtelmmDevSoundServer* server = new (ELeave) CT_EtelmmDevSoundServer();
       
    58     CleanupStack::PushL(server);
       
    59     server->ConstructL();
       
    60     CleanupStack::Pop(server);
       
    61     return server;
       
    62     }
       
    63 
       
    64 
       
    65 /**
       
    66  * Secure variant
       
    67  * Much simpler, uses the new Rendezvous() call to sync with the client
       
    68  */
       
    69 LOCAL_C void MainL()
       
    70 	{
       
    71 #if (defined __DATA_CAGING__)
       
    72     RProcess().DataCaging(RProcess::EDataCagingOn);
       
    73     RProcess().SecureApi(RProcess::ESecureApiOn);
       
    74 #endif
       
    75     CActiveScheduler*	sched=NULL;
       
    76     sched=new(ELeave) CActiveScheduler;
       
    77     CActiveScheduler::Install(sched);
       
    78     CT_EtelmmDevSoundServer* server = NULL;
       
    79 
       
    80     // Create the CTestServer derived server
       
    81     TRAPD(err,server = CT_EtelmmDevSoundServer::NewL());
       
    82     if(!err)
       
    83 	    {
       
    84         // Sync with the client and enter the active scheduler
       
    85         RProcess::Rendezvous(KErrNone);
       
    86         sched->Start();
       
    87         }
       
    88 
       
    89     delete server;
       
    90     delete sched;
       
    91     }
       
    92 
       
    93 
       
    94 /**
       
    95  * @return - Standard Epoc error code on process exit
       
    96  * Secure variant only
       
    97  * Process entry point. Called by client using RProcess API
       
    98  */
       
    99 GLDEF_C TInt E32Main()
       
   100 	{
       
   101     __UHEAP_MARK;
       
   102     CTrapCleanup* cleanup = CTrapCleanup::New();
       
   103     if(cleanup == NULL)
       
   104 	    {
       
   105         return KErrNoMemory;
       
   106         }
       
   107 
       
   108 #if (defined TRAP_IGNORE)
       
   109 	TRAP_IGNORE(MainL());
       
   110 #else
       
   111     TRAPD(err,MainL());
       
   112 #endif
       
   113 
       
   114     delete cleanup;
       
   115     __UHEAP_MARKEND;
       
   116     return KErrNone;
       
   117     }
       
   118 
       
   119 CDataWrapper* CT_EtelmmDevSoundServer::CT_EtelmmDevSoundBlock::CreateDataL(const TDesC& aData)
       
   120 	{
       
   121 	CDataWrapper*	wrapper=NULL;
       
   122 
       
   123 	if(KT_MmCustomApi() == aData)
       
   124 		{
       
   125 		wrapper=CT_RMmCustomApiData::NewL();
       
   126 		}
       
   127 	else if(KT_TelServer() == aData)
       
   128 		{
       
   129 		wrapper=CT_RTelServerData::NewL();
       
   130 		}
       
   131 	else if(KT_MobileLine() == aData)
       
   132 		{
       
   133 		wrapper=CT_RMobileLineData::NewL();
       
   134 		}
       
   135 	else if(KT_MobilePhone() == aData)
       
   136 		{
       
   137 		wrapper=CT_RMobilePhoneData::NewL();
       
   138 		}
       
   139 	else if(KT_MobileCall() == aData)
       
   140 		{
       
   141 		wrapper=CT_RMobileCallData::NewL();
       
   142 		}
       
   143 	else if(KT_ConferenceCall() == aData)
       
   144 		{
       
   145 		wrapper=CT_RMobileConferenceCallData::NewL();
       
   146 		}
       
   147 	else if (KT_CMMFDevSound() == aData)
       
   148 		{
       
   149 		wrapper = CT_CMMFDevSoundData::NewL();
       
   150 		}
       
   151 	else if (KT_CRepository() == aData)
       
   152 		{
       
   153 		wrapper = CT_CRepositoryData::NewL();
       
   154 		}	
       
   155 	else if (KT_CRestrictedAudioOutput() == aData)
       
   156 		{
       
   157 		wrapper = CT_CRestrictedAudioOutputData::NewL();
       
   158 		}
       
   159 	else if (KT_CTelephonyAudioRouting() == aData)
       
   160 		{
       
   161 		wrapper = CT_CTelephonyAudioRoutingData::NewL();
       
   162 		}
       
   163 	else if(KT_CAudioInput() == aData)
       
   164 		{
       
   165 		wrapper = CT_CAudioInputData::NewL();
       
   166 		}
       
   167 	else if(KT_CAudioOutput() == aData)
       
   168 		{
       
   169 		wrapper = CT_CAudioOutputData::NewL();
       
   170 		}
       
   171 
       
   172 	return wrapper;
       
   173 	}