devsound/devsoundrefplugin/src/platsec/server/AudioServer/MmfAudioServerStart.cpp
changeset 0 79dd3e2336a0
equal deleted inserted replaced
-1:000000000000 0:79dd3e2336a0
       
     1 // Copyright (c) 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 <e32std.h>
       
    17 #include "MmfAudioServerStart.h"
       
    18 #include "MmfAudioServer.h"
       
    19 
       
    20 
       
    21 // EKA2 much simpler
       
    22 // Just an E32Main and a MainL()
       
    23 LOCAL_C void MainL()
       
    24 /**
       
    25  * Much simpler, uses the new Rendezvous() call to sync with the client
       
    26  */
       
    27 	{
       
    28 	// Leave the hooks in for platform security
       
    29 #if (defined __DATA_CAGING__)
       
    30 	RProcess().DataCaging(RProcess::EDataCagingOn);
       
    31 	RProcess().SecureApi(RProcess::ESecureApiOn);
       
    32 #endif
       
    33 	CActiveScheduler* sched=NULL;
       
    34 	sched=new(ELeave) CActiveScheduler;
       
    35 	CActiveScheduler::Install(sched);
       
    36 	CMMFAudioServer* server = NULL;
       
    37 	TRAPD(err,server = CMMFAudioServer::NewL());
       
    38 	RProcess::Rendezvous(err);
       
    39 	if(!err)
       
    40 		{
       
    41 		// Sync with the client and enter the active scheduler
       
    42 		sched->Start();
       
    43 		}
       
    44 	delete server;
       
    45 	delete sched;	
       
    46 	
       
    47 	}
       
    48 
       
    49 
       
    50 
       
    51 GLDEF_C TInt E32Main()
       
    52 /**
       
    53  * @return - Standard Epoc error code on exit
       
    54  */
       
    55 	{
       
    56 	CTrapCleanup* cleanup = CTrapCleanup::New();
       
    57 	if(cleanup == NULL)
       
    58 		{
       
    59 		return KErrNoMemory;
       
    60 		}
       
    61 	TRAP_IGNORE(MainL());
       
    62 	delete cleanup;
       
    63 	return KErrNone;
       
    64     }