|
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 // Start listening to calendar db changes |
|
44 //myLocationsEngine->StartCalenderChangeNotifierL(); |
|
45 |
|
46 |
|
47 // Start listening to landmarks db changes |
|
48 //myLocationsEngine->StartLandmarksChangeNotifier(); |
|
49 |
|
50 //MYLOCLOGSTRING("Start listening to landmarks db changes."); |
|
51 |
|
52 RProcess::Rendezvous(KErrNone); |
|
53 // Start handling requests |
|
54 CActiveScheduler::Start(); |
|
55 |
|
56 CleanupStack::PopAndDestroy(myLocationsEngine); |
|
57 // Pop and destroy the scheduler |
|
58 CleanupStack::PopAndDestroy(scheduler); |
|
59 |
|
60 } |
|
61 |
|
62 // ----------------------------------------------------------------------------- |
|
63 // Execute() |
|
64 // |
|
65 // ----------------------------------------------------------------------------- |
|
66 // |
|
67 static TInt Execute() |
|
68 { |
|
69 // __UHEAP_MARK; |
|
70 TInt error = KErrNoMemory; |
|
71 // Create the cleanup stack |
|
72 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
73 if (cleanup) |
|
74 { |
|
75 // Initialize and start the server |
|
76 TRAP( error, DoExecuteL() ); |
|
77 delete cleanup; |
|
78 } |
|
79 // __UHEAP_MARKEND; |
|
80 return error; |
|
81 } |
|
82 |
|
83 GLDEF_C TInt E32Main() |
|
84 { |
|
85 return Execute(); |
|
86 } |
|
87 |