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