23 #include <mtp/mmtpobjectmgr.h> |
23 #include <mtp/mmtpobjectmgr.h> |
24 #include <mtp/cmtptypefile.h> |
24 #include <mtp/cmtptypefile.h> |
25 #include <mtp/mtpdatatypeconstants.h> |
25 #include <mtp/mtpdatatypeconstants.h> |
26 |
26 |
27 #include "cmtpknowledgehandler.h" |
27 #include "cmtpknowledgehandler.h" |
28 |
28 #include "mtpdebug.h" |
29 // Class constants. |
29 #include "OstTraceDefinitions.h" |
30 __FLOG_STMT(_LIT8(KComponent,"KwgObjHdler");) |
30 #ifdef OST_TRACE_COMPILER_IN_USE |
|
31 #include "cmtpknowledgehandlerTraces.h" |
|
32 #endif |
|
33 |
31 |
34 |
32 const TInt KDateTimeMaxLength = 22; |
35 const TInt KDateTimeMaxLength = 22; |
33 const TInt KNameMaxLength = 255; |
36 const TInt KNameMaxLength = 255; |
34 |
37 |
35 _LIT16(KEmptyContent16, ""); |
38 _LIT16(KEmptyContent16, ""); |
53 { |
56 { |
54 |
57 |
55 } |
58 } |
56 CKnowledgeObject::~CKnowledgeObject() |
59 CKnowledgeObject::~CKnowledgeObject() |
57 { |
60 { |
58 __FLOG(_L8("~CKnowledgeObject - Entry")); |
61 OstTraceFunctionEntry0( CKNOWLEDGEOBJECT_CKNOWLEDGEOBJECT_DES_ENTRY ); |
59 iDateModified.Close(); |
62 iDateModified.Close(); |
60 iName.Close(); |
63 iName.Close(); |
61 __FLOG(_L8("~CKnowledgeObject - Exit")); |
64 OstTraceFunctionExit0( CKNOWLEDGEOBJECT_CKNOWLEDGEOBJECT_DES_EXIT ); |
62 __FLOG_CLOSE; |
|
63 } |
65 } |
64 void CKnowledgeObject::ConstructL() |
66 void CKnowledgeObject::ConstructL() |
65 { |
67 { |
66 __FLOG_OPEN(KMTPSubsystem, KComponent); |
68 OstTraceFunctionEntry0( CKNOWLEDGEOBJECT_CONSTRUCTL_ENTRY ); |
67 __FLOG(_L8("CKnowledgeObject Construct - Entry")); |
|
68 iKnowledgeObjectSize = KObjectSizeNotAvaiable; |
69 iKnowledgeObjectSize = KObjectSizeNotAvaiable; |
69 iDateModified.CreateL(KDateTimeMaxLength); |
70 iDateModified.CreateL(KDateTimeMaxLength); |
70 iName.CreateL(KNameMaxLength); |
71 iName.CreateL(KNameMaxLength); |
71 iLastAuthorProxyID.Set(KMTPUnInitialized64, KMTPUnInitialized64); |
72 iLastAuthorProxyID.Set(KMTPUnInitialized64, KMTPUnInitialized64); |
72 iDirty = EBitFlagAll; |
73 iDirty = EBitFlagAll; |
73 __FLOG(_L8("CKnowledgeObject Construct - Exit")); |
74 OstTraceFunctionExit0( CKNOWLEDGEOBJECT_CONSTRUCTL_EXIT ); |
74 } |
75 } |
75 |
76 |
76 void CKnowledgeObject::LoadL() |
77 void CKnowledgeObject::LoadL() |
77 { |
78 { |
78 __FLOG(_L8("CKnowledgeObject LoadL - Entry")); |
79 OstTraceFunctionEntry0( CKNOWLEDGEOBJECT_LOADL_ENTRY ); |
79 // Load ObjectSize |
80 // Load ObjectSize |
80 TInt objSize; |
81 TInt objSize; |
81 User::LeaveIfError(iRepository.Get(ESize, objSize)); |
82 LEAVEIFERROR(iRepository.Get(ESize, objSize), |
|
83 OstTrace0( TRACE_ERROR, CKNOWLEDGEOBJECT_LOADL, "Can't Load ObjectSize from iRepository!" )); |
82 iKnowledgeObjectSize = objSize; |
84 iKnowledgeObjectSize = objSize; |
83 |
85 |
84 // Load DateModify |
86 // Load DateModify |
85 iDateModified.Zero(); |
87 iDateModified.Zero(); |
86 User::LeaveIfError(iRepository.Get(EDateModified, iDateModified)); |
88 LEAVEIFERROR(iRepository.Get(EDateModified, iDateModified), |
|
89 OstTrace0( TRACE_ERROR, DUP1_CKNOWLEDGEOBJECT_LOADL, "Can't Load DateModify from iRepository!" )); |
87 |
90 |
88 // Load Name |
91 // Load Name |
89 iName.Zero(); |
92 iName.Zero(); |
90 User::LeaveIfError(iRepository.Get(EName, iName)); |
93 LEAVEIFERROR(iRepository.Get(EName, iName), |
|
94 OstTrace0( TRACE_ERROR, DUP2_CKNOWLEDGEOBJECT_LOADL, "Can't Load Name from iRepository!" )); |
91 |
95 |
92 // Load LastAuthorProxyID: |
96 // Load LastAuthorProxyID: |
93 TPtr8 writeBuf(NULL, 0); //walkaroud for the TMTPTypeUint128 |
97 TPtr8 writeBuf(NULL, 0); //walkaroud for the TMTPTypeUint128 |
94 iLastAuthorProxyID.FirstWriteChunk(writeBuf); |
98 iLastAuthorProxyID.FirstWriteChunk(writeBuf); |
95 User::LeaveIfError(iRepository.Get(ELastAuthorProxyID, writeBuf)); |
99 LEAVEIFERROR(iRepository.Get(ELastAuthorProxyID, writeBuf), |
|
100 OstTrace0( TRACE_ERROR, DUP3_CKNOWLEDGEOBJECT_LOADL, "Can't Load LastAuthorProxyID from iRepository!" )); |
96 iDirty = EBitFlagNone; |
101 iDirty = EBitFlagNone; |
97 __FLOG(_L8("CKnowledgeObject LoadL - Exit")); |
102 OstTraceFunctionExit0( CKNOWLEDGEOBJECT_LOADL_EXIT ); |
98 return; |
103 return; |
99 } |
104 } |
100 |
105 |
101 |
106 |
102 void CKnowledgeObject::Clear() |
107 void CKnowledgeObject::Clear() |
103 { |
108 { |
104 __FLOG(_L8("CKnowledgeObject Clear - Entry")); |
109 OstTraceFunctionEntry0( CKNOWLEDGEOBJECT_CLEAR_ENTRY ); |
105 iKnowledgeObjectSize = KObjectSizeNotAvaiable; |
110 iKnowledgeObjectSize = KObjectSizeNotAvaiable; |
106 iDateModified.Zero(); |
111 iDateModified.Zero(); |
107 iName.Zero(); |
112 iName.Zero(); |
108 iLastAuthorProxyID.Set(KMTPUnInitialized64, KMTPUnInitialized64); |
113 iLastAuthorProxyID.Set(KMTPUnInitialized64, KMTPUnInitialized64); |
109 iDirty = EBitFlagAll; |
114 iDirty = EBitFlagAll; |
110 __FLOG(_L8("CKnowledgeObject Clear - Exit")); |
115 OstTraceFunctionExit0( CKNOWLEDGEOBJECT_CLEAR_EXIT ); |
111 } |
116 } |
112 |
117 |
113 void CKnowledgeObject::SetSize(TUint64 aSize) |
118 void CKnowledgeObject::SetSize(TUint64 aSize) |
114 { |
119 { |
115 iKnowledgeObjectSize = aSize; |
120 iKnowledgeObjectSize = aSize; |
139 iDirty |= EBitFlagLastAuthorProxyID; |
144 iDirty |= EBitFlagLastAuthorProxyID; |
140 } |
145 } |
141 |
146 |
142 void CKnowledgeObject::CommitL() |
147 void CKnowledgeObject::CommitL() |
143 { |
148 { |
144 __FLOG(_L8("CKnowledgeObject CommitL - Entry")); |
149 OstTraceFunctionEntry0( CKNOWLEDGEOBJECT_COMMITL_ENTRY ); |
145 if (EBitFlagSize == (iDirty & EBitFlagSize)) |
150 if (EBitFlagSize == (iDirty & EBitFlagSize)) |
146 { |
151 { |
147 // TUint64 -> TInt, some capability is lost, |
152 // TUint64 -> TInt, some capability is lost, |
148 // anyway, it's enough for knowledge object. |
153 // anyway, it's enough for knowledge object. |
149 User::LeaveIfError(iRepository.Set(ESize, (TInt)iKnowledgeObjectSize)); |
154 LEAVEIFERROR(iRepository.Set(ESize, (TInt)iKnowledgeObjectSize), |
|
155 OstTrace1( TRACE_ERROR, CKNOWLEDGEOBJECT_COMMITL, "set Size to %d failed against iRepository!", iKnowledgeObjectSize)); |
150 } |
156 } |
151 |
157 |
152 if (EBitFlagName == (iDirty & EBitFlagName)) |
158 if (EBitFlagName == (iDirty & EBitFlagName)) |
153 { |
159 { |
154 User::LeaveIfError(iRepository.Set(EName, iName)); |
160 LEAVEIFERROR(iRepository.Set(EName, iName), |
|
161 OstTraceExt1( TRACE_ERROR, DUP1_CKNOWLEDGEOBJECT_COMMITL, "set name to %S failed against iRepository!", iName)); |
155 } |
162 } |
156 |
163 |
157 if (EBitFlagLastAuthorProxyID == (iDirty & EBitFlagLastAuthorProxyID)) |
164 if (EBitFlagLastAuthorProxyID == (iDirty & EBitFlagLastAuthorProxyID)) |
158 { |
165 { |
159 if (EMTPRespCodeOK != SetColumnType128Value(ELastAuthorProxyID, iLastAuthorProxyID)) |
166 if (EMTPRespCodeOK != SetColumnType128Value(ELastAuthorProxyID, iLastAuthorProxyID)) |
160 { |
167 { |
|
168 OstTrace0( TRACE_ERROR, DUP2_CKNOWLEDGEOBJECT_COMMITL, "set LastAuthorProxyID failed!" ); |
161 User::Leave(KErrGeneral); |
169 User::Leave(KErrGeneral); |
162 } |
170 } |
163 } |
171 } |
164 |
172 |
165 // update DateModified to be the time of Commit |
173 // update DateModified to be the time of Commit |
166 RefreshDateModifed(); |
174 RefreshDateModifed(); |
167 User::LeaveIfError(iRepository.Set(EDateModified, iDateModified)); |
175 LEAVEIFERROR(iRepository.Set(EDateModified, iDateModified), |
|
176 OstTraceExt1( TRACE_ERROR, DUP3_CKNOWLEDGEOBJECT_COMMITL, "set DateModified to %S failed against iRepository!", iDateModified)); |
168 |
177 |
169 iDirty = EBitFlagNone; |
178 iDirty = EBitFlagNone; |
170 __FLOG(_L8("CKnowledgeObject KnowledgeObject CommitL - Exit")); |
179 OstTraceFunctionExit0( CKNOWLEDGEOBJECT_COMMITL_EXIT ); |
171 return; |
180 return; |
172 } |
181 } |
173 |
182 |
174 TMTPResponseCode CKnowledgeObject::SetColumnType128Value(TMTPKnowledgeStoreKeyNum aColumnNum, TMTPTypeUint128& aNewData) |
183 TMTPResponseCode CKnowledgeObject::SetColumnType128Value(TMTPKnowledgeStoreKeyNum aColumnNum, TMTPTypeUint128& aNewData) |
175 { |
184 { |
176 __FLOG(_L8("CKnowledgeObject SetColumnType128ValueL - Entry")); |
185 OstTraceFunctionEntry0( CKNOWLEDGEOBJECT_SETCOLUMNTYPE128VALUE_ENTRY ); |
177 TInt ret; |
186 TInt ret; |
178 TMTPResponseCode responseCode = EMTPRespCodeOK; |
187 TMTPResponseCode responseCode = EMTPRespCodeOK; |
179 TBuf8<KMTPTypeINT128Size> data; |
188 TBuf8<KMTPTypeINT128Size> data; |
180 data.FillZ(data.MaxLength()); |
189 data.FillZ(data.MaxLength()); |
181 TUint64 upperValue = aNewData.UpperValue(); |
190 TUint64 upperValue = aNewData.UpperValue(); |
196 ret = iRepository.Set(aColumnNum, data); |
205 ret = iRepository.Set(aColumnNum, data); |
197 if (KErrNone != ret) |
206 if (KErrNone != ret) |
198 { |
207 { |
199 responseCode = EMTPRespCodeGeneralError; |
208 responseCode = EMTPRespCodeGeneralError; |
200 } |
209 } |
201 __FLOG_VA((_L8("CKnowledgeObject SetColumnType128ValueL - Exit with responseCode = 0x%04X"), responseCode)); |
210 OstTraceFunctionExit0( CKNOWLEDGEOBJECT_SETCOLUMNTYPE128VALUE_EXIT ); |
|
211 OstTrace1( TRACE_NORMAL, CKNOWLEDGEOBJECT_SETCOLUMNTYPE128VALUE, "responseCode = 0x%04X", responseCode ); |
202 return responseCode; |
212 return responseCode; |
203 } |
213 } |
204 |
214 |
205 |
215 |
206 void CKnowledgeObject::RefreshDateModifed() |
216 void CKnowledgeObject::RefreshDateModifed() |
207 { |
217 { |
208 __FLOG(_L8("CKnowledgeObject RefreshDateModifed - Entry")); |
218 OstTraceFunctionEntry0( CKNOWLEDGEOBJECT_REFRESHDATEMODIFED_ENTRY ); |
209 //get current time |
219 //get current time |
210 TTime now; |
220 TTime now; |
211 now.UniversalTime(); |
221 now.UniversalTime(); |
212 _LIT(KFormat,"%F%Y%M%DT%H%T%SZ"); |
222 _LIT(KFormat,"%F%Y%M%DT%H%T%SZ"); |
213 iDateModified.Zero(); |
223 iDateModified.Zero(); |
214 now.FormatL(iDateModified, KFormat); |
224 now.FormatL(iDateModified, KFormat); |
215 __FLOG(_L8("CKnowledgeObject RefreshDateModifed - Exit")); |
225 OstTraceFunctionExit0( CKNOWLEDGEOBJECT_REFRESHDATEMODIFED_EXIT ); |
216 return; |
226 return; |
217 } |
227 } |
218 |
228 |
219 EXPORT_C CMTPKnowledgeHandler* CMTPKnowledgeHandler::NewL(MMTPDataProviderFramework& aFramework, TUint16 aFormatCode, |
229 EXPORT_C CMTPKnowledgeHandler* CMTPKnowledgeHandler::NewL(MMTPDataProviderFramework& aFramework, TUint16 aFormatCode, |
220 CRepository& aReposotry, const TDesC& aKwgSuid) |
230 CRepository& aReposotry, const TDesC& aKwgSuid) |
226 return self; |
236 return self; |
227 } |
237 } |
228 |
238 |
229 EXPORT_C CMTPKnowledgeHandler::~CMTPKnowledgeHandler() |
239 EXPORT_C CMTPKnowledgeHandler::~CMTPKnowledgeHandler() |
230 { |
240 { |
231 __FLOG(_L8("~CMTPKnowledgeHandler - Entry")); |
241 OstTraceFunctionEntry0( CMTPKNOWLEDGEHANDLER_CMTPKNOWLEDGEHANDLER_DES_ENTRY ); |
232 delete iKnowledgeObj; |
242 delete iKnowledgeObj; |
233 delete iKnowledgeSwpBuffer; |
243 delete iKnowledgeSwpBuffer; |
234 delete iCachedKnowledgeObject; |
244 delete iCachedKnowledgeObject; |
235 __FLOG(_L8("~CMTPKnowledgeHandler - Exit")); |
245 OstTraceFunctionExit0( CMTPKNOWLEDGEHANDLER_CMTPKNOWLEDGEHANDLER_DES_EXIT ); |
236 __FLOG_CLOSE; |
|
237 } |
246 } |
238 |
247 |
239 CMTPKnowledgeHandler::CMTPKnowledgeHandler(MMTPDataProviderFramework& aFramework, TUint16 aFormatCode, |
248 CMTPKnowledgeHandler::CMTPKnowledgeHandler(MMTPDataProviderFramework& aFramework, TUint16 aFormatCode, |
240 CRepository& aReposotry, const TDesC& aKwgSuid) : |
249 CRepository& aReposotry, const TDesC& aKwgSuid) : |
241 iFramework(aFramework), iRepository(aReposotry), iKnowledgeFormatCode(aFormatCode), iSuid(aKwgSuid) |
250 iFramework(aFramework), iRepository(aReposotry), iKnowledgeFormatCode(aFormatCode), iSuid(aKwgSuid) |
242 { |
251 { |
243 } |
252 } |
244 |
253 |
245 void CMTPKnowledgeHandler::ConstructL() |
254 void CMTPKnowledgeHandler::ConstructL() |
246 { |
255 { |
247 __FLOG_OPEN(KMTPSubsystem, KComponent); |
256 OstTraceFunctionEntry0( CMTPKNOWLEDGEHANDLER_CONSTRUCTL_ENTRY ); |
248 __FLOG(_L8("Construct - Entry")); |
|
249 |
257 |
250 iFramework.Fs().PrivatePath(iKnowObjFileName); |
258 iFramework.Fs().PrivatePath(iKnowObjFileName); |
251 iKnowObjFileName.Insert(0, KMTPKnowledgeObjDriveLocation); |
259 iKnowObjFileName.Insert(0, KMTPKnowledgeObjDriveLocation); |
252 iKnowObjFileName.Append(KMTPNoBackupFolder); |
260 iKnowObjFileName.Append(KMTPNoBackupFolder); |
253 iKnowObjFileName.Append(iSuid); |
261 iKnowObjFileName.Append(iSuid); |
263 |
271 |
264 // Recover for previous failed transaction |
272 // Recover for previous failed transaction |
265 if(BaflUtils::FileExists(iFramework.Fs(), iKnowObjSwpFileName)) |
273 if(BaflUtils::FileExists(iFramework.Fs(), iKnowObjSwpFileName)) |
266 { |
274 { |
267 // In case DP received some object content |
275 // In case DP received some object content |
268 User::LeaveIfError(iFramework.Fs().Delete(iKnowObjSwpFileName)); |
276 LEAVEIFERROR(iFramework.Fs().Delete(iKnowObjSwpFileName), |
|
277 OstTraceExt1( TRACE_ERROR, CMTPKNOWLEDGEHANDLER_CONSTRUCTL, "delete %S failed!", iKnowObjSwpFileName )); |
269 } |
278 } |
270 |
279 |
271 // create and load knowledge object properties |
280 // create and load knowledge object properties |
272 iCachedKnowledgeObject = CKnowledgeObject::NewL(iRepository); |
281 iCachedKnowledgeObject = CKnowledgeObject::NewL(iRepository); |
273 iCachedKnowledgeObject->LoadL(); |
282 iCachedKnowledgeObject->LoadL(); |
274 __FLOG(_L8("ConstructL - Exit")); |
283 OstTraceFunctionExit0( CMTPKNOWLEDGEHANDLER_CONSTRUCTL_EXIT ); |
275 } |
284 } |
276 |
285 |
277 EXPORT_C void CMTPKnowledgeHandler::SetStorageId(TUint32 aStorageId) |
286 EXPORT_C void CMTPKnowledgeHandler::SetStorageId(TUint32 aStorageId) |
278 { |
287 { |
279 iStorageID = aStorageId; |
288 iStorageID = aStorageId; |
280 } |
289 } |
281 |
290 |
282 void CMTPKnowledgeHandler::CommitL() |
291 void CMTPKnowledgeHandler::CommitL() |
283 { |
292 { |
284 __FLOG(_L8("CommitL - Entry")); |
293 OstTraceFunctionEntry0( CMTPKNOWLEDGEHANDLER_COMMITL_ENTRY ); |
285 User::LeaveIfError(iRepository.StartTransaction(CRepository::EReadWriteTransaction)); |
294 LEAVEIFERROR(iRepository.StartTransaction(CRepository::EReadWriteTransaction), |
|
295 OstTrace0( TRACE_ERROR, CMTPKNOWLEDGEHANDLER_COMMITL, "start readwrite transaction for iRepository failed!")); |
|
296 |
286 iRepository.CleanupCancelTransactionPushL(); |
297 iRepository.CleanupCancelTransactionPushL(); |
287 |
298 |
288 iCachedKnowledgeObject->CommitL(); |
299 iCachedKnowledgeObject->CommitL(); |
289 |
300 |
290 // Close all knowledge file and reset pointer. |
301 // Close all knowledge file and reset pointer. |
298 { |
309 { |
299 delete iKnowledgeSwpBuffer; |
310 delete iKnowledgeSwpBuffer; |
300 iKnowledgeSwpBuffer = NULL; |
311 iKnowledgeSwpBuffer = NULL; |
301 } |
312 } |
302 |
313 |
303 if(BaflUtils::FileExists(iFramework.Fs(), iKnowObjSwpFileName)) |
314 if(BaflUtils::FileExists(iFramework.Fs(), iKnowObjSwpFileName) && iCachedKnowledgeObject->Size() > 0) |
304 { |
315 { |
305 // In case DP received some object content |
316 // In case DP received some object content |
306 User::LeaveIfError(iFramework.Fs().Replace(iKnowObjSwpFileName, iKnowObjFileName)); |
317 LEAVEIFERROR(iFramework.Fs().Replace(iKnowObjSwpFileName, iKnowObjFileName), |
|
318 OstTraceExt2( TRACE_ERROR, DUP1_CMTPKNOWLEDGEHANDLER_COMMITL, |
|
319 "replace %S with %S failed!", iKnowObjSwpFileName, iKnowObjFileName)); |
307 } |
320 } |
308 // If swp file isn't exsited, that means 0 sized object received, need do nothing. |
321 // If swp file isn't exsited, that means 0 sized object received, need do nothing. |
309 |
322 |
310 TUint32 keyInfo; |
323 TUint32 keyInfo; |
311 User::LeaveIfError(iRepository.CommitTransaction(keyInfo)); |
324 LEAVEIFERROR(iRepository.CommitTransaction(keyInfo), |
|
325 OstTrace1( TRACE_ERROR, DUP2_CMTPKNOWLEDGEHANDLER_COMMITL, |
|
326 "Commits transaction failed. The number of keys whose values were modified is %d", keyInfo)); |
|
327 |
|
328 |
312 CleanupStack::Pop(&iRepository); |
329 CleanupStack::Pop(&iRepository); |
313 |
330 |
314 __FLOG(_L8("CommitL - Exit")); |
331 OstTraceFunctionExit0( CMTPKNOWLEDGEHANDLER_COMMITL_EXIT ); |
315 } |
332 } |
316 |
333 |
317 void CMTPKnowledgeHandler::CommitForNewObjectL(TDes& aSuid) |
334 void CMTPKnowledgeHandler::CommitForNewObjectL(TDes& aSuid) |
318 { |
335 { |
|
336 OstTraceFunctionEntry0( CMTPKNOWLEDGEHANDLER_COMMITFORNEWOBJECTL_ENTRY ); |
319 aSuid = iSuid; |
337 aSuid = iSuid; |
320 CommitL(); |
338 CommitL(); |
|
339 OstTraceFunctionExit0( CMTPKNOWLEDGEHANDLER_COMMITFORNEWOBJECTL_EXIT ); |
321 } |
340 } |
322 |
341 |
323 void CMTPKnowledgeHandler::RollBack() |
342 void CMTPKnowledgeHandler::RollBack() |
324 { |
343 { |
325 __FLOG(_L8("Rollback - Entry")); |
344 OstTraceFunctionEntry0( CMTPKNOWLEDGEHANDLER_ROLLBACK_ENTRY ); |
326 iCachedKnowledgeObject->Clear(); |
345 iCachedKnowledgeObject->Clear(); |
327 TRAP_IGNORE(iCachedKnowledgeObject->LoadL()); |
346 TRAP_IGNORE(iCachedKnowledgeObject->LoadL()); |
328 __FLOG(_L8("Rollback - Exit")); |
347 OstTraceFunctionExit0( CMTPKNOWLEDGEHANDLER_ROLLBACK_EXIT ); |
329 } |
348 } |
330 |
349 |
331 EXPORT_C void CMTPKnowledgeHandler::GetObjectSuidL(TDes& aSuid) const |
350 EXPORT_C void CMTPKnowledgeHandler::GetObjectSuidL(TDes& aSuid) const |
332 { |
351 { |
333 __FLOG(_L8("GetObjectSuidL - Entry")); |
352 OstTraceFunctionEntry0( CMTPKNOWLEDGEHANDLER_GETOBJECTSUIDL_ENTRY ); |
334 if(iCachedKnowledgeObject->Size() != KObjectSizeNotAvaiable) |
353 if(iCachedKnowledgeObject->Size() != KObjectSizeNotAvaiable) |
335 { |
354 { |
336 aSuid.Append(iSuid); |
355 aSuid.Append(iSuid); |
337 } |
356 } |
338 __FLOG(_L8("GetObjectSuidL - Exit")); |
357 OstTraceFunctionExit0( CMTPKNOWLEDGEHANDLER_GETOBJECTSUIDL_EXIT ); |
339 } |
358 } |
340 |
359 |
341 TMTPResponseCode CMTPKnowledgeHandler::SendObjectInfoL(const CMTPTypeObjectInfo& aObjectInfo, TUint32& aParentHandle, TDes& aSuid) |
360 TMTPResponseCode CMTPKnowledgeHandler::SendObjectInfoL(const CMTPTypeObjectInfo& aObjectInfo, TUint32& aParentHandle, TDes& aSuid) |
342 { |
361 { |
343 __FLOG(_L("SendObjectInfoL - Entry")); |
362 OstTraceFunctionEntry0( CMTPKNOWLEDGEHANDLER_SENDOBJECTINFOL_ENTRY ); |
344 TMTPResponseCode responseCode = EMTPRespCodeOK; |
363 TMTPResponseCode responseCode = EMTPRespCodeOK; |
345 if (aParentHandle != KMTPHandleNone && aParentHandle != KMTPHandleNoParent) |
364 if (aParentHandle != KMTPHandleNone && aParentHandle != KMTPHandleNoParent) |
346 { |
365 { |
347 responseCode = EMTPRespCodeInvalidParentObject; |
366 responseCode = EMTPRespCodeInvalidParentObject; |
348 } |
367 } |
349 else |
368 else |
350 { |
369 { |
351 //if there's a read error reread |
370 //if there's a read error reread |
352 if(iCachedKnowledgeObject->IsDirty()) |
371 if(iCachedKnowledgeObject->IsDirty()) |
353 { |
372 { |
354 __FLOG(_L8("Warning: The cached knowledge is dirty")); |
373 OstTrace0( TRACE_WARNING, CMTPKNOWLEDGEHANDLER_SENDOBJECTINFOL, "The cached knowledge is dirty" ); |
355 iCachedKnowledgeObject->Clear(); |
374 iCachedKnowledgeObject->Clear(); |
356 iCachedKnowledgeObject->LoadL(); |
375 iCachedKnowledgeObject->LoadL(); |
357 } |
376 } |
358 //already has a knowledge object |
377 //already has a knowledge object |
359 if(iCachedKnowledgeObject->Size() != KObjectSizeNotAvaiable) |
378 if(iCachedKnowledgeObject->Size() != KObjectSizeNotAvaiable) |
366 iCachedKnowledgeObject->SetSize(aObjectInfo.Uint32L(CMTPTypeObjectInfo::EObjectCompressedSize)); |
385 iCachedKnowledgeObject->SetSize(aObjectInfo.Uint32L(CMTPTypeObjectInfo::EObjectCompressedSize)); |
367 // DateModified will be updated when commit. |
386 // DateModified will be updated when commit. |
368 aSuid = iSuid; |
387 aSuid = iSuid; |
369 } |
388 } |
370 } |
389 } |
371 __FLOG(_L("SendObjectInfoL - Exit")); |
390 OstTraceFunctionExit0( CMTPKNOWLEDGEHANDLER_SENDOBJECTINFOL_EXIT ); |
372 return responseCode; |
391 return responseCode; |
373 } |
392 } |
374 |
393 |
375 TMTPResponseCode CMTPKnowledgeHandler::SendObjectPropListL(TUint64 aObjectSize, const CMTPTypeObjectPropList& /*aObjectPropList*/, |
394 TMTPResponseCode CMTPKnowledgeHandler::SendObjectPropListL(TUint64 aObjectSize, const CMTPTypeObjectPropList& /*aObjectPropList*/, |
376 TUint32& aParentHandle, TDes& aSuid) |
395 TUint32& aParentHandle, TDes& aSuid) |
377 { |
396 { |
378 __FLOG(_L8("SendObjectPropListL - Entry")); |
397 OstTraceFunctionEntry0( CMTPKNOWLEDGEHANDLER_SENDOBJECTPROPLISTL_ENTRY ); |
379 TMTPResponseCode responseCode = EMTPRespCodeOK; |
398 TMTPResponseCode responseCode = EMTPRespCodeOK; |
380 if (aParentHandle != KMTPHandleNone && aParentHandle != KMTPHandleNoParent) |
399 if (aParentHandle != KMTPHandleNone && aParentHandle != KMTPHandleNoParent) |
381 { |
400 { |
382 responseCode = EMTPRespCodeInvalidParentObject; |
401 responseCode = EMTPRespCodeInvalidParentObject; |
383 } |
402 } |
385 { |
404 { |
386 //if there's a read error reread |
405 //if there's a read error reread |
387 aParentHandle = KMTPHandleNoParent; |
406 aParentHandle = KMTPHandleNoParent; |
388 if(iCachedKnowledgeObject->IsDirty()) |
407 if(iCachedKnowledgeObject->IsDirty()) |
389 { |
408 { |
390 __FLOG(_L8("Warning: The cached knowledge is dirty")); |
409 OstTrace0( TRACE_WARNING, CMTPKNOWLEDGEHANDLER_SENDOBJECTPROPLISTL, "The cached knowledge is dirty" ); |
391 iCachedKnowledgeObject->Clear(); |
410 iCachedKnowledgeObject->Clear(); |
392 iCachedKnowledgeObject->LoadL(); |
411 iCachedKnowledgeObject->LoadL(); |
393 } |
412 } |
394 //already has a knowledge object |
413 //already has a knowledge object |
395 if(iCachedKnowledgeObject->Size() != KObjectSizeNotAvaiable) |
414 if(iCachedKnowledgeObject->Size() != KObjectSizeNotAvaiable) |
401 iCachedKnowledgeObject->Clear(); |
420 iCachedKnowledgeObject->Clear(); |
402 iCachedKnowledgeObject->SetSize(aObjectSize); |
421 iCachedKnowledgeObject->SetSize(aObjectSize); |
403 aSuid = iSuid; |
422 aSuid = iSuid; |
404 } |
423 } |
405 } |
424 } |
406 __FLOG(_L8("SendObjectPropListL - Exit")); |
425 OstTraceFunctionExit0( CMTPKNOWLEDGEHANDLER_SENDOBJECTPROPLISTL_EXIT ); |
407 return responseCode; |
426 return responseCode; |
408 } |
427 } |
409 |
428 |
410 TMTPResponseCode CMTPKnowledgeHandler::GetObjectPropertyL(const CMTPObjectMetaData& aObjectMetaData, |
429 TMTPResponseCode CMTPKnowledgeHandler::GetObjectPropertyL(const CMTPObjectMetaData& aObjectMetaData, |
411 TUint16 aPropertyCode, CMTPTypeObjectPropList& aPropList) |
430 TUint16 aPropertyCode, CMTPTypeObjectPropList& aPropList) |
412 { |
431 { |
413 __FLOG(_L8("GetObjectPropertyL - Entry")); |
432 OstTraceFunctionEntry0( CMTPKNOWLEDGEHANDLER_GETOBJECTPROPERTYL_ENTRY ); |
414 TMTPResponseCode responseCode = EMTPRespCodeOK; |
433 TMTPResponseCode responseCode = EMTPRespCodeOK; |
415 CMTPTypeObjectPropListElement* propertyElement = NULL; |
434 CMTPTypeObjectPropListElement* propertyElement = NULL; |
416 TUint32 aHandle = aObjectMetaData.Uint(CMTPObjectMetaData::EHandle); |
435 TUint32 aHandle = aObjectMetaData.Uint(CMTPObjectMetaData::EHandle); |
417 |
436 |
418 if(iCachedKnowledgeObject->IsDirty()) |
437 if(iCachedKnowledgeObject->IsDirty()) |
419 { |
438 { |
420 __FLOG(_L8("Warning: The cached knowledge is dirty")); |
439 OstTrace0( TRACE_WARNING, CMTPKNOWLEDGEHANDLER_GETOBJECTPROPERTYL, "The cached knowledge is dirty" ); |
421 iCachedKnowledgeObject->LoadL(); |
440 iCachedKnowledgeObject->LoadL(); |
422 } |
441 } |
423 |
442 |
424 switch (aPropertyCode) |
443 switch (aPropertyCode) |
425 { |
444 { |
522 } |
541 } |
523 if(propertyElement) |
542 if(propertyElement) |
524 { |
543 { |
525 aPropList.CommitPropElemL(*propertyElement); |
544 aPropList.CommitPropElemL(*propertyElement); |
526 } |
545 } |
527 __FLOG(_L8("GetObjectPropertyL - Exit")); |
546 OstTraceFunctionExit0( CMTPKNOWLEDGEHANDLER_GETOBJECTPROPERTYL_EXIT ); |
528 return responseCode; |
547 return responseCode; |
529 } |
548 } |
530 |
549 |
531 TMTPResponseCode CMTPKnowledgeHandler::SetObjectPropertyL(const TDesC& /*aSuid*/, |
550 TMTPResponseCode CMTPKnowledgeHandler::SetObjectPropertyL(const TDesC& /*aSuid*/, |
532 const CMTPTypeObjectPropListElement& aElement, |
551 const CMTPTypeObjectPropListElement& aElement, |
533 TMTPOperationCode aOperationCode) |
552 TMTPOperationCode aOperationCode) |
534 { |
553 { |
535 __FLOG(_L8("SetObjectPropertyL - Entry")); |
554 OstTraceFunctionEntry0( CMTPKNOWLEDGEHANDLER_SETOBJECTPROPERTYL_ENTRY ); |
536 TMTPResponseCode responseCode = CheckGenObjectPropertyL(aElement, aOperationCode); |
555 TMTPResponseCode responseCode = CheckGenObjectPropertyL(aElement, aOperationCode); |
537 if (responseCode == EMTPRespCodeOK) |
556 if (responseCode == EMTPRespCodeOK) |
538 { |
557 { |
539 TUint16 propertyCode(aElement.Uint16L(CMTPTypeObjectPropListElement::EPropertyCode)); |
558 TUint16 propertyCode(aElement.Uint16L(CMTPTypeObjectPropListElement::EPropertyCode)); |
540 switch (propertyCode) |
559 switch (propertyCode) |
567 default: |
586 default: |
568 responseCode = EMTPRespCodeObjectPropNotSupported; |
587 responseCode = EMTPRespCodeObjectPropNotSupported; |
569 break; |
588 break; |
570 } |
589 } |
571 } |
590 } |
572 __FLOG(_L8("SetObjectPropertyL - Exit")); |
591 OstTraceFunctionExit0( CMTPKNOWLEDGEHANDLER_SETOBJECTPROPERTYL_EXIT ); |
573 return responseCode; |
592 return responseCode; |
574 } |
593 } |
575 |
594 |
576 // Remove the knowledge object |
595 // Remove the knowledge object |
577 TMTPResponseCode CMTPKnowledgeHandler::DeleteObjectL(const CMTPObjectMetaData& /*aObjectMetaData*/) |
596 TMTPResponseCode CMTPKnowledgeHandler::DeleteObjectL(const CMTPObjectMetaData& /*aObjectMetaData*/) |
578 { |
597 { |
579 __FLOG(_L8("DeleteObjectL - Entry")); |
598 OstTraceFunctionEntry0( CMTPKNOWLEDGEHANDLER_DELETEOBJECTL_ENTRY ); |
580 |
599 |
581 User::LeaveIfError(iRepository.StartTransaction(CRepository::EReadWriteTransaction)); |
600 LEAVEIFERROR(iRepository.StartTransaction(CRepository::EReadWriteTransaction), |
|
601 OstTrace0( TRACE_ERROR, CMTPKNOWLEDGEHANDLER_DELETEOBJECTL, "Start readwrite transaction failed!")); |
582 iRepository.CleanupCancelTransactionPushL(); |
602 iRepository.CleanupCancelTransactionPushL(); |
583 |
603 |
584 // Delete obejct properties in transaction, if leave, mgr will rollback all properties. |
604 // Delete obejct properties in transaction, if leave, mgr will rollback all properties. |
585 iCachedKnowledgeObject->Clear(); |
605 iCachedKnowledgeObject->Clear(); |
586 iCachedKnowledgeObject->CommitL(); |
606 iCachedKnowledgeObject->CommitL(); |
593 } |
613 } |
594 |
614 |
595 // Keep file delete is atomic. |
615 // Keep file delete is atomic. |
596 if (BaflUtils::FileExists(iFramework.Fs(), iKnowObjFileName)) |
616 if (BaflUtils::FileExists(iFramework.Fs(), iKnowObjFileName)) |
597 { |
617 { |
598 User::LeaveIfError(iFramework.Fs().Delete(iKnowObjFileName)); |
618 LEAVEIFERROR(iFramework.Fs().Delete(iKnowObjFileName), |
|
619 OstTraceExt1( TRACE_ERROR, DUP1_CMTPKNOWLEDGEHANDLER_DELETEOBJECTL, "delete %S failed!", iKnowObjFileName)); |
599 } |
620 } |
600 |
621 |
601 TUint32 keyInfo; |
622 TUint32 keyInfo; |
602 User::LeaveIfError(iRepository.CommitTransaction(keyInfo)); |
623 LEAVEIFERROR(iRepository.CommitTransaction(keyInfo), |
|
624 OstTrace1( TRACE_ERROR, DUP2_CMTPKNOWLEDGEHANDLER_DELETEOBJECTL, |
|
625 "Commits transaction failed. The number of keys whose values were modified is %d", keyInfo)); |
|
626 |
603 CleanupStack::Pop(&iRepository); |
627 CleanupStack::Pop(&iRepository); |
604 |
628 |
605 __FLOG(_L8("DeleteObjectL - Exit")); |
629 OstTraceFunctionExit0( CMTPKNOWLEDGEHANDLER_DELETEOBJECTL_EXIT ); |
606 return EMTPRespCodeOK; |
630 return EMTPRespCodeOK; |
607 } |
631 } |
608 |
632 |
609 // Return the knowledge object content |
633 // Return the knowledge object content |
610 TMTPResponseCode CMTPKnowledgeHandler::GetObjectL(const CMTPObjectMetaData& /*aObjectMetaData*/, MMTPType** aBuffer) |
634 TMTPResponseCode CMTPKnowledgeHandler::GetObjectL(const CMTPObjectMetaData& /*aObjectMetaData*/, MMTPType** aBuffer) |
611 { |
635 { |
612 __FLOG(_L8("GetObjectL - Entry")); |
636 OstTraceFunctionEntry0( CMTPKNOWLEDGEHANDLER_GETOBJECTL_ENTRY ); |
613 if (!BaflUtils::FileExists(iFramework.Fs(), iKnowObjFileName)) |
637 if (!BaflUtils::FileExists(iFramework.Fs(), iKnowObjFileName)) |
614 { |
638 { |
615 RFile file; |
639 RFile file; |
616 CleanupClosePushL(file); |
640 CleanupClosePushL(file); |
617 User::LeaveIfError(file.Create(iFramework.Fs(), iKnowObjFileName, EFileRead)); |
641 LEAVEIFERROR(file.Create(iFramework.Fs(), iKnowObjFileName, EFileRead), |
|
642 OstTraceExt1( TRACE_ERROR, CMTPKNOWLEDGEHANDLER_GETOBJECTL, "Create readonly %S failed!", iKnowObjFileName)); |
618 CleanupStack::PopAndDestroy(&file); |
643 CleanupStack::PopAndDestroy(&file); |
619 } |
644 } |
620 |
645 |
621 // iKnowledgeObj will be NULL in four cases: 1. Initialize; 2. The Object has been deleted. |
646 // iKnowledgeObj will be NULL in four cases: 1. Initialize; 2. The Object has been deleted. |
622 // 3. it has been commited by SendObject. 4 released by GetObject. |
647 // 3. it has been commited by SendObject. 4 released by GetObject. |
623 if (!iKnowledgeObj) |
648 if (!iKnowledgeObj) |
624 { |
649 { |
625 iKnowledgeObj = CMTPTypeFile::NewL(iFramework.Fs(), iKnowObjFileName, EFileRead); |
650 iKnowledgeObj = CMTPTypeFile::NewL(iFramework.Fs(), iKnowObjFileName, EFileRead); |
626 } |
651 } |
627 *aBuffer = iKnowledgeObj; |
652 *aBuffer = iKnowledgeObj; |
628 __FLOG(_L8("GetObjectL - Exit")); |
653 OstTraceFunctionExit0( CMTPKNOWLEDGEHANDLER_GETOBJECTL_EXIT ); |
629 return EMTPRespCodeOK; |
654 return EMTPRespCodeOK; |
630 } |
655 } |
631 |
656 |
632 TMTPResponseCode CMTPKnowledgeHandler::DeleteObjectPropertyL(const CMTPObjectMetaData& /*aObjectMetaData*/, const TUint16 aPropertyCode) |
657 TMTPResponseCode CMTPKnowledgeHandler::DeleteObjectPropertyL(const CMTPObjectMetaData& /*aObjectMetaData*/, const TUint16 aPropertyCode) |
633 { |
658 { |
634 __FLOG(_L8("DeleteObjectPropertyL - Entry")); |
659 OstTraceFunctionEntry0( CMTPKNOWLEDGEHANDLER_DELETEOBJECTPROPERTYL_ENTRY ); |
635 TMTPResponseCode responseCode = EMTPRespCodeOK; |
660 TMTPResponseCode responseCode = EMTPRespCodeOK; |
636 switch (aPropertyCode) |
661 switch (aPropertyCode) |
637 { |
662 { |
638 case EMTPGenObjPropCodeDateModified: |
663 case EMTPGenObjPropCodeDateModified: |
639 // DateModified will be updated when Commit |
664 // DateModified will be updated when Commit |
658 |
683 |
659 default: |
684 default: |
660 responseCode = EMTPRespCodeInvalidObjectPropCode; |
685 responseCode = EMTPRespCodeInvalidObjectPropCode; |
661 break; |
686 break; |
662 } |
687 } |
663 __FLOG(_L8("DeleteObjectPropertyL - Exit")); |
688 OstTraceFunctionExit0( CMTPKNOWLEDGEHANDLER_DELETEOBJECTPROPERTYL_EXIT ); |
664 return responseCode; |
689 return responseCode; |
665 } |
690 } |
666 |
691 |
667 TMTPResponseCode CMTPKnowledgeHandler::GetBufferForSendObjectL(const CMTPObjectMetaData& /*aObjectMetaData*/, MMTPType** aBuffer) |
692 TMTPResponseCode CMTPKnowledgeHandler::GetBufferForSendObjectL(const CMTPObjectMetaData& /*aObjectMetaData*/, MMTPType** aBuffer) |
668 { |
693 { |
669 __FLOG(_L8("GetBufferForSendObjectL - Entry")); |
694 OstTraceFunctionEntry0( CMTPKNOWLEDGEHANDLER_GETBUFFERFORSENDOBJECTL_ENTRY ); |
670 if (iKnowledgeSwpBuffer) |
695 if (iKnowledgeSwpBuffer) |
671 { |
696 { |
672 delete iKnowledgeSwpBuffer; |
697 delete iKnowledgeSwpBuffer; |
673 iKnowledgeSwpBuffer = NULL; |
698 iKnowledgeSwpBuffer = NULL; |
674 } |
699 } |
675 iKnowledgeSwpBuffer = CMTPTypeFile::NewL(iFramework.Fs(), iKnowObjSwpFileName, EFileWrite); |
700 iKnowledgeSwpBuffer = CMTPTypeFile::NewL(iFramework.Fs(), iKnowObjSwpFileName, EFileWrite); |
676 iKnowledgeSwpBuffer->SetSizeL(0); |
701 iKnowledgeSwpBuffer->SetSizeL(0); |
677 *aBuffer = iKnowledgeSwpBuffer; |
702 *aBuffer = iKnowledgeSwpBuffer; |
678 __FLOG(_L8("GetBufferForSendObjectL - Exit")); |
703 OstTraceFunctionExit0( CMTPKNOWLEDGEHANDLER_GETBUFFERFORSENDOBJECTL_EXIT ); |
679 return EMTPRespCodeOK; |
704 return EMTPRespCodeOK; |
680 } |
705 } |
681 |
706 |
682 void CMTPKnowledgeHandler::BuildObjectInfoL(CMTPTypeObjectInfo& aObjectInfo) const |
707 void CMTPKnowledgeHandler::BuildObjectInfoL(CMTPTypeObjectInfo& aObjectInfo) const |
683 { |
708 { |
|
709 OstTraceFunctionEntry0( CMTPKNOWLEDGEHANDLER_BUILDOBJECTINFOL_ENTRY ); |
684 aObjectInfo.SetUint32L(CMTPTypeObjectInfo::EStorageID, iStorageID); |
710 aObjectInfo.SetUint32L(CMTPTypeObjectInfo::EStorageID, iStorageID); |
685 aObjectInfo.SetUint16L(CMTPTypeObjectInfo::EObjectFormat, iKnowledgeFormatCode); |
711 aObjectInfo.SetUint16L(CMTPTypeObjectInfo::EObjectFormat, iKnowledgeFormatCode); |
686 // Not use |
712 // Not use |
687 aObjectInfo.SetUint16L(CMTPTypeObjectInfo::EProtectionStatus, 0x0000); |
713 aObjectInfo.SetUint16L(CMTPTypeObjectInfo::EProtectionStatus, 0x0000); |
688 aObjectInfo.SetUint32L(CMTPTypeObjectInfo::EObjectCompressedSize, iCachedKnowledgeObject->Size()); |
714 aObjectInfo.SetUint32L(CMTPTypeObjectInfo::EObjectCompressedSize, iCachedKnowledgeObject->Size()); |
699 aObjectInfo.SetUint32L(CMTPTypeObjectInfo::ESequenceNumber, 0); |
725 aObjectInfo.SetUint32L(CMTPTypeObjectInfo::ESequenceNumber, 0); |
700 aObjectInfo.SetStringL(CMTPTypeObjectInfo::EFilename, KNullDesC); |
726 aObjectInfo.SetStringL(CMTPTypeObjectInfo::EFilename, KNullDesC); |
701 aObjectInfo.SetStringL(CMTPTypeObjectInfo::EDateModified, KNullDesC); |
727 aObjectInfo.SetStringL(CMTPTypeObjectInfo::EDateModified, KNullDesC); |
702 aObjectInfo.SetStringL(CMTPTypeObjectInfo::EDateCreated, KNullDesC); |
728 aObjectInfo.SetStringL(CMTPTypeObjectInfo::EDateCreated, KNullDesC); |
703 aObjectInfo.SetStringL(CMTPTypeObjectInfo::EKeywords, KNullDesC); |
729 aObjectInfo.SetStringL(CMTPTypeObjectInfo::EKeywords, KNullDesC); |
|
730 OstTraceFunctionExit0( CMTPKNOWLEDGEHANDLER_BUILDOBJECTINFOL_EXIT ); |
704 } |
731 } |
705 |
732 |
706 TMTPResponseCode CMTPKnowledgeHandler::GetObjectInfoL(const CMTPObjectMetaData& /*aObjectMetaData*/, CMTPTypeObjectInfo& aObjectInfo) |
733 TMTPResponseCode CMTPKnowledgeHandler::GetObjectInfoL(const CMTPObjectMetaData& /*aObjectMetaData*/, CMTPTypeObjectInfo& aObjectInfo) |
707 { |
734 { |
708 __FLOG(_L8("GetObjectInfoL - Entry")); |
735 OstTraceFunctionEntry0( CMTPKNOWLEDGEHANDLER_GETOBJECTINFOL_ENTRY ); |
709 if(iCachedKnowledgeObject->Size() != KObjectSizeNotAvaiable) |
736 if(iCachedKnowledgeObject->Size() != KObjectSizeNotAvaiable) |
710 { |
737 { |
711 BuildObjectInfoL(aObjectInfo); |
738 BuildObjectInfoL(aObjectInfo); |
712 } |
739 } |
713 __FLOG(_L8("GetObjectInfoL - Exit")); |
740 OstTraceFunctionExit0( CMTPKNOWLEDGEHANDLER_GETOBJECTINFOL_EXIT ); |
714 return EMTPRespCodeOK; |
741 return EMTPRespCodeOK; |
715 } |
742 } |
716 |
743 |
717 |
744 |
718 void CMTPKnowledgeHandler::ReleaseObjectBuffer() |
745 void CMTPKnowledgeHandler::ReleaseObjectBuffer() |
719 { |
746 { |
720 __FLOG(_L8("ReleaseObjectBuffer - Entry")); |
747 OstTraceFunctionEntry0( CMTPKNOWLEDGEHANDLER_RELEASEOBJECTBUFFER_ENTRY ); |
721 if (iKnowledgeObj) |
748 if (iKnowledgeObj) |
722 { |
749 { |
723 delete iKnowledgeObj; |
750 delete iKnowledgeObj; |
724 iKnowledgeObj = NULL; |
751 iKnowledgeObj = NULL; |
725 } |
752 } |
726 __FLOG(_L8("ReleaseObjectBuffer - Exit")); |
753 OstTraceFunctionExit0( CMTPKNOWLEDGEHANDLER_RELEASEOBJECTBUFFER_EXIT ); |
727 } |
754 } |
728 |
755 |
729 TMTPResponseCode CMTPKnowledgeHandler::GetObjectSizeL(const TDesC& aSuid, TUint64& aObjectSize) |
756 TMTPResponseCode CMTPKnowledgeHandler::GetObjectSizeL(const TDesC& aSuid, TUint64& aObjectSize) |
730 { |
757 { |
731 __FLOG(_L8("GetObjectSizeL - Entry")); |
758 OstTraceFunctionEntry0( CMTPKNOWLEDGEHANDLER_GETOBJECTSIZEL_ENTRY ); |
732 if (aSuid != iSuid) |
759 if (aSuid != iSuid) |
733 { |
760 { |
|
761 OstTraceFunctionExit0( CMTPKNOWLEDGEHANDLER_GETOBJECTSIZEL_EXIT ); |
734 return EMTPRespCodeGeneralError; |
762 return EMTPRespCodeGeneralError; |
735 } |
763 } |
736 aObjectSize = iCachedKnowledgeObject->Size(); |
764 aObjectSize = iCachedKnowledgeObject->Size(); |
737 __FLOG(_L8("GetObjectSizeL - Exit")); |
765 OstTraceFunctionExit0( DUP1_CMTPKNOWLEDGEHANDLER_GETOBJECTSIZEL_EXIT ); |
738 return EMTPRespCodeOK; |
766 return EMTPRespCodeOK; |
739 } |
767 } |
740 |
768 |
741 TMTPResponseCode CMTPKnowledgeHandler::GetAllObjectPropCodeByGroupL(TUint32 aGroupId, RArray<TUint32>& aPropCodes) |
769 TMTPResponseCode CMTPKnowledgeHandler::GetAllObjectPropCodeByGroupL(TUint32 aGroupId, RArray<TUint32>& aPropCodes) |
742 { |
770 { |
743 __FLOG(_L8("GetAllObjectPropCodeByGroupL - Entry")); |
771 OstTraceFunctionEntry0( CMTPKNOWLEDGEHANDLER_GETALLOBJECTPROPCODEBYGROUPL_ENTRY ); |
744 TMTPResponseCode responseCode = EMTPRespCodeOK; |
772 TMTPResponseCode responseCode = EMTPRespCodeOK; |
745 if (0 == aGroupId) |
773 if (0 == aGroupId) |
746 { |
774 { |
747 TInt count = sizeof(KMTPFullEnumSyncKnowledgeObjectProperties) / sizeof(KMTPFullEnumSyncKnowledgeObjectProperties[0]); |
775 TInt count = sizeof(KMTPFullEnumSyncKnowledgeObjectProperties) / sizeof(KMTPFullEnumSyncKnowledgeObjectProperties[0]); |
748 for (TInt i = 0; i < count; i++) |
776 for (TInt i = 0; i < count; i++) |