1 /* |
|
2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Main functions to start the Content Manager server |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include "cmserver.h" |
|
21 #include "msdebug.h" |
|
22 |
|
23 |
|
24 // LOCAL FUNCTION PROTOTYPES |
|
25 void RunServerL(); |
|
26 |
|
27 // --------------------------------------------------------------------------- |
|
28 // E32Main |
|
29 // |
|
30 // Module entry point |
|
31 // --------------------------------------------------------------------------- |
|
32 // |
|
33 TInt E32Main() |
|
34 { |
|
35 LOG(_L("[Cm Server]\t E32Main")); |
|
36 |
|
37 __UHEAP_MARK; |
|
38 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
39 TInt error = KErrNoMemory; |
|
40 if ( cleanup ) |
|
41 { |
|
42 TRAP( error, RunServerL() ); |
|
43 delete cleanup; |
|
44 } |
|
45 __UHEAP_MARKEND; |
|
46 |
|
47 return error; |
|
48 } |
|
49 |
|
50 // --------------------------------------------------------------------------- |
|
51 // RunServerL |
|
52 // |
|
53 // Constructs Active Scheduler and starts the server up & running |
|
54 // --------------------------------------------------------------------------- |
|
55 // |
|
56 void RunServerL() |
|
57 { |
|
58 LOG(_L("[Cm Server]\t RunServerL")); |
|
59 // Create and install the active scheduler we need |
|
60 CActiveScheduler* scheduler = new ( ELeave ) CActiveScheduler; |
|
61 CleanupStack::PushL( scheduler ); |
|
62 CActiveScheduler::Install( scheduler ); |
|
63 |
|
64 // Create server |
|
65 CCmServer* server = CCmServer::NewLC(); |
|
66 |
|
67 // Initialisation complete, now signal the client |
|
68 User::LeaveIfError( RThread().RenameMe( KCmServerName ) ); |
|
69 RProcess::Rendezvous( KErrNone ); |
|
70 |
|
71 // Ready to run |
|
72 CActiveScheduler::Start(); |
|
73 |
|
74 // Cleanup the server and scheduler |
|
75 CleanupStack::PopAndDestroy( server ); |
|
76 CleanupStack::PopAndDestroy( scheduler ); |
|
77 } |
|
78 |
|
79 // End of File |
|