1 /* |
|
2 * Copyright (c) 2010 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: Application startup main implementation. |
|
15 * |
|
16 */ |
|
17 |
|
18 // Include Files |
|
19 #include "mylocationlogger.h" |
|
20 #include "appmain.h" |
|
21 #include "mylocationsengine.h" |
|
22 #include <e32base.h> |
|
23 #include <e32std.h> |
|
24 |
|
25 // Local Functions |
|
26 // ----------------------------------------------------------------------------- |
|
27 // DoExecuteL() |
|
28 // |
|
29 // ----------------------------------------------------------------------------- |
|
30 // |
|
31 static void DoExecuteL() |
|
32 { |
|
33 __TRACE_CALLSTACK;// Create and install active scheduler |
|
34 CActiveScheduler* scheduler = NULL; |
|
35 |
|
36 scheduler = new (ELeave) CActiveScheduler; |
|
37 CleanupStack::PushL(scheduler); |
|
38 CActiveScheduler::Install(scheduler); |
|
39 |
|
40 // create Mylocations engine object |
|
41 CMyLocationsEngine *myLocationsEngine = CMyLocationsEngine::NewL(); |
|
42 CleanupStack::PushL( myLocationsEngine ); |
|
43 |
|
44 MYLOCLOGSTRING("myLocationsEngine created."); |
|
45 |
|
46 RProcess::Rendezvous(KErrNone); |
|
47 // Start handling requests |
|
48 CActiveScheduler::Start(); |
|
49 |
|
50 CleanupStack::PopAndDestroy(myLocationsEngine); |
|
51 // Pop and destroy the scheduler |
|
52 CleanupStack::PopAndDestroy(scheduler); |
|
53 |
|
54 } |
|
55 |
|
56 // ----------------------------------------------------------------------------- |
|
57 // Execute() |
|
58 // |
|
59 // ----------------------------------------------------------------------------- |
|
60 // |
|
61 static TInt Execute() |
|
62 { |
|
63 TInt error = KErrNoMemory; |
|
64 // Create the cleanup stack |
|
65 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
66 if (cleanup) |
|
67 { |
|
68 // Initialize and start the server |
|
69 TRAP( error, DoExecuteL() ); |
|
70 delete cleanup; |
|
71 } |
|
72 return error; |
|
73 } |
|
74 |
|
75 GLDEF_C TInt E32Main() |
|
76 { |
|
77 return Execute(); |
|
78 } |
|
79 |
|