os/mm/devsound/sounddevbt/PlatSec/src/Server/AudioServer/MmfBtAudioServerStart.cpp
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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
17 #include "MmfBtAudioServerStart.h"
18 #include "MmfBtAudioServer.h"
20 #include "A2dpBTHeadsetAudioIfServerStart.h"
21 #include "A2dpBTHeadsetAudioIfServer.h"
24 // Just an E32Main and a MainL()
27 * Much simpler, uses the new Rendezvous() call to sync with the client
30 // Leave the hooks in for platform security
31 #if (defined __DATA_CAGING__)
32 RProcess().DataCaging(RProcess::EDataCagingOn);
33 RProcess().SecureApi(RProcess::ESecureApiOn);
35 CActiveScheduler* sched=NULL;
36 sched=new(ELeave) CActiveScheduler;
37 CActiveScheduler::Install(sched);
38 CMMFAudioServer* server = NULL;
39 TRAPD(err,server = CMMFAudioServer::NewL());
41 // Start BT audio server in its own thread here...
42 // Assume that the server's not been started already
44 RThread btServerThread;
45 TThreadFunction btServerThreadFunc = CA2dpBTHeadsetAudioIfServer::StartThread;
46 TName btServerName(KA2DPAudioServerName);
49 err = btServerThread.Create(btServerName, btServerThreadFunc, KBTAudioServerStackSize,
50 KBTAudioServerInitHeapSize, KBTAudioServerMaxHeapSize,
51 NULL, EOwnerProcess); // NULL => not passing any params to thread
55 // Synchronise with the server
56 TRequestStatus reqStatus;
57 btServerThread.Rendezvous(reqStatus);
59 if (reqStatus != KRequestPending)
61 btServerThread.Kill(0);
66 btServerThread.Resume();
67 // Server will call the reciprocal static synchronise call
69 User::WaitForRequest(reqStatus); // wait for start or death
74 // Sync with the client and enter the active scheduler
75 RProcess::Rendezvous(KErrNone);
79 btServerThread.Close();
86 GLDEF_C TInt E32Main()
88 * @return - Standard Epoc error code on exit
91 CTrapCleanup* cleanup = CTrapCleanup::New();