36
|
1 |
// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
2 |
// All rights reserved.
|
|
3 |
// This component and the accompanying materials are made available
|
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
|
5 |
// which accompanies this distribution, and is available
|
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
7 |
//
|
|
8 |
// Initial Contributors:
|
|
9 |
// Nokia Corporation - initial contribution.
|
|
10 |
//
|
|
11 |
// Contributors:
|
|
12 |
//
|
|
13 |
// Description:
|
|
14 |
//
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
// INCLUDE FILES
|
|
19 |
#include <e32base.h>
|
|
20 |
#include <ecom/ecom.h>
|
|
21 |
#include <lbs/epos_cpositioner.h>
|
|
22 |
#include "EPos_MPosParameterObserver.h"
|
|
23 |
#include "EPos_PositionerConstructParams.h"
|
|
24 |
#include "EPos_CPositionerExtension.h"
|
|
25 |
#include "EPos_CPosPsyExtension.h"
|
|
26 |
#include "OstTraceDefinitions.h"
|
|
27 |
#ifdef OST_TRACE_COMPILER_IN_USE
|
|
28 |
#include "EPos_CPositionerTraces.h"
|
|
29 |
#endif
|
|
30 |
|
|
31 |
|
|
32 |
// ================= MEMBER FUNCTIONS =======================
|
|
33 |
|
|
34 |
/**
|
|
35 |
* Creates a new instance of a CPositioner implementation.
|
|
36 |
*
|
|
37 |
* @param aConstructionParameters Construction parameters for
|
|
38 |
* CPositioner.
|
|
39 |
* @return The positioner implementation.
|
|
40 |
*/
|
|
41 |
EXPORT_C CPositioner* CPositioner::NewL(
|
|
42 |
TAny* aConstructionParameters)
|
|
43 |
{
|
|
44 |
OstTraceFunctionEntry0( CPOSITIONER_NEWL_ENTRY );
|
|
45 |
TUid implUid = reinterpret_cast<TPositionerConstructParams*>
|
|
46 |
(aConstructionParameters)->iImplementationUid;
|
|
47 |
|
|
48 |
TInt32 offset = static_cast<TInt32> _FOFF(CPositioner, iDtorIdKey);
|
|
49 |
|
|
50 |
TAny* ptr = REComSession::CreateImplementationL(implUid,
|
|
51 |
offset, aConstructionParameters);
|
|
52 |
|
|
53 |
return reinterpret_cast<CPositioner*> (ptr);
|
|
54 |
}
|
|
55 |
|
|
56 |
/**
|
|
57 |
* Creates a new instance of a CPositioner implementation.
|
|
58 |
*
|
|
59 |
* This variant of NewL takes a CPositioner as input. The new
|
|
60 |
* positioner will get a copy of the construction parameters of the
|
|
61 |
* specified positioner.
|
|
62 |
*
|
|
63 |
* This NewL variant should be used by proxy positioners who need
|
|
64 |
* to load other positioners. A proxy positioner cannot use the other
|
|
65 |
* NewL method since the construction parameters are not public.
|
|
66 |
*
|
|
67 |
* @param aImplementationUid The implementation uid of the positioner
|
|
68 |
* which should be created.
|
|
69 |
* @param aPositioner The positioner to copy construction parameters
|
|
70 |
* from.
|
|
71 |
* @return The positioner implementation.
|
|
72 |
*/
|
|
73 |
EXPORT_C CPositioner* CPositioner::NewL(
|
|
74 |
TUid aImplementationUid,
|
|
75 |
const CPositioner& aPositioner)
|
|
76 |
{
|
|
77 |
OstTraceFunctionEntry0( DUP1_CPOSITIONER_NEWL_ENTRY );
|
|
78 |
TPositionerConstructParams params;
|
|
79 |
|
|
80 |
params.iImplementationUid = aImplementationUid;
|
|
81 |
params.iParamObserver = aPositioner.iExtension->iParamObserver;
|
|
82 |
params.iStatusObserver =
|
|
83 |
aPositioner.iExtension->iPsyExtension->iStatusObserver;
|
|
84 |
|
|
85 |
return NewL(¶ms);
|
|
86 |
}
|
|
87 |
|
|
88 |
/**
|
|
89 |
* Destructor.
|
|
90 |
*/
|
|
91 |
EXPORT_C CPositioner::~CPositioner()
|
|
92 |
{
|
|
93 |
OstTraceFunctionEntry1( CPOSITIONER_CPOSITIONER_ENTRY, this );
|
|
94 |
delete iExtension;
|
|
95 |
REComSession::DestroyedImplementation(iDtorIdKey);
|
|
96 |
OstTraceFunctionExit1( CPOSITIONER_CPOSITIONER_EXIT, this );
|
|
97 |
}
|
|
98 |
|
|
99 |
/**
|
|
100 |
* C++ default constructor.
|
|
101 |
*/
|
|
102 |
EXPORT_C CPositioner::CPositioner()
|
|
103 |
{
|
|
104 |
OstTraceFunctionEntry1( DUP1_CPOSITIONER_CPOSITIONER_ENTRY, this );
|
|
105 |
OstTraceFunctionExit1( DUP1_CPOSITIONER_CPOSITIONER_EXIT, this );
|
|
106 |
}
|
|
107 |
|
|
108 |
/**
|
|
109 |
* Creates the internals of the positioner.
|
|
110 |
*
|
|
111 |
* This function must be called first thing in the positioner's
|
|
112 |
* ConstructL() method.
|
|
113 |
*
|
|
114 |
* @param aConstructionParameters The construction parameters supplied
|
|
115 |
* in the factory call.
|
|
116 |
*/
|
|
117 |
EXPORT_C void CPositioner::BaseConstructL(TAny* aConstructionParameters)
|
|
118 |
{
|
|
119 |
OstTraceFunctionEntry1( CPOSITIONER_BASECONSTRUCTL_ENTRY, this );
|
|
120 |
TPositionerConstructParams* params =
|
|
121 |
reinterpret_cast<TPositionerConstructParams*>(aConstructionParameters);
|
|
122 |
|
|
123 |
iExtension = CPositionerExtension::NewL(
|
|
124 |
params->iImplementationUid,
|
|
125 |
params->iStatusObserver,
|
|
126 |
params->iParamObserver);
|
|
127 |
OstTraceFunctionExit1( CPOSITIONER_BASECONSTRUCTL_EXIT, this );
|
|
128 |
}
|
|
129 |
|
|
130 |
/**
|
|
131 |
* Indicate if the PSY has overridden tracking. The default
|
|
132 |
* implementation returns EFalse. Override and return ETrue to use PSY:s
|
|
133 |
* own timer.
|
|
134 |
* @return ETrue if PSY has own timer, otherwise EFalse.
|
|
135 |
*/
|
|
136 |
EXPORT_C TBool CPositioner::TrackingOverridden() const
|
|
137 |
{
|
|
138 |
OstTraceFunctionEntry1( CPOSITIONER_TRACKINGOVERRIDDEN_ENTRY, this );
|
|
139 |
return EFalse;
|
|
140 |
}
|
|
141 |
|
|
142 |
/**
|
|
143 |
* Initiate a tracking session.
|
|
144 |
*
|
|
145 |
* @param aInterval [in] Interval for position requests.
|
|
146 |
*/
|
|
147 |
EXPORT_C void CPositioner::StartTrackingL(
|
|
148 |
const TTimeIntervalMicroSeconds& /*aInterval*/)
|
|
149 |
{
|
|
150 |
OstTraceFunctionEntry1( CPOSITIONER_STARTTRACKINGL_ENTRY, this );
|
|
151 |
User::Leave(KErrNotSupported);
|
|
152 |
OstTraceFunctionExit1( CPOSITIONER_STARTTRACKINGL_EXIT, this );
|
|
153 |
}
|
|
154 |
|
|
155 |
/**
|
|
156 |
* Stop a periodic update session.
|
|
157 |
* Any outstanding requests will be cancelled.
|
|
158 |
*/
|
|
159 |
EXPORT_C void CPositioner::StopTracking()
|
|
160 |
{
|
|
161 |
OstTraceFunctionEntry1( CPOSITIONER_STOPTRACKING_ENTRY, this );
|
|
162 |
OstTraceFunctionExit1( CPOSITIONER_STOPTRACKING_EXIT, this );
|
|
163 |
}
|
|
164 |
|
|
165 |
/**
|
|
166 |
* Service a PSY specific request.
|
|
167 |
*
|
|
168 |
* The PSY uses the RMessage object to read input parameters, write
|
|
169 |
* return parameters and complete the request.
|
|
170 |
*
|
|
171 |
* ServiceL() should be implemented to leave with code
|
|
172 |
* KErrNotSupported if the request id is not recognized.
|
|
173 |
*
|
|
174 |
* @param aMessage The client server request message object.
|
|
175 |
*/
|
|
176 |
EXPORT_C void CPositioner::ServiceL(RMessage2& /*aMessage*/)
|
|
177 |
{
|
|
178 |
OstTraceFunctionEntry1( CPOSITIONER_SERVICEL_ENTRY, this );
|
|
179 |
User::Leave(KErrNotSupported);
|
|
180 |
OstTraceFunctionExit1( CPOSITIONER_SERVICEL_EXIT, this );
|
|
181 |
}
|
|
182 |
|
|
183 |
/**
|
|
184 |
* Called to return the implementation UID set when calling NewL.
|
|
185 |
*
|
|
186 |
* @return The UID of the handler implementation.
|
|
187 |
*/
|
|
188 |
EXPORT_C TUid CPositioner::ImplementationUid() const
|
|
189 |
{
|
|
190 |
OstTraceFunctionEntry1( CPOSITIONER_IMPLEMENTATIONUID_ENTRY, this );
|
|
191 |
return iExtension->iPsyExtension->iImplementationUid;
|
|
192 |
}
|
|
193 |
|
|
194 |
/**
|
|
195 |
* Get the quality of service requested by the client.
|
|
196 |
*
|
|
197 |
* This method can be used by positioning modules which have the ability
|
|
198 |
* to deliver different quality of service.
|
|
199 |
*
|
|
200 |
* @param aPositionQuality The requested quality of service.
|
|
201 |
* @return KErrNotFound if there is no requested quality of service,
|
|
202 |
* KErrNone if there is.
|
|
203 |
*/
|
|
204 |
EXPORT_C TInt CPositioner::GetRequiredPositionQuality(
|
|
205 |
TPositionQuality& aPositionQuality) const
|
|
206 |
{
|
|
207 |
OstTraceFunctionEntry1( CPOSITIONER_GETREQUIREDPOSITIONQUALITY_ENTRY, this );
|
|
208 |
return iExtension->iParamObserver->GetRequiredPositionQuality(
|
|
209 |
aPositionQuality);
|
|
210 |
}
|
|
211 |
|
|
212 |
/**
|
|
213 |
* Get the earliest allowed time of an old position fix, based on the
|
|
214 |
* current max age set by the client.
|
|
215 |
*
|
|
216 |
* The PSY may save the result from the latest position request and
|
|
217 |
* return the same result in the next position request if the client
|
|
218 |
* says it's ok. Max age tells the PSY how old the stored position is
|
|
219 |
* allowed to be. If the stored position is too old or the PSY does not
|
|
220 |
* support max age, a normal positioning should be performed.
|
|
221 |
*
|
|
222 |
* @param aMaxAge On return, will contain the earliest allowed time of
|
|
223 |
* an old position fix. If no max age is defined aMaxAge will contain
|
|
224 |
* a time set to zero.
|
|
225 |
*/
|
|
226 |
EXPORT_C void CPositioner::GetMaxAge(TTime& aMaxAge) const
|
|
227 |
{
|
|
228 |
OstTraceFunctionEntry1( CPOSITIONER_GETMAXAGE_ENTRY, this );
|
|
229 |
iExtension->iParamObserver->GetMaxAge(aMaxAge);
|
|
230 |
OstTraceFunctionExit1( CPOSITIONER_GETMAXAGE_EXIT, this );
|
|
231 |
}
|
|
232 |
|
|
233 |
/**
|
|
234 |
* Checks if the client allows a partial position update.
|
|
235 |
*
|
|
236 |
* A partial update result does not need to contain all parameters. The
|
|
237 |
* only mandatory parameters are latitude, longitude and time of fix.
|
|
238 |
* Everything else is optional.
|
|
239 |
*
|
|
240 |
* If a partial update is returned to the client in a
|
|
241 |
* NotifyPositionUpdate() call, the completion code must be set to
|
|
242 |
* KPositionPartialUpdate.
|
|
243 |
*
|
|
244 |
* @return ETrue if partial position updates are allowed, otherwise
|
|
245 |
* EFalse.
|
|
246 |
*/
|
|
247 |
EXPORT_C TBool CPositioner::IsPartialUpdateAllowed() const
|
|
248 |
{
|
|
249 |
OstTraceFunctionEntry1( CPOSITIONER_ISPARTIALUPDATEALLOWED_ENTRY, this );
|
|
250 |
return iExtension->iParamObserver->IsPartialUpdateAllowed();
|
|
251 |
}
|
|
252 |
|
|
253 |
/**
|
|
254 |
* Retrieve the interface for reporting positioner status.
|
|
255 |
*
|
|
256 |
* @return The interface for reporting positioner status.
|
|
257 |
*/
|
|
258 |
EXPORT_C MPositionerStatus* CPositioner::PositionerStatus()
|
|
259 |
{
|
|
260 |
OstTraceFunctionEntry1( CPOSITIONER_POSITIONERSTATUS_ENTRY, this );
|
|
261 |
return iExtension->iPsyExtension;
|
|
262 |
}
|
|
263 |
|
|
264 |
|
|
265 |
|
|
266 |
/**
|
|
267 |
* Cancels the request with the error code provided.
|
|
268 |
*
|
|
269 |
* @param aError The error code to cancel request with.
|
|
270 |
*
|
|
271 |
* @prototype
|
|
272 |
*/
|
|
273 |
|
|
274 |
EXPORT_C void CPositioner::CancelNotifyPositionUpdate(TInt /*aError*/)
|
|
275 |
{
|
|
276 |
OstTraceFunctionEntry1( CPOSITIONER_CANCELNOTIFYPOSITIONUPDATE_ENTRY, this );
|
|
277 |
CancelNotifyPositionUpdate();
|
|
278 |
OstTraceFunctionExit1( CPOSITIONER_CANCELNOTIFYPOSITIONUPDATE_EXIT, this );
|
|
279 |
}
|
|
280 |
|
|
281 |
//EXPORT_C void CPositioner::CPositioner_Reserved1()
|
|
282 |
// {
|
|
283 |
// }
|
|
284 |
|
|
285 |
/**
|
|
286 |
* Reserved function
|
|
287 |
*/
|
|
288 |
EXPORT_C void CPositioner::CPositioner_Reserved2()
|
|
289 |
{
|
|
290 |
OstTraceFunctionEntry1( CPOSITIONER_CPOSITIONER_RESERVED2_ENTRY, this );
|
|
291 |
OstTraceFunctionExit1( CPOSITIONER_CPOSITIONER_RESERVED2_EXIT, this );
|
|
292 |
}
|
|
293 |
|
|
294 |
/**
|
|
295 |
* Returns the location update timeout associated with the subsession. The method returns a real timeout,
|
|
296 |
* which is defined and used by the Location Server. It may be different from the timeout set by the client
|
|
297 |
* or default PSY timeout.
|
|
298 |
*
|
|
299 |
* @param aUpdateTimeOut [Out] The location update timeout.
|
|
300 |
*
|
|
301 |
* @prototype
|
|
302 |
*/
|
|
303 |
EXPORT_C void CPositioner::GetUpdateTimeOut(TTimeIntervalMicroSeconds& aUpdateTimeOut) const
|
|
304 |
{
|
|
305 |
OstTraceFunctionEntry1( CPOSITIONER_GETUPDATETIMEOUT_ENTRY, this );
|
|
306 |
iExtension->iParamObserver->GetUpdateTimeOut(aUpdateTimeOut);
|
|
307 |
OstTraceFunctionExit1( CPOSITIONER_GETUPDATETIMEOUT_EXIT, this );
|
|
308 |
}
|
|
309 |
|
|
310 |
/**
|
|
311 |
* Called to inform the Location Server about the PSY default update timeout. The Location
|
|
312 |
* Server may use this value to calculate the update timeout it uses.
|
|
313 |
* When this method is called, it does not affect the currect request. So, it must be called in advance
|
|
314 |
* before a request comes from the Location Server.
|
|
315 |
*
|
|
316 |
* @param aUpdateTimeOut [In] The PSY default location update timeout.
|
|
317 |
*
|
|
318 |
* @prototype
|
|
319 |
*/
|
|
320 |
EXPORT_C void CPositioner::SetPsyDefaultUpdateTimeOut(const TTimeIntervalMicroSeconds& aUpdateTimeOut)
|
|
321 |
{
|
|
322 |
OstTraceFunctionEntry1( CPOSITIONER_SETPSYDEFAULTUPDATETIMEOUT_ENTRY, this );
|
|
323 |
iExtension->iParamObserver->SetPsyDefaultUpdateTimeOut(aUpdateTimeOut);
|
|
324 |
OstTraceFunctionExit1( CPOSITIONER_SETPSYDEFAULTUPDATETIMEOUT_EXIT, this );
|
|
325 |
}
|
|
326 |
|
|
327 |
/**
|
|
328 |
* Extends the active request timeout by the value specified. Only the current active request is
|
|
329 |
* affected and the changes are not stored. That is the value returned by GetUpdateTimeOut and
|
|
330 |
* the default PSY timeout set by SetPsyDefaultUpdateTimeOut are not changed.
|
|
331 |
* This method is used, for example, to apply FNP lag.
|
|
332 |
*
|
|
333 |
* @param aUpdateTimeOut [In] The time to extend timeout for.
|
|
334 |
*
|
|
335 |
* @prototype
|
|
336 |
*/
|
|
337 |
EXPORT_C void CPositioner::ExtendUpdateTimeOut(const TTimeIntervalMicroSeconds& aAdditionalTime)
|
|
338 |
{
|
|
339 |
OstTraceFunctionEntry1( CPOSITIONER_EXTENDUPDATETIMEOUT_ENTRY, this );
|
|
340 |
iExtension->iParamObserver->ExtendUpdateTimeOut(aAdditionalTime);
|
|
341 |
OstTraceFunctionExit1( CPOSITIONER_EXTENDUPDATETIMEOUT_EXIT, this );
|
|
342 |
}
|
|
343 |
|
|
344 |
|
|
345 |
|
|
346 |
// End of File
|