mtpfws/mtpfw/dataproviders/dputility/src/cmtpsetobjectprotection.cpp
branchRCL_3
changeset 5 3673b591050c
parent 0 d0791faffa3f
child 6 ef55b168cedb
--- a/mtpfws/mtpfw/dataproviders/dputility/src/cmtpsetobjectprotection.cpp	Wed Mar 31 22:58:56 2010 +0300
+++ b/mtpfws/mtpfw/dataproviders/dputility/src/cmtpsetobjectprotection.cpp	Wed Apr 14 16:49:36 2010 +0300
@@ -37,6 +37,8 @@
         {TMTPTypeRequest::ERequestParameter1, EMTPElementTypeObjectHandle, EMTPElementAttrWrite, 0, 0, 0},      
      };
 
+const TInt KRetryTimes = 10;
+const TInt KRetryInterval = 150 * 1000; //150ms
 /**
 Two-phase construction method
 @param aPlugin  The data provider plugin
@@ -97,20 +99,42 @@
     {
     TUint32 handle = Request().Uint32(TMTPTypeRequest::ERequestParameter1);
     TUint32 statusValue = Request().Uint32(TMTPTypeRequest::ERequestParameter2);
-    TMTPResponseCode rsp = EMTPRespCodeOK;
+    TMTPResponseCode rsp = EMTPRespCodeAccessDenied;
     //iFramework.ObjectMgr().ObjectL(TMTPTypeUint32(handle), *iObjMeta);
     
     switch(statusValue)
         {
         case EMTPProtectionNoProtection:
             {
-            iRfs.SetAtt(iObjMeta->DesC(CMTPObjectMetaData::ESuid),KEntryAttNormal,KEntryAttReadOnly);
+            for(TInt i = 0; i < KRetryTimes; ++ i)
+                {
+                if(KErrNone == iRfs.SetAtt(iObjMeta->DesC(CMTPObjectMetaData::ESuid),KEntryAttNormal,KEntryAttReadOnly))
+                    {
+                    rsp = EMTPRespCodeOK;
+                    break;
+                    }
+                else
+                    {
+                    User::After(KRetryInterval);	
+                    }
+                }
             }
             break;
         case EMTPProtectionReadOnly:
         case EMTPProtectionReadOnlyData:
             {
-            iRfs.SetAtt(iObjMeta->DesC(CMTPObjectMetaData::ESuid),KEntryAttReadOnly,KEntryAttNormal);
+            for(TInt i = 0; i < KRetryTimes; ++ i)
+                {
+                if(KErrNone == iRfs.SetAtt(iObjMeta->DesC(CMTPObjectMetaData::ESuid),KEntryAttReadOnly,KEntryAttNormal))
+                    {
+                        rsp = EMTPRespCodeOK;
+                        break;
+                    }
+                    else
+                    {
+                        User::After(KRetryInterval);	
+                    }
+                }
             }
             break;
         default: