videocollection/mpxmyvideoscollection/tsrc/mpxmvcolltest/inc/VCXTestMdsDbModifier.h
changeset 0 96612d01cf9f
child 15 cf5481c2bc0b
child 34 bbb98528c666
equal deleted inserted replaced
-1:000000000000 0:96612d01cf9f
       
     1 /*
       
     2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CVCXTESTMDSDBMODIFIER_H
       
    21 #define CVCXTESTMDSDBMODIFIER_H
       
    22 
       
    23 #include <mdesession.h>
       
    24 #include <mdequery.h>
       
    25 #include <harvesterclient.h>
       
    26 #include <mpxcollectionmessagedefs.h>
       
    27 
       
    28 // Copied from vcxmyvideosmdsdb.cpp, keep up to date.
       
    29 
       
    30 /**
       
    31  *  MDS database class for VCX testing.
       
    32  */
       
    33 NONSHARABLE_CLASS(CVCXTestMdsDbModifier) :
       
    34                                 public CBase,
       
    35                                 public MMdESessionObserver,
       
    36                                 public MMdEQueryObserver,
       
    37                                 public MMdESchemaObserver,
       
    38                                 public MMdEObjectObserver
       
    39     {
       
    40 
       
    41 public:
       
    42 
       
    43     /**
       
    44      * Two-phased constructor.
       
    45      */
       
    46     static CVCXTestMdsDbModifier* NewL();
       
    47 
       
    48     /**
       
    49      * Two-phased constructor.
       
    50      */
       
    51     static CVCXTestMdsDbModifier* NewLC();
       
    52 
       
    53 
       
    54     /**
       
    55     * Destructor.
       
    56     */
       
    57     virtual ~CVCXTestMdsDbModifier();
       
    58 
       
    59     /**
       
    60      * Remove video.
       
    61      *
       
    62      * @param aMdsId Id of the item to be removed.
       
    63      * @return       KErrNotFound if video was not found, KErrNone if found and deleted.
       
    64      */
       
    65     TInt RemoveVideoL(
       
    66         TUint32 aMdsId );
       
    67 
       
    68     /**
       
    69      * Update video.
       
    70      *
       
    71      * @param aVideo Video to update in MDS database.
       
    72      */
       
    73     void UpdateVideoL(
       
    74         CMPXMedia& aVideo );
       
    75 
       
    76     /**
       
    77      * Delete an existing video.
       
    78      *
       
    79      * @param aFileId      File id (key) of the video to delete.
       
    80      * @param aResultCount Result count is saved to this parameter.
       
    81      * @return KErrNone if successful, otherwise another of the system-wide
       
    82      *         error codes.
       
    83      */
       
    84     TInt DeleteVideoL(
       
    85         TUint32 aFileId,
       
    86         TInt& aResultCount,
       
    87         TBool aForcedDelete = EFalse );
       
    88 
       
    89 // from MMdESessionObserver
       
    90 
       
    91 	/**
       
    92 	 * Called to notify the observer that opening the session has been
       
    93 	 * completed and, if the opening succeeded, the session is ready for use.
       
    94 	 *
       
    95 	 * @param aSession  session
       
    96 	 * @param aError    <code>KErrNone</code>, if opening the session succeeded
       
    97 	 *     or one of the system-wide error codes, if opening the session failed
       
    98 	 */
       
    99 	void HandleSessionOpened( CMdESession& aSession, TInt aError );
       
   100 
       
   101 	/**
       
   102 	 * Called to notify the observer about errors, which are not a direct
       
   103 	 * consequence of the operations initiated by the client but caused by some
       
   104 	 * external source (e.g., other clients). The error cannot be recovered and
       
   105 	 * all on-going operations initiated by the client have been aborted.
       
   106 	 * Any attempts to continue using the session will cause a panic. The
       
   107 	 * client should close the session immediately and try to open a new
       
   108 	 * session if it needs to continue using the metadata engine.
       
   109 	 *
       
   110 	 * @param aSession  session
       
   111 	 * @param aError    one of the system-wide error codes
       
   112 	 */
       
   113 	void HandleSessionError( CMdESession& aSession, TInt aError );
       
   114 
       
   115 
       
   116 //  from MMdEQueryObserver
       
   117 
       
   118     /**
       
   119      * Called to notify the observer that new results have been received
       
   120      * in the query.
       
   121      *
       
   122      * @param aQuery              Query instance that received new results.
       
   123      * @param aFirstNewItemIndex  Index of the first new item that was added
       
   124      *                            to the result item array.
       
   125      * @param aNewItemCount       Number of items added to the result item
       
   126      *                            array.
       
   127      */
       
   128     void HandleQueryNewResults( CMdEQuery& aQuery,
       
   129                                        TInt aFirstNewItemIndex,
       
   130                                        TInt aNewItemCount );
       
   131 
       
   132     /**
       
   133      * Called to notify the observer that the query has been completed,
       
   134      * or that an error has occured.
       
   135      *
       
   136      * @param aQuery  Query instance.
       
   137      * @param aError  <code>KErrNone</code>, if the query was completed
       
   138      *                successfully. Otherwise one of the system-wide error
       
   139      *                codes.
       
   140      */
       
   141     void HandleQueryCompleted( CMdEQuery& aQuery, TInt aError );
       
   142 
       
   143 
       
   144 //  from MMdESchemaObserver
       
   145 
       
   146 	/**
       
   147 	 * Called to notify the observer that the schema has been modified.
       
   148 	 *
       
   149 	 * @param none
       
   150 	 */
       
   151 	void HandleSchemaModified();
       
   152 
       
   153 // from MMdEObjectObserver
       
   154 
       
   155     void HandleObjectNotification( CMdESession& aSession,
       
   156             TObserverNotificationType aType,
       
   157             const RArray<TItemId>& aObjectIdArray);
       
   158 
       
   159 private:
       
   160 
       
   161     /**
       
   162      * Constructor.
       
   163      * @param aObserver The db change observer.
       
   164      */
       
   165     CVCXTestMdsDbModifier();
       
   166 
       
   167     void ConstructL();
       
   168 
       
   169     /**
       
   170      * Fill the object from media.
       
   171      *
       
   172      * @param aMedia            The media class to read from.
       
   173      * @param aObject           The object to modify.
       
   174      */
       
   175     void Media2ObjectL( CMPXMedia& aVideo, CMdEObject& aObject );
       
   176 
       
   177     /*
       
   178      * Get the schema definitions needed.
       
   179      */
       
   180     void GetSchemaDefinitionsL();
       
   181 
       
   182 private: // data
       
   183 
       
   184     /**
       
   185      * The MDS session object. Own.
       
   186      */
       
   187     CMdESession* iMDSSession;
       
   188 
       
   189     /**
       
   190      * The error code saved from the callbacks.
       
   191      */
       
   192     TInt iMDSError;
       
   193 
       
   194     /**
       
   195      * The default namespace definition. Not own.
       
   196      */
       
   197     CMdENamespaceDef* iNamespaceDef;
       
   198 
       
   199     /**
       
   200      * The Video object definition. Not own.
       
   201      */
       
   202     CMdEObjectDef* iVideoObjectDef;
       
   203 
       
   204     /**
       
   205      * 2.
       
   206      * The Title property definition. Not own.
       
   207      */
       
   208     CMdEPropertyDef* iTitlePropertyDef;
       
   209 
       
   210     /**
       
   211      * 3.
       
   212      * The Description property definition. Not own.
       
   213      */
       
   214     CMdEPropertyDef* iDescriptionPropertyDef;
       
   215 
       
   216     // 4. URI ( = file path ), set with SetUriL method
       
   217 
       
   218     /**
       
   219      * 5.
       
   220      * The Size property definition. Not own.
       
   221      */
       
   222     CMdEPropertyDef* iSizePropertyDef;
       
   223 
       
   224     /**
       
   225      * 6.
       
   226      * The Creation Date property definition. Not own.
       
   227      */
       
   228     CMdEPropertyDef* iCreationDatePropertyDef;
       
   229 
       
   230     /**
       
   231     * Time offset from the universal time. Not own.
       
   232     */
       
   233     CMdEPropertyDef* iTimeOffsetPropertyDef;
       
   234 
       
   235     /**
       
   236      * 7.
       
   237      * The Flags property definition. Not own.
       
   238      */
       
   239     CMdEPropertyDef* iFlagsPropertyDef;
       
   240 
       
   241     /**
       
   242      * 8.
       
   243      * The Copyright property definition. Not own.
       
   244      */
       
   245     CMdEPropertyDef* iCopyrightPropertyDef;
       
   246 
       
   247     /**
       
   248      * 9.
       
   249      * The Item Type property definition. Not own.
       
   250      */
       
   251     CMdEPropertyDef* iItemTypePropertyDef;
       
   252 
       
   253     /**
       
   254      * 10.
       
   255      * The Modified Date property definition. Not own.
       
   256      */
       
   257     CMdEPropertyDef* iLastModifiedDatePropertyDef;
       
   258 
       
   259     /**
       
   260      * 11.
       
   261      * The Age Profile property definition. Not own.
       
   262      */
       
   263     CMdEPropertyDef* iAgeProfilePropertyDef;
       
   264 
       
   265     /**
       
   266      * 12.
       
   267      * The Audio Language property definition. Not own.
       
   268      */
       
   269     CMdEPropertyDef* iAudioLanguagePropertyDef;
       
   270 
       
   271     /**
       
   272      * 13.
       
   273      * The Author property definition. Not own.
       
   274      */
       
   275     CMdEPropertyDef* iAuthorPropertyDef;
       
   276 
       
   277     /**
       
   278      * 14.
       
   279      * The Origin property definition. Not own.
       
   280      */
       
   281     CMdEPropertyDef* iOriginPropertyDef;
       
   282 
       
   283     /**
       
   284      * 15.
       
   285      * The Duration property definition. Not own.
       
   286      */
       
   287     CMdEPropertyDef* iDurationPropertyDef;
       
   288 
       
   289     /**
       
   290      * 16.
       
   291      * The Last Play Point property definition. Not own.
       
   292      */
       
   293     CMdEPropertyDef* iLastPlayPositionPropertyDef;
       
   294 
       
   295     /**
       
   296      * 17.
       
   297      * The Download ID property definition. Not own.
       
   298      */
       
   299     CMdEPropertyDef* iDownloadIdPropertyDef;
       
   300 	
       
   301     /**
       
   302     * 18.
       
   303     * Rating property definition, not own.
       
   304     */
       
   305     CMdEPropertyDef* iRatingPropertyDef;
       
   306     
       
   307     /**
       
   308     * 19.
       
   309     * Bitrate property definition, not own.
       
   310     */
       
   311     CMdEPropertyDef* iBitratePropertyDef;
       
   312     
       
   313     /**
       
   314     * DRM protection flag, not own.
       
   315     */
       
   316     CMdEPropertyDef* iDrmPropertyDef;
       
   317 
       
   318     /**
       
   319     * Not own.
       
   320     */
       
   321     CMdEPropertyDef* iAudioFourCcPropertyDef;
       
   322 
       
   323 
       
   324     /**
       
   325      * Active scheduled waiter Own..
       
   326      */
       
   327     CActiveSchedulerWait* iActiveSchedulerWait;
       
   328 
       
   329     /**
       
   330      * The file server session.
       
   331      */
       
   332     RFs iRfs;
       
   333 
       
   334     /**
       
   335      * Is the db already in use. If so, return KErrInUse.
       
   336      */
       
   337     TBool iDbInUse;
       
   338 
       
   339     public:
       
   340 
       
   341     };
       
   342 
       
   343 #endif // CVCXTESTMDSDBMODIFIER_H
       
   344