|
1 /* |
|
2 * Copyright (c) 2006 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: Active object interface for obtaining Location updates |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CSIMPSYUIAO_H_ |
|
20 #define CSIMPSYUIAO_H_ |
|
21 |
|
22 |
|
23 // System Includes |
|
24 #include <e32base.h> |
|
25 #include <lbs.h> |
|
26 #include <lbspositioninfo.h> |
|
27 |
|
28 // User Includes |
|
29 |
|
30 // Forward Declarations |
|
31 |
|
32 // Class Definition |
|
33 |
|
34 /** |
|
35 * Observer to the SimPsyConfigurator Active Object |
|
36 */ |
|
37 class MSimPsyAOObserver |
|
38 { |
|
39 public: |
|
40 /** |
|
41 * Notifies that the previously issued Location request is complete |
|
42 * This implies that the TPositionInfo passed to the Location request |
|
43 * call is now populated with the current location information |
|
44 */ |
|
45 virtual void NotifyLocationRequestCompletedL() = 0; |
|
46 }; |
|
47 |
|
48 |
|
49 /** |
|
50 * Interface class thats used to asynchronously obtain Location information. |
|
51 * This class interacts with the Location Acquistion API and asynchronously |
|
52 * obtains the current location |
|
53 */ |
|
54 class CSimPsyUiAO: public CActive |
|
55 { |
|
56 public: |
|
57 /** |
|
58 * Static Two phase contructor that instantiates the CSimPsyUiAO |
|
59 * |
|
60 * @param aObserver Observer to the Active object |
|
61 * @return CSimPsyUiAO* Reference to the object created |
|
62 */ |
|
63 static CSimPsyUiAO* NewL( MSimPsyAOObserver& aObserver ); |
|
64 |
|
65 /** |
|
66 * Destructor |
|
67 */ |
|
68 ~CSimPsyUiAO(); |
|
69 |
|
70 /** |
|
71 * Obtains the current Location information using the Location |
|
72 * Acquisition API. The function call is asynchronous and the |
|
73 * notification regarding the completion of the operation is |
|
74 * provided through the MSimPsyAOObserver object |
|
75 * |
|
76 */ |
|
77 void GetCurrentLocationL(); |
|
78 |
|
79 /** |
|
80 * Cancels any outstanding Location request |
|
81 */ |
|
82 void CancelLocationRequest(); |
|
83 |
|
84 /** |
|
85 * Displays the current Location |
|
86 */ |
|
87 void DisplayCurrentLocationL(); |
|
88 |
|
89 protected: |
|
90 /** |
|
91 * Inherited from CActive |
|
92 */ |
|
93 void RunL(); |
|
94 |
|
95 /** |
|
96 * Inherited from CActive |
|
97 */ |
|
98 void DoCancel(); |
|
99 |
|
100 private: |
|
101 /** |
|
102 * Private Constructor |
|
103 */ |
|
104 CSimPsyUiAO( MSimPsyAOObserver& aObserver ); |
|
105 |
|
106 /** |
|
107 * Second phase of the two phase constructor |
|
108 */ |
|
109 void ConstructL(); |
|
110 |
|
111 /** |
|
112 * Displays error note |
|
113 * |
|
114 * @param aErrorText Error text |
|
115 */ |
|
116 void ShowErrorL(const TDesC& aErrorText); |
|
117 |
|
118 private: |
|
119 /** |
|
120 * Reference to the Active object observer |
|
121 */ |
|
122 MSimPsyAOObserver& iObserver; |
|
123 |
|
124 /** |
|
125 * Handle to the Location server session |
|
126 * Owns |
|
127 */ |
|
128 RPositionServer iPositionServer; |
|
129 |
|
130 /** |
|
131 * Handle to the Location server sub-session |
|
132 */ |
|
133 RPositioner iPositioner; |
|
134 |
|
135 /** |
|
136 * Position Info structure |
|
137 */ |
|
138 TPositionInfo iPositionInfo; |
|
139 }; |
|
140 |
|
141 #endif // CSIMPSYUIAO_H_ |