os/mm/devsound/sounddevbt/PlatSec/src/Server/AudioServer/MmfBtDevSoundServerStart.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 2004-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 <ecom/ecom.h>
    18 #include "MmfBtDevSoundServerStart.h"
    19 #include "MmfBtDevSoundServer.h"
    20 
    21 
    22 
    23 
    24 EXPORT_C TInt CMMFDevSoundServer::StartThread(TAny* aParms)
    25 /**
    26 Thread entry-point function.
    27 The TServerStart objects is passed as the thread parameter
    28 **/
    29 	{
    30 	TInt err = KErrNone;
    31 	__UHEAP_MARK;
    32 	TDevSoundServerStart* start = reinterpret_cast<TDevSoundServerStart*>(aParms);
    33 	CTrapCleanup* cleanup = CTrapCleanup::New();
    34 	if (!cleanup)
    35 		err = KErrNoMemory;
    36 	if (!err)
    37 		{
    38 		CActiveScheduler* sched=NULL;
    39 		TRAP(err, sched=new(ELeave) CActiveScheduler);
    40 		if (!err)
    41 			{
    42 			CActiveScheduler::Install(sched);
    43 			CMMFDevSoundServer* server = NULL;
    44 			TRAPD(err,server = CMMFDevSoundServer::NewL(start->iAudioServer, start->iProcessId));
    45 			
    46 			if(!err)
    47 				{
    48 				// Sync with the client and enter the active scheduler
    49 				RThread::Rendezvous(KErrNone);
    50 				sched->Start();
    51 				}
    52 			delete server;
    53 			delete sched;		
    54 			}
    55 		}
    56 	delete cleanup;
    57 	REComSession::FinalClose();
    58 	__UHEAP_MARKEND;
    59 	return err;
    60 	}