Update contrib.
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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
17 #include "MmfBtAudioPolicyStart.h"
18 #include "MmfBtAudioPolicyServer.h"
19 #include "mmfcontrollerframeworkbase.h"
21 TInt TServerStart::Signal()
23 // Signal the owning thread that the server has started successfully
27 TInt err = starter.Open(iId);
30 starter.RequestComplete(iStatus,KErrNone);
36 LOCAL_C void DoStartThreadL(TServerStart* aParams)
38 //create the active scheduler
39 CActiveScheduler* s = new(ELeave) CActiveScheduler();
40 CleanupStack::PushL(s);
41 CActiveScheduler::Install(s);
42 //create the server & leave it on the cleanupstack
43 CleanupStack::PushL(CMMFAudioPolicyServer::NewL());
44 //initialisation complete - now signal the client
45 User::LeaveIfError(aParams->Signal());
46 //start the server running
47 CActiveScheduler::Start();
48 //now exiting the server so cleanup
49 CleanupStack::PopAndDestroy(2);//scheduler and server
53 EXPORT_C TInt EntryPoint(TAny* aParam)
57 TServerStart* start = REINTERPRET_CAST(TServerStart*, aParam);
58 CTrapCleanup* cleanup = CTrapCleanup::New();
63 TRAP(err, DoStartThreadL(start));
71 TInt TServerStart::GetCommand()
73 In EPOC, the EPOCEXE target is a process, and the server startup
74 parameters are encoded in the command line
77 if (User::CommandLineLength()!=sizeof(TServerStart)/sizeof(TText))
79 TPtr ptr(reinterpret_cast<TText*>(this),0,sizeof(TServerStart)/sizeof(TText));
80 User::CommandLine(ptr);
86 Server process entry-point
87 Recover the startup parameters and run the server
91 TInt r=start.GetCommand();
93 r=EntryPoint((TAny*)&start);