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 __LBSPOSITION_H__
|
williamr@2
|
17 |
#define __LBSPOSITION_H__
|
williamr@2
|
18 |
|
williamr@2
|
19 |
#include <e32std.h>
|
williamr@4
|
20 |
#include <lbsvariant.h>
|
williamr@2
|
21 |
|
williamr@2
|
22 |
/**
|
williamr@2
|
23 |
@publishedAll
|
williamr@2
|
24 |
@released
|
williamr@2
|
25 |
Datum IDs
|
williamr@2
|
26 |
*/
|
williamr@2
|
27 |
typedef TUid TPositionDatumId;
|
williamr@2
|
28 |
|
williamr@2
|
29 |
|
williamr@2
|
30 |
/**
|
williamr@2
|
31 |
@publishedAll
|
williamr@2
|
32 |
@released
|
williamr@2
|
33 |
Constant for the co-ordinate system for GPS system
|
williamr@2
|
34 |
*/
|
williamr@2
|
35 |
const TPositionDatumId KPositionDatumWgs84 = {0x101FAA29};
|
williamr@2
|
36 |
|
williamr@2
|
37 |
class TCoordinate
|
williamr@2
|
38 |
/**
|
williamr@2
|
39 |
TCoordinate is used to hold the basic coordinates of a location (latitude,
|
williamr@2
|
40 |
longitude and altitude).
|
williamr@2
|
41 |
|
williamr@2
|
42 |
@publishedAll
|
williamr@2
|
43 |
@released
|
williamr@2
|
44 |
*/
|
williamr@2
|
45 |
{
|
williamr@2
|
46 |
public:
|
williamr@2
|
47 |
IMPORT_C TCoordinate();
|
williamr@2
|
48 |
IMPORT_C TCoordinate(const TReal64& aLatitude,
|
williamr@2
|
49 |
const TReal64& aLongitude);
|
williamr@2
|
50 |
IMPORT_C TCoordinate(const TReal64& aLatitude,
|
williamr@2
|
51 |
const TReal64& aLongitude,
|
williamr@2
|
52 |
TReal32 aAltitude);
|
williamr@2
|
53 |
|
williamr@2
|
54 |
IMPORT_C void SetCoordinate(const TReal64& aLatitude,
|
williamr@2
|
55 |
const TReal64& aLongitude);
|
williamr@2
|
56 |
IMPORT_C void SetCoordinate(const TReal64& aLatitude,
|
williamr@2
|
57 |
const TReal64& aLongitude,
|
williamr@2
|
58 |
TReal32 aAltitude);
|
williamr@2
|
59 |
|
williamr@2
|
60 |
IMPORT_C void SetDatum(TPositionDatumId aDatum);
|
williamr@2
|
61 |
|
williamr@2
|
62 |
IMPORT_C TReal64 Latitude() const;
|
williamr@2
|
63 |
IMPORT_C TReal64 Longitude() const;
|
williamr@2
|
64 |
IMPORT_C TReal32 Altitude() const;
|
williamr@2
|
65 |
IMPORT_C TPositionDatumId Datum() const;
|
williamr@2
|
66 |
|
williamr@2
|
67 |
IMPORT_C TInt Distance(const TCoordinate& aCoordinate,
|
williamr@2
|
68 |
TReal32& aDistance) const;
|
williamr@2
|
69 |
IMPORT_C TInt BearingTo(const TCoordinate& aTargetCoordinate,
|
williamr@2
|
70 |
TReal32& aBearing) const;
|
williamr@2
|
71 |
|
williamr@2
|
72 |
IMPORT_C TInt Move(TReal32 aBearing, TReal32 aDistance);
|
williamr@2
|
73 |
|
williamr@2
|
74 |
private:
|
williamr@2
|
75 |
void NormalizeCoordinate();
|
williamr@2
|
76 |
|
williamr@2
|
77 |
protected:
|
williamr@4
|
78 |
/** Latitude, defaults to WGS-84 format. Represented in degree. */
|
williamr@2
|
79 |
TReal64 iLatitude;
|
williamr@4
|
80 |
/** Longitude, defaults to WGS-84 format. Represented in degree. */
|
williamr@2
|
81 |
TReal64 iLongitude;
|
williamr@4
|
82 |
/** Altitude, defaults to WGS-84 format. Represented in meters. */
|
williamr@2
|
83 |
TReal32 iAltitude;
|
williamr@2
|
84 |
/** The ID of the datum the coordinate is in, defaults to WGS-84 format. */
|
williamr@2
|
85 |
TPositionDatumId iDatum;
|
williamr@2
|
86 |
/** Unused variable for future expansion. */
|
williamr@2
|
87 |
TUint8 iReserved[4];
|
williamr@2
|
88 |
};
|
williamr@2
|
89 |
|
williamr@2
|
90 |
|
williamr@2
|
91 |
class TLocality : public TCoordinate
|
williamr@2
|
92 |
/**
|
williamr@2
|
93 |
Adds an error estimate for the horizontal and vertical accuracy of the point
|
williamr@2
|
94 |
to TCoordinate. Accuracy information is held in a TReal32 and is measure in
|
williamr@2
|
95 |
metres. The class also provides its own methods for determining the distance
|
williamr@2
|
96 |
and bearing to a target point. These methods also provide an error estimate.
|
williamr@2
|
97 |
|
williamr@2
|
98 |
@publishedAll
|
williamr@2
|
99 |
@released
|
williamr@2
|
100 |
*/
|
williamr@2
|
101 |
{
|
williamr@2
|
102 |
public:
|
williamr@2
|
103 |
IMPORT_C TLocality();
|
williamr@2
|
104 |
IMPORT_C TLocality(const TCoordinate& aCoordinate,
|
williamr@2
|
105 |
TReal32 aHorizontalAccuracy);
|
williamr@2
|
106 |
IMPORT_C TLocality(const TCoordinate& aCoordinate,
|
williamr@2
|
107 |
TReal32 aHorizontalAccuracy,
|
williamr@2
|
108 |
TReal32 aVerticalAccuracy);
|
williamr@2
|
109 |
|
williamr@2
|
110 |
IMPORT_C void SetHorizontalAccuracy(TReal32 aHorizontalAccuracy);
|
williamr@2
|
111 |
IMPORT_C void SetVerticalAccuracy(TReal32 aVerticalAccuracy);
|
williamr@2
|
112 |
IMPORT_C void SetAccuracy(TReal32 aHorizontalAccuracy,
|
williamr@2
|
113 |
TReal32 aVerticalAccuracy);
|
williamr@2
|
114 |
|
williamr@2
|
115 |
IMPORT_C TReal32 HorizontalAccuracy() const;
|
williamr@2
|
116 |
IMPORT_C TReal32 VerticalAccuracy() const;
|
williamr@2
|
117 |
|
williamr@2
|
118 |
IMPORT_C TInt Distance(const TCoordinate& aCoordinate,
|
williamr@2
|
119 |
TReal32& aDistance) const;
|
williamr@2
|
120 |
IMPORT_C TInt Distance(const TLocality& aLocality,
|
williamr@2
|
121 |
TReal32& aDistance,
|
williamr@2
|
122 |
TReal32& aDelta) const;
|
williamr@2
|
123 |
|
williamr@2
|
124 |
IMPORT_C TInt BearingTo(const TCoordinate& aTargetCoordinate,
|
williamr@2
|
125 |
TReal32& aBearing) const;
|
williamr@2
|
126 |
|
williamr@2
|
127 |
IMPORT_C TInt BearingTo(const TLocality& aTargetLocality,
|
williamr@2
|
128 |
TReal32& aBearing,
|
williamr@2
|
129 |
TReal32& aDelta) const;
|
williamr@2
|
130 |
|
williamr@2
|
131 |
protected:
|
williamr@2
|
132 |
/** Horizontal (earths-surface) accuracy, in metres. */
|
williamr@2
|
133 |
TReal32 iHorizontalAccuracy;
|
williamr@2
|
134 |
/** Altitudinal accuracy, in metres. */
|
williamr@2
|
135 |
TReal32 iVerticalAccuracy;
|
williamr@2
|
136 |
|
williamr@2
|
137 |
private:
|
williamr@2
|
138 |
/** Unused variable for future expansion. */
|
williamr@2
|
139 |
TUint8 iReserved[16];
|
williamr@2
|
140 |
};
|
williamr@2
|
141 |
|
williamr@2
|
142 |
|
williamr@2
|
143 |
class TPosition : public TLocality
|
williamr@2
|
144 |
/**
|
williamr@2
|
145 |
This class is the standard data structure for retrieving location
|
williamr@2
|
146 |
information. It adds a time dimension to the inherited TLocality information.
|
williamr@2
|
147 |
This enables the speed to be calculated from two TPosition instances.
|
williamr@2
|
148 |
|
williamr@2
|
149 |
The time reflects the system time (that is, the mobile terminal) of when the
|
williamr@2
|
150 |
location fix was obtained. It does not indicate the time as obtained from the
|
williamr@2
|
151 |
position technology (for example network or satellite time).
|
williamr@2
|
152 |
|
williamr@2
|
153 |
The time is contained in a TTime data structure that provides microsecond
|
williamr@2
|
154 |
resolution. However, it should be noted that system clocks only provide a
|
williamr@2
|
155 |
resolution of milliseconds or indeed hundredths of a second.
|
williamr@2
|
156 |
|
williamr@2
|
157 |
@publishedAll
|
williamr@2
|
158 |
@released
|
williamr@2
|
159 |
*/
|
williamr@2
|
160 |
{
|
williamr@2
|
161 |
public:
|
williamr@2
|
162 |
IMPORT_C TPosition();
|
williamr@2
|
163 |
IMPORT_C TPosition(const TLocality& aLocality,
|
williamr@2
|
164 |
TTime aTime);
|
williamr@2
|
165 |
|
williamr@2
|
166 |
IMPORT_C void SetTime(TTime aTime);
|
williamr@2
|
167 |
IMPORT_C void SetCurrentTime();
|
williamr@2
|
168 |
|
williamr@2
|
169 |
IMPORT_C TTime Time() const;
|
williamr@2
|
170 |
|
williamr@2
|
171 |
IMPORT_C TInt Speed(const TPosition& aPosition,
|
williamr@2
|
172 |
TReal32& aSpeed) const;
|
williamr@2
|
173 |
IMPORT_C TInt Speed(const TPosition& aPosition,
|
williamr@2
|
174 |
TReal32& aSpeed,
|
williamr@2
|
175 |
TReal32& aDelta) const;
|
williamr@2
|
176 |
|
williamr@2
|
177 |
protected:
|
williamr@2
|
178 |
/** This is the system time when the position related member data was
|
williamr@2
|
179 |
obtained. */
|
williamr@2
|
180 |
TTime iTime;
|
williamr@2
|
181 |
|
williamr@2
|
182 |
private:
|
williamr@2
|
183 |
/** Unused variable for future expansion. */
|
williamr@2
|
184 |
TUint8 iReserved[16];
|
williamr@2
|
185 |
};
|
williamr@2
|
186 |
|
williamr@2
|
187 |
|
williamr@2
|
188 |
class TCourse
|
williamr@2
|
189 |
/**
|
williamr@2
|
190 |
This is used to hold information about the current speed and direction
|
williamr@2
|
191 |
of the device. It is generally used in conjunction with TPositionCourseInfo
|
williamr@2
|
192 |
when a positioning technology is able to supply these details as part of
|
williamr@2
|
193 |
its positioning information.
|
williamr@2
|
194 |
|
williamr@2
|
195 |
@publishedAll
|
williamr@2
|
196 |
@released
|
williamr@2
|
197 |
*/
|
williamr@2
|
198 |
{
|
williamr@2
|
199 |
public:
|
williamr@2
|
200 |
IMPORT_C TCourse();
|
williamr@2
|
201 |
|
williamr@2
|
202 |
IMPORT_C TReal32 Speed() const;
|
williamr@4
|
203 |
IMPORT_C TReal32 VerticalSpeed() const;
|
williamr@2
|
204 |
IMPORT_C TReal32 Heading() const;
|
williamr@2
|
205 |
IMPORT_C TReal32 Course() const;
|
williamr@4
|
206 |
|
williamr@4
|
207 |
IMPORT_C TReal32 SpeedAccuracy() const;
|
williamr@4
|
208 |
IMPORT_C TReal32 VerticalSpeedAccuracy() const;
|
williamr@4
|
209 |
IMPORT_C TReal32 HeadingAccuracy() const;
|
williamr@2
|
210 |
IMPORT_C TReal32 CourseAccuracy() const;
|
williamr@4
|
211 |
|
williamr@4
|
212 |
|
williamr@4
|
213 |
IMPORT_C void SetSpeed(TReal32 aSpeed);
|
williamr@4
|
214 |
IMPORT_C void SetVerticalSpeed(TReal32 aVerticalSpeed);
|
williamr@4
|
215 |
IMPORT_C void SetHeading(TReal32 aHeading);
|
williamr@2
|
216 |
IMPORT_C void SetSpeedAccuracy(TReal32 aSpeedAccuracy);
|
williamr@4
|
217 |
IMPORT_C void SetVerticalSpeedAccuracy(TReal32 aVerticalSpeedAccuracy);
|
williamr@2
|
218 |
IMPORT_C void SetHeadingAccuracy(TReal32 aHeadingAccuracy);
|
williamr@2
|
219 |
IMPORT_C void SetCourse(TReal32 aCourse);
|
williamr@2
|
220 |
IMPORT_C void SetCourseAccuracy(TReal32 aCourseAccuracy);
|
williamr@4
|
221 |
|
williamr@4
|
222 |
|
williamr@4
|
223 |
|
williamr@2
|
224 |
|
williamr@2
|
225 |
protected:
|
williamr@2
|
226 |
/** Speed, in metres per second. */
|
williamr@2
|
227 |
TReal32 iSpeed;
|
williamr@4
|
228 |
/** True Heading, in degrees. */
|
williamr@2
|
229 |
TReal32 iHeading;
|
williamr@2
|
230 |
/** Speed accuracy, in metres per second. */
|
williamr@2
|
231 |
TReal32 iSpeedAccuracy;
|
williamr@2
|
232 |
/** Heading accuracy, in degrees. */
|
williamr@2
|
233 |
TReal32 iHeadingAccuracy;
|
williamr@4
|
234 |
/** True Course, in degrees. */
|
williamr@2
|
235 |
TReal32 iCourse;
|
williamr@2
|
236 |
/** Course accuracy, in degrees. */
|
williamr@2
|
237 |
TReal32 iCourseAccuracy;
|
williamr@4
|
238 |
/** Vertical Speed, in metres per second. */
|
williamr@4
|
239 |
TReal32 iVerticalSpeed;
|
williamr@4
|
240 |
/** Vertical Speed accuracy, in metres per second. */
|
williamr@4
|
241 |
TReal32 iVerticalSpeedAccuracy;
|
williamr@4
|
242 |
|
williamr@2
|
243 |
private:
|
williamr@2
|
244 |
/** Unused variable for future expansion. */
|
williamr@4
|
245 |
TUint8 iReserved[8];
|
williamr@2
|
246 |
};
|
williamr@2
|
247 |
|
williamr@2
|
248 |
#endif //__LBSPOSITION_H__
|