|
1 // Copyright (c) 2008-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 /** |
|
17 @file |
|
18 @internalComponent |
|
19 */ |
|
20 |
|
21 #include <ecom/ecom.h> |
|
22 #include "mmcameraserver.h" |
|
23 |
|
24 // Perform all server initialisation, in particular creation of the |
|
25 // scheduler and server and then run the scheduler |
|
26 static void RunServerL() |
|
27 { |
|
28 User::LeaveIfError(User::RenameProcess(KMMCameraServerName)); |
|
29 |
|
30 // create and install the active scheduler we need |
|
31 CActiveScheduler* activeScheduler = new(ELeave) CActiveScheduler; |
|
32 CleanupStack::PushL(activeScheduler); |
|
33 CActiveScheduler::Install(activeScheduler); |
|
34 |
|
35 // Create the server, leaving it on the cleanup stack. |
|
36 CMMCameraServer::NewLC(); |
|
37 |
|
38 // Initialisation complete, now signal the client |
|
39 RProcess::Rendezvous(KErrNone); |
|
40 |
|
41 // Ready to run |
|
42 CActiveScheduler::Start(); |
|
43 |
|
44 // Cleanup the server and scheduler |
|
45 CleanupStack::PopAndDestroy(2, activeScheduler); |
|
46 } |
|
47 |
|
48 /** |
|
49 * Program entry point. |
|
50 * Symbian OS will call this method when the server process is started. |
|
51 */ |
|
52 GLDEF_C TInt E32Main() |
|
53 { |
|
54 __UHEAP_MARK; |
|
55 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
56 TInt err = KErrNoMemory; |
|
57 |
|
58 if (cleanup) |
|
59 { |
|
60 TRAP(err,RunServerL()); |
|
61 delete cleanup; |
|
62 } |
|
63 |
|
64 REComSession::FinalClose(); |
|
65 __UHEAP_MARKEND; |
|
66 return err; |
|
67 } |