|
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: Positioning Indicator Helper Client Interface |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef POS_INDICATOR_HELPER_H |
|
21 #define POS_INDICATOR_HELPER_H |
|
22 |
|
23 #include <e32std.h> |
|
24 #include <lbssatellite.h> |
|
25 #include <locationvariationdomaincrkeys.h> |
|
26 #include <centralrepository.h> |
|
27 |
|
28 #include "posindicatorserverconst.h" |
|
29 #include "posindicatorlogger.h" |
|
30 |
|
31 class CPosIndHelperClientRequester; |
|
32 class RPosIndicatorHelperServer; |
|
33 class MPosIndInfoChangeObserver; |
|
34 class CPosLandmark; |
|
35 |
|
36 /** |
|
37 * A handle to Positioning Indicator Helper Server subsession. This class provides |
|
38 * methods to use Positioning Indicator Helper service from Positioning Indicator Helper |
|
39 * Server. |
|
40 * |
|
41 * RPosIndicatorHelper is used to create subsession with Positioning Indicator Helper Server. |
|
42 * This class provides mechanisms for retrieving location |
|
43 * [coordinate or reverse geo-code info], actively requesting location. |
|
44 * Before using any of these services, a connection to Positioning Indicator Helper |
|
45 * Server must first be made. |
|
46 * |
|
47 * A client can have multiple sessions connected to the Positioning Indicator Helper |
|
48 * Server. There can be multiple subsessions opened from one session. |
|
49 * |
|
50 * |
|
51 * @see RPosIndicatorHelperServer |
|
52 * |
|
53 * @lib posindicatorhelper.lib |
|
54 * |
|
55 */ |
|
56 |
|
57 class MServerRequestCompletetionObserver |
|
58 { |
|
59 public: |
|
60 /* |
|
61 * It will be used to notify RPosIndicatorHelper client that server has completed |
|
62 * the requested operation. |
|
63 * |
|
64 * @param[out] aServiceId - Id of the operation which is requested |
|
65 * @param[out] aErrCode - Error code if operation is failed |
|
66 * KErrNone if operation is successful. |
|
67 */ |
|
68 virtual void NotifyServerRequestCompletion(TServiceIds aServiceId, TInt aErrCode) = 0; |
|
69 }; |
|
70 |
|
71 class RPosIndicatorHelper : public RSubSessionBase, |
|
72 public MServerRequestCompletetionObserver |
|
73 { |
|
74 public: |
|
75 |
|
76 public: |
|
77 /** |
|
78 * default constructior. |
|
79 */ |
|
80 RPosIndicatorHelper(); |
|
81 |
|
82 /** |
|
83 * destructior. |
|
84 */ |
|
85 ~RPosIndicatorHelper(); |
|
86 |
|
87 /** |
|
88 * Opens a subsession with Positioning Indicator Helper Server. |
|
89 * |
|
90 * A subsession must be opened before any other service can be used. |
|
91 * |
|
92 * @panic PosIndicatorHelper EPosIndicatorHelperServerBadHandle If a session to |
|
93 * Positioning Indicator Helper Server has not been connected. |
|
94 * |
|
95 * @param[in] aServer Reference to the Positioning Indicator Helper Server |
|
96 * session. |
|
97 * @param[in] aPosIndInfoChangeObserver Reference to the Positioning |
|
98 * Indicator Info Change observer. Any change in position information |
|
99 * is notified by this observer. |
|
100 * |
|
101 * @return KErrNone if successful. Otherwise, Symbian standard |
|
102 * error code is returned, such as KErrNoMemory, KErrServerBusy, etc. |
|
103 */ |
|
104 TInt Open( RPosIndicatorHelperServer& aServer, |
|
105 MPosIndInfoChangeObserver* aPosIndInfoChangeObserver ); |
|
106 |
|
107 /** |
|
108 * Closes the subsession with Positioning Indicator Helper Server. |
|
109 * |
|
110 * Close() must be called when RPosIndicatorHelper subsession is no longer required. |
|
111 * |
|
112 * Before a subsession is closed, the client application must ensure |
|
113 * that all outstanding notification requests have been cancelled. In |
|
114 * particular, the application must issue all the appropriate Cancel |
|
115 * requests and then wait for a confirmation that the notification has |
|
116 * been terminated. A failure to do so results in a panic. |
|
117 * |
|
118 * @panic PosIndicatorHelper EPosIndicatorHelperRequestsNotCancelled If client application |
|
119 * has requests outstanding with Positioning Indicator Helper Server. |
|
120 */ |
|
121 void Close(); |
|
122 |
|
123 /* |
|
124 * Requests current position information. |
|
125 * |
|
126 * It will first request for current location. if it is already available |
|
127 * it will request for reverse geo-code address. |
|
128 * |
|
129 * The result of the request is notified to the client through observer. |
|
130 */ |
|
131 void RequestPosInfo(); |
|
132 |
|
133 /** |
|
134 * Cancels the current request |
|
135 */ |
|
136 void CancelCurrentRequest(); |
|
137 |
|
138 /** |
|
139 * Symbian 2nd phase construction. |
|
140 */ |
|
141 void ConstructL(); |
|
142 |
|
143 /* |
|
144 * from MServerRequestCompletetionObserver |
|
145 */ |
|
146 void NotifyServerRequestCompletion(TServiceIds aServiceId, TInt aErrCode); |
|
147 |
|
148 private: |
|
149 /* |
|
150 * Requests size of landmark object containing current position with |
|
151 * reverse geo-coded address. |
|
152 * |
|
153 * It will request for the reverse geo-coded location giving the |
|
154 * position coordinates as input. |
|
155 * |
|
156 * The size of the landmark object returned from reverse geo-coded |
|
157 * plugin is notified to the client through observer. |
|
158 * |
|
159 */ |
|
160 void GetAddressInfoSize(); |
|
161 |
|
162 /* |
|
163 * Requests landmark object containing current position with |
|
164 * reverse geo-coded address. |
|
165 * |
|
166 * It will request for the reverse geo-coded location |
|
167 * |
|
168 * The landmark object returned from reverse geo-coded |
|
169 * plugin is notified to the client through observer. |
|
170 * |
|
171 */ |
|
172 void GetAddressL(); |
|
173 |
|
174 /* |
|
175 * Check Hide Coordinates feature flag. |
|
176 * Uses KLocHideCoordinates CenRep key |
|
177 */ |
|
178 void CheckHideCoordinateL(); |
|
179 |
|
180 private:// data |
|
181 |
|
182 /** |
|
183 * Pointer to client requestor. |
|
184 * Own. |
|
185 */ |
|
186 CPosIndHelperClientRequester* iClientRequester; |
|
187 |
|
188 /** |
|
189 * It is used to request position details from server |
|
190 */ |
|
191 TPositionSatelliteInfo iPositionInfo; |
|
192 |
|
193 /** |
|
194 * It is used to request size of the landmark object from server |
|
195 */ |
|
196 TInt iSize; |
|
197 |
|
198 /** |
|
199 * It is used to request the landmark object from the server |
|
200 * Owns |
|
201 */ |
|
202 HBufC8* iLmkBuf; |
|
203 |
|
204 /** |
|
205 * It is used to sent the landmark object to the observer |
|
206 * Owns |
|
207 */ |
|
208 CPosLandmark * iLandmark; |
|
209 |
|
210 /** |
|
211 * It is used to notify PosIndicatorInfoPrivate that new position information |
|
212 * new position information is available. |
|
213 * |
|
214 * Array of observers are not stored here as multiple client requests are actually |
|
215 * handled by signal-slot mechanism in PosIndicatorInfoPrivate |
|
216 * Does not own |
|
217 */ |
|
218 MPosIndInfoChangeObserver* iPosIndInfoChangeObserver; |
|
219 |
|
220 /* |
|
221 * Holds value of Hide Coordinates CenRep key |
|
222 */ |
|
223 TInt iCoordinateSettingValue; |
|
224 }; |
|
225 #endif // POS_INDICATOR_HELPER_H |