|
1 /* |
|
2 * Copyright (c) 2007 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: NetMon Server Startup module |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include <e32base.h> |
|
21 |
|
22 #include "CNetMon.h" |
|
23 |
|
24 // ---------------------------------------------------------------------------- |
|
25 // Initialize and run the server |
|
26 // ---------------------------------------------------------------------------- |
|
27 static void RunTheServerL() |
|
28 { |
|
29 // First create and install the active scheduler |
|
30 CActiveScheduler* scheduler = new (ELeave) CActiveScheduler; |
|
31 CleanupStack::PushL(scheduler); |
|
32 CActiveScheduler::Install(scheduler); |
|
33 |
|
34 |
|
35 // Create the server |
|
36 CNetMon* server = CNetMon::NewL(); |
|
37 CleanupStack::PushL(server); |
|
38 |
|
39 // Signal the client the startup is complete |
|
40 RProcess::Rendezvous(KErrNone); |
|
41 |
|
42 // Enter the wait loop |
|
43 CActiveScheduler::Start(); |
|
44 |
|
45 // Exited cleanup scheduler and server |
|
46 CleanupStack::PopAndDestroy(server); |
|
47 CleanupStack::PopAndDestroy(scheduler); |
|
48 |
|
49 |
|
50 } |
|
51 |
|
52 // ---------------------------------------------------------------------------- |
|
53 // Main entry-point for the server thread/process |
|
54 // ---------------------------------------------------------------------------- |
|
55 static TInt RunTheServer() |
|
56 { |
|
57 CTrapCleanup* cleanup=CTrapCleanup::New(); |
|
58 TInt r = KErrNoMemory; |
|
59 if (cleanup) |
|
60 { |
|
61 TRAP(r,RunTheServerL()); |
|
62 delete cleanup; |
|
63 } |
|
64 |
|
65 return (r); |
|
66 } |
|
67 |
|
68 // ---------------------------------------------------------------------------- |
|
69 // Process entry point |
|
70 // ---------------------------------------------------------------------------- |
|
71 TInt E32Main() |
|
72 { |
|
73 return RunTheServer(); |
|
74 } |