|
1 /* |
|
2 * Copyright (c) 2005 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: Provides static functions which handles server startup. |
|
15 * |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include "EPos_PosLmServerStartup.h" |
|
22 #include "EPos_CPosLmServer.h" |
|
23 #include "EPos_PosLmServerCommon.h" |
|
24 |
|
25 // ============================ MEMBER FUNCTIONS =============================== |
|
26 |
|
27 // ----------------------------------------------------------------------------- |
|
28 // PosLmServerStartup::StartServer |
|
29 // |
|
30 // (other items were commented in a header). |
|
31 // ----------------------------------------------------------------------------- |
|
32 // |
|
33 TInt PosLmServerStartup::StartServer() |
|
34 { |
|
35 __UHEAP_MARK; |
|
36 |
|
37 CTrapCleanup* cleanupStack = CTrapCleanup::New(); |
|
38 |
|
39 TInt ret = KErrNoMemory; |
|
40 |
|
41 if (cleanupStack) |
|
42 { |
|
43 TRAP(ret, StartServerL()); |
|
44 delete cleanupStack; |
|
45 } |
|
46 |
|
47 __UHEAP_MARKEND; |
|
48 |
|
49 return ret; |
|
50 } |
|
51 |
|
52 // ----------------------------------------------------------------------------- |
|
53 // PosLmServerStartup::StartServerL |
|
54 // |
|
55 // (other items were commented in a header). |
|
56 // ----------------------------------------------------------------------------- |
|
57 // |
|
58 void PosLmServerStartup::StartServerL() |
|
59 { |
|
60 // Rename thread to aid debugging |
|
61 User::LeaveIfError(User::RenameThread(KPosLandmarksServerName)); |
|
62 |
|
63 // start scheduler and server |
|
64 CActiveScheduler* scheduler = new(ELeave) CActiveScheduler; |
|
65 CleanupStack::PushL(scheduler); |
|
66 CActiveScheduler::Install(scheduler); |
|
67 |
|
68 CPosLmServer* server = CPosLmServer::NewL(); |
|
69 CleanupStack::PushL(server); |
|
70 |
|
71 CleanupStack::Pop(2, scheduler); // server |
|
72 |
|
73 RProcess::Rendezvous(KErrNone); |
|
74 |
|
75 CActiveScheduler::Start(); |
|
76 |
|
77 delete server; |
|
78 delete scheduler; |
|
79 } |
|
80 |
|
81 // ----------------------------------------------------------------------------- |
|
82 // E32Main |
|
83 // Server process entry-point |
|
84 // Recover the startup parameters and run the server |
|
85 // ----------------------------------------------------------------------------- |
|
86 // |
|
87 TInt E32Main() |
|
88 { |
|
89 return PosLmServerStartup::StartServer(); |
|
90 } |
|
91 |
|
92 // End of File |