1 /* |
|
2 * Copyright (c) 2002-2005 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: Implements methods for interfacing with Location Acquisition API. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef __CEVTMGMTUILOCATIONSERVICEADAPTER_H__ |
|
20 #define __CEVTMGMTUILOCATIONSERVICEADAPTER_H__ |
|
21 |
|
22 // INCLUDES |
|
23 #include <lbs.h> |
|
24 |
|
25 // FORWARD DECLARATION |
|
26 class MEvtMgmtUiLocationObserver; |
|
27 class TPosition; |
|
28 class RPositionServer; |
|
29 class RPositioner; |
|
30 class TPositionInfo; |
|
31 |
|
32 // CLASS DECLARATIONS |
|
33 /** |
|
34 * @class MEvtMgmtUiLocationServiceObserver |
|
35 * Class that represents the observer to notify completion |
|
36 * of location acquisition operation |
|
37 * |
|
38 * It is used to notify completion of location acquisition operation. |
|
39 * It is also used to notify error if it fails. |
|
40 * |
|
41 * @since S60 v9.1 |
|
42 */ |
|
43 |
|
44 class MEvtMgmtUiLocationServiceObserver |
|
45 { |
|
46 public: |
|
47 /** |
|
48 * Notifies the observer about occured event. |
|
49 * Engine observer has to update its data when this function is called. |
|
50 * @param [in] aStatus - response code |
|
51 */ |
|
52 virtual void HandleLocationServiceResponseL( const TInt aStatus ) = 0; |
|
53 |
|
54 /** |
|
55 * Called if occured event fails. |
|
56 * @param [in] aErrorCode - Occured general errorcode. |
|
57 * KErrAccessDenied - if right capability is not added. |
|
58 * KPositionQualityLoss - if accuracy is not acceptable. |
|
59 * KErrTimedOut - if operation takes a lot of time to complete. |
|
60 * KErrNotFound - if no psy is enabled. |
|
61 * KErrCancel - if operation is canceled. |
|
62 * Otherwise system wide error-codes. |
|
63 */ |
|
64 virtual void HandleLocationServiceErrorL( TInt aErrorCode ) = 0; |
|
65 }; |
|
66 |
|
67 |
|
68 // CLASS DECLARATIONS |
|
69 /** |
|
70 * @class CEvtMgmtUiLocationServiceAdapter |
|
71 * Class that represents the adapter for location acquisition engine |
|
72 * |
|
73 * This class acts as an adapter for location acquisition engine. |
|
74 * It is used to retrieve current location |
|
75 * |
|
76 * @since S60 v9.1 |
|
77 */ |
|
78 |
|
79 class CEvtMgmtUiLocationServiceAdapter : public CActive |
|
80 { |
|
81 public: |
|
82 /** |
|
83 * Two-phased constructor. |
|
84 * @param location service requester name |
|
85 * (Landmarks Application's name) |
|
86 * which is passed to Location framework as a parameter to Location Acquisition API |
|
87 * It is maintained by Location Framework for privacy rules and logging purposes |
|
88 * @return CLmkLocationService object. |
|
89 */ |
|
90 static CEvtMgmtUiLocationServiceAdapter* NewL( MEvtMgmtUiLocationServiceObserver& aObserver ); |
|
91 |
|
92 /** |
|
93 * Destructor. |
|
94 */ |
|
95 virtual ~CEvtMgmtUiLocationServiceAdapter(); |
|
96 |
|
97 public: //new functions |
|
98 |
|
99 /** |
|
100 * It is used to request current location |
|
101 * |
|
102 * @since S60 v9.1 |
|
103 */ |
|
104 void LocationRequestL(); |
|
105 |
|
106 /** |
|
107 * It is used to retrieve current location |
|
108 * |
|
109 * @since S60 v9.1 |
|
110 * |
|
111 * @return Recently retrieved current location |
|
112 */ |
|
113 TPosition& CurrentPosition(); |
|
114 |
|
115 /** |
|
116 * It is used to cancel recently issued location request |
|
117 * |
|
118 * @since S60 v9.1 |
|
119 */ |
|
120 void CancelRequest(); |
|
121 |
|
122 /** |
|
123 * Check if all positioning methods are disabled. |
|
124 * |
|
125 * @since S60 v9.1 |
|
126 * |
|
127 * @ret true if disabled else false |
|
128 */ |
|
129 TBool AllPositionMethodsDisabledL(); |
|
130 |
|
131 public: //Derived |
|
132 /* |
|
133 * Derived from CActive |
|
134 */ |
|
135 void RunL(); |
|
136 /* |
|
137 * Derived from CActive |
|
138 */ |
|
139 void DoCancel(); |
|
140 /* |
|
141 * Derived from CActive |
|
142 */ |
|
143 TInt RunError(TInt aError); |
|
144 |
|
145 private: |
|
146 /** |
|
147 * By default Symbian 2nd phase constructor is private. |
|
148 * @param location service requester name |
|
149 * (Landmarks Application's name) |
|
150 * which is passed to Location framework as a parameter to Location Acquisition API |
|
151 * It is maintained by Location Framework for privacy rules and logging purposes |
|
152 */ |
|
153 void ConstructL( ); |
|
154 |
|
155 /** |
|
156 * C++ default constructor. |
|
157 * @param[in] aObserver - observer to notify completion of location acquisition operation |
|
158 */ |
|
159 CEvtMgmtUiLocationServiceAdapter( MEvtMgmtUiLocationServiceObserver& aObserver ); |
|
160 |
|
161 private: // data |
|
162 |
|
163 /// Own: iServer |
|
164 RPositionServer iServer; |
|
165 |
|
166 ///Ref: observer to notify completion of location acquisition operation |
|
167 MEvtMgmtUiLocationServiceObserver& iObserver; |
|
168 |
|
169 /// RPositioner |
|
170 RPositioner iPositioner; |
|
171 |
|
172 /// TPosition |
|
173 TPosition iPosition; |
|
174 |
|
175 /// TPositionInfo |
|
176 TPositionInfo iPositionInfo; |
|
177 |
|
178 }; |
|
179 |
|
180 #endif // __CEVTMGMTUILOCATIONSERVICEADAPTER_H__ |
|
181 |
|
182 // End of File |
|