2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * 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
6 * which accompanies this distribution, and is available
7 * at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
16 * Part of : Mobile Location Framework/Location FW
17 * Interface : Location Acquisition API
18 * Position data Fields manager
25 #ifndef __LBSFIELDS_H__
26 #define __LBSFIELDS_H__
29 #include <lbsfieldids.h>
32 * This header file defines the helper classes used by HPositionGenericInfo
33 * The client should not use this class to access any positioning related information.
34 * Instead the cleitn should use the methods provided by HGenericPositionInfo.
38 * Standard position field identifiers. It takes one of the enumerated values of _TPositionFieldId
42 typedef TUint16 TPositionFieldId;
45 * Array of standard position field identifiers
49 typedef TPositionFieldId TPositionFieldIdList[];
50 class HPositionGenericInfo;
54 * This is an internal class to provide the interface for the
55 * HPositionGenericInfo::GetValue() and HPositionGenericInfo::SetValue()
56 * methods. Methods in this class are not intended to be called directly.
57 * Clients should use HPositionGenericInfo::GetValue() and
58 * HPositionGenericInfo::SetValue() methods.
62 class PositionFieldManager
66 * Supported data types
70 /// Undefined data type. This value should not be used.
92 /// Time specified in microseconds
93 ETTimeIntervalMicroSeconds,
94 /// 8-bit descriptor datatype
96 /// 16-bit descriptor datatype
100 friend class HPositionGenericInfo;
103 * Set the value for a location field of data type TInt8 in the
104 * HPositionGenericInfo.
105 * @param aFieldId Id of the field to be copied into the HPositionGenericInfo.
106 * @param aValue Value to be copied into the HPositionGenericInfo.
107 * @param aInfo The HPositionGenericInfo object where this field needs to
109 * @return KErrArgument if aFieldId is EPositionFieldNone.
110 * @return KErrPositionBufferOverflow if aValue will not fit in the HPositionGenericInfo
112 * @return KErrOverflow if there are already KPositionMaxReturnableFields set in the
113 * HPositionGenericInfo object.
114 * @return KErrNone if the SetValue was successful.
116 IMPORT_C static TInt SetValue(TPositionFieldId aFieldId,
118 HPositionGenericInfo& aInfo);
121 * Get the value for a location field of data type TInt8 from the
122 * HPositionGenericInfo.
123 * @param aFieldId Id of the field for which the value should be read from
124 * HPositionGenericInfo.
125 * @param[out] aValue The object where the data from the
126 * HPositionGenericInfo is returned.
127 * @param[in] aInfo The HPositionGenericInfo object from where this field needs
129 * @return KErrNone is the operation was successful.
130 * @return KErrNotFound if an object with aFieldId cannot be found in aInfo.
132 IMPORT_C static TInt GetValue(TPositionFieldId aFieldId,
134 const HPositionGenericInfo& aInfo);
137 * Set the value for a location field of data type TInt16 in the
138 * HPositionGenericInfo.
139 * @param aFieldId Id of the field to be copied into the HPositionGenericInfo.
140 * @param aValue Value to be copied into the HPositionGenericInfo.
141 * @param aInfo The HPositionGenericInfo object where this field needs to
143 * @return KErrArgument if aFieldId is EPositionFieldNone.
144 * @return KErrPositionBufferOverflow if aValue will not fit in the HPositionGenericInfo
146 * @return KErrOverflow if there are already KPositionMaxReturnableFields set in the
147 * HPositionGenericInfo object.
148 * @return KErrNone if the SetValue was successful.
150 IMPORT_C static TInt SetValue(TPositionFieldId aFieldId,
152 HPositionGenericInfo& aInfo);
155 * Get the value for a location field of data type TInt16 from the
156 * HPositionGenericInfo.
157 * @param aFieldId Id of the field for which the value should be read from
158 * HPositionGenericInfo.
159 * @param[in] aValue The object where the data from the
160 * HPositionGenericInfo is returned.
161 * @param aInfo The HPositionGenericInfo object from where this field needs
163 * @return KErrNone is the operation was successful.
164 * @return KErrNotFound if an object with aFieldId cannot be found in aInfo.
166 IMPORT_C static TInt GetValue(TPositionFieldId aFieldId,
168 const HPositionGenericInfo& aInfo);
171 * Set the value for a location field of data type TInt32 in the
172 * HPositionGenericInfo.
173 * @param aFieldId Id of the field to be copied into the HPositionGenericInfo.
174 * @param aValue Value to be copied into the HPositionGenericInfo.
175 * @param aInfo The HPositionGenericInfo object where this field needs to
177 * @return KErrArgument if aFieldId is EPositionFieldNone.
178 * @return KErrPositionBufferOverflow if aValue will not fit in the HPositionGenericInfo
180 * @return KErrOverflow if there are already KPositionMaxReturnableFields set in the
181 * HPositionGenericInfo object.
182 * @return KErrNone if the SetValue was successful.
184 IMPORT_C static TInt SetValue(TPositionFieldId aFieldId,
186 HPositionGenericInfo& aInfo);
189 * Get the value for a location field of data type TInt32 from the
190 * HPositionGenericInfo.
191 * @param aFieldId Id of the field for which the value should be read from
192 * HPositionGenericInfo.
193 * @param[out] aValue The object where the data from the
194 * HPositionGenericInfo is returned.
195 * @param aInfo The HPositionGenericInfo object from where this field needs
197 * @return KErrNone is the operation was successful.
198 * @return KErrNotFound if an object with aFieldId cannot be found in aInfo.
200 IMPORT_C static TInt GetValue(TPositionFieldId aFieldId,
202 const HPositionGenericInfo& aInfo);
205 * Set the value for a location field of data type TInt64 in the
206 * HPositionGenericInfo.
207 * @param aFieldId Id of the field to be copied into the HPositionGenericInfo.
208 * @param aValue Value to be copied into the HPositionGenericInfo.
209 * @param aInfo The HPositionGenericInfo object where this field needs to
211 * @return KErrArgument if aFieldId is EPositionFieldNone.
212 * @return KErrPositionBufferOverflow if aValue will not fit in the HPositionGenericInfo
214 * @return KErrOverflow if there are already KPositionMaxReturnableFields set in the
215 * HPositionGenericInfo object.
216 * @return KErrNone if the SetValue was successful.
218 IMPORT_C static TInt SetValue(TPositionFieldId aFieldId,
219 const TInt64& aValue,
220 HPositionGenericInfo& aInfo);
223 * Get the value for a location field of data type TInt64 from the
224 * HPositionGenericInfo.
225 * @param aFieldId Id of the field for which the value should be read from
226 * HPositionGenericInfo.
227 * @param[out] aValue The object where the data from the
228 * HPositionGenericInfo is returned.
229 * @param aInfo The HPositionGenericInfo object from where this field needs
231 * @return KErrNone is the operation was successful.
232 * @return KErrNotFound if an object with aFieldId cannot be found in aInfo.
234 IMPORT_C static TInt GetValue(TPositionFieldId aFieldId,
236 const HPositionGenericInfo& aInfo);
239 * Set the value for a location field of data type TUint8 in the
240 * HPositionGenericInfo.
241 * @param aFieldId Id of the field to be copied into the HPositionGenericInfo.
242 * @param aValue Value to be copied into the HPositionGenericInfo.
243 * @param aInfo The HPositionGenericInfo object where this field needs to
245 * @return KErrArgument if aFieldId is EPositionFieldNone.
246 * @return KErrPositionBufferOverflow if aValue will not fit in the HPositionGenericInfo
248 * @return KErrOverflow if there are already KPositionMaxReturnableFields set in the
249 * HPositionGenericInfo object.
250 * @return KErrNone if the SetValue was successful.
252 IMPORT_C static TInt SetValue(TPositionFieldId aFieldId,
254 HPositionGenericInfo& aInfo);
257 * Get the value for a location field of data type TUint8 from the
258 * HPositionGenericInfo.
259 * @param aFieldId Id of the field for which the value should be read from
260 * HPositionGenericInfo.
261 * @param[out] aValue The object where the data from the
262 * HPositionGenericInfo is returned.
263 * @param aInfo The HPositionGenericInfo object from where this field needs
265 * @return KErrNone is the operation was successful.
266 * @return KErrNotFound if an object with aFieldId cannot be found in aInfo.
268 IMPORT_C static TInt GetValue(TPositionFieldId aFieldId,
270 const HPositionGenericInfo& aInfo);
273 * Set the value for a location field of data type TUint16 in the
274 * HPositionGenericInfo.
275 * @param aFieldId Id of the field to be copied into the HPositionGenericInfo.
276 * @param aValue Value to be copied into the HPositionGenericInfo.
277 * @param aInfo The HPositionGenericInfo object where this field needs to
279 * @return KErrArgument if aFieldId is EPositionFieldNone.
280 * @return KErrPositionBufferOverflow if aValue will not fit in the HPositionGenericInfo
282 * @return KErrOverflow if there are already KPositionMaxReturnableFields set in the
283 * HPositionGenericInfo object.
284 * @return KErrNone if the SetValue was successful.
286 IMPORT_C static TInt SetValue(TPositionFieldId aFieldId,
288 HPositionGenericInfo& aInfo);
291 * Get the value for a location field of data type TUint16 from the
292 * HPositionGenericInfo.
293 * @param aFieldId Id of the field for which the value should be read from
294 * HPositionGenericInfo.
295 * @param[out] aValue The object where the data from the
296 * HPositionGenericInfo is returned.
297 * @param aInfo The HPositionGenericInfo object from where this field needs
299 * @return KErrNone is the operation was successful.
300 * @return KErrNotFound if an object with aFieldId cannot be found in aInfo.
302 IMPORT_C static TInt GetValue(TPositionFieldId aFieldId,
304 const HPositionGenericInfo& aInfo);
307 * Set the value for a location field of data type TUint32 in the
308 * HPositionGenericInfo.
309 * @param aFieldId Id of the field to be copied into the HPositionGenericInfo.
310 * @param aValue Value to be copied into the HPositionGenericInfo.
311 * @param aInfo The HPositionGenericInfo object where this field needs to
313 * @return KErrArgument if aFieldId is EPositionFieldNone.
314 * @return KErrPositionBufferOverflow if aValue will not fit in the HPositionGenericInfo
316 * @return KErrOverflow if there are already KPositionMaxReturnableFields set in the
317 * HPositionGenericInfo object.
318 * @return KErrNone if the SetValue was successful.
320 IMPORT_C static TInt SetValue(TPositionFieldId aFieldId,
322 HPositionGenericInfo& aInfo);
325 * Get the value for a location field of data type TUint32 from the
326 * HPositionGenericInfo.
327 * @param aFieldId Id of the field for which the value should be read from
328 * HPositionGenericInfo.
329 * @param[out] aValue The object where the data from the
330 * HPositionGenericInfo is returned.
331 * @param aInfo The HPositionGenericInfo object from where this field needs
333 * @return KErrNone is the operation was successful.
334 * @return KErrNotFound if an object with aFieldId cannot be found in aInfo.
336 IMPORT_C static TInt GetValue(TPositionFieldId aFieldId,
338 const HPositionGenericInfo& aInfo);
341 * Set the value for a location field of data type TReal32 in the
342 * HPositionGenericInfo.
343 * @param aFieldId Id of the field to be copied into the HPositionGenericInfo.
344 * @param aValue Value to be copied into the HPositionGenericInfo.
345 * @param aInfo The HPositionGenericInfo object where this field needs to
347 * @return KErrArgument if aFieldId is EPositionFieldNone.
348 * @return KErrPositionBufferOverflow if aValue will not fit in the HPositionGenericInfo
350 * @return KErrOverflow if there are already KPositionMaxReturnableFields set in the
351 * HPositionGenericInfo object.
352 * @return KErrNone if the SetValue was successful.
354 IMPORT_C static TInt SetValue(TPositionFieldId aFieldId,
356 HPositionGenericInfo& aInfo);
359 * Get the value for a location field of data type TReal32 from the
360 * HPositionGenericInfo.
361 * @param aFieldId Id of the field for which the value should be read from
362 * HPositionGenericInfo.
363 * @param[out] aValue The object where the data from the
364 * HPositionGenericInfo is returned.
365 * @param aInfo The HPositionGenericInfo object from where this field needs
367 * @return KErrNone is the operation was successful.
368 * @return KErrNotFound if an object with aFieldId cannot be found in aInfo.
370 IMPORT_C static TInt GetValue(TPositionFieldId aFieldId,
372 const HPositionGenericInfo& aInfo);
375 * Set the value for a location field of data type TReal64 in the
376 * HPositionGenericInfo.
377 * @param aFieldId Id of the field to be copied into the HPositionGenericInfo.
378 * @param aValue Value to be copied into the HPositionGenericInfo.
379 * @param aInfo The HPositionGenericInfo object where this field needs to
381 * @return KErrArgument if aFieldId is EPositionFieldNone.
382 * @return KErrPositionBufferOverflow if aValue will not fit in the HPositionGenericInfo
384 * @return KErrOverflow if there are already KPositionMaxReturnableFields set in the
385 * HPositionGenericInfo object.
386 * @return KErrNone if the SetValue was successful.
388 IMPORT_C static TInt SetValue(TPositionFieldId aFieldId,
389 const TReal64& aValue,
390 HPositionGenericInfo& aInfo);
393 * Get the value for a location field of data type TReal64 from the
394 * HPositionGenericInfo.
395 * @param aFieldId Id of the field for which the value should be read from
396 * HPositionGenericInfo.
397 * @param[out] aValue The object where the data from the
398 * HPositionGenericInfo is returned.
399 * @param aInfo The HPositionGenericInfo object from where this field needs
401 * @return KErrNone is the operation was successful.
402 * @return KErrNotFound if an object with aFieldId cannot be found in aInfo.
404 IMPORT_C static TInt GetValue(TPositionFieldId aFieldId,
406 const HPositionGenericInfo& aInfo);
409 * Set the value for a location field of data type TDesC8 & TDes8 in the
410 * HPositionGenericInfo.
411 * @param aFieldId Id of the field to be copied into the HPositionGenericInfo.
412 * @param aValue Value to be copied into the HPositionGenericInfo.
413 * @param aInfo The HPositionGenericInfo object where this field needs to
415 * @return KErrArgument if aFieldId is EPositionFieldNone.
416 * @return KErrPositionBufferOverflow if aValue will not fit in the HPositionGenericInfo
418 * @return KErrOverflow if there are already KPositionMaxReturnableFields set in the
419 * HPositionGenericInfo object.
420 * @return KErrNone if the SetValue was successful.
422 IMPORT_C static TInt SetValue(TPositionFieldId aFieldId,
423 const TDesC8& aValue,
424 HPositionGenericInfo& aInfo);
427 * Get the value for a location field of data type TDes8 from the
428 * HPositionGenericInfo.
429 * @param aFieldId Id of the field for which the value should be read from
430 * HPositionGenericInfo.
431 * @param[out] aValue The object where the data from the
432 * HPositionGenericInfo is returned.
433 * @param aInfo The HPositionGenericInfo object from where this field needs
435 * @return KErrNone is the operation was successful.
436 * @return KErrNotFound if an object with aFieldId cannot be found in aInfo.
438 IMPORT_C static TInt GetValue(TPositionFieldId aFieldId,
440 const HPositionGenericInfo& aInfo);
443 * Set the value for a location field of data type TDesC16 & TDes16 in the
444 * HPositionGenericInfo.
445 * @param aFieldId Id of the field to be copied into the HPositionGenericInfo.
446 * @param aValue Value to be copied into the HPositionGenericInfo.
447 * @param aInfo The HPositionGenericInfo object where this field needs to
449 * @return KErrArgument if aFieldId is EPositionFieldNone.
450 * @return KErrPositionBufferOverflow if aValue will not fit in the HPositionGenericInfo
452 * @return KErrOverflow if there are already KPositionMaxReturnableFields set in the
453 * HPositionGenericInfo object.
454 * @return KErrNone if the SetValue was successful.
456 IMPORT_C static TInt SetValue(TPositionFieldId aFieldId,
457 const TDesC16& aValue,
458 HPositionGenericInfo& aInfo);
461 * Get the value for a location field of data type TDes16 from the
462 * HPositionGenericInfo.
463 * @param aFieldId Id of the field for which the value should be read from
464 * HPositionGenericInfo.
465 * @param[out] aValue The object where the data from the
466 * HPositionGenericInfo is returned.
467 * @param aInfo The HPositionGenericInfo object from where this field needs
469 * @return KErrNone is the operation was successful.
470 * @return KErrNotFound if an object with aFieldId cannot be found in aInfo.
472 IMPORT_C static TInt GetValue(TPositionFieldId aFieldId,
474 const HPositionGenericInfo& aInfo);
477 * Get the value for a location field of data type TPtrC8 from the
478 * HPositionGenericInfo.
479 * @param aFieldId Id of the field for which the value should be read from
480 * HPositionGenericInfo.
481 * @param[out] aValue The object where the data from the
482 * HPositionGenericInfo is returned.
483 * @param aInfo The HPositionGenericInfo object from where this field needs
485 * @return KErrNone is the operation was successful.
486 * @return KErrNotFound if an object with aFieldId cannot be found in aInfo.
488 IMPORT_C static TInt GetValue(TPositionFieldId aFieldId,
490 const HPositionGenericInfo& aInfo);
493 * Get the value for a location field of data type TPtrC16 from the
494 * HPositionGenericInfo.
495 * @param aFieldId Id of the field for which the value should be read from
496 * HPositionGenericInfo.
497 * @param[out] aValue The object where the data from the
498 * HPositionGenericInfo is returned.
499 * @param aInfo The HPositionGenericInfo object from where this field needs
501 * @return KErrNone is the operation was successful.
502 * @return KErrNotFound if an object with aFieldId cannot be found in aInfo.
504 IMPORT_C static TInt GetValue(TPositionFieldId aFieldId,
506 const HPositionGenericInfo& aInfo);
509 * Set the value for a location field of data type TTime in the
510 * HPositionGenericInfo.
511 * @param aFieldId Id of the field to be copied into the HPositionGenericInfo.
512 * @param aValue Value to be copied into the HPositionGenericInfo.
513 * @param aInfo The HPositionGenericInfo object where this field needs to
515 * @return KErrArgument if aFieldId is EPositionFieldNone.
516 * @return KErrPositionBufferOverflow if aValue will not fit in the HPositionGenericInfo
518 * @return KErrOverflow if there are already KPositionMaxReturnableFields set in the
519 * HPositionGenericInfo object.
520 * @return KErrNone if the SetValue was successful.
522 IMPORT_C static TInt SetValue(TPositionFieldId aFieldId,
524 HPositionGenericInfo& aInfo);
527 * Get the value for a location field of data type TTime from the
528 * HPositionGenericInfo.
529 * @param aFieldId Id of the field for which the value should be read from
530 * HPositionGenericInfo.
531 * @param[out] aValue The object where the data from the
532 * HPositionGenericInfo is returned.
533 * @param aInfo The HPositionGenericInfo object from where this field needs
535 * @return KErrNone is the operation was successful.
536 * @return KErrNotFound if an object with aFieldId cannot be found in aInfo.
538 IMPORT_C static TInt GetValue(TPositionFieldId aFieldId,
540 const HPositionGenericInfo& aInfo);
543 * Set the value for a location field of data type TTimeIntervalMicroSeconds in the
544 * HPositionGenericInfo.
545 * @param aFieldId Id of the field to be copied into the HPositionGenericInfo.
546 * @param aValue Value to be copied into the HPositionGenericInfo.
547 * @param aInfo The HPositionGenericInfo object where this field needs to
549 * @return KErrArgument if aFieldId is EPositionFieldNone.
550 * @return KErrPositionBufferOverflow if aValue will not fit in the HPositionGenericInfo
552 * @return KErrOverflow if there are already KPositionMaxReturnableFields set in the
553 * HPositionGenericInfo object.
554 * @return KErrNone if the SetValue was successful.
556 IMPORT_C static TInt SetValue(TPositionFieldId aFieldId,
557 const TTimeIntervalMicroSeconds& aValue,
558 HPositionGenericInfo& aInfo);
561 * Get the value for a location field of data type TTimeIntervalMicroSeconds from the
562 * HPositionGenericInfo.
563 * @param aFieldId Id of the field for which the value should be read from
564 * HPositionGenericInfo.
565 * @param[out] aValue The object where the data from the
566 * HPositionGenericInfo is returned.
567 * @param aInfo The HPositionGenericInfo object from where this field needs
569 * @return KErrNone is the operation was successful.
570 * @return KErrNotFound if an object with aFieldId cannot be found in aInfo.
572 IMPORT_C static TInt GetValue(TPositionFieldId aFieldId,
573 TTimeIntervalMicroSeconds& aValue,
574 const HPositionGenericInfo& aInfo);
578 * This is an internal class used for indexing entries in HPositionGenericInfo.
579 * Methods in this class are not intended to be called directly. Clients should use
580 * HPositionGenericInfo::GetValue() and HPositionGenericInfo::SetValue() methods.
581 * @internalTechnology
584 class TPositionFieldIndex
588 inline TPositionFieldIndex();
591 * Get the field ID referred to by this object.
592 * @return The Field Id. The Id is one of the enumerated values of
593 * #_TPositionFieldId.
595 inline TPositionFieldId FieldId() const;
597 * Get the offset in buffer where this field is contained.
598 * @return The offset in the buffer.
600 inline TUint16 FieldStartPos() const;
602 * Get the data type of this field.
603 * @return The data type of this field. The data type is one of the
604 * enumerated values of PositionFieldManager::TFieldType.
606 inline PositionFieldManager::TFieldType FieldType() const;
608 * Set the field ID referred to by this object.
609 * @param aFieldId The Id of the field referred by this object. The Id is
610 * one of the enumerated values of #_TPositionFieldId.
612 inline void SetFieldId(TPositionFieldId aFieldId);
614 * Set the offset in buffer where this field is contained.
615 * @param aFieldStartPos The offset in the buffer where this field is added.
617 inline void SetFieldStartPos(TUint16 aFieldStartPos);
619 * Set the data type of this field.
620 * @param aFieldType The data type of this field. The data type is one of
621 * the enumerated values of PositionFieldManager::TFieldType.
623 inline void SetFieldType(PositionFieldManager::TFieldType aFieldType);
626 /** Id of the field that this index refers to. */
627 TPositionFieldId iFieldId;
628 /** Offset from HPositionGenericInfo::iBuffer that the object referred to by
629 this index starts at. */
630 TUint16 iFieldStartPos;
631 /** Type of the data that this index refers to. */
632 PositionFieldManager::TFieldType iFieldType;
635 #endif //__LBSFIELDS_H__