|
1 /* |
|
2 * Copyright (c) 2005-2009 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <e32base.h> |
|
19 #include <e32debug.h> |
|
20 |
|
21 #include "../../public/clientServerShared.h" |
|
22 #include "classContServer.h" |
|
23 |
|
24 static void RunServerL(); |
|
25 |
|
26 |
|
27 /** |
|
28 *This is the code entry point, calls run server function |
|
29 */ |
|
30 GLDEF_C TInt E32Main() |
|
31 { |
|
32 |
|
33 TInt ret = KErrNoMemory; |
|
34 |
|
35 __UHEAP_MARK; |
|
36 |
|
37 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
38 |
|
39 if ( cleanup ) |
|
40 { |
|
41 TRAP(ret, RunServerL()); |
|
42 delete cleanup; |
|
43 } |
|
44 |
|
45 __UHEAP_MARKEND; |
|
46 |
|
47 return ret; |
|
48 |
|
49 } |
|
50 |
|
51 /** |
|
52 * Function to initialise a CServer2 derived class and connect to |
|
53 * the client. |
|
54 */ |
|
55 static void RunServerL() |
|
56 { |
|
57 static_cast<void>(User::RenameThread(KServerName)); |
|
58 |
|
59 // Create and install the active scheduler. |
|
60 CActiveScheduler* scheduler = new(ELeave) CActiveScheduler; |
|
61 CleanupStack::PushL(scheduler); |
|
62 CActiveScheduler::Install(scheduler); |
|
63 |
|
64 (void)CClassContServer::NewLC(); |
|
65 |
|
66 // Initialisation complete, now signal the client |
|
67 RProcess::Rendezvous(KErrNone); |
|
68 // Ready to run. This only returns when the server is closing down. |
|
69 CActiveScheduler::Start(); |
|
70 // Clean up the server and scheduler. |
|
71 CleanupStack::PopAndDestroy(2, scheduler); |
|
72 } |