1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Class used by client applications to convert location |
|
15 * information |
|
16 * |
|
17 */ |
|
18 |
|
19 /** |
|
20 @file |
|
21 @publishedPartner |
|
22 @prototype |
|
23 */ |
|
24 |
|
25 #ifndef LBS_LOCATION_INFO_CONVERTER_H |
|
26 #define LBS_LOCATION_INFO_CONVERTER_H |
|
27 |
|
28 |
|
29 // OS wide |
|
30 #include <e32base.h> |
|
31 |
|
32 // LBS wide |
|
33 #include <lbs/lbslocationcommon.h> |
|
34 #include <lbs/lbslocationinfo.h> |
|
35 #include <lbs/lbslocationinfoconvertercommon.h> |
|
36 |
|
37 |
|
38 /** |
|
39 * The MLbsLocationInfoConverterObserver class is used in partnership with |
|
40 * CLbsLocationInfoConverter. The observer interface is used by the LBS |
|
41 * subsystem to inform a client application when a Locality conversion |
|
42 * process initiated through the CLbsLocationInfoConverter class has been |
|
43 * finished. In OnResolveLocationComplete the results will be returned |
|
44 * as an argument of the function, while OnConversionComplete indicates that the results |
|
45 * have been written in to the data that was passed in using ConvertLocationInfoL. |
|
46 * |
|
47 * Although all the interface methods in the MLbsLocationInfoConverterObserver |
|
48 * class are synchronous, the client application should ensure they return quickly |
|
49 * (e.g. any extensive processing of the received data is scheduled in another |
|
50 * active object). |
|
51 */ |
|
52 class MLbsLocationInfoConverterObserver |
|
53 { |
|
54 |
|
55 public: |
|
56 |
|
57 /** |
|
58 * Gets the current version of the observer interface. |
|
59 * Derived classes should not change the implementation. |
|
60 * |
|
61 * @return Version number (currently 1.0.0) |
|
62 */ |
|
63 IMPORT_C virtual TVersion Version() const; |
|
64 |
|
65 /** |
|
66 * The callback is used by the LBS subsystem to inform a client application |
|
67 * that a general purpose Locality conversion process initiated through the |
|
68 * CLbsLocationInfoConverter::ConvertLocationInfoL method has been finished. |
|
69 * |
|
70 * Receiving the callback indicates that, unless the conversion was not successful, |
|
71 * the location data structures passed through the |
|
72 * CLbsLocationInfoConverter::ConvertLocationInfoL method have been updated with the |
|
73 * requested information. |
|
74 * |
|
75 * @param aStatusCode Result of the conversion operation; |
|
76 * KErrNone if at least one conversion have been successful and |
|
77 * the related location data structure(s) passed through the |
|
78 * CLbsLocationInfoConverter::ConvertLocationInfoL method |
|
79 * have been updated with the requested information; |
|
80 * KErrNotSupported if the conversion type specified by |
|
81 * aRequestedInfo is not supported by converter plugin |
|
82 * KErrNotFound if none of conversions have been successful; |
|
83 * Or other system wide error code othervise. |
|
84 In here I think we should say that when the caller uses ConvertLocationInfoL( RLbsLocationInfoBaseArray& aLocationInfoArray, ..) then on OnConversionComplete the caller should iterate around all 'n' of the entries of the aLocationInfoArray and call GetAreaInfoL to see if there is any conversion results. OH I see below that you say something near the ConvertLocationInfoL method. Maybe should say it here as well to ti e together |
|
85 */ |
|
86 virtual void OnConversionComplete(TInt aStatusCode) = 0; |
|
87 |
|
88 }; |
|
89 |
|
90 |
|
91 |
|
92 |
|
93 /** |
|
94 * The CLbsLocationInfoConverter interface is used in partnership with MLbsLocationInfoConverterObserver |
|
95 * and provides the services to convert location information between different formats. |
|
96 * |
|
97 * Completion of conversions is indicated by the LBS subsystem by invoking callbacks defined |
|
98 * by the MLbsLocationInfoConverterObserver class. |
|
99 * |
|
100 * Currently the only supported conversion is from WLAN and/or GSM and/or WCDMA info into a geographic |
|
101 * Locality. |
|
102 */ |
|
103 NONSHARABLE_CLASS(CLbsLocationInfoConverter) : public CBase |
|
104 { |
|
105 |
|
106 public: |
|
107 |
|
108 /** |
|
109 * Allocates and construct a new CLbsLocationInfoConverter |
|
110 * @param[in] aObserver An observer for location conversion event. |
|
111 * @param[in] aConverterModuleId UID of the conversion plugin to be used. |
|
112 */ |
|
113 IMPORT_C static CLbsLocationInfoConverter* NewL( |
|
114 MLbsLocationInfoConverterObserver& aObserver, |
|
115 const TUid aConverterModuleId); |
|
116 |
|
117 /** |
|
118 * Allocates and construct a new CLbsLocationInfoConverter |
|
119 * Note here to say that impementations for both OnResolveLocationComplete and OnConversionComplete MUST be provided even though only interested in say, ConvertLocationFingerPrintToLocalityL |
|
120 * Opens the default module. |
|
121 * @param[in] aObserver An observer for location conversion event. |
|
122 */ |
|
123 IMPORT_C static CLbsLocationInfoConverter* NewL( |
|
124 MLbsLocationInfoConverterObserver& aObserver); |
|
125 |
|
126 /** |
|
127 * Destructor. |
|
128 */ |
|
129 IMPORT_C ~CLbsLocationInfoConverter(); |
|
130 |
|
131 /** |
|
132 * A general purpose function that converts a single locationinfo. |
|
133 * Completion of the conversion is indicated by the LBS subsystem by invoking the |
|
134 * MLbsLocationInfoConverterObserver::OnConversionComplete |
|
135 * and the caller can then iterate through the results returned in aLocationInfo |
|
136 * |
|
137 * @capability Location |
|
138 * |
|
139 * @param[in] aLocationInfo location information to be converted. |
|
140 * @param[in] aConversionPrefs Conversion preferences suggested by client |
|
141 * @param[in] aRequestedInfo Location information that is requested. Currently |
|
142 * the only supported conversion is from WLAN and/or GSM and/or WCDMA info into |
|
143 * a geographic position, hence the parameter should be set to ELbsConversionOutputPosition) |
|
144 * Need to say that can only do one of either ConvertLocationFingerPrintToLocalityL or ConvertLocationInfoL at a time or else user is panicked |
|
145 |
|
146 * @leave KErrNoMemory if there is not enough memory available to perform the conversion. |
|
147 * KErrArgument If the location info pointer is NULL. |
|
148 */ |
|
149 IMPORT_C void ConvertLocationInfoL( CLbsLocationInfoBase& aLocationInfo, |
|
150 const TLbsConversionPrefs aConversionPrefs, |
|
151 const TLbsConversionOutputInfoMask aRequestedInfo ); |
|
152 |
|
153 |
|
154 /** |
|
155 * A general purpose function that converts multiple locationinfos. |
|
156 * The maximum allowable batch size is defined by KPositionMaxBatchSize which is 500. |
|
157 * Exceeding KPositionMaxBatchSize will result in KErrNotSupported being reported. |
|
158 * |
|
159 * Completion of the conversion is indicated by the LBS subsystem by invoking the |
|
160 * MLbsLocationInfoConverterObserver::OnConversionComplete |
|
161 * and the caller can then iterate through the results returned in aLocationInfoArray |
|
162 * |
|
163 * @capability Location |
|
164 * |
|
165 * @param[in] aLocationInfo An array of location information to be converted. |
|
166 * @param[in] aConversionPrefs Conversion preferences suggested by client |
|
167 * @param[in] aRequestedInfo Location information that is requested. Currently |
|
168 * the only supported conversion is from WLAN and/or GSM and/or WCDMA info into |
|
169 * a geographic position, hence the parameter should be set to ELbsConversionOutputPosition) |
|
170 * |
|
171 * @leave KErrNoMemory if there is not enough memory available to perform the conversion. |
|
172 * KErrArgument If the location info pointer is NULL. |
|
173 * KErrNotSupported if the conversion type specified by |
|
174 * aRequestedInfo is not supported or if the bitmask specified by the |
|
175 * client has all options set. This error is also returned if the |
|
176 * batch size exceeds KPositionMaxBatchSize. |
|
177 */ |
|
178 IMPORT_C void ConvertLocationInfoL( RLbsLocationInfoBaseArray& aLocationInfoArray, |
|
179 const TLbsConversionPrefs aConversionPrefs, |
|
180 const TLbsConversionOutputInfoMask aRequestedInfo ); |
|
181 |
|
182 /** |
|
183 * Cancels an ongoing conversion operation. |
|
184 * If there is no ongoing conversion the cancellation request is ignored. |
|
185 * |
|
186 * Neither of the The MLbsLocationInfoConverterObserver callbacks will not be invoked if cancellation is successful. |
|
187 */ |
|
188 IMPORT_C void CancelConvertLocationInfo(); |
|
189 |
|
190 private: |
|
191 |
|
192 /** |
|
193 * Default constructor |
|
194 */ |
|
195 CLbsLocationInfoConverter(); |
|
196 |
|
197 /** |
|
198 * Symbian 2nd phase constructor. |
|
199 */ |
|
200 void ConstructL(MLbsLocationInfoConverterObserver& aObserver, |
|
201 const TUid aConverterModuleId); |
|
202 |
|
203 /** |
|
204 * Copy constructor. Restricted by default. |
|
205 */ |
|
206 CLbsLocationInfoConverter( CLbsLocationInfoConverter& ); |
|
207 |
|
208 /** |
|
209 * Overloaded assignment operator. Restricted by default. |
|
210 */ |
|
211 CLbsLocationInfoConverter& operator=( CLbsLocationInfoConverter& ); |
|
212 |
|
213 private: |
|
214 |
|
215 /** |
|
216 * Pointer to implementation class |
|
217 */ |
|
218 TAny* iLocationInfoConverterImpl; |
|
219 |
|
220 }; |
|
221 |
|
222 |
|
223 |
|
224 #endif // LBS_LOCATION_INFO_CONVERTER_H |
|