|
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 MMS Settings Adapter |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 #ifndef __NSMLDMMMSADAPTER_H__ |
|
23 #define __NSMLDMMMSADAPTER_H__ |
|
24 |
|
25 // ----------------------------------------------------------------------------- |
|
26 // Includes |
|
27 // ----------------------------------------------------------------------------- |
|
28 #include <e32base.h> |
|
29 #include <smldmadapter.h> |
|
30 #include <mtclreg.h> |
|
31 #include <mmssettings.h> |
|
32 |
|
33 // -------------------------------------------------------------------------- |
|
34 // Class forwards |
|
35 // -------------------------------------------------------------------------- |
|
36 class CClientMtmRegistry; |
|
37 class CMsvSession; |
|
38 class CMmsClientMtm; |
|
39 |
|
40 // -------------------------------------------------------------------------- |
|
41 // Constant definitions |
|
42 // -------------------------------------------------------------------------- |
|
43 |
|
44 const TInt KNSmlDMMMSDefaultExpiry = 72 * 3600; //3 days |
|
45 const TInt KNSmlDMMMSExpiryHour = 3600; //1 hour |
|
46 const TInt KNSmlDMMMSExpirySixHours = 6*3600; //6 hours |
|
47 const TInt KNSmlDMMMSExpiryDay = 24*3600; //24 hours |
|
48 const TInt KNSmlDMMMSExpiryThreeDays = 3*24*3600; //3 days |
|
49 const TInt KNSmlDMMMSExpiryWeek = 7*24*3600; //1 week |
|
50 const TInt KNSmlDMMMSExpiryMaximum = 0; |
|
51 //Iap id which is not found from commsdb |
|
52 const TUint32 KNSmlDMMMSIapNotDefined = 999999; |
|
53 const TInt KNSmlMMSUndefinedStatusRef = -1; |
|
54 |
|
55 const TInt KNSmlDMMMSFirstAccessPointId = 0; |
|
56 const TInt KNSmlDMMMSSecondAccessPointId = 1; |
|
57 const TUint8 KNSmlDMMMSSeparatorDef = 0x2f; //forward slash |
|
58 const TUint8 KNSmlDmMmsObjectSizeWidth = 4; |
|
59 |
|
60 // the DDF version must be changed if any changes in DDF structure |
|
61 // ( built in DDFStructureL() function ) |
|
62 |
|
63 // -------------------------------------------------------------------------- |
|
64 // Literal definitions |
|
65 // -------------------------------------------------------------------------- |
|
66 |
|
67 _LIT8( KNSmlDMMMSDDFVersion, "1.1" ); |
|
68 |
|
69 _LIT8( KNSmlDMMMSNodeName, "MMS" ); |
|
70 _LIT8( KNSmlDMMMSName, "Name" ); |
|
71 _LIT8( KNSmlDMMMSMMRecep, "MMRecep" ); |
|
72 _LIT8( KNSmlDMMMSAMsg, "AMsg" ); |
|
73 _LIT8( KNSmlDMMMSRcvAds, "RcvAds" ); |
|
74 _LIT8( KNSmlDMMMSImgSize, "ImgSize" ); |
|
75 _LIT8( KNSmlDMMMSDRepSnd, "DRepSnd" ); |
|
76 _LIT8( KNSmlDMMMSRcvRep, "RcvRep" ); |
|
77 _LIT8( KNSmlDMMMSMsgVal, "MsgVal" ); |
|
78 _LIT8( KNSmlDMMMSCon, "Con" ); |
|
79 _LIT8( KNSmlDMMMSMToNapID, "MToNapID" ); |
|
80 _LIT8( KNSmlDMMMSMToNapIDL, "MToNapIDL" ); |
|
81 _LIT8( KNSmlDMMMSCreMode, "CreMode" ); |
|
82 |
|
83 _LIT8( KNSmlDMMMSConSlash, "Con/" ); |
|
84 _LIT8( KNSmlDMMMSTextPlain, "text/plain" ); |
|
85 |
|
86 _LIT8( KNSmlDMMMSNodeNameDescription, "The interior object holds all MMS objects" ); |
|
87 _LIT8( KNSmlDMMMSDynamicNodeDescription, "Placeholder for one set of MMS settings" ); |
|
88 _LIT8( KNSmlDMMMSNameDescription, "Displayable Account Name for the MMS Settings" ); |
|
89 _LIT8( KNSmlDMMMSMMRecepDescription, "Level of MMS protocol operations" ); |
|
90 _LIT8( KNSmlDMMMSAMsgDescription, "Anonymous messages allowed or not" ); |
|
91 _LIT8( KNSmlDMMMSRcvAdsDescription, "Receiving adverts allowed or not" ); |
|
92 _LIT8( KNSmlDMMMSImgSizeDescription, "Image resolution in sending messages" ); |
|
93 _LIT8( KNSmlDMMMSDRepSndDescription, "Sending of Delivery Reports is allowed or not" ); |
|
94 _LIT8( KNSmlDMMMSRcvRepDescription, "Defines whether the delivery report is requested by default from each recipient or not" ); |
|
95 _LIT8( KNSmlDMMMSMsgValDescription, "Message validity time" ); |
|
96 _LIT8( KNSmlDMMMSMMSSAddrDescription, "MMS server address" ); |
|
97 |
|
98 _LIT8( KNSmlDMMMSConNodeDescription, "Parent for MMS connectivity object" ); |
|
99 _LIT8( KNSmlDMMMSConRtNodeDescription, "Place holder for one or more connectivity objects" ); |
|
100 _LIT8( KNSmlDMMMSMToNapIDDescription, "Parent to multiple NAP connection reference objects" ); |
|
101 _LIT8( KNSmlDMMMSMToNapIDLDescription, "Link to internet access point" ); |
|
102 _LIT8( KNSmlDMMMSCreModeDescription, "MMS creation mode" ); |
|
103 _LIT8( KNSmlDMMMSTextPlainDescription, "text/plain" ); |
|
104 |
|
105 _LIT8( KNSmlDMMMSAccount8, "MMSAcc" ); |
|
106 _LIT( KNSmlDMMMSAccount16, "MMSAcc" ); |
|
107 _LIT8( KNSmlDMMMSListOfLeafsLo, "MMRecep/CreMode/AMsg/RcvAds/ImgSize/DRepSnd/RcvRep/MsgVal/Con" ); |
|
108 _LIT8( KNSmlDMMMSListOfLeafsMid, "MMSSAddr/MToNapID" ); |
|
109 _LIT8( KNSmlDMMMSListOfLeafsHi, "MToNapIDL" ); |
|
110 _LIT8( KNSmlDMMMSConDynamicName8, "DCon" ); |
|
111 _LIT8( KNSmlDMMMSConDynamicName16, "DCon" ); |
|
112 _LIT8( KNSmlDMMMSMMSSAddr, "MMSSAddr" ); |
|
113 |
|
114 _LIT8( KNSmlDMMMSDynamicPrimary, "Primary" ); |
|
115 |
|
116 |
|
117 _LIT( KNSmlDMMMSSeparator16, "/" ); |
|
118 _LIT8( KNSmlDMMMSSeparator8, "/" ); |
|
119 |
|
120 _LIT8( KNSmlDMMMSValueTrue, "True" ); |
|
121 _LIT8( KNSmlDMMMSValueFalse, "False" ); |
|
122 _LIT8( KNSmlDMMMSValueAlwaysOn, "Always on" ); |
|
123 |
|
124 _LIT8( KNSmlDMMMSValueAutomaticAtHome, "Automatic at home" ); |
|
125 _LIT8( KNSmlDMMMSValueAutomaticAtHomeShort, "Aut" ); |
|
126 _LIT8( KNSmlDMMMSValueAlwaysManual, "Always Manual" ); |
|
127 _LIT8( KNSmlDMMMSValueAlwaysManual2, "Always manual" ); |
|
128 _LIT8( KNSmlDMMMSValueOff, "Off" ); |
|
129 _LIT8( KNSmlDMMMSValueFree, "Free" ); |
|
130 _LIT8( KNSmlDMMMSValueRestricted, "Restricted" ); |
|
131 _LIT8( KNSmlDMMMSValueWarning, "Warning" ); |
|
132 |
|
133 _LIT8( KNSmlDMMMSValueLow, "Low" ); |
|
134 _LIT8( KNSmlDMMMSValueNormal, "Normal" ); |
|
135 _LIT8( KNSmlDMMMSValueHigh, "High" ); |
|
136 _LIT8( KNSmlDMMMSValueSmall, "Small" ); |
|
137 _LIT8( KNSmlDMMMSValueLarge, "Large" ); |
|
138 _LIT8( KNSmlDMMMSValueOriginal, "Original" ); |
|
139 |
|
140 _LIT8( KNSmlDMMMSValueHour, "one hour" ); |
|
141 _LIT8( KNSmlDMMMSValueSixHours, "six hours" ); |
|
142 _LIT8( KNSmlDMMMSValueDay, "24 hours" ); |
|
143 _LIT8( KNSmlDMMMSValueThreeDays, "three days" ); |
|
144 _LIT8( KNSmlDMMMSValueWeek, "a week" ); |
|
145 |
|
146 _LIT8( KNSmlDMMMSValueHourShort, "hour" ); |
|
147 _LIT8( KNSmlDMMMSValueSixHoursShort, "six" ); |
|
148 _LIT8( KNSmlDMMMSValueSixHoursShortNum, "6" ); |
|
149 _LIT8( KNSmlDMMMSValueDayShort, "24" ); |
|
150 _LIT8( KNSmlDMMMSValueThreeDaysShort, "three" ); |
|
151 _LIT8( KNSmlDMMMSValueThreeDaysShortNum, "3" ); |
|
152 _LIT8( KNSmlDMMMSValueWeekShort, "week" ); |
|
153 _LIT8( KNSmlDMMMSValueMaximumTimeShort, "max" ); |
|
154 _LIT8( KNSmlDMMMSValueMaximumTime , "maximum time" ); |
|
155 |
|
156 _LIT8( KNSmlDMMMSValuePrimary, "Primary" ); |
|
157 _LIT8( KNSmlDMMMSValueSecondary, "Secondary" ); |
|
158 _LIT8( KNSmlMMSUriDotSlash, "./"); |
|
159 _LIT8( KNSmlDMMMSIAPUri, "AP" ); |
|
160 |
|
161 _LIT8( KNSmlDMMMSLevel3Parents, "MMS/MMSAcc" ); |
|
162 _LIT8( KNSmlDMMMSLevel5Parents, "MMS/MMSAcc/Con/DCon" ); |
|
163 _LIT8( KNSmlDMMMSLevel7Parents1, "MMS/MMSAcc/Con/DCon/MToNapID/Primary" ); |
|
164 _LIT8( KNSmlDMMMSLevel7Parents2, "MMS/MMSAcc/Con/DCon/MToNapID/Secondary" ); |
|
165 |
|
166 _LIT8( KNSmlDMMMSAclName, "MMS/MMSAcc/Name" ); |
|
167 _LIT8( KNSmlDMMMSAclMMRecep, "MMS/MMSAcc/MMRecep" ); |
|
168 _LIT8( KNSmlDMMMSAclCreMode, "MMS/MMSAcc/CreMode" ); |
|
169 _LIT8( KNSmlDMMMSAclAMsg, "MMS/MMSAcc/AMsg" ); |
|
170 _LIT8( KNSmlDMMMSAclRcvAds, "MMS/MMSAcc/RcvAds" ); |
|
171 _LIT8( KNSmlDMMMSAclImgSize, "MMS/MMSAcc/ImgSize" ); |
|
172 _LIT8( KNSmlDMMMSAclDRepSnd, "MMS/MMSAcc/DRepSnd" ); |
|
173 _LIT8( KNSmlDMMMSAclRcvRep, "MMS/MMSAcc/RcvRep" ); |
|
174 _LIT8( KNSmlDMMMSAclMsgVal, "MMS/MMSAcc/MsgVal" ); |
|
175 _LIT8( KNSmlDMMMSAclMMSSAddr, "MMS/MMSAcc/Con/DCon/MMSSAddr" ); |
|
176 _LIT8( KNSmlDMMMSAclPrimaryMToNapIDL, "MMS/MMSAcc/Con/DCon/MToNapID/Primary/MToNapIDL" ); |
|
177 |
|
178 _LIT8(KNSmlDmMMSAclDefault, "Get=*&Replace=*"); |
|
179 _LIT8(KNSmlDmMMSAclGet, "Get=*"); |
|
180 |
|
181 /** |
|
182 * The main class of the SyncML DM MMS adapter. |
|
183 * |
|
184 * @since |
|
185 */ |
|
186 |
|
187 class CNSmlDmMMSAdapter : public CSmlDmAdapter, public MMsvSessionObserver |
|
188 { |
|
189 public: |
|
190 static CNSmlDmMMSAdapter* NewL(MSmlDmCallback* aDmCallback ); |
|
191 |
|
192 ~CNSmlDmMMSAdapter(); |
|
193 |
|
194 // Adapter interface from CSmlDmAdapter |
|
195 void DDFVersionL( CBufBase& aDDFVersion ); |
|
196 void DDFStructureL( MSmlDmDDFObject& aDDF ); |
|
197 void UpdateLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, |
|
198 const TDesC8& aObject, const TDesC8& aType, |
|
199 TInt aStatusRef ); |
|
200 void DeleteObjectL( const TDesC8& aURI, const TDesC8& aLUID, |
|
201 const TInt aStatusRef ); |
|
202 void FetchLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, |
|
203 const TDesC8& aType, const TInt aResultsRef, |
|
204 const TInt aStatusRef ); |
|
205 void ChildURIListL( const TDesC8& aURI, const TDesC8& aLUID, |
|
206 const CArrayFix<TSmlDmMappingInfo>& aPreviousURISegmentList, |
|
207 const TInt aResultsRef, const TInt aStatusRef ); |
|
208 void AddNodeObjectL( const TDesC8& aURI, const TDesC8& aParentLUID, |
|
209 const TInt aStatusRef ); |
|
210 void UpdateLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, |
|
211 RWriteStream*& aStream, const TDesC8& aType, |
|
212 const TInt aStatusRef ); |
|
213 void FetchLeafObjectSizeL( const TDesC8& aURI, const TDesC8& aLUID, |
|
214 const TDesC8& aType, const TInt aResultsRef, |
|
215 const TInt aStatusRef ); |
|
216 void ExecuteCommandL( const TDesC8& aURI, const TDesC8& aLUID, |
|
217 const TDesC8& aArgument, const TDesC8& aType, |
|
218 const TInt aStatusRef ); |
|
219 void ExecuteCommandL( const TDesC8& aURI, const TDesC8& aLUID, |
|
220 RWriteStream*& aStream, const TDesC8& aType, |
|
221 const TInt aStatusRef ); |
|
222 void CopyCommandL( const TDesC8& aTargetURI, const TDesC8& aTargetLUID, |
|
223 const TDesC8& aSourceURI, const TDesC8& aSourceLUID, |
|
224 const TDesC8& aType, TInt aStatusRef ); |
|
225 void StartAtomicL(); |
|
226 void CommitAtomicL(); |
|
227 void RollbackAtomicL(); |
|
228 TBool StreamingSupport( TInt& aItemSize ); |
|
229 void StreamCommittedL(); |
|
230 void CompleteOutstandingCmdsL(); |
|
231 |
|
232 // from MMsvSessionObserver |
|
233 void HandleSessionEventL( TMsvSessionEvent aEvent, TAny* aArg1, TAny* aArg2, |
|
234 TAny* aArg3 ); |
|
235 |
|
236 private: |
|
237 /** |
|
238 * Default constructor |
|
239 * @param aDmCallback Pointer to callback interface |
|
240 * @return |
|
241 */ |
|
242 CNSmlDmMMSAdapter( MSmlDmCallback* aDmCallback ); |
|
243 |
|
244 /** |
|
245 * Second level constructor |
|
246 * @param |
|
247 * @return |
|
248 */ |
|
249 void ConstructL(); |
|
250 |
|
251 /** |
|
252 * Converts a descriptor to integer. |
|
253 * @param aLuid Descriptor to convert. |
|
254 * @return TInt value |
|
255 */ |
|
256 TInt DesToInt( const TDesC& aLuid ); |
|
257 /** |
|
258 * Removes the last uri segment, ie. everything after and including the last "/" character. |
|
259 * @param aURI The URI to process. |
|
260 * @return The modified aURI |
|
261 */ |
|
262 |
|
263 TPtrC8 RemoveLastURISeg( const TDesC8& aURI ); |
|
264 /** |
|
265 * Calculates the number of the URI segments. |
|
266 * @param aURI URI to process. |
|
267 * @return The number of segments. |
|
268 */ |
|
269 |
|
270 TInt NumOfURISegs( const TDesC8& aURI ); |
|
271 /** |
|
272 * Parses the last segment of URI, ie everything after the last "/" character. |
|
273 * @param aURI The URI to parse. |
|
274 * @return The last segment of the URI. |
|
275 */ |
|
276 |
|
277 TPtrC8 LastURISeg( const TDesC8& aURI ); |
|
278 /** |
|
279 * Performs the actual UPDATE operation. |
|
280 * @param aURI The URI to update. |
|
281 * @param aParentLUID LUID of the object. |
|
282 * @param aObject The new data to update. |
|
283 * @param aStatusRef The command reference. |
|
284 * @return Status of the UPDATE operation |
|
285 */ |
|
286 |
|
287 CSmlDmAdapter::TError UpdateDataL( const TDesC8& aURI, |
|
288 const TDesC8& aParentLUID, |
|
289 const TDesC8& aObject, |
|
290 TInt aStatusRef ); |
|
291 /** |
|
292 * Replaces accesspoint in iMmsSettings's accesspoint array. |
|
293 * @param aIapId The new IAP id to update. |
|
294 * @param aPos A position to update IAP id |
|
295 * @return |
|
296 */ |
|
297 |
|
298 void ReplaceAPL( TInt aIapId, TInt aPos ); |
|
299 /** |
|
300 * Performs updating of MMSAddr field. |
|
301 * @param |
|
302 * @return Status of the update. |
|
303 */ |
|
304 |
|
305 CSmlDmAdapter::TError UpdateMMSAddrL(); |
|
306 /** |
|
307 * Retrieves the paramters to iMmsSettings class from phones permanent storage. |
|
308 * @param |
|
309 * @return |
|
310 */ |
|
311 |
|
312 void CreateMMSClientL(); |
|
313 |
|
314 /** |
|
315 * Updates the parameters of given DDF node |
|
316 * @param aNode The node to update. |
|
317 * @param aAccTypes Access types of the node. |
|
318 * @param aOccurrence Occurrance of the node. |
|
319 * @param aScope Scope of the node. |
|
320 * @param aFormat Format of the node. |
|
321 * @param aDescription A description of the node. |
|
322 * @return |
|
323 */ |
|
324 |
|
325 void FillNodeInfoL( MSmlDmDDFObject& aNode,TSmlDmAccessTypes aAccTypes, |
|
326 MSmlDmDDFObject::TOccurence aOccurrence, |
|
327 MSmlDmDDFObject::TScope aScope, |
|
328 MSmlDmDDFObject::TDFFormat aFormat, |
|
329 const TDesC8& aDescription); |
|
330 |
|
331 /** |
|
332 * Fetches a value from iMmsSettings class. |
|
333 * @param aURI The URI to fetch |
|
334 * @param aObject The container for the result. |
|
335 * @return Status of the operation. |
|
336 */ |
|
337 |
|
338 CSmlDmAdapter::TError FetchObjectL( const TDesC8& aURI, CBufBase& aObject ); |
|
339 /** |
|
340 * Stores the contents of iMmsSettings class to phones permanen storage. |
|
341 * @param |
|
342 * @return |
|
343 */ |
|
344 |
|
345 void StoreSettingsL(); |
|
346 /** |
|
347 * Checks the URI validity. |
|
348 * @param aURI The URI to check. |
|
349 * @return Status of the operation. |
|
350 */ |
|
351 |
|
352 CSmlDmAdapter::TError ValidateUriL(const TDesC8& aURI ); |
|
353 |
|
354 TBool IsWAPAccessPointRecordLockedL(TUint32 aRecord); |
|
355 |
|
356 /** |
|
357 * Gets the IAP ID using CMManager |
|
358 * @param aUid the accesspointID |
|
359 * @return the IAP ID |
|
360 */ |
|
361 TUint32 GetIapIdL( TUint32 aUid ); |
|
362 |
|
363 |
|
364 TInt DoProtectWAPAccessRecordL(TUint32 aRecord,TBool aProtect); |
|
365 private: |
|
366 CClientMtmRegistry* iClientMtmRegistry; |
|
367 CMsvSession* iMsvSession; |
|
368 CMmsClientMtm *iMmsClient; |
|
369 CMmsSettings* iMmsSettings; |
|
370 MSmlDmCallback* iCallback; |
|
371 TInt iStatusRef; |
|
372 HBufC8 *iMMSSAddr; |
|
373 TInt iImgSizeStatusRef; |
|
374 CCommsDatabase* iDatabase; |
|
375 }; |
|
376 |
|
377 #endif // __NSMLDMMMSADAPTER_H__ |
|
378 |
|
379 // End of File |