os/mm/devsound/sounddevbt/src/A2dpBlueTooth/server/A2dpBTHeadsetAudioIfServerStart.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 2005-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 "A2dpBTHeadsetAudioIfServerStart.h"
    18 #include "A2dpBTHeadsetAudioIfServer.h"
    19 
    20 
    21 /**
    22 Thread entry-point function.
    23 **/
    24 EXPORT_C TInt CA2dpBTHeadsetAudioIfServer::StartThread(TAny* /*aParms*/)
    25 	{
    26 	TInt err = KErrNone;
    27 	__UHEAP_MARK;
    28 	CTrapCleanup* cleanup = CTrapCleanup::New();
    29 	if (!cleanup)
    30 		{
    31 		err = KErrNoMemory;
    32 		}
    33 	else		
    34 		{
    35 		CActiveScheduler* sched = NULL;
    36 		TRAP(err, sched = new(ELeave) CActiveScheduler);
    37 		if (!err)
    38 			{
    39 			CActiveScheduler::Install(sched);
    40 			CA2dpBTHeadsetAudioIfServer* server = NULL;
    41 			TRAP(err, server = CA2dpBTHeadsetAudioIfServer::NewL());
    42 			
    43 			if(!err)
    44 				{
    45 				// Sync with the client and enter the active scheduler
    46 				RThread::Rendezvous(KErrNone);
    47 				sched->Start();
    48 				}
    49 			delete server;
    50 			delete sched;		
    51 			}
    52 		}
    53 	delete cleanup;
    54 	__UHEAP_MARKEND;
    55 	return err;
    56 	}