|
1 /* |
|
2 * Copyright (c) 2007-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 /** |
|
19 @file |
|
20 @internalComponent |
|
21 */ |
|
22 |
|
23 #include <e32base.h> |
|
24 #include "fdfserver.h" |
|
25 #include <usb/usblogger.h> |
|
26 |
|
27 static void RunFdfL(); |
|
28 |
|
29 #ifdef __FLOG_ACTIVE |
|
30 _LIT8(KLogComponent, "fdf "); |
|
31 #endif |
|
32 |
|
33 GLDEF_C TInt E32Main() |
|
34 { |
|
35 LOGTEXT(_L8(">>E32Main")); |
|
36 |
|
37 TInt ret = KErrNoMemory; |
|
38 |
|
39 __UHEAP_MARK; |
|
40 |
|
41 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
42 |
|
43 if ( cleanup ) |
|
44 { |
|
45 // Create the logger object |
|
46 #ifdef __FLOG_ACTIVE |
|
47 (void)CUsbLog::Connect(); |
|
48 #endif |
|
49 |
|
50 TRAP(ret, RunFdfL()); |
|
51 |
|
52 #ifdef __FLOG_ACTIVE |
|
53 CUsbLog::Close(); |
|
54 #endif |
|
55 |
|
56 delete cleanup; |
|
57 } |
|
58 |
|
59 __UHEAP_MARKEND; |
|
60 |
|
61 LOGTEXT2(_L8("<<E32Main ret = %d"), ret); |
|
62 return ret; |
|
63 } |
|
64 |
|
65 static void RunFdfL() |
|
66 { |
|
67 // Create and install the active scheduler. |
|
68 CActiveScheduler* scheduler = new(ELeave) CActiveScheduler; |
|
69 CleanupStack::PushL(scheduler); |
|
70 CActiveScheduler::Install(scheduler); |
|
71 |
|
72 // Create the server |
|
73 CFdfServer::NewLC(); |
|
74 |
|
75 // Initialisation complete, now signal the client |
|
76 RProcess::Rendezvous(KErrNone); |
|
77 |
|
78 // Ready to run. This only returns when the server is closing down. |
|
79 CActiveScheduler::Start(); |
|
80 |
|
81 // Clean up the server and scheduler. |
|
82 CleanupStack::PopAndDestroy(2, scheduler); |
|
83 } |