1.1 --- a/epoc32/include/lbsposition.h Tue Nov 24 13:55:44 2009 +0000
1.2 +++ b/epoc32/include/lbsposition.h Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -1,1 +1,235 @@
1.4 -lbsposition.h
1.5 +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
1.6 +// All rights reserved.
1.7 +// This component and the accompanying materials are made available
1.8 +// 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
1.9 +// which accompanies this distribution, and is available
1.10 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.11 +//
1.12 +// Initial Contributors:
1.13 +// Nokia Corporation - initial contribution.
1.14 +//
1.15 +// Contributors:
1.16 +//
1.17 +// Description:
1.18 +//
1.19 +
1.20 +#ifndef __LBSPOSITION_H__
1.21 +#define __LBSPOSITION_H__
1.22 +
1.23 +#include <e32std.h>
1.24 +#include <lbs/lbsvariant.h>
1.25 +
1.26 +/**
1.27 +@publishedAll
1.28 +@released
1.29 +Datum IDs
1.30 + */
1.31 +typedef TUid TPositionDatumId;
1.32 +
1.33 +
1.34 +/**
1.35 +@publishedAll
1.36 +@released
1.37 +Constant for the co-ordinate system for GPS system
1.38 + */
1.39 +const TPositionDatumId KPositionDatumWgs84 = {0x101FAA29};
1.40 +
1.41 +class TCoordinate
1.42 +/**
1.43 +TCoordinate is used to hold the basic coordinates of a location (latitude,
1.44 +longitude and altitude).
1.45 +
1.46 +@publishedAll
1.47 +@released
1.48 + */
1.49 + {
1.50 +public:
1.51 + IMPORT_C TCoordinate();
1.52 + IMPORT_C TCoordinate(const TReal64& aLatitude,
1.53 + const TReal64& aLongitude);
1.54 + IMPORT_C TCoordinate(const TReal64& aLatitude,
1.55 + const TReal64& aLongitude,
1.56 + TReal32 aAltitude);
1.57 +
1.58 + IMPORT_C void SetCoordinate(const TReal64& aLatitude,
1.59 + const TReal64& aLongitude);
1.60 + IMPORT_C void SetCoordinate(const TReal64& aLatitude,
1.61 + const TReal64& aLongitude,
1.62 + TReal32 aAltitude);
1.63 +
1.64 + IMPORT_C void SetDatum(TPositionDatumId aDatum);
1.65 +
1.66 + IMPORT_C TReal64 Latitude() const;
1.67 + IMPORT_C TReal64 Longitude() const;
1.68 + IMPORT_C TReal32 Altitude() const;
1.69 + IMPORT_C TPositionDatumId Datum() const;
1.70 +
1.71 + IMPORT_C TInt Distance(const TCoordinate& aCoordinate,
1.72 + TReal32& aDistance) const;
1.73 + IMPORT_C TInt BearingTo(const TCoordinate& aTargetCoordinate,
1.74 + TReal32& aBearing) const;
1.75 +
1.76 + IMPORT_C TInt Move(TReal32 aBearing, TReal32 aDistance);
1.77 +
1.78 +private:
1.79 + void NormalizeCoordinate();
1.80 +
1.81 +protected:
1.82 + /** Latitude, defaults to WGS-84 format. */
1.83 + TReal64 iLatitude;
1.84 + /** Longitude, defaults to WGS-84 format. */
1.85 + TReal64 iLongitude;
1.86 + /** Altitude, defaults to WGS-84 format. */
1.87 + TReal32 iAltitude;
1.88 + /** The ID of the datum the coordinate is in, defaults to WGS-84 format. */
1.89 + TPositionDatumId iDatum;
1.90 + /** Unused variable for future expansion. */
1.91 + TUint8 iReserved[4];
1.92 + };
1.93 +
1.94 +
1.95 +class TLocality : public TCoordinate
1.96 +/**
1.97 +Adds an error estimate for the horizontal and vertical accuracy of the point
1.98 +to TCoordinate. Accuracy information is held in a TReal32 and is measure in
1.99 +metres. The class also provides its own methods for determining the distance
1.100 +and bearing to a target point. These methods also provide an error estimate.
1.101 +
1.102 +@publishedAll
1.103 +@released
1.104 + */
1.105 + {
1.106 +public:
1.107 + IMPORT_C TLocality();
1.108 + IMPORT_C TLocality(const TCoordinate& aCoordinate,
1.109 + TReal32 aHorizontalAccuracy);
1.110 + IMPORT_C TLocality(const TCoordinate& aCoordinate,
1.111 + TReal32 aHorizontalAccuracy,
1.112 + TReal32 aVerticalAccuracy);
1.113 +
1.114 + IMPORT_C void SetHorizontalAccuracy(TReal32 aHorizontalAccuracy);
1.115 + IMPORT_C void SetVerticalAccuracy(TReal32 aVerticalAccuracy);
1.116 + IMPORT_C void SetAccuracy(TReal32 aHorizontalAccuracy,
1.117 + TReal32 aVerticalAccuracy);
1.118 +
1.119 + IMPORT_C TReal32 HorizontalAccuracy() const;
1.120 + IMPORT_C TReal32 VerticalAccuracy() const;
1.121 +
1.122 + IMPORT_C TInt Distance(const TCoordinate& aCoordinate,
1.123 + TReal32& aDistance) const;
1.124 + IMPORT_C TInt Distance(const TLocality& aLocality,
1.125 + TReal32& aDistance,
1.126 + TReal32& aDelta) const;
1.127 +
1.128 + IMPORT_C TInt BearingTo(const TCoordinate& aTargetCoordinate,
1.129 + TReal32& aBearing) const;
1.130 +
1.131 + IMPORT_C TInt BearingTo(const TLocality& aTargetLocality,
1.132 + TReal32& aBearing,
1.133 + TReal32& aDelta) const;
1.134 +
1.135 +protected:
1.136 + /** Horizontal (earths-surface) accuracy, in metres. */
1.137 + TReal32 iHorizontalAccuracy;
1.138 + /** Altitudinal accuracy, in metres. */
1.139 + TReal32 iVerticalAccuracy;
1.140 +
1.141 +private:
1.142 + /** Unused variable for future expansion. */
1.143 + TUint8 iReserved[16];
1.144 + };
1.145 +
1.146 +
1.147 +class TPosition : public TLocality
1.148 +/**
1.149 +This class is the standard data structure for retrieving location
1.150 +information. It adds a time dimension to the inherited TLocality information.
1.151 +This enables the speed to be calculated from two TPosition instances.
1.152 +
1.153 +The time reflects the system time (that is, the mobile terminal) of when the
1.154 +location fix was obtained. It does not indicate the time as obtained from the
1.155 +position technology (for example network or satellite time).
1.156 +
1.157 +The time is contained in a TTime data structure that provides microsecond
1.158 +resolution. However, it should be noted that system clocks only provide a
1.159 +resolution of milliseconds or indeed hundredths of a second.
1.160 +
1.161 +@publishedAll
1.162 +@released
1.163 + */
1.164 + {
1.165 +public:
1.166 + IMPORT_C TPosition();
1.167 + IMPORT_C TPosition(const TLocality& aLocality,
1.168 + TTime aTime);
1.169 +
1.170 + IMPORT_C void SetTime(TTime aTime);
1.171 + IMPORT_C void SetCurrentTime();
1.172 +
1.173 + IMPORT_C TTime Time() const;
1.174 +
1.175 + IMPORT_C TInt Speed(const TPosition& aPosition,
1.176 + TReal32& aSpeed) const;
1.177 + IMPORT_C TInt Speed(const TPosition& aPosition,
1.178 + TReal32& aSpeed,
1.179 + TReal32& aDelta) const;
1.180 +
1.181 +protected:
1.182 + /** This is the system time when the position related member data was
1.183 + obtained. */
1.184 + TTime iTime;
1.185 +
1.186 +private:
1.187 + /** Unused variable for future expansion. */
1.188 + TUint8 iReserved[16];
1.189 + };
1.190 +
1.191 +
1.192 +class TCourse
1.193 +/**
1.194 +This is used to hold information about the current speed and direction
1.195 +of the device. It is generally used in conjunction with TPositionCourseInfo
1.196 +when a positioning technology is able to supply these details as part of
1.197 +its positioning information.
1.198 +
1.199 +@publishedAll
1.200 +@released
1.201 + */
1.202 + {
1.203 +public:
1.204 + IMPORT_C TCourse();
1.205 +
1.206 + IMPORT_C TReal32 Speed() const;
1.207 + IMPORT_C TReal32 Heading() const;
1.208 + IMPORT_C TReal32 Course() const;
1.209 + IMPORT_C TReal32 SpeedAccuracy() const;
1.210 + IMPORT_C TReal32 HeadingAccuracy() const;
1.211 + IMPORT_C TReal32 CourseAccuracy() const;
1.212 +
1.213 + IMPORT_C void SetSpeed(TReal32 aSpeed);
1.214 + IMPORT_C void SetHeading(TReal32 aHeading);
1.215 + IMPORT_C void SetSpeedAccuracy(TReal32 aSpeedAccuracy);
1.216 + IMPORT_C void SetHeadingAccuracy(TReal32 aHeadingAccuracy);
1.217 + IMPORT_C void SetCourse(TReal32 aCourse);
1.218 + IMPORT_C void SetCourseAccuracy(TReal32 aCourseAccuracy);
1.219 +
1.220 +protected:
1.221 + /** Speed, in metres per second. */
1.222 + TReal32 iSpeed;
1.223 + /** Heading, in degrees. */
1.224 + TReal32 iHeading;
1.225 + /** Speed accuracy, in metres per second. */
1.226 + TReal32 iSpeedAccuracy;
1.227 + /** Heading accuracy, in degrees. */
1.228 + TReal32 iHeadingAccuracy;
1.229 + /** Course, in degrees. */
1.230 + TReal32 iCourse;
1.231 + /** Course accuracy, in degrees. */
1.232 + TReal32 iCourseAccuracy;
1.233 +
1.234 +private:
1.235 + /** Unused variable for future expansion. */
1.236 + TUint8 iReserved[__LBS_TCOURSE_RESERVED_SIZE];
1.237 + };
1.238 +
1.239 +#endif //__LBSPOSITION_H__