--- a/videocollection/mpxmyvideoscollection/inc/vcxmyvideosmdsdb.h Tue Apr 27 16:40:33 2010 +0300
+++ b/videocollection/mpxmyvideoscollection/inc/vcxmyvideosmdsdb.h Tue May 11 16:15:40 2010 +0300
@@ -25,10 +25,86 @@
#include <mdequery.h>
#include <harvesterclient.h>
#include <mpxcollectionmessagedefs.h>
+#include <e32property.h>
+
+const TUid KHarvesterPSShutdown = { 0x200009F5 } ;
+const TInt KMdSShutdown = 0x00000002; // values 1 = shutdown, 0 = restart, normal state
+
+static _LIT_SECURITY_POLICY_PASS(KAllowAllPolicy);
+static _LIT_SECURITY_POLICY_C1(KPowerMgmtPolicy,ECapabilityPowerMgmt);
class CRepository;
/**
+ * PSCW Listener Observer interface for signaling that MDS has Shutdown/restarted
+ */
+class MVcxMdsShutdownMonitorObserver
+ {
+public:
+
+ virtual void ShutdownNotification( TInt aShutdownState ) = 0;
+ };
+
+/**
+ * Active object for observing P&S keys
+ */
+class CVcxMdsShutdownMonitor: public CActive
+ {
+public:
+
+ /**
+ * Two-phased constructor.
+ *
+ * @return Instance of CVcxMdsShutdownMonitor.
+ */
+ static CVcxMdsShutdownMonitor* NewL( MVcxMdsShutdownMonitorObserver& aObserver,
+ const TUid& aKeyCategory, const TInt aPropertyKey, TBool aDefineKey);
+
+ /**
+ * Destructor
+ */
+ virtual ~CVcxMdsShutdownMonitor();
+
+protected:
+
+ /**
+ * Handles an active object's request completion event.
+ */
+ void RunL();
+
+ /**
+ * Implements cancellation of an outstanding request.
+ */
+ void DoCancel();
+
+private:
+
+ /**
+ * C++ default constructor
+ *
+ * @return Instance of CVcxMdsShutdownMonitor.
+ */
+ CVcxMdsShutdownMonitor( MVcxMdsShutdownMonitorObserver& aObserver,
+ const TUid& aKeyCategory, const TInt iPropertyKey, TBool aDefineKey );
+
+ /**
+ * Symbian 2nd phase constructor can leave.
+ */
+ void ConstructL();
+
+private:
+
+ // not own
+ MVcxMdsShutdownMonitorObserver& iObserver;
+
+ const TUid& iKeyCategory;
+ RProperty iProperty;
+ TInt iPropertyKey;
+
+ TBool iDefineKey;
+};
+
+/**
* MPX My Videos collection MDS database observer class.
* Part of ECOM Plugin.
*/
@@ -86,7 +162,8 @@
public MMdESessionObserver,
public MMdEQueryObserver,
public MMdEObjectObserver,
- public MMdEObjectPresentObserver
+ public MMdEObjectPresentObserver,
+ public MVcxMdsShutdownMonitorObserver
{
public:
@@ -166,6 +243,8 @@
*/
CMPXMedia* CreateVideoL( TUint32 aId, TBool aFullDetails = ETrue );
+protected: // from base classes
+
// from MMdESessionObserver
/**
@@ -222,7 +301,6 @@
// from MMdEObjectObserver
-
void HandleObjectNotification( CMdESession& aSession,
TObserverNotificationType aType,
const RArray<TItemId>& aObjectIdArray);
@@ -230,6 +308,10 @@
// from MMdEObjectPresentObserver
void HandleObjectPresentNotification(CMdESession& aSession,
TBool aPresent, const RArray<TItemId>& aObjectIdArray);
+
+// from MVcxMdsShutdownMonitorObserver
+ void ShutdownNotification( TInt aShutdownState );
+
private:
/**
@@ -315,6 +397,17 @@
* @param aObject Creation date is written here.
*/
void SetCreationDateToObjectL( const CMPXMedia& aVideo, CMdEObject& aObject );
+
+ /**
+ * Opens MDS session.
+ */
+ void OpenMdsSessionL();
+
+ /**
+ * @return MDS session.
+ */
+ CMdESession& MdsSessionL();
+
public:
/**
@@ -328,12 +421,12 @@
/**
* The MDS session object. Own.
*/
- CMdESession* iMDSSession;
+ CMdESession* iMdsSession;
/**
- * The error code saved from the callbacks.
+ * The error code of last iMDSSession operation.
*/
- TInt iMDSError;
+ TInt iMdsSessionError;
/**
* Asynchronous video list fetching query is stored here.
@@ -517,6 +610,12 @@
* Cenrep session.
*/
CRepository* iRepository;
+
+ /**
+ * Monitors Mds server shutdown states.
+ */
+ CVcxMdsShutdownMonitor* iMdsShutdownMonitor;
+
};
#endif // VCXMYVIDEOSMDSDB_H