|
1 /* |
|
2 * Copyright (c) 2005 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: |
|
15 * ?description_line |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #ifndef CPOSLMDATABASEMANAGERIMPL_H |
|
21 #define CPOSLMDATABASEMANAGERIMPL_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32base.h> |
|
25 #include <badesca.h> |
|
26 #include <EPos_CPosLmDatabaseManager.h> |
|
27 #include <EPos_TPosLmDatabaseEvent.h> |
|
28 #include <EPos_TPosLmDatabaseSettings.h> |
|
29 #include <EPos_HPosLmDatabaseInfo.h> |
|
30 #include "FT_RPosLandmarkServer.h" |
|
31 #include "EPos_RPosLmDatabaseEventListener.h" |
|
32 |
|
33 // FORWARD DECLARATIONS |
|
34 class CPosLmSettingsHandler; |
|
35 class CPosLmDbManPluginStore; |
|
36 class CPosLmDatabaseManagerPluginBase; |
|
37 |
|
38 // CLASS DECLARATION |
|
39 |
|
40 /** |
|
41 * This class is used to manage landmark databases. It implements the common |
|
42 * database management methods in @refCPosLmDatabaseManager and loads |
|
43 * protocol-specific database management provider implementations. |
|
44 * |
|
45 * @p CPosLmDatabaseManagerImpl contains functions for listing registering, |
|
46 * unregistering, creating, deleting, copying landmark databases, etc. |
|
47 * It also has functions for managing the default landmark database. The |
|
48 * client can listen to events related to database management. |
|
49 * |
|
50 * @lib eposlmdbmanprov.lib |
|
51 * @since Series 60 3.0 |
|
52 * @version $Revision: 1.1 $, $Date: 2005/03/07 15:36:15 $ |
|
53 */ |
|
54 class CPosLmDatabaseManagerImpl : public CPosLmDatabaseManager |
|
55 { |
|
56 public: |
|
57 |
|
58 /** |
|
59 * Two-phased constructor. |
|
60 * |
|
61 * @since Series 60 3.0 |
|
62 */ |
|
63 static CPosLmDatabaseManagerImpl* NewL(); |
|
64 |
|
65 /** |
|
66 * Destructor. |
|
67 * |
|
68 * @since Series 60 3.0 |
|
69 */ |
|
70 virtual ~CPosLmDatabaseManagerImpl(); |
|
71 |
|
72 public: // Functions from base classes |
|
73 |
|
74 /** |
|
75 * From CPosLmDatabaseManager. |
|
76 * |
|
77 * @return The URI of the default landmark database. The client takes |
|
78 * ownership of the descriptor object. |
|
79 */ |
|
80 HBufC* DefaultDatabaseUriLC(); |
|
81 |
|
82 /** |
|
83 * From CPosLmDatabaseManager. |
|
84 * |
|
85 * @param aDatabaseUri The URI of the database which should be set as |
|
86 * default. |
|
87 */ |
|
88 void SetDefaultDatabaseUriL( |
|
89 /* IN */ const TDesC& aDatabaseUri |
|
90 ); |
|
91 |
|
92 /** |
|
93 * From CPosLmDatabaseManager. |
|
94 * |
|
95 * @param aEvent Contains the event information when an event |
|
96 * occurs. |
|
97 * @param aStatus Is completed with @p KErrNone if an event |
|
98 * occurs or an error code if some error is encountered. |
|
99 */ |
|
100 void NotifyDatabaseEvent( |
|
101 /* OUT */ TPosLmDatabaseEvent& aEvent, |
|
102 /* OUT */ TRequestStatus& aStatus |
|
103 ); |
|
104 |
|
105 /** |
|
106 * From CPosLmDatabaseManager. |
|
107 * |
|
108 * @return @p KErrNone if the request was successfully cancelled, |
|
109 * otherwise a system wide error code. |
|
110 */ |
|
111 TInt CancelNotifyDatabaseEvent(); |
|
112 |
|
113 /** |
|
114 * From CPosLmDatabaseManager. |
|
115 * |
|
116 * @return The database URI associated with the event. The client takes |
|
117 * ownership of the descriptor object. |
|
118 */ |
|
119 HBufC* DatabaseUriFromLastEventLC(); |
|
120 |
|
121 /** |
|
122 * From CPosLmDatabaseManager. |
|
123 * |
|
124 * @param aProtocol The protocol for which database URIs should be |
|
125 * listed. If no protocol is specified, i.e. if an empty string is |
|
126 * specified, all known database URIs are listed. |
|
127 * @return The list of database URIs. |
|
128 */ |
|
129 CDesCArray* ListDatabasesLC( |
|
130 /* IN */ const TDesC& aProtocol = KNullDesC |
|
131 ); |
|
132 |
|
133 /** |
|
134 * From CPosLmDatabaseManager. |
|
135 * |
|
136 * @param aDatabaseInfoArray On return, contains information about |
|
137 * the landmark databases. Any objects which are in the array when |
|
138 * it is passed to this function are not be removed. |
|
139 * @param aProtocol The protocol for which database URIs should be |
|
140 * listed. If no protocol is specified, i.e. if an empty string is |
|
141 * specified, all known database URIs are listed. |
|
142 */ |
|
143 void ListDatabasesL( |
|
144 /* OUT */ RPointerArray<HPosLmDatabaseInfo>& aDatabaseInfoArray, |
|
145 /* IN */ const TDesC& aProtocol = KNullDesC |
|
146 ); |
|
147 |
|
148 /** |
|
149 * From CPosLmDatabaseManager. |
|
150 * |
|
151 * @param aDatabaseInfo Information about the landmark database to |
|
152 * register. |
|
153 */ |
|
154 void RegisterDatabaseL( |
|
155 /* IN/OUT */ HPosLmDatabaseInfo& aDatabaseInfo |
|
156 ); |
|
157 |
|
158 /** |
|
159 * From CPosLmDatabaseManager. |
|
160 * |
|
161 * @param aDatabaseUri The URI of the database to register. |
|
162 */ |
|
163 void UnregisterDatabaseL( |
|
164 /* IN */ const TDesC& aDatabaseUri |
|
165 ); |
|
166 |
|
167 /** |
|
168 * From CPosLmDatabaseManager. |
|
169 * |
|
170 * @param aProtocol The protocol to unregister all databases for. |
|
171 */ |
|
172 void UnregisterAllDatabasesL( |
|
173 /* IN */ const TDesC& aProtocol |
|
174 ); |
|
175 |
|
176 /** |
|
177 * From CPosLmDatabaseManager. |
|
178 * |
|
179 * @param aDatabaseUri The URI of the database to modify settings for. |
|
180 * @param aDatabaseSettings The new settings for the database. |
|
181 */ |
|
182 void ModifyDatabaseSettingsL( |
|
183 /* IN */ const TDesC& aDatabaseUri, |
|
184 /* IN */ const TPosLmDatabaseSettings& aDatabaseSettings |
|
185 ); |
|
186 |
|
187 /** |
|
188 * From CPosLmDatabaseManager. |
|
189 * |
|
190 * @param aDatabaseInfo An information object containing the URI of the |
|
191 * landmark database. On return, the object contains information about |
|
192 * the landmark database, including any database settings. |
|
193 */ |
|
194 void GetDatabaseInfoL( |
|
195 /* IN/OUT */ HPosLmDatabaseInfo& aDatabaseInfo |
|
196 ); |
|
197 |
|
198 /** |
|
199 * From CPosLmDatabaseManager. |
|
200 * |
|
201 * @param aDatabaseUri The URI of the database which should be checked |
|
202 * for existence. |
|
203 * @return @p ETrue if the database exists, otherwise @p EFalse. |
|
204 */ |
|
205 TBool DatabaseExistsL( |
|
206 /* IN */ const TDesC& aDatabaseUri |
|
207 ); |
|
208 |
|
209 /** |
|
210 * From CPosLmDatabaseManager. |
|
211 * |
|
212 * @param aDatabaseUri The URI of the new database. |
|
213 */ |
|
214 void CreateDatabaseL( |
|
215 /* IN/OUT */ HPosLmDatabaseInfo& aDatabaseInfo |
|
216 ); |
|
217 |
|
218 /** |
|
219 * From CPosLmDatabaseManager. |
|
220 * |
|
221 * @param aDatabaseUri The URI of the database to delete. |
|
222 */ |
|
223 void DeleteDatabaseL( |
|
224 /* IN */ const TDesC& aDatabaseUri |
|
225 ); |
|
226 |
|
227 /** |
|
228 * From CPosLmDatabaseManager. |
|
229 * |
|
230 * @param aSourceUri The URI of the database to copy. |
|
231 * @param aTargetUri The URI of the new database location. |
|
232 */ |
|
233 void CopyDatabaseL( |
|
234 /* IN */ const TDesC& aSourceUri, |
|
235 /* IN */ const TDesC& aTargetUri |
|
236 ); |
|
237 |
|
238 protected: |
|
239 |
|
240 /** |
|
241 * C++ default constructor. |
|
242 */ |
|
243 CPosLmDatabaseManagerImpl(); |
|
244 |
|
245 private: |
|
246 |
|
247 /** |
|
248 * By default Symbian 2nd phase constructor is private. |
|
249 */ |
|
250 void ConstructL(); |
|
251 |
|
252 /** |
|
253 * Validates URI and extracts protocol. |
|
254 * Leaves with @p KErrArgument if the protocol is empty or |
|
255 * does not exist. |
|
256 */ |
|
257 static const TPtrC GetProtocolFromUriL( |
|
258 /* IN */ const TDesC& aUri |
|
259 ); |
|
260 |
|
261 /** |
|
262 * Validates URI, i.e. checks that there is a protocol separator |
|
263 * and the protocol part is not empty. |
|
264 * Leaves with @p KErrArgument if the protocol is empty or |
|
265 * does not exist. |
|
266 */ |
|
267 static void ValidateUriL( |
|
268 /* IN */ const TDesC& aUri |
|
269 ); |
|
270 |
|
271 /** |
|
272 * Returns @p ETrue if database URI starts with "file". |
|
273 */ |
|
274 TBool IsLocalDatabase( |
|
275 /* IN */ const TDesC& aUri |
|
276 ); |
|
277 |
|
278 /** |
|
279 * Retrieves the default database display name from the resource file. |
|
280 */ |
|
281 HBufC* DefaultDatabaseDisplayNameL(); |
|
282 |
|
283 /** |
|
284 * Fills in default flag, database drive and media type in |
|
285 * each object in the array. Helper for the list method. |
|
286 */ |
|
287 void FillInDbInfoListL( |
|
288 /* IN/OUT */ RPointerArray<HPosLmDatabaseInfo>& aDatabaseInfoArray, |
|
289 /* IN */ CPosLmDatabaseManagerPluginBase* aPlugin |
|
290 ); |
|
291 |
|
292 /** |
|
293 * Fills in default flag, database drive and media type in |
|
294 * the object. Helper for the list method. |
|
295 */ |
|
296 void FillInDbInfo( |
|
297 /* IN/OUT */ HPosLmDatabaseInfo& aDatabaseInfo, |
|
298 /* IN */ CPosLmDatabaseManagerPluginBase* aPlugin, |
|
299 /* IN */ const TDesC& aDefaultDbUri |
|
300 ); |
|
301 |
|
302 |
|
303 // By default, prohibit copy constructor |
|
304 CPosLmDatabaseManagerImpl( const CPosLmDatabaseManagerImpl& ); |
|
305 // Prohibit assigment operator |
|
306 CPosLmDatabaseManagerImpl& operator= ( const CPosLmDatabaseManagerImpl& ); |
|
307 |
|
308 private: // Data |
|
309 |
|
310 CPosLmSettingsHandler* iSettingsHandler; |
|
311 CPosLmDbManPluginStore* iPlugins; |
|
312 RPosLandmarkServer iSession; |
|
313 RPosLmDatabaseEventListener iEventListener; |
|
314 HBufC* iDefaultDatabaseDisplayName; |
|
315 |
|
316 }; |
|
317 |
|
318 #endif // CPOSLMDATABASEMANAGERIMPL_H |
|
319 |
|
320 // End of File |