videocollection/mpxmyvideoscollection/inc/vcxmyvideosmdsdb.h
changeset 37 4eb2df7f7cbe
parent 36 8aed59de29f9
child 39 f6d44a0cd476
equal deleted inserted replaced
36:8aed59de29f9 37:4eb2df7f7cbe
    23 #include <mdesession.h>
    23 #include <mdesession.h>
    24 #include <mdequery.h>
    24 #include <mdequery.h>
    25 #include <harvesterclient.h>
    25 #include <harvesterclient.h>
    26 #include <mpxcollectionmessagedefs.h>
    26 #include <mpxcollectionmessagedefs.h>
    27 #include <vcxmyvideosdefs.h>
    27 #include <vcxmyvideosdefs.h>
       
    28 #include <e32property.h>
    28 #include "vcxmyvideosalbum.h"
    29 #include "vcxmyvideosalbum.h"
    29 
    30 
    30 class CVcxMyVideosMdsAlbums;
    31 class CVcxMyVideosMdsAlbums;
    31 class CMPXMedia;
    32 class CMPXMedia;
    32 class CVcxMyVideosMdsCmdQueue;
    33 class CVcxMyVideosMdsCmdQueue;
       
    34 
       
    35 const TUid KHarvesterPSShutdown = { 0x200009F5 } ;
       
    36 const TInt KMdSShutdown = 0x00000002; // values 1 = shutdown, 0 = restart, normal state
       
    37 
       
    38 static _LIT_SECURITY_POLICY_PASS(KAllowAllPolicy);
       
    39 static _LIT_SECURITY_POLICY_C1(KPowerMgmtPolicy,ECapabilityPowerMgmt);
    33 
    40 
    34 /**
    41 /**
    35  *  MPX My Videos collection MDS database observer class.
    42  *  MPX My Videos collection MDS database observer class.
    36  *  Part of ECOM Plugin.
    43  *  Part of ECOM Plugin.
    37  */
    44  */
   169 #endif
   176 #endif
   170         
   177         
   171     };
   178     };
   172 
   179 
   173 /**
   180 /**
       
   181  * PSCW Listener Observer interface for signaling that MDS has Shutdown/restarted
       
   182  */
       
   183 class MVcxMdsShutdownMonitorObserver
       
   184     {
       
   185 public:
       
   186 
       
   187     virtual void ShutdownNotification( TInt aShutdownState ) = 0;
       
   188     };
       
   189 
       
   190 /**
       
   191  *  Active object for observing P&S keys
       
   192  */
       
   193 class CVcxMdsShutdownMonitor: public CActive
       
   194     {
       
   195 public:
       
   196 
       
   197     /**
       
   198      * Two-phased constructor.
       
   199      *
       
   200      * @return Instance of CVcxMdsShutdownMonitor.
       
   201      */
       
   202     static CVcxMdsShutdownMonitor* NewL( MVcxMdsShutdownMonitorObserver& aObserver,
       
   203             const TUid& aKeyCategory, const TInt aPropertyKey, TBool aDefineKey);
       
   204 
       
   205     /**
       
   206      * Destructor
       
   207      */
       
   208     virtual ~CVcxMdsShutdownMonitor();
       
   209     
       
   210 protected:
       
   211 
       
   212     /**
       
   213      * Handles an active object's request completion event.
       
   214      */
       
   215     void RunL();
       
   216 
       
   217     /**
       
   218      * Implements cancellation of an outstanding request.
       
   219      */
       
   220     void DoCancel();
       
   221 
       
   222 private:
       
   223 
       
   224     /**
       
   225      * C++ default constructor
       
   226      *
       
   227      * @return Instance of CVcxMdsShutdownMonitor.
       
   228      */
       
   229     CVcxMdsShutdownMonitor( MVcxMdsShutdownMonitorObserver& aObserver,
       
   230             const TUid& aKeyCategory, const TInt iPropertyKey, TBool aDefineKey );
       
   231 
       
   232     /**
       
   233      * Symbian 2nd phase constructor can leave.
       
   234      */
       
   235     void ConstructL();
       
   236 
       
   237 private:
       
   238     
       
   239     // not own
       
   240     MVcxMdsShutdownMonitorObserver& iObserver;
       
   241     
       
   242     const TUid& iKeyCategory;
       
   243     RProperty iProperty;
       
   244     TInt iPropertyKey;
       
   245     
       
   246     TBool iDefineKey;
       
   247 };
       
   248 
       
   249 /**
   174  *  MPX My Videos collection ECOM plugin's MDS database class.
   250  *  MPX My Videos collection ECOM plugin's MDS database class.
   175  */
   251  */
   176 NONSHARABLE_CLASS(CVcxMyVideosMdsDb) :
   252 NONSHARABLE_CLASS(CVcxMyVideosMdsDb) :
   177                                 public CBase,
   253                                 public CBase,
   178                                 public MMdESessionObserver,
   254                                 public MMdESessionObserver,
   179                                 public MMdEQueryObserver,
   255                                 public MMdEQueryObserver,
   180                                 public MMdEObjectObserver,
   256                                 public MMdEObjectObserver,
   181                                 public MMdEObjectPresentObserver
   257                                 public MMdEObjectPresentObserver,
       
   258                                 public MVcxMdsShutdownMonitorObserver
   182     {
   259     {
   183         
   260         
   184 public:
   261 public:
   185 
   262 
   186     friend class CVcxMyVideosMdsAlbums;
   263     friend class CVcxMyVideosMdsAlbums;
   277      * @return             Pointer to media object, ownership moves. NULL if
   354      * @return             Pointer to media object, ownership moves. NULL if
   278      *                     not found.
   355      *                     not found.
   279      */
   356      */
   280     CMPXMedia* CreateVideoL( TUint32 aId, TBool aFullDetails = ETrue );
   357     CMPXMedia* CreateVideoL( TUint32 aId, TBool aFullDetails = ETrue );
   281 
   358 
       
   359 protected:
       
   360     
   282 // from MMdESessionObserver
   361 // from MMdESessionObserver
   283 
   362 
   284 	/**
   363 	/**
   285 	 * Called to notify the observer that opening the session has been
   364 	 * Called to notify the observer that opening the session has been
   286 	 * completed and, if the opening succeeded, the session is ready for use.
   365 	 * completed and, if the opening succeeded, the session is ready for use.
   341             const RArray<TItemId>& aObjectIdArray);
   420             const RArray<TItemId>& aObjectIdArray);
   342 
   421 
   343 // from MMdEObjectPresentObserver
   422 // from MMdEObjectPresentObserver
   344     void HandleObjectPresentNotification(CMdESession& aSession, 
   423     void HandleObjectPresentNotification(CMdESession& aSession, 
   345 			TBool aPresent, const RArray<TItemId>& aObjectIdArray);
   424 			TBool aPresent, const RArray<TItemId>& aObjectIdArray);
       
   425 			
       
   426 // from MVcxMdsShutdownMonitorObserver
       
   427     void ShutdownNotification( TInt aShutdownState );
       
   428 
   346 private:
   429 private:
   347 
   430 
   348     /**
   431     /**
   349      * Constructor.
   432      * Constructor.
   350      * @param aObserver The db change observer.
   433      * @param aObserver The db change observer.
   457 
   540 
   458     /**
   541     /**
   459      * Opens MDS session.
   542      * Opens MDS session.
   460      */
   543      */
   461     void OpenMdsSessionL();
   544     void OpenMdsSessionL();
       
   545 
       
   546     /**
       
   547     * @return MDS session.
       
   548     */
       
   549     CMdESession& MdsSessionL();
   462     
   550     
   463 public:
   551 public:
   464 
   552 
   465     /**
   553     /**
   466     * Set to ETrue when starting to fetch media list from MDS.
   554     * Set to ETrue when starting to fetch media list from MDS.
   484      * The MDS session object. Own.
   572      * The MDS session object. Own.
   485      */
   573      */
   486     CMdESession* iMdsSession;
   574     CMdESession* iMdsSession;
   487 
   575 
   488     /**
   576     /**
   489      * The error code saved from the callbacks.
   577      * The sessions error state.
   490      */
   578      */
   491     TInt iMdsError;
   579     TInt iMdsSessionError;
   492 
   580 
   493     /**
   581     /**
   494     * Asynchronous video list fetching query is stored here.
   582     * Asynchronous video list fetching query is stored here.
   495     */
   583     */
   496     CMdEObjectQuery* iVideoQuery;
   584     CMdEObjectQuery* iVideoQuery;
   671      * Used to handle complete events asynchronously.
   759      * Used to handle complete events asynchronously.
   672      * This avoids problems like deleting query objects in the
   760      * This avoids problems like deleting query objects in the
   673      * handler or starting new query from the handler.
   761      * handler or starting new query from the handler.
   674      */
   762      */
   675     CAsyncCallBack* iAsyncHandleQueryCompleteCaller;
   763     CAsyncCallBack* iAsyncHandleQueryCompleteCaller;
       
   764 
       
   765     /**
       
   766     * Monitors Mds server shutdown states.
       
   767     */
       
   768     CVcxMdsShutdownMonitor* iMdsShutdownMonitor;
       
   769 
   676     };
   770     };
   677 
   771 
   678 #endif // VCXMYVIDEOSMDSDB_H
   772 #endif // VCXMYVIDEOSMDSDB_H
   679 
   773