|
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 * |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #ifndef RPOSLANDMARKSERVER_H |
|
21 #define RPOSLANDMARKSERVER_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32base.h> |
|
25 #include <badesca.h> |
|
26 #include <EPos_TPosLmDatabaseEvent.h> |
|
27 #include <EPos_TPosLmDatabaseSettings.h> |
|
28 #include <EPos_HPosLmDatabaseInfo.h> |
|
29 |
|
30 // FORWARD DECLARATIONS |
|
31 class CPosLandmarkServerExtension; |
|
32 |
|
33 // CLASS DECLARATION |
|
34 |
|
35 /** |
|
36 * Client API for the landmark server. |
|
37 * |
|
38 * @lib eposlmservlib.lib |
|
39 * @since S60 3.0 |
|
40 * @version $Revision: 1.4 $, $Date: 2005/07/07 13:40:03 $ |
|
41 */ |
|
42 class RPosLandmarkServer : public RSessionBase |
|
43 { |
|
44 public: // Constructors and destructor |
|
45 |
|
46 /** |
|
47 * C++ default constructor. |
|
48 */ |
|
49 IMPORT_C RPosLandmarkServer(); |
|
50 |
|
51 public: // New functions |
|
52 |
|
53 |
|
54 /** |
|
55 * Connect to the landmark server. |
|
56 * |
|
57 * The server is started if it is not already running. |
|
58 * |
|
59 * This function requires @p ReadUserData capability. |
|
60 * |
|
61 * @since S60 3.0 |
|
62 * @return @p KErrNone if successful, otherwise a system-wide error |
|
63 * code. |
|
64 */ |
|
65 IMPORT_C TInt Connect(); |
|
66 |
|
67 /** |
|
68 * Closes the session to the server |
|
69 * |
|
70 * @since S60 3.0 |
|
71 */ |
|
72 IMPORT_C void Close(); |
|
73 |
|
74 /** |
|
75 * Lists all URIs in the server's database registry for a certain |
|
76 * protocol. |
|
77 * |
|
78 * The client specifies a protocol string as input to this function. |
|
79 * The function only returns a list of the databases which are |
|
80 * accessed through this protocol. |
|
81 * |
|
82 * The client takes ownership of the returned array. |
|
83 * |
|
84 * This function requires @p ReadUserData capability. |
|
85 * |
|
86 * @since S60 3.0 |
|
87 * @param aProtocol The protocol for which database URIs should be |
|
88 * listed. |
|
89 * @return The list of database URIs. |
|
90 */ |
|
91 IMPORT_C CDesCArray* ListDatabasesLC( |
|
92 /* IN */ const TDesC& aProtocol |
|
93 ); |
|
94 |
|
95 /** |
|
96 * Lists information about each landmark database in the |
|
97 * server's database registry. |
|
98 * |
|
99 * The client specifies a protocol string as input to this function. |
|
100 * The function only returns information about the databases |
|
101 * which are accessed through this protocol. |
|
102 * |
|
103 * The client specifies an array which is populated by this function. |
|
104 * The client takes ownership of all information objects in the array. |
|
105 * |
|
106 * This function requires @p ReadUserData capability. |
|
107 * |
|
108 * @since S60 3.0 |
|
109 * @param aDatabaseInfoArray On return, contains information about |
|
110 * the landmark databases. Any objects which are in the array when |
|
111 * it is passed to this function will be not be removed. |
|
112 * @param aProtocol The protocol for which database URIs should be |
|
113 * listed. |
|
114 */ |
|
115 IMPORT_C void ListDatabasesL( |
|
116 /* OUT */ RPointerArray<HPosLmDatabaseInfo>& aDatabaseInfoArray, |
|
117 /* IN */ const TDesC& aProtocol = KNullDesC |
|
118 ); |
|
119 |
|
120 /** |
|
121 * Registers a landmark database. |
|
122 * |
|
123 * The landmark database is then returned when listing landmark |
|
124 * databases. |
|
125 * |
|
126 * The client supplies an information object containing the URI of the |
|
127 * database to register. The information object can also contain |
|
128 * database settings, e.g. a display name for the database. |
|
129 * |
|
130 * This function requires @p ReadUserData and @p WriteUserData |
|
131 * capabilities. |
|
132 * |
|
133 * @since S60 3.0 |
|
134 * @param aDatabaseInfo Information about the landmark database to |
|
135 * register. |
|
136 * @return @p KErrNone if successful.\n |
|
137 * @p KErrArgument if the URI is incorrect.\n |
|
138 * @p KErrAlreadyExists if the database has already been registered. |
|
139 */ |
|
140 IMPORT_C TInt RegisterDatabase( |
|
141 /* IN/OUT */ HPosLmDatabaseInfo& aDatabaseInfo |
|
142 ); |
|
143 |
|
144 /** |
|
145 * Unregisters a landmark database. |
|
146 * |
|
147 * After this, the landmark database will not be returned when listing |
|
148 * landmark databases. |
|
149 * |
|
150 * If the database has not been registered, nothing happens. |
|
151 * |
|
152 * This function requires @p ReadUserData and @p WriteUserData |
|
153 * capabilities. |
|
154 * |
|
155 * @since S60 3.0 |
|
156 * @param aDatabaseUri The URI of the database to unregister. |
|
157 * @param aDriveLetter The drive where the database resides. If |
|
158 * drive is not applicable, 0 should be specified. |
|
159 * @return @p KErrNone if successful.\n |
|
160 * @p KErrArgument if the URI is incorrect. |
|
161 */ |
|
162 IMPORT_C TInt UnregisterDatabase( |
|
163 /* IN */ const TDesC& aDatabaseUri, |
|
164 /* IN */ TChar aDriveLetter = 0 |
|
165 ); |
|
166 |
|
167 /** |
|
168 * Unregisters all landmark databases which are accessed through a |
|
169 * certain protocol. |
|
170 * |
|
171 * After this, the landmark databases will not be returned when listing |
|
172 * landmark databases. |
|
173 * |
|
174 * If the protocol is not known or if there are no databases for |
|
175 * the protocol, nothing happens. |
|
176 * |
|
177 * This function requires @p ReadUserData and @p WriteUserData |
|
178 * capabilities. |
|
179 * |
|
180 * @since S60 3.0 |
|
181 * @param aProtocol The protocol to unregister all databases for. |
|
182 * @return @p KErrNone if successful, otherwise a system-wide error |
|
183 * code. |
|
184 */ |
|
185 IMPORT_C TInt UnregisterAllDatabases( |
|
186 /* IN */ const TDesC& aProtocol |
|
187 ); |
|
188 |
|
189 /** |
|
190 * Modifies the settings for a landmark database. |
|
191 * |
|
192 * This function requires @p ReadUserData and @p WriteUserData |
|
193 * capabilities. |
|
194 * |
|
195 * @since S60 3.0 |
|
196 * @param aDatabaseUri The URI of the database to modify settings for. |
|
197 * @param aDatabaseSettings The new settings for the database. |
|
198 * @param aDriveLetter The drive where the database resides. If |
|
199 * drive is not applicable, 0 should be specified. |
|
200 * @return @p KErrNone if successful.\n |
|
201 * @p KErrArgument if the URI is incorrect.\n |
|
202 * @p KErrNotFound if the URI does not exist in the registry. |
|
203 */ |
|
204 IMPORT_C TInt ModifyDatabaseSettings( |
|
205 /* IN */ const TDesC& aDatabaseUri, |
|
206 /* IN */ const TPosLmDatabaseSettings& aDatabaseSettings, |
|
207 /* IN */ TChar aDriveLetter = 0 |
|
208 ); |
|
209 |
|
210 /** |
|
211 * Retrieve information about a landmark database. |
|
212 * |
|
213 * This function requires @p ReadUserData capability. |
|
214 * |
|
215 * @since S60 3.0 |
|
216 * @param aDatabaseInfo An information object containing the URI of the |
|
217 * landmark database. On return, the object contains information about |
|
218 * the landmark database, including any database settings. |
|
219 * @return @p KErrNone if successful.\n |
|
220 * @p KErrArgument if the URI is incorrect.\n |
|
221 * @p KErrNotFound if the URI does not exist in the registry. |
|
222 */ |
|
223 IMPORT_C TInt GetDatabaseInfo( |
|
224 /* IN/OUT */ HPosLmDatabaseInfo& aDatabaseInfo |
|
225 ); |
|
226 |
|
227 /** |
|
228 * Reports a database management event. |
|
229 * |
|
230 * The event is distributed to all listening clients. |
|
231 * |
|
232 * A database URI can be specified to indicate which database the |
|
233 * event is about. |
|
234 * |
|
235 * This function requires @p ReadUserData and @p WriteUserData |
|
236 * capabilities. |
|
237 * |
|
238 * @since S60 3.0 |
|
239 * @param aEvent Event information |
|
240 * @param aDatabaseUri The URI of the database which the event is about. |
|
241 * @return @p KErrNone if successful, otherwise a system-wide error |
|
242 * code. |
|
243 */ |
|
244 IMPORT_C TInt ReportEvent( |
|
245 /* IN */ const TPosLmDatabaseEvent& aEvent, |
|
246 /* IN */ const TDesC& aDatabaseUri = KNullDesC |
|
247 ); |
|
248 |
|
249 private: |
|
250 |
|
251 HBufC8* SendMessageLC( |
|
252 /* IN */ TInt aFunction, |
|
253 /* IN */ const TDesC& aDes, |
|
254 /* IN */ TInt aLength, |
|
255 /* IN/OUT */ TInt& aAllocLength |
|
256 ); |
|
257 |
|
258 void PopulateArrayL( |
|
259 /* OUT */ RPointerArray<HPosLmDatabaseInfo>& aDatabaseInfoArray, |
|
260 /* IN */ HBufC8* aBuffer |
|
261 ); |
|
262 |
|
263 void PopulateArrayL( |
|
264 /* OUT */ CDesCArray* aArray, |
|
265 /* IN */ HBufC8* aBuffer |
|
266 ); |
|
267 |
|
268 void FreeResources(); |
|
269 |
|
270 static void FreeRsc(TAny* aParam); |
|
271 /** |
|
272 * Starts the server. |
|
273 * |
|
274 * @return KErrNone on success, otherwise any system wide error. |
|
275 */ |
|
276 TInt StartServer(); |
|
277 |
|
278 private: // Data |
|
279 |
|
280 CPosLandmarkServerExtension* iExtension; |
|
281 }; |
|
282 |
|
283 #endif // RPOSLANDMARKSERVER_H |
|
284 |
|
285 // End of File |