|
1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // mw/remoteconn/mtpfws/mtpfw/dataproviders/dputility/src/cmtpfullenumservicehandler.cpp |
|
15 |
|
16 #include <centralrepository.h> |
|
17 #include <mtp/cmtptypearray.h> |
|
18 |
|
19 #include <mtp/cmtptypeformatcapabilitylist.h> |
|
20 #include <mtp/cmtptypeservicepropdesclist.h> |
|
21 #include <mtp/mmtpdataproviderframework.h> |
|
22 #include <mtp/mmtpobjectmgr.h> |
|
23 #include <mtp/cmtpobjectmetadata.h> |
|
24 |
|
25 #include "mtpsvcdpconst.h" |
|
26 #include "cmtpfullenumservicehandler.h" |
|
27 #include "cmtpabstractdatacodemgr.h" |
|
28 |
|
29 // Class constants. |
|
30 __FLOG_STMT(_LIT8(KComponent, "FullEnumServiceHandler");) |
|
31 |
|
32 EXPORT_C CMTPFullEnumServiceHandler* CMTPFullEnumServiceHandler::NewL(MMTPDataProviderFramework& aFramework, |
|
33 const CMTPFullEnumDataCodeMgr& aDataCodeMgr, |
|
34 CRepository& aRepository, |
|
35 TUint aNormalServiceID, |
|
36 const TDesC& aKnowledgeObjectSUID, |
|
37 const TMTPTypeGuid& aServiceFormatGUID) |
|
38 { |
|
39 CMTPFullEnumServiceHandler* self = new(ELeave) CMTPFullEnumServiceHandler(aFramework, aDataCodeMgr, |
|
40 aRepository, aNormalServiceID, |
|
41 aKnowledgeObjectSUID, aServiceFormatGUID); |
|
42 CleanupStack::PushL(self); |
|
43 self->ConstructL(); |
|
44 CleanupStack::Pop(self); |
|
45 return self; |
|
46 } |
|
47 |
|
48 EXPORT_C CMTPFullEnumServiceHandler::~CMTPFullEnumServiceHandler() |
|
49 { |
|
50 __FLOG(_L8("~CMTPFullEnumServiceHandler - Destructed")); |
|
51 __FLOG_CLOSE; |
|
52 } |
|
53 |
|
54 CMTPFullEnumServiceHandler::CMTPFullEnumServiceHandler(MMTPDataProviderFramework& aFramework, |
|
55 const CMTPFullEnumDataCodeMgr& aDataCodeMgr, CRepository& aRepository, |
|
56 TUint aNormalServiceID, const TDesC& aKnowledgeObjectSUID, |
|
57 const TMTPTypeGuid& aServiceFormatGUID) : |
|
58 iFramework(aFramework), iDataCodeMgr(aDataCodeMgr), iRepository(aRepository), |
|
59 iNormalServiceID(aNormalServiceID), iKnowledgeObjectSUID(aKnowledgeObjectSUID) |
|
60 { |
|
61 iNormalServiceFormatGUID = aServiceFormatGUID; |
|
62 } |
|
63 |
|
64 void CMTPFullEnumServiceHandler::ConstructL() |
|
65 { |
|
66 __FLOG_OPEN(KMTPSubsystem, KComponent); |
|
67 __FLOG(_L8("ConstructL - Entry")); |
|
68 // Initialize the service properties's value stored in iRepository |
|
69 LoadServicePropValueL(); |
|
70 __FLOG(_L8("ConstructL - Exit")); |
|
71 } |
|
72 |
|
73 // GetServiceCapabilities |
|
74 EXPORT_C TMTPResponseCode CMTPFullEnumServiceHandler::GetServiceCapabilityL( |
|
75 TUint16 aServiceFormatCode, CMTPTypeServiceCapabilityList& aServiceCapabilityList) const |
|
76 { |
|
77 __FLOG(_L8("GetServiceCapabilitiesL - Entry")); |
|
78 |
|
79 __ASSERT_DEBUG((aServiceFormatCode == iDataCodeMgr.KnowledgeFormat().iFormatCode), User::Invariant()); |
|
80 |
|
81 //only Knowledge format supported |
|
82 CMTPTypeFormatCapability* element = CMTPTypeFormatCapability::NewLC(aServiceFormatCode, NULL); |
|
83 |
|
84 //only Generic Object namespace properties supported |
|
85 const RMTPServiceFormat& serviceFormat = iDataCodeMgr.KnowledgeFormat(); |
|
86 TUint propCout = serviceFormat.iProps.Count(); |
|
87 for (TUint i = 0; i < propCout; i++) |
|
88 { |
|
89 //only Generic Object namespace properties supported |
|
90 CMTPTypeObjectPropDesc* objectProperty |
|
91 = MMTPServiceHandler::GenerateGenericObjectPropDescLC(serviceFormat.iProps[i]); |
|
92 if (objectProperty) |
|
93 { |
|
94 element->AppendL(objectProperty); |
|
95 CleanupStack::Pop(objectProperty); |
|
96 } |
|
97 } // End of loop for every format |
|
98 aServiceCapabilityList.AppendL(element); |
|
99 CleanupStack::Pop(element); |
|
100 __FLOG(_L8("GetServiceCapabilitiesL - Exit")); |
|
101 return EMTPRespCodeOK; |
|
102 } |
|
103 |
|
104 // GetServicePropDesc |
|
105 EXPORT_C TMTPResponseCode CMTPFullEnumServiceHandler::GetServicePropDescL( |
|
106 TUint16 aServicePropertyCode, CMTPTypeServicePropDescList& aPropDescList) const |
|
107 { |
|
108 __FLOG(_L8("GetServicePropDescL - Entry")); |
|
109 TMTPResponseCode respCode(EMTPRespCodeOK); |
|
110 CMTPTypeServicePropDesc* servicePropDesc = NULL; |
|
111 const TMTPServicePropertyInfo* pPropInfo = iDataCodeMgr.ServicePropertyInfo(aServicePropertyCode); |
|
112 TUint16 servicePropEnum = pPropInfo ? pPropInfo->iIndex : EMTPAbstractServicePropertyEnd; |
|
113 switch (servicePropEnum) |
|
114 { |
|
115 case EMTPServicePropertyVersionProps: |
|
116 { |
|
117 const TUint32 KMaxNumVersionProps = 0x000000FF; |
|
118 TMTPTypeUint32 expectedForm(KMaxNumVersionProps); |
|
119 servicePropDesc = CMTPTypeServicePropDesc::NewLC( |
|
120 aServicePropertyCode, |
|
121 EMTPTypeAUINT8, |
|
122 CMTPTypeObjectPropDesc::EReadOnly, |
|
123 CMTPTypeObjectPropDesc::EByteArrayForm, // Form tag |
|
124 &expectedForm); |
|
125 break; |
|
126 } |
|
127 |
|
128 case EMTPServicePropertyReplicaID: |
|
129 { |
|
130 servicePropDesc = CMTPTypeServicePropDesc::NewLC( |
|
131 aServicePropertyCode, |
|
132 EMTPTypeUINT128, |
|
133 CMTPTypeObjectPropDesc::EReadWrite, |
|
134 CMTPTypeObjectPropDesc::ENone, |
|
135 NULL); |
|
136 break; |
|
137 } |
|
138 |
|
139 case EMTPServicePropertyKnowledgeObjectID: |
|
140 { |
|
141 servicePropDesc = CMTPTypeServicePropDesc::NewLC( |
|
142 aServicePropertyCode, |
|
143 EMTPTypeUINT32, |
|
144 CMTPTypeObjectPropDesc::EReadOnly, |
|
145 CMTPTypeObjectPropDesc::EObjectIDForm, |
|
146 NULL); |
|
147 break; |
|
148 } |
|
149 case EMTPServicePropertyLastSyncProxyID: |
|
150 { |
|
151 servicePropDesc = CMTPTypeServicePropDesc::NewLC( |
|
152 aServicePropertyCode, |
|
153 EMTPTypeUINT128, |
|
154 CMTPTypeObjectPropDesc::EReadWrite, |
|
155 CMTPTypeObjectPropDesc::ENone, |
|
156 NULL); |
|
157 break; |
|
158 } |
|
159 case EMTPServicePropertyProviderVersion: |
|
160 { |
|
161 servicePropDesc = CMTPTypeServicePropDesc::NewLC( |
|
162 aServicePropertyCode, |
|
163 EMTPTypeUINT16, |
|
164 CMTPTypeObjectPropDesc::EReadOnly, |
|
165 CMTPTypeObjectPropDesc::ENone, |
|
166 NULL); |
|
167 break; |
|
168 } |
|
169 case EMTPServicePropertySyncFormat: |
|
170 { |
|
171 servicePropDesc = CMTPTypeServicePropDesc::NewLC( |
|
172 aServicePropertyCode, |
|
173 EMTPTypeUINT128, |
|
174 CMTPTypeObjectPropDesc::EReadOnly, |
|
175 CMTPTypeObjectPropDesc::ENone, |
|
176 NULL); |
|
177 break; |
|
178 } |
|
179 case EMTPServicePropertyLocalOnlyDelete: |
|
180 { |
|
181 CMTPTypeObjectPropDescEnumerationForm* expectedForm |
|
182 = CMTPTypeObjectPropDescEnumerationForm::NewL(EMTPTypeUINT8); |
|
183 CleanupStack::PushL(expectedForm); |
|
184 expectedForm->AppendSupportedValueL(TMTPTypeUint8(EMTPLocalOnlyDeleteFalse)); |
|
185 expectedForm->AppendSupportedValueL(TMTPTypeUint8(EMTPLocalOnlyDeleteTrue)); |
|
186 servicePropDesc = CMTPTypeServicePropDesc::NewL( |
|
187 aServicePropertyCode, |
|
188 EMTPTypeUINT8, |
|
189 CMTPTypeObjectPropDesc::EReadWrite, |
|
190 CMTPTypeObjectPropDesc::EEnumerationForm, |
|
191 expectedForm); |
|
192 // Form can be NULL, so need destroy here for MTPType object here. |
|
193 CleanupStack::PopAndDestroy(expectedForm); |
|
194 CleanupStack::PushL(servicePropDesc); |
|
195 break; |
|
196 } |
|
197 |
|
198 case EMTPServicePropertyFilterType: |
|
199 { |
|
200 CMTPTypeObjectPropDescEnumerationForm* expectedForm |
|
201 = CMTPTypeObjectPropDescEnumerationForm::NewL(EMTPTypeUINT8); |
|
202 CleanupStack::PushL(expectedForm); |
|
203 expectedForm->AppendSupportedValueL(TMTPTypeUint8(EMTPSyncSvcFilterNone)); |
|
204 expectedForm->AppendSupportedValueL(TMTPTypeUint8(EMTPSyncSvcFilterContactsWithPhone)); |
|
205 expectedForm->AppendSupportedValueL(TMTPTypeUint8(EMTPSyncSvcFilterTaskActive)); |
|
206 expectedForm->AppendSupportedValueL(TMTPTypeUint8(EMTPSyncSvcFilterCalendarWindowWithRecurrence)); |
|
207 |
|
208 servicePropDesc = CMTPTypeServicePropDesc::NewL( |
|
209 aServicePropertyCode, |
|
210 EMTPTypeUINT8, |
|
211 CMTPTypeObjectPropDesc::EReadWrite, |
|
212 CMTPTypeObjectPropDesc::EEnumerationForm, |
|
213 expectedForm); |
|
214 // Form can be NULL, so need destroy here for MTPType object here. |
|
215 CleanupStack::PopAndDestroy(expectedForm); |
|
216 CleanupStack::PushL(servicePropDesc); |
|
217 break; |
|
218 } |
|
219 case EMTPServicePropertySyncObjectReferences: |
|
220 { |
|
221 CMTPTypeObjectPropDescEnumerationForm* expectedForm |
|
222 = CMTPTypeObjectPropDescEnumerationForm::NewL(EMTPTypeUINT8); |
|
223 CleanupStack::PushL(expectedForm); |
|
224 expectedForm->AppendSupportedValueL(TMTPTypeUint8(EMTPSyncObjectReferencesDisabled)); |
|
225 expectedForm->AppendSupportedValueL(TMTPTypeUint8(EMTPSyncObjectReferencesEnabled)); |
|
226 servicePropDesc = CMTPTypeServicePropDesc::NewL( |
|
227 aServicePropertyCode, |
|
228 EMTPTypeUINT8, |
|
229 CMTPTypeObjectPropDesc::EReadOnly, |
|
230 CMTPTypeObjectPropDesc::EEnumerationForm, |
|
231 expectedForm); |
|
232 // Form can be NULL, so need destroy here for MTPType object here. |
|
233 CleanupStack::PopAndDestroy(expectedForm); |
|
234 CleanupStack::PushL(servicePropDesc); |
|
235 break; |
|
236 } |
|
237 |
|
238 default: |
|
239 respCode = EMTPRespCodeParameterNotSupported; |
|
240 break; |
|
241 } |
|
242 |
|
243 if (servicePropDesc) |
|
244 { |
|
245 aPropDescList.AppendL(servicePropDesc); |
|
246 CleanupStack::Pop(servicePropDesc); |
|
247 } |
|
248 __FLOG(_L8("GetServicePropDescL - Exit")); |
|
249 return respCode; |
|
250 } |
|
251 |
|
252 // Get specific property of the service |
|
253 EXPORT_C TMTPResponseCode CMTPFullEnumServiceHandler::GetServicePropetyL(TUint16 aPropertyCode, CMTPTypeServicePropList& aPropList) const |
|
254 { |
|
255 __FLOG(_L8("GetServicePropetyL - Entry")); |
|
256 |
|
257 TMTPResponseCode responseCode = EMTPRespCodeOK; |
|
258 const TMTPServicePropertyInfo* pPropInfo = iDataCodeMgr.ServicePropertyInfo(aPropertyCode); |
|
259 TUint16 servicePropEnum = pPropInfo ? pPropInfo->iIndex : EMTPAbstractServicePropertyEnd; |
|
260 CMTPTypeServicePropListElement* propertyElement = NULL; |
|
261 switch (servicePropEnum) |
|
262 { |
|
263 case EMTPServicePropertyVersionProps: |
|
264 { |
|
265 RArray<TUint> elementData; |
|
266 CleanupClosePushL(elementData); |
|
267 const TUint values[] = |
|
268 { |
|
269 // Change Unit Count |
|
270 0x01, 0x00, 0x00, 0x00, |
|
271 // Change Unit 1 |
|
272 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
|
273 0x00, 0x00, 0x00, 0x00, |
|
274 // Count for Change Unit 1 |
|
275 0x01, 0x00, 0x00, 0x00, |
|
276 // Version Prop DateModified Namespace and PID |
|
277 0x0D, 0x49, 0x6B, 0xEF, 0xD8, 0x5C, 0x7A, 0x43, 0xAF, 0xFC, 0xDA, 0x8B, 0x60, 0xEE, 0x4A, 0x3C, |
|
278 0x28, 0x00, 0x00, 0x00 |
|
279 }; |
|
280 TUint numValues((sizeof(values) / sizeof(values[0]))); |
|
281 for (TUint i = 0; i < numValues; i++) |
|
282 { |
|
283 elementData.AppendL(values[i]); |
|
284 } |
|
285 |
|
286 CMTPTypeArray* versionProp = CMTPTypeArray::NewLC(EMTPTypeAUINT8, elementData); |
|
287 propertyElement = CMTPTypeServicePropListElement::NewL(iNormalServiceID, aPropertyCode, |
|
288 EMTPTypeAUINT8, *versionProp); |
|
289 CleanupStack::PopAndDestroy(versionProp); |
|
290 CleanupStack::PopAndDestroy(&elementData); |
|
291 CleanupStack::PushL(propertyElement); |
|
292 break; |
|
293 } |
|
294 |
|
295 case EMTPServicePropertyReplicaID: |
|
296 { |
|
297 const TMTPTypeGuid unInitValue(MAKE_TUINT64(KMTPUnInitialized32, KMTPUnInitialized32), |
|
298 MAKE_TUINT64(KMTPUnInitialized32, KMTPUnInitialized32)); |
|
299 if (!unInitValue.Equal(iReplicateID)) |
|
300 { |
|
301 propertyElement = CMTPTypeServicePropListElement::NewLC(iNormalServiceID, aPropertyCode, |
|
302 EMTPTypeUINT128, iReplicateID); |
|
303 } |
|
304 break; |
|
305 } |
|
306 |
|
307 case EMTPServicePropertyKnowledgeObjectID: |
|
308 { |
|
309 CMTPObjectMetaData* object = CMTPObjectMetaData::NewLC(); |
|
310 if (iFramework.ObjectMgr().ObjectL(iKnowledgeObjectSUID, *object)) |
|
311 { |
|
312 // Use knowledge object's handle as service property KnowledgeObjectId. |
|
313 TUint knowledgeObjectID = object->Uint(CMTPObjectMetaData::EHandle); |
|
314 CleanupStack::PopAndDestroy(object); |
|
315 TMTPTypeUint32 objId; |
|
316 objId.Set(knowledgeObjectID); |
|
317 propertyElement = CMTPTypeServicePropListElement::NewLC(iNormalServiceID, aPropertyCode, |
|
318 EMTPTypeUINT32, objId); |
|
319 } |
|
320 else |
|
321 { |
|
322 CleanupStack::PopAndDestroy(object); |
|
323 } |
|
324 break; |
|
325 } |
|
326 case EMTPServicePropertyLastSyncProxyID: |
|
327 { |
|
328 const TMTPTypeGuid unInitValue(MAKE_TUINT64(KMTPUnInitialized32, KMTPUnInitialized32), |
|
329 MAKE_TUINT64(KMTPUnInitialized32, KMTPUnInitialized32)); |
|
330 if (!unInitValue.Equal(iLastSyncProxyID)) |
|
331 { |
|
332 propertyElement = CMTPTypeServicePropListElement::NewLC(iNormalServiceID, aPropertyCode, |
|
333 EMTPTypeUINT128, iLastSyncProxyID); |
|
334 } |
|
335 break; |
|
336 } |
|
337 case EMTPServicePropertyProviderVersion: |
|
338 { |
|
339 TMTPTypeUint16 version(KMTPDefaultProviderVersion); |
|
340 propertyElement = CMTPTypeServicePropListElement::NewLC(iNormalServiceID, aPropertyCode, |
|
341 EMTPTypeUINT16, version); |
|
342 break; |
|
343 } |
|
344 case EMTPServicePropertySyncFormat: |
|
345 { |
|
346 propertyElement = CMTPTypeServicePropListElement::NewLC(iNormalServiceID, aPropertyCode, |
|
347 EMTPTypeUINT128, iNormalServiceFormatGUID); |
|
348 break; |
|
349 } |
|
350 case EMTPServicePropertyLocalOnlyDelete: |
|
351 { |
|
352 if (EMTPLocalOnlyDeleteUnInitialized != iLocalOnlyDelete) |
|
353 { |
|
354 TMTPTypeUint8 localOnlyDelete(iLocalOnlyDelete); |
|
355 propertyElement = CMTPTypeServicePropListElement::NewLC(iNormalServiceID, aPropertyCode, |
|
356 EMTPTypeUINT8, localOnlyDelete); |
|
357 } |
|
358 break; |
|
359 } |
|
360 |
|
361 case EMTPServicePropertyFilterType: |
|
362 if (EMTPSyncSvcFilterUnInitialized != iFilterType) |
|
363 { |
|
364 TMTPTypeUint8 filterType(iFilterType); |
|
365 propertyElement = CMTPTypeServicePropListElement::NewLC(iNormalServiceID, aPropertyCode, |
|
366 EMTPTypeUINT8, filterType); |
|
367 } |
|
368 break; |
|
369 case EMTPServicePropertySyncObjectReferences: |
|
370 { |
|
371 TMTPTypeUint8 syncObjectRef(iSyncObjectReference); |
|
372 propertyElement = CMTPTypeServicePropListElement::NewLC(iNormalServiceID, aPropertyCode, |
|
373 EMTPTypeUINT8, syncObjectRef); |
|
374 break; |
|
375 } |
|
376 |
|
377 default: |
|
378 responseCode = EMTPRespCodeInvalidServicePropCode; |
|
379 } |
|
380 if (propertyElement) |
|
381 { |
|
382 aPropList.AppendL(propertyElement); |
|
383 CleanupStack::Pop(propertyElement); |
|
384 } |
|
385 __FLOG_VA((_L8("GetServicePropetyL - Exit with responseCode = 0x%04X"), responseCode)); |
|
386 return responseCode; |
|
387 } |
|
388 |
|
389 EXPORT_C TMTPResponseCode CMTPFullEnumServiceHandler::SetServicePropetyL( |
|
390 TUint16 aPropEnumIndex, const CMTPTypeServicePropListElement& aElement) |
|
391 { |
|
392 __FLOG(_L8("SetServicePropetyL - Entry")); |
|
393 TMTPResponseCode responseCode = EMTPRespCodeOK; |
|
394 |
|
395 TUint16 dataType = aElement.Uint16L(CMTPTypeServicePropListElement::EDatatype); |
|
396 switch (aPropEnumIndex) |
|
397 { |
|
398 case EMTPServicePropertyReplicaID: |
|
399 { |
|
400 if (dataType == EMTPTypeUINT128) |
|
401 { |
|
402 TMTPTypeGuid unInitValue; |
|
403 aElement.GetL(CMTPTypeServicePropListElement::EValue, unInitValue); |
|
404 iReplicateID = unInitValue; |
|
405 responseCode = MMTPServiceHandler::SaveServicePropValue(iRepository, EReplicaID, iReplicateID); |
|
406 } |
|
407 else |
|
408 { |
|
409 responseCode = EMTPRespCodeInvalidDataset; |
|
410 } |
|
411 break; |
|
412 } |
|
413 case EMTPServicePropertyLastSyncProxyID: |
|
414 { |
|
415 if (dataType == EMTPTypeUINT128) |
|
416 { |
|
417 TMTPTypeGuid unInitValue; |
|
418 aElement.GetL(CMTPTypeServicePropListElement::EValue, unInitValue); |
|
419 iLastSyncProxyID = unInitValue; |
|
420 responseCode = MMTPServiceHandler::SaveServicePropValue(iRepository, ELastSyncProxyID, iLastSyncProxyID); |
|
421 } |
|
422 else |
|
423 { |
|
424 responseCode = EMTPRespCodeInvalidDataset; |
|
425 } |
|
426 break; |
|
427 } |
|
428 case EMTPServicePropertyLocalOnlyDelete: |
|
429 { |
|
430 if (dataType == EMTPTypeUINT8) |
|
431 { |
|
432 TMTPSyncSvcLocalOnlyDelete localOnlyDelete |
|
433 = static_cast<TMTPSyncSvcLocalOnlyDelete>(aElement.Uint8L(CMTPTypeServicePropListElement::EValue)); |
|
434 if (localOnlyDelete < EMTPLocalOnlyDeleteFalse || localOnlyDelete > EMTPLocalOnlyDeleteTrue) |
|
435 { |
|
436 responseCode = EMTPRespCodeInvalidDataset; |
|
437 } |
|
438 else |
|
439 { |
|
440 iLocalOnlyDelete = localOnlyDelete; |
|
441 responseCode = MMTPServiceHandler::SaveServicePropValue(iRepository, ELocalOnlyDelete, iLocalOnlyDelete); |
|
442 } |
|
443 } |
|
444 else |
|
445 { |
|
446 responseCode = EMTPRespCodeInvalidDataset; |
|
447 } |
|
448 break; |
|
449 } |
|
450 |
|
451 case EMTPServicePropertyFilterType: |
|
452 { |
|
453 if (dataType == EMTPTypeUINT8) |
|
454 { |
|
455 TMTPSyncSvcFilterType filterType |
|
456 = static_cast<TMTPSyncSvcFilterType>(aElement.Uint8L(CMTPTypeServicePropListElement::EValue)); |
|
457 if (filterType < EMTPSyncSvcFilterNone || |
|
458 filterType > EMTPSyncSvcFilterCalendarWindowWithRecurrence) |
|
459 { |
|
460 responseCode = EMTPRespCodeInvalidDataset; |
|
461 } |
|
462 else |
|
463 { |
|
464 iFilterType = filterType; |
|
465 responseCode = MMTPServiceHandler::SaveServicePropValue(iRepository, EFilterType, iFilterType); |
|
466 } |
|
467 } |
|
468 else |
|
469 { |
|
470 responseCode = EMTPRespCodeInvalidDataset; |
|
471 } |
|
472 break; |
|
473 } |
|
474 |
|
475 case EMTPServicePropertyVersionProps: |
|
476 case EMTPServicePropertyKnowledgeObjectID: |
|
477 case EMTPServicePropertyProviderVersion: |
|
478 case EMTPServicePropertySyncFormat: |
|
479 case EMTPServicePropertySyncObjectReferences: |
|
480 responseCode = EMTPRespCodeAccessDenied; |
|
481 break; |
|
482 default: |
|
483 responseCode = EMTPRespCodeInvalidServicePropCode; |
|
484 break; |
|
485 } //End of switch |
|
486 __FLOG_VA((_L8("SetServicePropertyL - Exit with responseCode = 0x%04X"), responseCode)); |
|
487 return responseCode; |
|
488 } |
|
489 |
|
490 EXPORT_C TMTPResponseCode CMTPFullEnumServiceHandler::DeleteServiceProperty(TUint16 aPropEnumIndex) |
|
491 { |
|
492 __FLOG(_L8("DeleteServiceProperty - Entry")); |
|
493 TMTPResponseCode responseCode = EMTPRespCodeOK; |
|
494 switch (aPropEnumIndex) |
|
495 { |
|
496 // Deleteserviceproplist set all preoperties to uninitialized value |
|
497 case EMTPServicePropertyReplicaID: |
|
498 { |
|
499 TMTPTypeGuid tmp(MAKE_TINT64(KMTPUnInitialized32, KMTPUnInitialized32), |
|
500 MAKE_TINT64(KMTPUnInitialized32, KMTPUnInitialized32)); |
|
501 iReplicateID = tmp; |
|
502 responseCode = MMTPServiceHandler::SaveServicePropValue(iRepository, EReplicaID, iReplicateID); |
|
503 break; |
|
504 } |
|
505 case EMTPServicePropertyLastSyncProxyID: |
|
506 { |
|
507 TMTPTypeGuid tmp(MAKE_TINT64(KMTPUnInitialized32, KMTPUnInitialized32), |
|
508 MAKE_TINT64(KMTPUnInitialized32, KMTPUnInitialized32)); |
|
509 iLastSyncProxyID = tmp; |
|
510 responseCode = MMTPServiceHandler::SaveServicePropValue(iRepository, ELastSyncProxyID, iLastSyncProxyID); |
|
511 break; |
|
512 } |
|
513 case EMTPServicePropertyLocalOnlyDelete: |
|
514 { |
|
515 iLocalOnlyDelete = EMTPLocalOnlyDeleteUnInitialized; |
|
516 responseCode = MMTPServiceHandler::SaveServicePropValue(iRepository, ELocalOnlyDelete, iLocalOnlyDelete); |
|
517 break; |
|
518 } |
|
519 case EMTPServicePropertyFilterType: |
|
520 { |
|
521 iFilterType = EMTPSyncSvcFilterUnInitialized; |
|
522 responseCode = MMTPServiceHandler::SaveServicePropValue(iRepository, EFilterType, iFilterType); |
|
523 break; |
|
524 } |
|
525 case EMTPServicePropertyVersionProps: |
|
526 case EMTPServicePropertyKnowledgeObjectID: |
|
527 case EMTPServicePropertyProviderVersion: |
|
528 case EMTPServicePropertySyncFormat: |
|
529 case EMTPServicePropertySyncObjectReferences: |
|
530 { |
|
531 responseCode = EMTPRespCodeAccessDenied; |
|
532 break; |
|
533 } |
|
534 default: |
|
535 { |
|
536 responseCode = EMTPRespCodeInvalidServicePropCode; |
|
537 __FLOG(_L8("Invalid service propcode")); |
|
538 break; |
|
539 } |
|
540 } |
|
541 __FLOG(_L8("DeleteServiceProperty - Exit")); |
|
542 return responseCode; |
|
543 } |
|
544 |
|
545 void CMTPFullEnumServiceHandler::LoadServicePropValueL() |
|
546 { |
|
547 __FLOG(_L8("LoadServicePropValueL - Entry")); |
|
548 // Load ReplicaID: |
|
549 TPtr8 writeBuf(NULL, 0); //walkaroud for the TMTPTypeGuid |
|
550 iReplicateID.FirstWriteChunk(writeBuf); |
|
551 User::LeaveIfError(iRepository.Get(EReplicaID, writeBuf)); |
|
552 |
|
553 //load LastSyncProxyID |
|
554 iLastSyncProxyID.FirstWriteChunk(writeBuf); |
|
555 User::LeaveIfError(iRepository.Get(ELastSyncProxyID, writeBuf)); |
|
556 |
|
557 TInt value; |
|
558 // Load LocalOnlyDelete |
|
559 User::LeaveIfError(iRepository.Get(ELocalOnlyDelete, value)); |
|
560 iLocalOnlyDelete = static_cast<TMTPSyncSvcLocalOnlyDelete>(value); |
|
561 |
|
562 // Load EFilterType |
|
563 User::LeaveIfError(iRepository.Get(EFilterType, value)); |
|
564 iFilterType = static_cast<TMTPSyncSvcFilterType>(value); |
|
565 |
|
566 //Load SyncObjectReferenceEnabled |
|
567 //Only dp which support SyncObjectReference need to save it into central responsitory |
|
568 value = EMTPSyncObjectReferencesDisabled; |
|
569 TInt ret = iRepository.Get(ESyncObjectReference, value); |
|
570 if (ret != KErrNone && ret != KErrNotFound ) |
|
571 { |
|
572 User::Leave(ret); |
|
573 } |
|
574 iSyncObjectReference = static_cast<TMTPSyncSvcSyncObjectReferences>(value); |
|
575 |
|
576 __FLOG(_L8("LoadServicePropValueL - Exit")); |
|
577 return; |
|
578 } |