1 // Copyright (c) 2003-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 the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
16 #ifndef __LBSPOSITION_H__
17 #define __LBSPOSITION_H__
20 #include <lbs/lbsvariant.h>
27 typedef TUid TPositionDatumId;
33 Constant for the co-ordinate system for GPS system
35 const TPositionDatumId KPositionDatumWgs84 = {0x101FAA29};
39 TCoordinate is used to hold the basic coordinates of a location (latitude,
40 longitude and altitude).
47 IMPORT_C TCoordinate();
48 IMPORT_C TCoordinate(const TReal64& aLatitude,
49 const TReal64& aLongitude);
50 IMPORT_C TCoordinate(const TReal64& aLatitude,
51 const TReal64& aLongitude,
54 IMPORT_C void SetCoordinate(const TReal64& aLatitude,
55 const TReal64& aLongitude);
56 IMPORT_C void SetCoordinate(const TReal64& aLatitude,
57 const TReal64& aLongitude,
60 IMPORT_C void SetDatum(TPositionDatumId aDatum);
62 IMPORT_C TReal64 Latitude() const;
63 IMPORT_C TReal64 Longitude() const;
64 IMPORT_C TReal32 Altitude() const;
65 IMPORT_C TPositionDatumId Datum() const;
67 IMPORT_C TInt Distance(const TCoordinate& aCoordinate,
68 TReal32& aDistance) const;
69 IMPORT_C TInt BearingTo(const TCoordinate& aTargetCoordinate,
70 TReal32& aBearing) const;
72 IMPORT_C TInt Move(TReal32 aBearing, TReal32 aDistance);
75 void NormalizeCoordinate();
78 /** Latitude, defaults to WGS-84 format. */
80 /** Longitude, defaults to WGS-84 format. */
82 /** Altitude, defaults to WGS-84 format. */
84 /** The ID of the datum the coordinate is in, defaults to WGS-84 format. */
85 TPositionDatumId iDatum;
86 /** Unused variable for future expansion. */
91 class TLocality : public TCoordinate
93 Adds an error estimate for the horizontal and vertical accuracy of the point
94 to TCoordinate. Accuracy information is held in a TReal32 and is measure in
95 metres. The class also provides its own methods for determining the distance
96 and bearing to a target point. These methods also provide an error estimate.
103 IMPORT_C TLocality();
104 IMPORT_C TLocality(const TCoordinate& aCoordinate,
105 TReal32 aHorizontalAccuracy);
106 IMPORT_C TLocality(const TCoordinate& aCoordinate,
107 TReal32 aHorizontalAccuracy,
108 TReal32 aVerticalAccuracy);
110 IMPORT_C void SetHorizontalAccuracy(TReal32 aHorizontalAccuracy);
111 IMPORT_C void SetVerticalAccuracy(TReal32 aVerticalAccuracy);
112 IMPORT_C void SetAccuracy(TReal32 aHorizontalAccuracy,
113 TReal32 aVerticalAccuracy);
115 IMPORT_C TReal32 HorizontalAccuracy() const;
116 IMPORT_C TReal32 VerticalAccuracy() const;
118 IMPORT_C TInt Distance(const TCoordinate& aCoordinate,
119 TReal32& aDistance) const;
120 IMPORT_C TInt Distance(const TLocality& aLocality,
122 TReal32& aDelta) const;
124 IMPORT_C TInt BearingTo(const TCoordinate& aTargetCoordinate,
125 TReal32& aBearing) const;
127 IMPORT_C TInt BearingTo(const TLocality& aTargetLocality,
129 TReal32& aDelta) const;
132 /** Horizontal (earths-surface) accuracy, in metres. */
133 TReal32 iHorizontalAccuracy;
134 /** Altitudinal accuracy, in metres. */
135 TReal32 iVerticalAccuracy;
138 /** Unused variable for future expansion. */
139 TUint8 iReserved[16];
143 class TPosition : public TLocality
145 This class is the standard data structure for retrieving location
146 information. It adds a time dimension to the inherited TLocality information.
147 This enables the speed to be calculated from two TPosition instances.
149 The time reflects the system time (that is, the mobile terminal) of when the
150 location fix was obtained. It does not indicate the time as obtained from the
151 position technology (for example network or satellite time).
153 The time is contained in a TTime data structure that provides microsecond
154 resolution. However, it should be noted that system clocks only provide a
155 resolution of milliseconds or indeed hundredths of a second.
162 IMPORT_C TPosition();
163 IMPORT_C TPosition(const TLocality& aLocality,
166 IMPORT_C void SetTime(TTime aTime);
167 IMPORT_C void SetCurrentTime();
169 IMPORT_C TTime Time() const;
171 IMPORT_C TInt Speed(const TPosition& aPosition,
172 TReal32& aSpeed) const;
173 IMPORT_C TInt Speed(const TPosition& aPosition,
175 TReal32& aDelta) const;
178 /** This is the system time when the position related member data was
183 /** Unused variable for future expansion. */
184 TUint8 iReserved[16];
190 This is used to hold information about the current speed and direction
191 of the device. It is generally used in conjunction with TPositionCourseInfo
192 when a positioning technology is able to supply these details as part of
193 its positioning information.
202 IMPORT_C TReal32 Speed() const;
203 IMPORT_C TReal32 Heading() const;
204 IMPORT_C TReal32 Course() const;
205 IMPORT_C TReal32 SpeedAccuracy() const;
206 IMPORT_C TReal32 HeadingAccuracy() const;
207 IMPORT_C TReal32 CourseAccuracy() const;
209 IMPORT_C void SetSpeed(TReal32 aSpeed);
210 IMPORT_C void SetHeading(TReal32 aHeading);
211 IMPORT_C void SetSpeedAccuracy(TReal32 aSpeedAccuracy);
212 IMPORT_C void SetHeadingAccuracy(TReal32 aHeadingAccuracy);
213 IMPORT_C void SetCourse(TReal32 aCourse);
214 IMPORT_C void SetCourseAccuracy(TReal32 aCourseAccuracy);
217 /** Speed, in metres per second. */
219 /** Heading, in degrees. */
221 /** Speed accuracy, in metres per second. */
222 TReal32 iSpeedAccuracy;
223 /** Heading accuracy, in degrees. */
224 TReal32 iHeadingAccuracy;
225 /** Course, in degrees. */
227 /** Course accuracy, in degrees. */
228 TReal32 iCourseAccuracy;
231 /** Unused variable for future expansion. */
232 TUint8 iReserved[__LBS_TCOURSE_RESERVED_SIZE];
235 #endif //__LBSPOSITION_H__