|
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: DM tree etc. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef __NSMLDMHOSTCLIENT_H |
|
21 #define __NSMLDMHOSTCLIENT_H |
|
22 |
|
23 #include <smldmadapter.h> |
|
24 #include <e32base.h> |
|
25 #include <nsmldebug.h> |
|
26 #include "nsmldmclientandserver.h" |
|
27 |
|
28 class CNSmlDmMgmtTree; |
|
29 class CNSmlDmDDF; |
|
30 |
|
31 // =========================================================================== |
|
32 // RNSmlDMDataSession |
|
33 // =========================================================================== |
|
34 /** |
|
35 * DM host client implementation |
|
36 * |
|
37 * @since |
|
38 */ |
|
39 class RNSmlDMDataSession : public RSessionBase |
|
40 { |
|
41 public: |
|
42 |
|
43 |
|
44 /** |
|
45 * Constructor |
|
46 */ |
|
47 RNSmlDMDataSession(); |
|
48 |
|
49 /** |
|
50 * Destructor |
|
51 */ |
|
52 ~RNSmlDMDataSession(); |
|
53 |
|
54 /** |
|
55 * Connects to correct host server. If Host server is not launhed, |
|
56 * the function launches it |
|
57 * @param aServerName Server name |
|
58 * @param aDmCallback Pointer to DDF class |
|
59 * @return Success of operation, systemWide error code |
|
60 */ |
|
61 TInt ConnectL(const TDesC& aServerName,CNSmlDmDDF* aDmCallback); |
|
62 |
|
63 /** |
|
64 * Returns server version |
|
65 * @return Server version |
|
66 */ |
|
67 TVersion Version() const; |
|
68 |
|
69 /** |
|
70 * Closes the session |
|
71 */ |
|
72 void Close(); |
|
73 |
|
74 /** |
|
75 * Gets the DDF structure from plugin adapters of corresponding |
|
76 * host server |
|
77 * @param aRoot Reference to root node of tree |
|
78 * @return Checksum from the current hots servers plug-in |
|
79 * adapter ddf versions |
|
80 */ |
|
81 TInt DDFStructureL(CNSmlDmMgmtTree& aRoot); |
|
82 |
|
83 |
|
84 /** |
|
85 * Update leaf object in given adapter |
|
86 * @param aAdapterId Adapter id |
|
87 * @param aLuid Luid mapped to uri |
|
88 * @param aStatusRef Reference to status element |
|
89 * @param aURI Target URI in command |
|
90 * @param aObject Data |
|
91 * @param aType Mime type of the object |
|
92 * @param aLargeItem True if object comes in multiple messages |
|
93 * @param aTotSizeOfLarge The overall size of the large object. |
|
94 * Sent with the first chunk for the FOTA |
|
95 * adapter. |
|
96 */ |
|
97 void UpdateLeafL(const TUint32 aAdapterId, |
|
98 const TDesC8& aLuid, |
|
99 const TInt32 aStatusRef, |
|
100 const TDesC8& aURI, |
|
101 const TDesC8& aObject, |
|
102 const TDesC8& aType, |
|
103 const TBool aLargeItem=EFalse, |
|
104 // FOTA |
|
105 const TInt aTotSizeOfLarge=0 |
|
106 // FOTA end |
|
107 ); |
|
108 |
|
109 |
|
110 /** |
|
111 * Add node object in given adapter |
|
112 * @param aAdapterId Adapter id |
|
113 * @param aLuid Luid mapped to uri |
|
114 * @param aStatusRef Reference to status element |
|
115 * @param aURI Target URI in command |
|
116 */ |
|
117 void AddNodeL(const TUint32 aAdapterId, |
|
118 const TDesC8& aLuid, |
|
119 const TInt32 aStatusRef, |
|
120 const TDesC8& aURI); |
|
121 |
|
122 /** |
|
123 * Execute command in given adapter |
|
124 * @param aAdapterId Adapter id |
|
125 * @param aLuid Luid mapped to uri |
|
126 * @param aStatusRef Reference to status element |
|
127 * @param aURI Target URI in command |
|
128 * @param aObject Data |
|
129 * @param aType Mime type of the object |
|
130 * @param aLargeItem True if object comes in multiple messages |
|
131 */ |
|
132 void ExecuteCommandL(const TUint32 aAdapterId, |
|
133 const TDesC8& aLuid, |
|
134 const TInt32 aStatusRef, |
|
135 const TDesC8& aURI, |
|
136 const TDesC8& aObject, |
|
137 const TDesC8& aType, |
|
138 const TBool aLargeItem=EFalse); |
|
139 |
|
140 /** |
|
141 * Copy data in given adapter |
|
142 * @param aAdapterId Adapter id |
|
143 * @param aTargetLuid Luid mapped to uri |
|
144 * @param aTargetURI Target URI in command |
|
145 * @param aSourceLuid Source luid mapped to uri |
|
146 * @param aSourceURI Source URI in command |
|
147 * @param aStatusRef Reference to status element |
|
148 * @param aType Mime type of the object |
|
149 */ |
|
150 void CopyCommandL(const TUint32 aAdapterId, |
|
151 const TDesC8& aTargetLuid, |
|
152 const TDesC8& aTargetURI, |
|
153 const TDesC8& aSourceLuid, |
|
154 const TDesC8& aSourceURI, |
|
155 const TInt32 aStatusRef, |
|
156 const TDesC8& aType); |
|
157 |
|
158 /** |
|
159 * Delete object in given adapter |
|
160 * @param aAdapterId Adapter id |
|
161 * @param aLuid Luid mapped to uri |
|
162 * @param aStatusRef Reference to status element |
|
163 * @param aURI Target URI in command |
|
164 */ |
|
165 void DeleteObjectL(const TUint32 aAdapterId, |
|
166 const TDesC8& aLuid, |
|
167 const TInt32 aStatusRef, |
|
168 const TDesC8& aURI); |
|
169 |
|
170 /** |
|
171 * Get data from given adapter |
|
172 * @param aAdapterId Adapter id |
|
173 * @param aURI Target URI in command |
|
174 * @param aLUID Luid mapped to uri |
|
175 * @param aType Mime type of the object |
|
176 * @param aResultRef Reference to result element |
|
177 * @param aStatusRef Reference to status element |
|
178 */ |
|
179 void FetchLeafObjectL(const TUint32 aAdapterId, |
|
180 const TDesC8& aURI, |
|
181 const TDesC8& aLUID, |
|
182 const TDesC8& aType, |
|
183 const TInt aResultsRef, |
|
184 const TInt aStatusRef ); |
|
185 |
|
186 /** |
|
187 * Get data size from given adapter |
|
188 * @param aAdapterId Adapter id |
|
189 * @param aURI Target URI in command |
|
190 * @param aLUID Luid mapped to uri |
|
191 * @param aType Mime type of the object |
|
192 * @param aResultRef Reference to result element |
|
193 * @param aStatusRef Reference to status element |
|
194 */ |
|
195 void FetchLeafObjectSizeL(const TUint32 aAdapterId, |
|
196 const TDesC8& aURI, |
|
197 const TDesC8& aLUID, |
|
198 const TDesC8& aType, |
|
199 const TInt aResultsRef, |
|
200 const TInt aStatusRef ); |
|
201 |
|
202 /** |
|
203 * Get child list from given adapter |
|
204 * @param aAdapterId Adapter id |
|
205 * @param aURI Target URI in command |
|
206 * @param aLUID Luid mapped to uri |
|
207 * @param aPreviousURISegmentList Previous list from tree db |
|
208 * @param aResultRef Reference to result element |
|
209 * @param aStatusRef Reference to status element |
|
210 */ |
|
211 void ChildURIListL(const TUint32 aAdapterId, |
|
212 const TDesC8& aURI, |
|
213 const TDesC8& aLUID, |
|
214 const CArrayFixFlat<TSmlDmMappingInfo>& aPreviousURISegmentList, |
|
215 const TInt aResultsRef,const TInt aStatusRef ); |
|
216 |
|
217 /** |
|
218 * Indicates host server about the atomic statrt |
|
219 */ |
|
220 void StartAtomicL(); |
|
221 |
|
222 /** |
|
223 * Indicates host server about the atomic commit |
|
224 */ |
|
225 void CommitAtomicL(); |
|
226 |
|
227 /** |
|
228 * Indicates host server about the atomic rollback |
|
229 */ |
|
230 void RollbackAtomicL(); |
|
231 |
|
232 /** |
|
233 * Indicates host server about the message ending |
|
234 */ |
|
235 void CompleteOutstandingCmdsL(); |
|
236 |
|
237 /** |
|
238 * Gets more data from host server in case of large object |
|
239 * @param aData Reference to data buffer where to |
|
240 * write data |
|
241 */ |
|
242 void MoreDataL(CBufBase*& aData); |
|
243 |
|
244 // FOTA |
|
245 /** |
|
246 * When the generic alerts are successfully sent to the remote |
|
247 * server, the FOTA adapter needs to be informed about this. |
|
248 * This command is chained through the DM engine. |
|
249 * In this function a request is issued as an IPC call. |
|
250 */ |
|
251 void MarkGenAlertsSent(); |
|
252 |
|
253 |
|
254 void MarkGenAlertsSent(const TDesC8 &aURI); |
|
255 |
|
256 // FOTA end |
|
257 |
|
258 private: |
|
259 /** |
|
260 * Launches server |
|
261 * @param aServerExeName Server executable name |
|
262 * @return Success of operation |
|
263 */ |
|
264 TInt LaunchServerL( const TDesC& aServerExeName ); |
|
265 |
|
266 /** |
|
267 * Sends chunck handle to host server |
|
268 * @return Success of operation |
|
269 */ |
|
270 TInt SendChunkHandle(); |
|
271 |
|
272 /** |
|
273 * Handles callbacks from host server |
|
274 * @param aCallbackType Callback type |
|
275 */ |
|
276 void HandleCallbacksL(TNSmlDmHostCallbackType aCallbackType); |
|
277 |
|
278 |
|
279 private: |
|
280 /** |
|
281 * Handle to chunk that is used to transfer data between client and server |
|
282 */ |
|
283 RChunk iChunk; |
|
284 |
|
285 /** |
|
286 * Pouinter to DDF class |
|
287 */ |
|
288 CNSmlDmDDF* iCallback; |
|
289 |
|
290 /** |
|
291 * Array of URIs when host server sends mappings |
|
292 */ |
|
293 CArrayPtrSeg<HBufC8>* iMapUris; |
|
294 |
|
295 /** |
|
296 * Array of Luids when host server sends mappings |
|
297 */ |
|
298 CArrayPtrSeg<HBufC8>* iMapLuids; |
|
299 |
|
300 /** |
|
301 * Id of the session, 1...4 |
|
302 */ |
|
303 TUint8 iServerId; |
|
304 |
|
305 /** |
|
306 * Large object uri in case of incoming large object |
|
307 */ |
|
308 HBufC8* iLargeObjectUri; |
|
309 }; |
|
310 |
|
311 |
|
312 |
|
313 #endif // __NSMLDMHOSTCLIENT_H |