mmappcomponents/mmmtpdataprovider/src/mmmtpdputility.cpp
branchRCL_3
changeset 17 6f9f6e99a23e
parent 14 f56ec6ce2732
child 22 b034b1c214c2
--- a/mmappcomponents/mmmtpdataprovider/src/mmmtpdputility.cpp	Tue May 11 16:40:32 2010 +0300
+++ b/mmappcomponents/mmmtpdataprovider/src/mmmtpdputility.cpp	Tue May 25 13:14:13 2010 +0300
@@ -27,6 +27,7 @@
 #include <mtp/mmtpdataproviderframework.h>
 #include <mtp/mmtpobjectmgr.h>
 #include <mtp/tmtptypeuint32.h>
+#include <e32property.h>    // for RProperty
 
 // for asf mimetype parsing
 #ifdef __WINDOWS_MEDIA
@@ -39,6 +40,7 @@
 #include "tobjectdescription.h"
 #include "mmmtpdplogger.h"
 #include "mmmtpdp_variant.hrh"
+#include "cmmmtpdpaccesssingleton.h"
 
 using namespace ContentAccess;
 
@@ -702,4 +704,36 @@
     return drmStatus;
     }
 
+EXPORT_C void MmMtpDpUtility::SetPSStatus( TMtpPSStatus aStatus )
+    {
+    TBool changeScheduled = EFalse;
+    CMmMtpDpAccessSingleton::CancelActiveToIdleStatusChange();  // cancel any outstanding delay status change
+    
+    if ( aStatus == EMtpPSStatusReadyToSync )
+        {
+        TInt mtpStatus;
+        RProperty::Get( KMtpPSUid, KMtpPSStatus, mtpStatus );
+        
+        if ( mtpStatus == EMtpPSStatusActive )
+            {
+            CMmMtpDpAccessSingleton::ActiveToIdleStatusChange();
+            changeScheduled = ETrue;
+            }
+        }
+
+    if ( !changeScheduled )
+        DoSetPSStatus( aStatus );
+    }
+
+void MmMtpDpUtility::DoSetPSStatus( TMtpPSStatus aStatus )
+    {
+    TInt mtpStatus;
+    RProperty::Get( KMtpPSUid, KMtpPSStatus, mtpStatus );
+
+    if ( mtpStatus != aStatus )
+        {
+        TInt err = RProperty::Set( KMtpPSUid, KMtpPSStatus, aStatus );
+        PRINT3( _L("MM MTP <> CRequestProcessor::DoSetPSStatus err = %d, previous = %d, current = %d" ), err , mtpStatus, aStatus);
+        }
+    }
 // end of file