epoc32/include/lbsposition.h
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
child 4 837f303aceeb
equal deleted inserted replaced
1:666f914201fb 2:2fe1408b6811
     1 lbsposition.h
     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".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #ifndef __LBSPOSITION_H__
       
    17 #define __LBSPOSITION_H__
       
    18 
       
    19 #include <e32std.h>
       
    20 #include <lbs/lbsvariant.h>
       
    21 
       
    22 /**
       
    23 @publishedAll
       
    24 @released
       
    25 Datum IDs
       
    26  */
       
    27 typedef TUid TPositionDatumId;
       
    28 
       
    29 
       
    30 /**
       
    31 @publishedAll
       
    32 @released
       
    33 Constant for the co-ordinate system for GPS system
       
    34  */
       
    35 const TPositionDatumId KPositionDatumWgs84 = {0x101FAA29};
       
    36 
       
    37 class TCoordinate
       
    38 /**
       
    39 TCoordinate is used to hold the basic coordinates of a location (latitude,
       
    40 longitude and altitude).
       
    41 
       
    42 @publishedAll
       
    43 @released
       
    44  */
       
    45 	{
       
    46 public:
       
    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,
       
    52 	                     TReal32 aAltitude);
       
    53 
       
    54 	IMPORT_C void SetCoordinate(const TReal64& aLatitude,
       
    55 	                            const TReal64& aLongitude);
       
    56 	IMPORT_C void SetCoordinate(const TReal64& aLatitude,
       
    57 	                            const TReal64& aLongitude,
       
    58 	                            TReal32 aAltitude);
       
    59 
       
    60 	IMPORT_C void SetDatum(TPositionDatumId aDatum);
       
    61 
       
    62 	IMPORT_C TReal64 Latitude() const;
       
    63 	IMPORT_C TReal64 Longitude() const;
       
    64 	IMPORT_C TReal32 Altitude() const;
       
    65 	IMPORT_C TPositionDatumId Datum() const;
       
    66 
       
    67 	IMPORT_C TInt Distance(const TCoordinate& aCoordinate,
       
    68 	                       TReal32& aDistance) const;
       
    69 	IMPORT_C TInt BearingTo(const TCoordinate& aTargetCoordinate,
       
    70 	                        TReal32& aBearing) const;
       
    71 
       
    72 	IMPORT_C TInt Move(TReal32 aBearing, TReal32 aDistance);
       
    73 
       
    74 private:
       
    75 	void NormalizeCoordinate();
       
    76 
       
    77 protected:
       
    78 	/** Latitude, defaults to WGS-84 format. */
       
    79 	TReal64 iLatitude;
       
    80 	/** Longitude, defaults to WGS-84 format. */
       
    81 	TReal64 iLongitude;
       
    82 	/** Altitude, defaults to WGS-84 format. */
       
    83 	TReal32 iAltitude;
       
    84 	/** The ID of the datum the coordinate is in, defaults to WGS-84 format. */
       
    85 	TPositionDatumId iDatum;
       
    86 	/** Unused variable for future expansion. */
       
    87 	TUint8 iReserved[4];
       
    88 	};
       
    89 
       
    90 
       
    91 class TLocality : public TCoordinate
       
    92 /**
       
    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.
       
    97 
       
    98 @publishedAll
       
    99 @released
       
   100  */
       
   101 	{
       
   102 public:
       
   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);
       
   109 
       
   110 	IMPORT_C void SetHorizontalAccuracy(TReal32 aHorizontalAccuracy);
       
   111 	IMPORT_C void SetVerticalAccuracy(TReal32 aVerticalAccuracy);
       
   112 	IMPORT_C void SetAccuracy(TReal32 aHorizontalAccuracy,
       
   113 	                          TReal32 aVerticalAccuracy);
       
   114 
       
   115 	IMPORT_C TReal32 HorizontalAccuracy() const;
       
   116 	IMPORT_C TReal32 VerticalAccuracy() const;
       
   117 
       
   118 	IMPORT_C TInt Distance(const TCoordinate& aCoordinate,
       
   119 	                       TReal32& aDistance) const;
       
   120 	IMPORT_C TInt Distance(const TLocality& aLocality,
       
   121 	                       TReal32& aDistance,
       
   122 	                       TReal32& aDelta) const;
       
   123 
       
   124 	IMPORT_C TInt BearingTo(const TCoordinate& aTargetCoordinate,
       
   125 	                        TReal32& aBearing) const;
       
   126 
       
   127 	IMPORT_C TInt BearingTo(const TLocality& aTargetLocality,
       
   128 	                        TReal32& aBearing,
       
   129 	                        TReal32& aDelta) const;
       
   130 
       
   131 protected:
       
   132 	/** Horizontal (earths-surface) accuracy, in metres. */
       
   133 	TReal32 iHorizontalAccuracy;
       
   134 	/** Altitudinal accuracy, in metres. */
       
   135 	TReal32 iVerticalAccuracy;
       
   136 
       
   137 private:
       
   138 	/** Unused variable for future expansion. */
       
   139 	TUint8 iReserved[16];
       
   140 	};
       
   141 
       
   142 
       
   143 class TPosition : public TLocality
       
   144 /**
       
   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.
       
   148  
       
   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).
       
   152 
       
   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.
       
   156 
       
   157 @publishedAll
       
   158 @released
       
   159  */
       
   160 	{
       
   161 public:
       
   162 	IMPORT_C TPosition();
       
   163 	IMPORT_C TPosition(const TLocality& aLocality,
       
   164 	                   TTime aTime);
       
   165 
       
   166 	IMPORT_C void SetTime(TTime aTime);
       
   167 	IMPORT_C void SetCurrentTime();
       
   168 
       
   169 	IMPORT_C TTime Time() const;
       
   170 
       
   171 	IMPORT_C TInt Speed(const TPosition& aPosition,
       
   172 	                    TReal32& aSpeed) const;
       
   173 	IMPORT_C TInt Speed(const TPosition& aPosition,
       
   174 	                    TReal32& aSpeed,
       
   175 	                    TReal32& aDelta) const;
       
   176 
       
   177 protected:
       
   178 	/** This is the system time when the position related member data was
       
   179 	obtained. */
       
   180 	TTime iTime;
       
   181 
       
   182 private:
       
   183 	/** Unused variable for future expansion. */
       
   184 	TUint8 iReserved[16];
       
   185 	};
       
   186 
       
   187 
       
   188 class TCourse
       
   189 /**
       
   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.
       
   194 
       
   195 @publishedAll
       
   196 @released
       
   197  */
       
   198 	{
       
   199 public:
       
   200 	IMPORT_C TCourse();
       
   201 
       
   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;
       
   208 
       
   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);
       
   215 
       
   216 protected:
       
   217 	/** Speed, in metres per second. */
       
   218 	TReal32 iSpeed;
       
   219 	/** Heading, in degrees. */
       
   220 	TReal32 iHeading;
       
   221 	/** Speed accuracy, in metres per second. */
       
   222 	TReal32 iSpeedAccuracy;
       
   223 	/** Heading accuracy, in degrees. */
       
   224 	TReal32 iHeadingAccuracy;
       
   225 	/** Course, in degrees. */
       
   226 	TReal32 iCourse;
       
   227 	/** Course accuracy, in degrees. */
       
   228 	TReal32 iCourseAccuracy;
       
   229 
       
   230 private:
       
   231 	/** Unused variable for future expansion. */
       
   232 	TUint8 iReserved[__LBS_TCOURSE_RESERVED_SIZE];
       
   233 	};
       
   234 
       
   235 #endif //__LBSPOSITION_H__