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