|
1 /* |
|
2 * Copyright (c) 2002 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: Sub-client to managed particular session slot |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef __RPENGSTORAGESUBFOLDERCLIENT_H__ |
|
20 #define __RPENGSTORAGESUBFOLDERCLIENT_H__ |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32def.h> |
|
24 #include "PEngStorageGlobals.h" |
|
25 |
|
26 |
|
27 // FORWARD DECLARATIONS |
|
28 class RPEngStorageClient; |
|
29 |
|
30 /** |
|
31 * Storage sub-client |
|
32 * It is used for management of particular session slot to which |
|
33 * this sub-session client is connected. |
|
34 * |
|
35 * @lib PEngStoreMan2.dll |
|
36 * @since 3.0 |
|
37 */ |
|
38 // CLASS DECLARATION |
|
39 NONSHARABLE_CLASS( RPEngStorageSubFolderClient ): |
|
40 public RSubSessionBase |
|
41 |
|
42 { |
|
43 |
|
44 public: // Constructors and destructors |
|
45 |
|
46 /** |
|
47 * C++ default constructor. |
|
48 */ |
|
49 RPEngStorageSubFolderClient( ); |
|
50 |
|
51 /** |
|
52 * Destructor. |
|
53 */ |
|
54 ~RPEngStorageSubFolderClient( void ); |
|
55 |
|
56 public: // new methods |
|
57 |
|
58 /** |
|
59 * Connects to the presence server |
|
60 * |
|
61 * @since 3.0 |
|
62 * @param aStorageMainClient storage main client |
|
63 * @param aSessionName packed session slot Id to connect to |
|
64 * @return KErrNone if connected or any of system wide error codes |
|
65 */ |
|
66 TInt Connect( RPEngStorageClient& aStorageMainClient, |
|
67 const TDesC8& aSesssionName ); |
|
68 |
|
69 /** |
|
70 * Close connection to the presence server |
|
71 * |
|
72 * @since 3.0 |
|
73 */ |
|
74 void Close(); |
|
75 |
|
76 public: // new Storage management Functions |
|
77 |
|
78 /** |
|
79 * Stores Store Entry to the Server |
|
80 * |
|
81 * @since 3.0 |
|
82 * @param aStoreId storage ID of the store entry |
|
83 * @param aStoreType Type of the store entry |
|
84 * @param aData data buffer of store entry |
|
85 * @return KErrNone if client is connected and request went through |
|
86 * otherwise system wide error code |
|
87 */ |
|
88 TInt Store( const TDesC& aStoreId, |
|
89 TPEngStorageType aStoreType, |
|
90 const TDesC8& aData ); |
|
91 |
|
92 /** |
|
93 * Retrieves Store Entry from Server |
|
94 * |
|
95 * @since 3.0 |
|
96 * @param aStoreId storage ID of the store entry |
|
97 * @param aStoreType Type of the store entry |
|
98 * @param aData data buffer of store entry |
|
99 * @return KErrNone if client is connected and request went through, |
|
100 * if positive Error code, then returned number specifies |
|
101 * size of the buffer needed to write data to the client buffer, |
|
102 * since buffer was not big enough.Otherwise system wide error |
|
103 */ |
|
104 TInt Retrieve( const TDesC& aStoreId, |
|
105 TPEngStorageType aStoreType, |
|
106 TDes8& aData ); |
|
107 |
|
108 /** |
|
109 * Deletes Store entry from the storage |
|
110 * |
|
111 * @since 3.0 |
|
112 * @param aStoreId storage ID of the store entry |
|
113 * @param aStoreType Type of the store entry |
|
114 * @return KErrNone if client is connected and request went through |
|
115 * otherwise system wide error code |
|
116 */ |
|
117 TInt Delete( const TDesC& aStoreId, TPEngStorageType aStoreType ); |
|
118 |
|
119 /* |
|
120 * Check is store entry is locked |
|
121 * |
|
122 * @since 3.0 |
|
123 * @param aStoreId storage ID of the store entry |
|
124 * @param aStoreType Type of the store entry |
|
125 * @param aPriority lock priority |
|
126 * @return KErrNone if client is connected and request went through |
|
127 * and entry is not locked, ETrue if locked and call went through |
|
128 * otherwise system wide error code |
|
129 */ |
|
130 TInt StoreEntryLocked( const TDesC& aStoreId, |
|
131 TPEngStorageType aStoreType, |
|
132 TPengStorageLockPriority aPriority ) const; |
|
133 |
|
134 /* |
|
135 * Lock defined store entry |
|
136 * |
|
137 * @since 3.0 |
|
138 * @param aStoreId storage ID of the store entry |
|
139 * @param aStoreType Type of the store entry |
|
140 * @param aPriority lock priority |
|
141 * @return KErrNone if client is connected and request went through |
|
142 * otherwise system wide error code |
|
143 */ |
|
144 TInt LockStoreEntry( const TDesC& aStoreId, |
|
145 TPEngStorageType aStoreType, |
|
146 TPengStorageLockPriority aPriority, |
|
147 TBool aCreateEntry ) const; |
|
148 |
|
149 /* |
|
150 * Unlock defined store entry |
|
151 * |
|
152 * @since 3.0 |
|
153 * @param aStoreId storage ID of the store entry |
|
154 * @param aStoreType Type of the store entry |
|
155 * @return KErrNone if client is connected and request went through |
|
156 * otherwise system wide error code |
|
157 */ |
|
158 TInt UnlockStoreEntry( const TDesC& aStoreId, |
|
159 TPEngStorageType aStoreType ) const; |
|
160 |
|
161 |
|
162 /* |
|
163 * Starts buffering server side notifications from this sub session |
|
164 * |
|
165 * @since 3.0 |
|
166 * @param aCount number to increase server counter by |
|
167 * @return KErrNone if client is connected and request went through |
|
168 * otherwise system wide error code |
|
169 */ |
|
170 TInt BufferServerSideNotifications( TInt aCount ); |
|
171 |
|
172 |
|
173 /* |
|
174 * Release buffering of Server side notifications, from this |
|
175 * sub session, all buffered notifications are notified to other |
|
176 * clients |
|
177 * |
|
178 * @since 3.0 |
|
179 * @param aCount number to decrease server counter by |
|
180 * @return KErrNone if client is connected and request went through |
|
181 * otherwise system wide error code |
|
182 */ |
|
183 TInt ReleaseServerSideBuffering( TInt aCount ); |
|
184 |
|
185 public: // notify functions |
|
186 |
|
187 /** |
|
188 * Synchronous request to start Storage ID listening. |
|
189 * This request carries information about SIDs client |
|
190 * is interested in, and also pointer to the return |
|
191 * array which is used by the client to return information |
|
192 * about changes SIDs. This synchronous request has to be |
|
193 * followed by the asynchronous request which will bring to |
|
194 * the server TRequestStatus which will be used |
|
195 * to signal changes to the client |
|
196 * |
|
197 * @since 3.0 |
|
198 * @param aEngagedSIds packed Storage Ids to listen |
|
199 * @return TInt KErrNone if operation is successful, |
|
200 KErrDisconnected if server is disconnected, |
|
201 * or system wide error code |
|
202 */ |
|
203 TInt StartListeningSIdsChanges( const TDesC& aEngagedSIds ); |
|
204 |
|
205 /** |
|
206 * Synchronous request to update listen storage IDs scout |
|
207 * with new set of storage IDs New set of SIDs which will be |
|
208 * watched by the client is delivered to the Server while |
|
209 * Existing Listen SIDs scout has to exists, if not, |
|
210 * call is completed with KErrNotFound. If this function fails |
|
211 * on the server side and completed with error code, existing |
|
212 * listener is kept and also old set of SIDs client |
|
213 * is interested in stays untouched |
|
214 * |
|
215 * @since 3.0 |
|
216 * @param aEngagedSIds packed Storage Ids to listen |
|
217 * @return TInt KErrNone if operation is successful, |
|
218 * KErrDisconnected if server is disconnected, |
|
219 * or system wide error code |
|
220 */ |
|
221 TInt UpdateListenSIdsChangesScout( const TDesC& aEngagedSIds ); |
|
222 |
|
223 /** |
|
224 * Asynchronous request to the server which reload Storage ID |
|
225 * listener with new TRequestStatus which is used to signal |
|
226 * changes to the Client. When TRequestStatus is completed |
|
227 * and client consumes SID changes, same request can be used |
|
228 * to continue with listening of SID changes. SIDs which client |
|
229 * is interested in are defined |
|
230 * by the StartListeningSIDsChanges function call |
|
231 * |
|
232 * @since 3.0 |
|
233 * @param aAnswerBuffer buffer server will answer indexes of |
|
234 * changed Store Ids |
|
235 * @param aStatus - TRequestStatus, where server will signal |
|
236 * completing of the request |
|
237 * @return TInt KErrNone is server is connected, |
|
238 * KErrDisconnected if server is disconnected |
|
239 */ |
|
240 TInt ReloadListenSIdsChangesScout( /*TDes& aAnswerBuffer,*/ |
|
241 TRequestStatus& aStatus ); |
|
242 |
|
243 |
|
244 /** |
|
245 * Synchronous request to fetch changed Storage IDs indexes |
|
246 * |
|
247 * @since 3.0 |
|
248 * @param aChangedIds buffer where indexes of changed Ids will be stored |
|
249 * @return TInt KErrNone is server is connected, |
|
250 * KErrDisconnected if server is disconnected |
|
251 */ |
|
252 TInt FetchChangedSIdsIndexes( |
|
253 TDes& aChangedIds ); |
|
254 |
|
255 |
|
256 /** |
|
257 * Synchronous request to stop listening of the SID changes |
|
258 * This request also cancel pending asynchronous request |
|
259 * from ReloadSIDsChangesScout call |
|
260 * |
|
261 * @since 3.0 |
|
262 * @return TInt KErrNone is server is connected, |
|
263 * KErrDisconnected if server is disconnected |
|
264 */ |
|
265 TInt StopListeningSIdsChanges(); |
|
266 |
|
267 /** |
|
268 * SYNCHRONOUS request to the server to notify it |
|
269 * about change of one storage ID. Server then notifies all |
|
270 * the clients which are listening change of this particular SID |
|
271 * This issues blind message, so it returns to client |
|
272 * without waiting how server will response |
|
273 * |
|
274 * @since 3.0 |
|
275 * @param aChangedSId - changed Storage Id |
|
276 * @return KErrDisconnected if server is disconnected, |
|
277 * otherwise answer from the server |
|
278 */ |
|
279 TInt NotifyChangedSIdBlind( const TDesC& aPackedChangedSId, |
|
280 TPEngStorageType aStoreType ); |
|
281 |
|
282 private: // Data |
|
283 |
|
284 /// Flag if sub Session is connected to the Server |
|
285 TBool iConnected; |
|
286 |
|
287 |
|
288 }; |
|
289 |
|
290 #endif // __RPENGSTORAGESUBFOLDERCLIENT_H__ |
|
291 |
|
292 |
|
293 |
|
294 |
|
295 |
|
296 |
|
297 |
|
298 |
|
299 |
|
300 |
|
301 |
|
302 |
|
303 |
|
304 |
|
305 |
|
306 |
|
307 |
|
308 |
|
309 |
|
310 |
|
311 |