1 lbscriteria.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 __LBSCRITERIA_H__ |
|
17 #define __LBSCRITERIA_H__ |
|
18 |
|
19 #include <lbscommon.h> |
|
20 |
|
21 |
|
22 class TPositionSelectionOrder |
|
23 /** |
|
24 This class is used as part of the TPositionCriteria class to chose a |
|
25 positioning module that will provide the desired quality of information. |
|
26 It allows position-quality-metrics to be given priorities, enabling them |
|
27 to be given preference in the decision. |
|
28 |
|
29 @publishedAll |
|
30 @released |
|
31 */ |
|
32 { |
|
33 public: |
|
34 /** |
|
35 Specifies the priority of selection parameters. |
|
36 */ |
|
37 enum TOrder |
|
38 { |
|
39 /** Don't care */ |
|
40 EOrderDontCare = 0, |
|
41 /** Default */ |
|
42 EOrderDefault = 1, |
|
43 /** Very low */ |
|
44 EOrderVeryLow = 25, |
|
45 /** Low */ |
|
46 EOrderLow = 50, |
|
47 /** Fairly low */ |
|
48 EOrderFairlyLow = 75, |
|
49 /** Medium */ |
|
50 EOrderMedium = 100, |
|
51 /** Fairly high */ |
|
52 EOrderFairlyHigh = 125, |
|
53 /** High */ |
|
54 EOrderHigh = 150, |
|
55 /** Very high */ |
|
56 EOrderVeryHigh = 175 |
|
57 }; |
|
58 |
|
59 /** |
|
60 Specifies the quality of position metrics that can be prioritized. |
|
61 */ |
|
62 enum TField |
|
63 { |
|
64 /** Time to first fix */ |
|
65 EFieldTimeToFirstFix, |
|
66 /** Time to next fix */ |
|
67 EFieldTimeToNextFix, |
|
68 /** Field Horizontal Accuracy */ |
|
69 EFieldHorizontalAccuracy, |
|
70 /** Field Vertical Accuracy */ |
|
71 EFieldVerticalAccuracy, |
|
72 /** Field cost */ |
|
73 EFieldCost, |
|
74 /** Field power */ |
|
75 EFieldPower, |
|
76 /** Number of fields */ |
|
77 EFieldNumFields, // Do not use this value. Must appear after all other field values. |
|
78 /** Last field */ |
|
79 EFieldLast = KMaxTInt8 // Do not use this value. Must appear at end. |
|
80 }; |
|
81 |
|
82 IMPORT_C TPositionSelectionOrder(); |
|
83 |
|
84 IMPORT_C TInt SetOrderTimeToFirstFix(TOrder aOrder); |
|
85 IMPORT_C TInt SetOrderTimeToNextFix(TOrder aOrder); |
|
86 |
|
87 IMPORT_C TInt SetOrderHorizontalAccuracy(TOrder aOrder); |
|
88 IMPORT_C TInt SetOrderVerticalAccuracy(TOrder aOrder); |
|
89 |
|
90 IMPORT_C TInt SetOrderCostIndicator(TOrder aOrder); |
|
91 IMPORT_C TInt SetOrderPowerConsumption(TOrder aOrder); |
|
92 |
|
93 IMPORT_C void ResetSelectionOrder(); |
|
94 IMPORT_C void ClearSelectionOrder(); |
|
95 |
|
96 IMPORT_C TUint NumSelectionItems() const; |
|
97 IMPORT_C TInt GetSelectionItem(TUint aIndex, |
|
98 TField& aField, |
|
99 TOrder& aOrder) const; |
|
100 |
|
101 protected: |
|
102 struct SItem |
|
103 /** |
|
104 Stores a field / priority pair. |
|
105 |
|
106 @publishedAll |
|
107 @released |
|
108 */ |
|
109 { |
|
110 /** A position quality metric identifier. */ |
|
111 TField iField; |
|
112 /** The priority given to the iField position quality metric. */ |
|
113 TOrder iOrder; |
|
114 }; |
|
115 |
|
116 protected: |
|
117 TInt AddItem(TField aField, TOrder aOrder); |
|
118 |
|
119 protected: |
|
120 /** The number of selection items in the iItems array. */ |
|
121 TUint iNumItems; |
|
122 /** Array of users position quality priorities. */ |
|
123 SItem iItems[KPositionMaxSectionFields]; |
|
124 }; |
|
125 |
|
126 /** |
|
127 TPositionCriteriaBase derived classes class types |
|
128 // If the following line generates an error, too many fields have been added |
|
129 // to the TPositionSelectionOrder::TOrder enumeration, some must be removed |
|
130 // to maintain BC. |
|
131 @publishedAll |
|
132 @released |
|
133 */ |
|
134 POSITION_COMPILE_TIME_ASSERT(TPositionSelectionOrder::EFieldNumFields <= KPositionMaxSectionFields); |
|
135 |
|
136 |
|
137 class TPositionCriteriaBase : public TPositionClassTypeBase |
|
138 /** |
|
139 The base class for classes used to store position module selection |
|
140 criteria information. |
|
141 |
|
142 @publishedAll |
|
143 @released |
|
144 */ |
|
145 { |
|
146 protected: |
|
147 IMPORT_C TPositionCriteriaBase(); |
|
148 IMPORT_C TPositionCriteriaBase(TPositionModuleInfo::TCapabilities aCapabilityMask); |
|
149 |
|
150 public: |
|
151 IMPORT_C void AddRequiredCapabilities(TPositionModuleInfo::TCapabilities aCapabilityMask); |
|
152 IMPORT_C void ClearRequiredCapabilities(); |
|
153 IMPORT_C TPositionModuleInfo::TCapabilities RequiredCapabilities() const; |
|
154 |
|
155 IMPORT_C void SetRequiredQuality(const TPositionQuality& aPosQuality); |
|
156 IMPORT_C void GetRequiredQuality(TPositionQuality& aPosQuality) const; |
|
157 |
|
158 IMPORT_C void SetSelectionOrder(const TPositionSelectionOrder& aSelectionOrder); |
|
159 IMPORT_C void GetSelectionOrder(TPositionSelectionOrder& aSelectionOrder) const; |
|
160 |
|
161 IMPORT_C void ResetCriteria(); |
|
162 IMPORT_C void ClearCriteria(); |
|
163 |
|
164 protected: |
|
165 /** The capabilities a positioning module must have. */ |
|
166 TPositionModuleInfo::TCapabilities iRequiredCaps; |
|
167 /** The quality required of a positioning module. */ |
|
168 TPositionQuality iRequiredQuality; |
|
169 /** The priorities assigned to the various quality metrics. */ |
|
170 TPositionSelectionOrder iSelectionOrder; |
|
171 }; |
|
172 |
|
173 |
|
174 class TPositionCriteria : public TPositionCriteriaBase |
|
175 /** |
|
176 The standard class criteria class for selecting a positioning module. |
|
177 |
|
178 @publishedAll |
|
179 @released |
|
180 */ |
|
181 { |
|
182 public: |
|
183 IMPORT_C TPositionCriteria(); |
|
184 IMPORT_C TPositionCriteria(TPositionModuleInfo::TCapabilities aCapabilityMask); |
|
185 |
|
186 private: |
|
187 /** Unused variable for future expansion. */ |
|
188 TUint8 iReserved[4]; |
|
189 }; |
|
190 |
|
191 #endif // __LBSCRITERIA_H__ |