williamr@2
|
1 |
// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
|
williamr@2
|
2 |
// All rights reserved.
|
williamr@2
|
3 |
// This component and the accompanying materials are made available
|
williamr@2
|
4 |
// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
|
williamr@2
|
5 |
// which accompanies this distribution, and is available
|
williamr@2
|
6 |
// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
|
williamr@2
|
7 |
//
|
williamr@2
|
8 |
// Initial Contributors:
|
williamr@2
|
9 |
// Nokia Corporation - initial contribution.
|
williamr@2
|
10 |
//
|
williamr@2
|
11 |
// Contributors:
|
williamr@2
|
12 |
//
|
williamr@2
|
13 |
// Description:
|
williamr@2
|
14 |
//
|
williamr@2
|
15 |
|
williamr@2
|
16 |
#ifndef __LBSPOSITIONINFO_H__
|
williamr@2
|
17 |
#define __LBSPOSITIONINFO_H__
|
williamr@2
|
18 |
|
williamr@2
|
19 |
#include <lbsposition.h>
|
williamr@2
|
20 |
#include <lbscommon.h>
|
williamr@2
|
21 |
#include <lbsfields.h>
|
williamr@2
|
22 |
|
williamr@2
|
23 |
/**
|
williamr@2
|
24 |
The default size for a HPositionGenericInfo position information buffer
|
williamr@2
|
25 |
|
williamr@2
|
26 |
@publishedAll
|
williamr@2
|
27 |
@released
|
williamr@2
|
28 |
*/
|
williamr@2
|
29 |
const TInt KPositionGenericInfoDefaultBufferSize = 1024;
|
williamr@2
|
30 |
|
williamr@2
|
31 |
/**
|
williamr@2
|
32 |
The default number of requested fields for a HPositionGenericInfo
|
williamr@2
|
33 |
position information buffer
|
williamr@2
|
34 |
|
williamr@2
|
35 |
@publishedAll
|
williamr@2
|
36 |
@released
|
williamr@2
|
37 |
*/
|
williamr@2
|
38 |
const TInt KPositionGenericInfoDefaultMaxFields = 32;
|
williamr@2
|
39 |
|
williamr@2
|
40 |
/**
|
williamr@2
|
41 |
Position update types
|
williamr@2
|
42 |
|
williamr@2
|
43 |
@publishedAll
|
williamr@2
|
44 |
@released
|
williamr@2
|
45 |
*/
|
williamr@2
|
46 |
enum _TPositionUpdateType
|
williamr@2
|
47 |
{
|
williamr@2
|
48 |
/** EPositionUpdateUnknown */
|
williamr@2
|
49 |
EPositionUpdateUnknown = 0,
|
williamr@2
|
50 |
/** EPositionUpdateGeneral */
|
williamr@2
|
51 |
EPositionUpdateGeneral = 0x01
|
williamr@2
|
52 |
};
|
williamr@2
|
53 |
/**
|
williamr@2
|
54 |
TPositionUpdateType code
|
williamr@2
|
55 |
@publishedAll
|
williamr@2
|
56 |
@released
|
williamr@2
|
57 |
*/
|
williamr@2
|
58 |
typedef TUint32 TPositionUpdateType;
|
williamr@2
|
59 |
|
williamr@2
|
60 |
|
williamr@2
|
61 |
/**
|
williamr@2
|
62 |
Position mode reasons. These values summarise the reasons why module
|
williamr@2
|
63 |
was unable to uses its preferred calculation mode when producing a
|
williamr@2
|
64 |
position update. The values are a bit mask that can be combined
|
williamr@2
|
65 |
to describe the various reasons.
|
williamr@2
|
66 |
|
williamr@2
|
67 |
NetworkError is used when there is no network coverage or
|
williamr@2
|
68 |
the service is unavailable.
|
williamr@2
|
69 |
|
williamr@2
|
70 |
LocalError represents environmental reasons that prevent a terminal
|
williamr@2
|
71 |
based calculation - such as no satellites in view.
|
williamr@2
|
72 |
|
williamr@2
|
73 |
DataError is returned when there is a problem with the initialisation
|
williamr@2
|
74 |
data. For example, GPS assistance data was received but it was
|
williamr@2
|
75 |
either invalid or could not be used..
|
williamr@2
|
76 |
|
williamr@2
|
77 |
@publishedAll
|
williamr@2
|
78 |
@released
|
williamr@2
|
79 |
*/
|
williamr@2
|
80 |
enum _TPositionModeReason
|
williamr@2
|
81 |
{
|
williamr@2
|
82 |
/** Mode reason none */
|
williamr@2
|
83 |
EPositionModeReasonNone = 0,
|
williamr@2
|
84 |
/** Mode reason network error */
|
williamr@2
|
85 |
EPositionModeReasonNetworkError = 1 << 0,
|
williamr@2
|
86 |
/** Mode reason local error */
|
williamr@2
|
87 |
EPositionModeReasonLocalError = 1 << 1,
|
williamr@2
|
88 |
/** Mode reason data error */
|
williamr@2
|
89 |
EPositionModeReasonDataError = 1 << 2
|
williamr@2
|
90 |
};
|
williamr@2
|
91 |
|
williamr@2
|
92 |
/**
|
williamr@2
|
93 |
TPositionModeReason code
|
williamr@2
|
94 |
@publishedAll
|
williamr@2
|
95 |
@released
|
williamr@2
|
96 |
*/
|
williamr@2
|
97 |
typedef TUint32 TPositionModeReason;
|
williamr@2
|
98 |
|
williamr@2
|
99 |
|
williamr@2
|
100 |
class TPositionInfoBase : public TPositionClassTypeBase
|
williamr@2
|
101 |
/**
|
williamr@2
|
102 |
This class provides the interface used by RPositioner to get a location fix,
|
williamr@2
|
103 |
and as such all classes used to get location info from the location server should
|
williamr@2
|
104 |
derive from this class.
|
williamr@2
|
105 |
|
williamr@2
|
106 |
Class contains info about the update type and the ID of the module that gave the
|
williamr@2
|
107 |
location fix
|
williamr@2
|
108 |
|
williamr@2
|
109 |
@publishedAll
|
williamr@2
|
110 |
@released
|
williamr@2
|
111 |
*/
|
williamr@2
|
112 |
{
|
williamr@2
|
113 |
public:
|
williamr@2
|
114 |
IMPORT_C TPositionModuleId ModuleId() const;
|
williamr@2
|
115 |
IMPORT_C void SetModuleId(TPositionModuleId aModuleId);
|
williamr@2
|
116 |
|
williamr@2
|
117 |
IMPORT_C TPositionUpdateType UpdateType() const;
|
williamr@2
|
118 |
IMPORT_C void SetUpdateType(TPositionUpdateType aUpdateType);
|
williamr@2
|
119 |
|
williamr@2
|
120 |
IMPORT_C TPositionModuleInfo::TTechnologyType PositionMode() const;
|
williamr@2
|
121 |
IMPORT_C void SetPositionMode(TPositionModuleInfo::TTechnologyType aMode);
|
williamr@2
|
122 |
|
williamr@2
|
123 |
IMPORT_C TPositionModeReason PositionModeReason() const;
|
williamr@2
|
124 |
IMPORT_C void SetPositionModeReason(TPositionModeReason aReason);
|
williamr@2
|
125 |
|
williamr@2
|
126 |
protected:
|
williamr@2
|
127 |
IMPORT_C TPositionInfoBase();
|
williamr@2
|
128 |
|
williamr@2
|
129 |
protected:
|
williamr@2
|
130 |
/** The Id of the module that gave the location fix. */
|
williamr@2
|
131 |
TPositionModuleId iModuleId;
|
williamr@2
|
132 |
/** The type of update that this location fix represents. */
|
williamr@2
|
133 |
TUint32 iUpdateType;
|
williamr@2
|
134 |
|
williamr@2
|
135 |
/** The positioning mode used to calculate this location fix. */
|
williamr@2
|
136 |
TPositionModuleInfo::TTechnologyType iPositionMode;
|
williamr@2
|
137 |
|
williamr@2
|
138 |
/** The reason why the prefered position mode was not used. */
|
williamr@2
|
139 |
TPositionModeReason iPositionModeReason;
|
williamr@2
|
140 |
|
williamr@2
|
141 |
private:
|
williamr@2
|
142 |
/** Unused variable for future expansion. */
|
williamr@2
|
143 |
TUint8 iReserved[8];
|
williamr@2
|
144 |
};
|
williamr@2
|
145 |
|
williamr@2
|
146 |
|
williamr@2
|
147 |
class TPositionInfo : public TPositionInfoBase
|
williamr@2
|
148 |
/**
|
williamr@2
|
149 |
Standard class for getting a TPosition location fix from the location server.
|
williamr@2
|
150 |
|
williamr@2
|
151 |
@publishedAll
|
williamr@2
|
152 |
@released
|
williamr@2
|
153 |
*/
|
williamr@2
|
154 |
{
|
williamr@2
|
155 |
public:
|
williamr@2
|
156 |
IMPORT_C TPositionInfo();
|
williamr@2
|
157 |
|
williamr@2
|
158 |
IMPORT_C void GetPosition(TPosition& aPosition) const;
|
williamr@2
|
159 |
IMPORT_C void SetPosition(const TPosition& aPosition);
|
williamr@2
|
160 |
|
williamr@2
|
161 |
protected:
|
williamr@2
|
162 |
/** The TPosition. */
|
williamr@2
|
163 |
TPosition iPosition;
|
williamr@2
|
164 |
};
|
williamr@2
|
165 |
|
williamr@2
|
166 |
|
williamr@2
|
167 |
class TPositionCourseInfo : public TPositionInfo
|
williamr@2
|
168 |
/**
|
williamr@2
|
169 |
Class for getting a TCourse from the location server.
|
williamr@2
|
170 |
|
williamr@2
|
171 |
@publishedAll
|
williamr@2
|
172 |
@released
|
williamr@2
|
173 |
*/
|
williamr@2
|
174 |
{
|
williamr@2
|
175 |
public:
|
williamr@2
|
176 |
IMPORT_C TPositionCourseInfo();
|
williamr@2
|
177 |
|
williamr@2
|
178 |
IMPORT_C void GetCourse(TCourse& aCourse) const;
|
williamr@2
|
179 |
IMPORT_C void SetCourse(const TCourse& aCourse);
|
williamr@2
|
180 |
|
williamr@2
|
181 |
protected:
|
williamr@2
|
182 |
/** The TCourse. */
|
williamr@2
|
183 |
TCourse iCourse;
|
williamr@2
|
184 |
};
|
williamr@2
|
185 |
|
williamr@2
|
186 |
|
williamr@2
|
187 |
/**
|
williamr@2
|
188 |
Class for getting arbitrary positioning related information back from the location server.
|
williamr@2
|
189 |
The client can set upto KPositionMaxRequestedFields as the number of requested fields.
|
williamr@2
|
190 |
The definitions of the fields are given in the enum #_TPositionFieldId. The client must
|
williamr@2
|
191 |
know what data type will be returned for each of the fields. The server will make a best
|
williamr@2
|
192 |
attempt to fill in the requested fields.
|
williamr@2
|
193 |
|
williamr@2
|
194 |
The client needs to allocate a big enough buffer to store the information it is requesting.
|
williamr@2
|
195 |
In order to be sure of getting back all the information the client must know and allocate
|
williamr@2
|
196 |
memory considering the return value for each requested field.
|
williamr@2
|
197 |
|
williamr@2
|
198 |
@publishedAll
|
williamr@2
|
199 |
@released
|
williamr@2
|
200 |
*/
|
williamr@2
|
201 |
class HPositionGenericInfo : public TPositionInfo
|
williamr@2
|
202 |
{
|
williamr@2
|
203 |
public:
|
williamr@2
|
204 |
|
williamr@2
|
205 |
IMPORT_C static HPositionGenericInfo* New(TInt aBufferSize = KPositionGenericInfoDefaultBufferSize,
|
williamr@2
|
206 |
TInt aMaxFields = KPositionGenericInfoDefaultMaxFields);
|
williamr@2
|
207 |
IMPORT_C static HPositionGenericInfo* NewL(TInt aBufferSize = KPositionGenericInfoDefaultBufferSize,
|
williamr@2
|
208 |
TInt aMaxFields = KPositionGenericInfoDefaultMaxFields);
|
williamr@2
|
209 |
IMPORT_C static HPositionGenericInfo* NewLC(TInt aBufferSize = KPositionGenericInfoDefaultBufferSize,
|
williamr@2
|
210 |
TInt aMaxFields = KPositionGenericInfoDefaultMaxFields);
|
williamr@2
|
211 |
IMPORT_C void ClearRequestedFields();
|
williamr@2
|
212 |
IMPORT_C TInt SetRequestedField(TPositionFieldId aFieldId);
|
williamr@2
|
213 |
IMPORT_C TInt SetRequestedFields(const TPositionFieldIdList aFieldIdList);
|
williamr@2
|
214 |
IMPORT_C TInt IsRequestedField(TPositionFieldId aFieldId) const;
|
williamr@2
|
215 |
IMPORT_C TPositionFieldId FirstRequestedFieldId() const;
|
williamr@2
|
216 |
IMPORT_C TPositionFieldId NextRequestedFieldId(TPositionFieldId aFieldId) const;
|
williamr@2
|
217 |
IMPORT_C TBool IsFieldAvailable(TPositionFieldId aFieldId) const;
|
williamr@2
|
218 |
IMPORT_C void ClearPositionData(); //Required on server side
|
williamr@2
|
219 |
IMPORT_C TInt BufferSize() const;
|
williamr@2
|
220 |
IMPORT_C TInt MaxFields() const;
|
williamr@2
|
221 |
|
williamr@2
|
222 |
/**
|
williamr@2
|
223 |
* Used to store position information.
|
williamr@2
|
224 |
* @param aFieldId Standard position field identifier. See _TPositionFieldId
|
williamr@2
|
225 |
* @param[in] aValue The parameter aValue can be of the type
|
williamr@2
|
226 |
* TInt8, TInt16, TInt32, TInt64, TUint8, TUint16, TUint32,
|
williamr@2
|
227 |
* TReal32, TReal64, TTime, TTimeIntervalMicroSeconds, Des8, or Des16.
|
williamr@2
|
228 |
* @return a symbian OS error code.
|
williamr@2
|
229 |
* @return KErrNone on successful operation.
|
williamr@2
|
230 |
* @return KErrPositionBufferOverflow if the data contained in the
|
williamr@2
|
231 |
* parameter aValue cannot be added to the class due to the buffer being too small.
|
williamr@2
|
232 |
*/
|
williamr@2
|
233 |
template <class TType>
|
williamr@2
|
234 |
inline TInt SetValue(TPositionFieldId aFieldId, const TType& aValue)
|
williamr@2
|
235 |
{return PositionFieldManager::SetValue(aFieldId, aValue, *this);}
|
williamr@2
|
236 |
|
williamr@2
|
237 |
/**
|
williamr@2
|
238 |
* Used to retrieve position information.
|
williamr@2
|
239 |
* @param aFieldId Standard position field identifier. See _TPositionFieldId
|
williamr@2
|
240 |
* @param[out] aValue The parameter aValue can be of the type
|
williamr@2
|
241 |
* TInt8, TInt16, TInt32, TInt64, TUint8, TUint16, TUint32,
|
williamr@2
|
242 |
* TReal32, TReal64, TTime, TTimeIntervalMicroSeconds, Des8, or Des16.
|
williamr@2
|
243 |
* Panics with EPositionGenericInfoMismatchDataType if there is a
|
williamr@2
|
244 |
* mismatch in the data type of a field.
|
williamr@2
|
245 |
* @return a symbian OS error code.
|
williamr@2
|
246 |
* @return KErrNone on successful operation.
|
williamr@2
|
247 |
* @return KErrOverflow if the supplied descriptor is too short to contain the requested field.
|
williamr@2
|
248 |
* This method must use the same data type as that assigned by SetValue() .
|
williamr@2
|
249 |
*/
|
williamr@2
|
250 |
template <class TType>
|
williamr@2
|
251 |
inline TInt GetValue(TPositionFieldId aFieldId, TType& aValue) const
|
williamr@2
|
252 |
{return PositionFieldManager::GetValue(aFieldId, aValue, *this);}
|
williamr@2
|
253 |
|
williamr@2
|
254 |
private:
|
williamr@2
|
255 |
HPositionGenericInfo(TInt aDataBufferSize, TInt aMaxFields,
|
williamr@2
|
256 |
TUint aFieldIndexStartPoint, TUint aDataStartPoint, TBool aResetRequestedFields);
|
williamr@2
|
257 |
/**
|
williamr@2
|
258 |
* internal private method
|
williamr@2
|
259 |
*/
|
williamr@2
|
260 |
HPositionGenericInfo& operator=(const HPositionGenericInfo&);
|
williamr@2
|
261 |
/**
|
williamr@2
|
262 |
* internal private method
|
williamr@2
|
263 |
*/
|
williamr@2
|
264 |
HPositionGenericInfo(const HPositionGenericInfo&);
|
williamr@2
|
265 |
|
williamr@2
|
266 |
TInt FindEmptyRequestedFieldOffset(TInt& aEmptyFieldOffset) const;
|
williamr@2
|
267 |
|
williamr@2
|
268 |
/**
|
williamr@2
|
269 |
* Helper method. For internal usage only
|
williamr@2
|
270 |
*/
|
williamr@2
|
271 |
inline TPositionFieldId* RequestedFieldPtr();
|
williamr@2
|
272 |
/**
|
williamr@2
|
273 |
* Helper method. For internal usage only
|
williamr@2
|
274 |
*/
|
williamr@2
|
275 |
inline const TPositionFieldId* RequestedFieldPtr() const;
|
williamr@2
|
276 |
/**
|
williamr@2
|
277 |
* Helper method. For internal usage only
|
williamr@2
|
278 |
*/
|
williamr@2
|
279 |
inline TPositionFieldIndex* FieldIndexPtr();
|
williamr@2
|
280 |
/**
|
williamr@2
|
281 |
* Helper method. For internal usage only
|
williamr@2
|
282 |
*/
|
williamr@2
|
283 |
inline const TPositionFieldIndex* FieldIndexPtr() const;
|
williamr@2
|
284 |
|
williamr@2
|
285 |
private:
|
williamr@2
|
286 |
friend class TPositionFieldSetter;
|
williamr@2
|
287 |
friend class TPositionFieldGetter;
|
williamr@2
|
288 |
|
williamr@2
|
289 |
/** Max number of requesable/returnable fields. */
|
williamr@2
|
290 |
const TInt iMaxFields;
|
williamr@2
|
291 |
|
williamr@2
|
292 |
/** Offset into iBuffer of the field index. */
|
williamr@2
|
293 |
const TUint iFieldIndexStartPoint;
|
williamr@2
|
294 |
|
williamr@2
|
295 |
/** Offset into iBuffer of the actual location data. */
|
williamr@2
|
296 |
const TUint iDataStartPoint;
|
williamr@2
|
297 |
|
williamr@2
|
298 |
/** Total size of the buffer */
|
williamr@2
|
299 |
const TInt iTotalBufferSize;
|
williamr@2
|
300 |
|
williamr@2
|
301 |
/** Start of the buffer. The heap cell allocated for an instance of this class
|
williamr@2
|
302 |
has space for information up to iBuffer[iTotalBufferSize-1]*/
|
williamr@2
|
303 |
TUint8 iBuffer[1]; //Must be at end of class
|
williamr@2
|
304 |
};
|
williamr@2
|
305 |
|
williamr@2
|
306 |
#endif //__LBSPOSITIONINFO_H__
|