Attempt to represent the S^2->S^3 header reorganisation as a series of "hg rename" operations
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 __LBSPOSITIONINFO_H__
17 #define __LBSPOSITIONINFO_H__
19 #include <lbsposition.h>
20 #include <lbscommon.h>
21 #include <lbsfields.h>
24 The default size for a HPositionGenericInfo position information buffer
29 const TInt KPositionGenericInfoDefaultBufferSize = 1024;
32 The default number of requested fields for a HPositionGenericInfo
33 position information buffer
38 const TInt KPositionGenericInfoDefaultMaxFields = 32;
46 enum _TPositionUpdateType
48 /** EPositionUpdateUnknown */
49 EPositionUpdateUnknown = 0,
50 /** EPositionUpdateGeneral */
51 EPositionUpdateGeneral = 0x01
54 TPositionUpdateType code
58 typedef TUint32 TPositionUpdateType;
62 Position mode reasons. These values summarise the reasons why module
63 was unable to uses its preferred calculation mode when producing a
64 position update. The values are a bit mask that can be combined
65 to describe the various reasons.
67 NetworkError is used when there is no network coverage or
68 the service is unavailable.
70 LocalError represents environmental reasons that prevent a terminal
71 based calculation - such as no satellites in view.
73 DataError is returned when there is a problem with the initialisation
74 data. For example, GPS assistance data was received but it was
75 either invalid or could not be used..
80 enum _TPositionModeReason
82 /** Mode reason none */
83 EPositionModeReasonNone = 0,
84 /** Mode reason network error */
85 EPositionModeReasonNetworkError = 1 << 0,
86 /** Mode reason local error */
87 EPositionModeReasonLocalError = 1 << 1,
88 /** Mode reason data error */
89 EPositionModeReasonDataError = 1 << 2
93 TPositionModeReason code
97 typedef TUint32 TPositionModeReason;
100 class TPositionInfoBase : public TPositionClassTypeBase
102 This class provides the interface used by RPositioner to get a location fix,
103 and as such all classes used to get location info from the location server should
104 derive from this class.
106 Class contains info about the update type and the ID of the module that gave the
114 IMPORT_C TPositionModuleId ModuleId() const;
115 IMPORT_C void SetModuleId(TPositionModuleId aModuleId);
117 IMPORT_C TPositionUpdateType UpdateType() const;
118 IMPORT_C void SetUpdateType(TPositionUpdateType aUpdateType);
120 IMPORT_C TPositionModuleInfo::TTechnologyType PositionMode() const;
121 IMPORT_C void SetPositionMode(TPositionModuleInfo::TTechnologyType aMode);
123 IMPORT_C TPositionModeReason PositionModeReason() const;
124 IMPORT_C void SetPositionModeReason(TPositionModeReason aReason);
127 IMPORT_C TPositionInfoBase();
130 /** The Id of the module that gave the location fix. */
131 TPositionModuleId iModuleId;
132 /** The type of update that this location fix represents. */
135 /** The positioning mode used to calculate this location fix. */
136 TPositionModuleInfo::TTechnologyType iPositionMode;
138 /** The reason why the prefered position mode was not used. */
139 TPositionModeReason iPositionModeReason;
142 /** Unused variable for future expansion. */
147 class TPositionInfo : public TPositionInfoBase
149 Standard class for getting a TPosition location fix from the location server.
156 IMPORT_C TPositionInfo();
158 IMPORT_C void GetPosition(TPosition& aPosition) const;
159 IMPORT_C void SetPosition(const TPosition& aPosition);
162 /** The TPosition. */
167 class TPositionCourseInfo : public TPositionInfo
169 Class for getting a TCourse from the location server.
176 IMPORT_C TPositionCourseInfo();
178 IMPORT_C void GetCourse(TCourse& aCourse) const;
179 IMPORT_C void SetCourse(const TCourse& aCourse);
188 Class for getting arbitrary positioning related information back from the location server.
189 The client can set upto KPositionMaxRequestedFields as the number of requested fields.
190 The definitions of the fields are given in the enum #_TPositionFieldId. The client must
191 know what data type will be returned for each of the fields. The server will make a best
192 attempt to fill in the requested fields.
194 The client needs to allocate a big enough buffer to store the information it is requesting.
195 In order to be sure of getting back all the information the client must know and allocate
196 memory considering the return value for each requested field.
201 class HPositionGenericInfo : public TPositionInfo
205 IMPORT_C static HPositionGenericInfo* New(TInt aBufferSize = KPositionGenericInfoDefaultBufferSize,
206 TInt aMaxFields = KPositionGenericInfoDefaultMaxFields);
207 IMPORT_C static HPositionGenericInfo* NewL(TInt aBufferSize = KPositionGenericInfoDefaultBufferSize,
208 TInt aMaxFields = KPositionGenericInfoDefaultMaxFields);
209 IMPORT_C static HPositionGenericInfo* NewLC(TInt aBufferSize = KPositionGenericInfoDefaultBufferSize,
210 TInt aMaxFields = KPositionGenericInfoDefaultMaxFields);
211 IMPORT_C void ClearRequestedFields();
212 IMPORT_C TInt SetRequestedField(TPositionFieldId aFieldId);
213 IMPORT_C TInt SetRequestedFields(const TPositionFieldIdList aFieldIdList);
214 IMPORT_C TInt IsRequestedField(TPositionFieldId aFieldId) const;
215 IMPORT_C TPositionFieldId FirstRequestedFieldId() const;
216 IMPORT_C TPositionFieldId NextRequestedFieldId(TPositionFieldId aFieldId) const;
217 IMPORT_C TBool IsFieldAvailable(TPositionFieldId aFieldId) const;
218 IMPORT_C void ClearPositionData(); //Required on server side
219 IMPORT_C TInt BufferSize() const;
220 IMPORT_C TInt MaxFields() const;
223 * Used to store position information.
224 * @param aFieldId Standard position field identifier. See _TPositionFieldId
225 * @param[in] aValue The parameter aValue can be of the type
226 * TInt8, TInt16, TInt32, TInt64, TUint8, TUint16, TUint32,
227 * TReal32, TReal64, TTime, TTimeIntervalMicroSeconds, Des8, or Des16.
228 * @return a symbian OS error code.
229 * @return KErrNone on successful operation.
230 * @return KErrPositionBufferOverflow if the data contained in the
231 * parameter aValue cannot be added to the class due to the buffer being too small.
233 template <class TType>
234 inline TInt SetValue(TPositionFieldId aFieldId, const TType& aValue)
235 {return PositionFieldManager::SetValue(aFieldId, aValue, *this);}
238 * Used to retrieve position information.
239 * @param aFieldId Standard position field identifier. See _TPositionFieldId
240 * @param[out] aValue The parameter aValue can be of the type
241 * TInt8, TInt16, TInt32, TInt64, TUint8, TUint16, TUint32,
242 * TReal32, TReal64, TTime, TTimeIntervalMicroSeconds, Des8, or Des16.
243 * Panics with EPositionGenericInfoMismatchDataType if there is a
244 * mismatch in the data type of a field.
245 * @return a symbian OS error code.
246 * @return KErrNone on successful operation.
247 * @return KErrOverflow if the supplied descriptor is too short to contain the requested field.
248 * This method must use the same data type as that assigned by SetValue() .
250 template <class TType>
251 inline TInt GetValue(TPositionFieldId aFieldId, TType& aValue) const
252 {return PositionFieldManager::GetValue(aFieldId, aValue, *this);}
255 HPositionGenericInfo(TInt aDataBufferSize, TInt aMaxFields,
256 TUint aFieldIndexStartPoint, TUint aDataStartPoint, TBool aResetRequestedFields);
258 * internal private method
260 HPositionGenericInfo& operator=(const HPositionGenericInfo&);
262 * internal private method
264 HPositionGenericInfo(const HPositionGenericInfo&);
266 TInt FindEmptyRequestedFieldOffset(TInt& aEmptyFieldOffset) const;
269 * Helper method. For internal usage only
271 inline TPositionFieldId* RequestedFieldPtr();
273 * Helper method. For internal usage only
275 inline const TPositionFieldId* RequestedFieldPtr() const;
277 * Helper method. For internal usage only
279 inline TPositionFieldIndex* FieldIndexPtr();
281 * Helper method. For internal usage only
283 inline const TPositionFieldIndex* FieldIndexPtr() const;
286 friend class TPositionFieldSetter;
287 friend class TPositionFieldGetter;
289 /** Max number of requesable/returnable fields. */
290 const TInt iMaxFields;
292 /** Offset into iBuffer of the field index. */
293 const TUint iFieldIndexStartPoint;
295 /** Offset into iBuffer of the actual location data. */
296 const TUint iDataStartPoint;
298 /** Total size of the buffer */
299 const TInt iTotalBufferSize;
301 /** Start of the buffer. The heap cell allocated for an instance of this class
302 has space for information up to iBuffer[iTotalBufferSize-1]*/
303 TUint8 iBuffer[1]; //Must be at end of class
306 #endif //__LBSPOSITIONINFO_H__