videocollection/mpxmyvideoscollection/tsrc/ut_vcxmyvideosmdsdb/inc/vcxmyvideosmdscmdqueue.h
branchRCL_3
changeset 16 67eb01668b0e
equal deleted inserted replaced
15:8f0df5c82986 16:67eb01668b0e
       
     1 /*
       
     2 * Copyright (c) 2007 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:   Queues commands to MDS.
       
    15 */
       
    16 
       
    17 
       
    18 
       
    19 #ifndef VCXMYVIDEOSMDSCMDQUEUE_H
       
    20 #define VCXMYVIDEOSMDSCMDQUEUE_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <vcxmyvideosdefs.h>
       
    24 
       
    25 #include <mdesession.h>
       
    26 #include <mdequery.h>
       
    27 #include <harvesterclient.h>
       
    28 #include <mpxcollectionmessagedefs.h>
       
    29 #include <vcxmyvideosdefs.h>
       
    30 #include <e32property.h>
       
    31 #include "vcxmyvideosalbum.h"
       
    32 
       
    33 #define protected public
       
    34 #define private public
       
    35 #include "vcxmyvideosmdsdb.h"
       
    36 #undef private
       
    37 #undef protected
       
    38 
       
    39 // FORWARD DECLARATIONS
       
    40 class CMPXMedia;
       
    41 class MVcxMyVideosMdsAlbumsObserver;
       
    42 
       
    43 // CONSTANTS
       
    44 
       
    45 // CLASS DECLARATION
       
    46 
       
    47 /**
       
    48 * All MDS commands inherit this.
       
    49 *
       
    50 * @lib mpxmyvideoscollectionplugin.lib
       
    51 */
       
    52 NONSHARABLE_CLASS(CVcxMyVideosMdsCmd) : public CBase
       
    53     {    
       
    54     public:
       
    55 
       
    56         /**
       
    57         * Destructor
       
    58         */
       
    59         virtual ~CVcxMyVideosMdsCmd() {}
       
    60         
       
    61         /**
       
    62         * Command type. Used for casting the pointer to correct type.
       
    63         */
       
    64         CVcxMyVideosMdsDb::TRequestType iCmdType;
       
    65         
       
    66         /**
       
    67          * Pointer to client is stored here, used for performing response call.
       
    68          */
       
    69         MVcxMyVideosMdsAlbumsObserver* iClient;    
       
    70     };
       
    71 
       
    72 /**
       
    73 * Class which encapsulates GetVideoListL function parameters.
       
    74 *
       
    75 * @lib mpxmyvideoscollectionplugin.lib
       
    76 */
       
    77 NONSHARABLE_CLASS(CVcxMyVideosMdsCmdGetVideoList) : public CVcxMyVideosMdsCmd
       
    78     {    
       
    79     public:
       
    80 
       
    81         /**
       
    82         * Constructor
       
    83         */
       
    84         CVcxMyVideosMdsCmdGetVideoList() {}
       
    85 
       
    86         /**
       
    87         * Destructor
       
    88         */
       
    89         virtual ~CVcxMyVideosMdsCmdGetVideoList() {}
       
    90 
       
    91     public:
       
    92         /**
       
    93         * Stored CreateVideoListL function parameters, see meanings from vcxmyvideosmdsdb.h file.
       
    94         */
       
    95         TVcxMyVideosSortingOrder iSortingOrder;
       
    96         TBool                    iAscending;
       
    97         TBool                    iFullDetails;
       
    98         CMPXMedia**              iVideoList;
       
    99     };
       
   100 
       
   101 /**
       
   102 * Class which stores GetAlbumsL function arguments.
       
   103 *
       
   104 * @lib mpxmyvideoscollectionplugin.lib
       
   105 */
       
   106 NONSHARABLE_CLASS(CVcxMyVideosMdsCmdGetAlbums) : public CVcxMyVideosMdsCmd
       
   107     {    
       
   108     public: // Constructors and destructor
       
   109 
       
   110         /**
       
   111         * Constructor
       
   112         */
       
   113         CVcxMyVideosMdsCmdGetAlbums() {}
       
   114 
       
   115         /**
       
   116         * Destructor
       
   117         */
       
   118         virtual ~CVcxMyVideosMdsCmdGetAlbums() {}
       
   119 
       
   120     public:
       
   121         /**
       
   122         * Stored GetAlbumsL function parameters, see meanings from vcxmyvideosmdsalbums.h file.
       
   123         */
       
   124         CMPXMedia* iAlbumList;
       
   125     };
       
   126 
       
   127 /**
       
   128 * Class which stores GetAlbumContentIdsL function arguments.
       
   129 *
       
   130 * @lib mpxmyvideoscollectionplugin.lib
       
   131 */
       
   132 NONSHARABLE_CLASS(CVcxMyVideosMdsCmdGetAlbumContentIds) : public CVcxMyVideosMdsCmd
       
   133     {    
       
   134     public: // Constructors and destructor
       
   135 
       
   136         /**
       
   137         * Constructor
       
   138         */
       
   139         CVcxMyVideosMdsCmdGetAlbumContentIds() {}
       
   140 
       
   141         /**
       
   142         * Destructor
       
   143         */
       
   144         virtual ~CVcxMyVideosMdsCmdGetAlbumContentIds() {}
       
   145 
       
   146     public:
       
   147         /**
       
   148         * Stored GetAlbumContentL function parameters, see meanings from vcxmyvideosmdsalbums.h file.
       
   149         */
       
   150         TUint32                         iAlbumId;        
       
   151         RArray<TVcxMyVideosAlbumVideo>* iAlbumContent; //not own
       
   152     };
       
   153 
       
   154 /**
       
   155 * Class which stores GetAlbumContentVideosL function arguments.
       
   156 *
       
   157 * @lib mpxmyvideoscollectionplugin.lib
       
   158 */
       
   159 NONSHARABLE_CLASS(CVcxMyVideosMdsCmdGetAlbumContentVideos) : public CVcxMyVideosMdsCmd
       
   160     {    
       
   161     public: // Constructors and destructor
       
   162 
       
   163         /**
       
   164         * Constructor
       
   165         */
       
   166         CVcxMyVideosMdsCmdGetAlbumContentVideos() {}
       
   167 
       
   168         /**
       
   169         * Destructor
       
   170         */
       
   171         virtual ~CVcxMyVideosMdsCmdGetAlbumContentVideos() {}
       
   172 
       
   173     public:
       
   174         /**
       
   175         * Stored GetAlbumContentL function parameters, see meanings from vcxmyvideosmdsalbums.h file.
       
   176         */
       
   177         TUint32    iAlbumId;        
       
   178         CMPXMedia* iAlbumContentVideos; //not own
       
   179     };
       
   180 
       
   181 /**
       
   182 * Class which stores AddVideosToAlbumL function arguments.
       
   183 *
       
   184 * @lib mpxmyvideoscollectionplugin.lib
       
   185 */
       
   186 NONSHARABLE_CLASS(CVcxMyVideosMdsCmdAddVideosToAlbum) : public CVcxMyVideosMdsCmd
       
   187     {    
       
   188     public: // Constructors and destructor
       
   189 
       
   190         /**
       
   191         * Constructor
       
   192         */
       
   193         CVcxMyVideosMdsCmdAddVideosToAlbum() {}
       
   194 
       
   195         /**
       
   196         * Destructor
       
   197         */
       
   198         virtual ~CVcxMyVideosMdsCmdAddVideosToAlbum() {}
       
   199 
       
   200     public:
       
   201         /**
       
   202         * Stored AddVideosToAlbumL function parameters, see meanings from vcxmyvideosdefs.h
       
   203         * KVcxCommandMyVideosAddToAlbum command descriptions.
       
   204         */
       
   205         CMPXMedia* iMpxCmd;
       
   206     };
       
   207 
       
   208 /**
       
   209 * Class which stores RemoveRelationsL function arguments.
       
   210 *
       
   211 * @lib mpxmyvideoscollectionplugin.lib
       
   212 */
       
   213 NONSHARABLE_CLASS(CVcxMyVideosMdsCmdRemoveRelations) : public CVcxMyVideosMdsCmd
       
   214     {    
       
   215     public: // Constructors and destructor
       
   216 
       
   217         /**
       
   218         * Constructor
       
   219         */
       
   220         CVcxMyVideosMdsCmdRemoveRelations() {}
       
   221 
       
   222         /**
       
   223         * Destructor
       
   224         */
       
   225         virtual ~CVcxMyVideosMdsCmdRemoveRelations() {}
       
   226 
       
   227     public:
       
   228         /**
       
   229         * Stored RemoveRelationsL function parameters, see meanings from vcxmyvideosmdsalbums.h file.
       
   230         */
       
   231         RArray<TUint32>* iRelationIds; //not own
       
   232         RArray<TUint32>* iResults;  //not own
       
   233     };
       
   234 
       
   235 /**
       
   236 * Class which stores RemoveAlbumsL function arguments.
       
   237 *
       
   238 * @lib mpxmyvideoscollectionplugin.lib
       
   239 */
       
   240 NONSHARABLE_CLASS(CVcxMyVideosMdsCmdRemoveAlbums) : public CVcxMyVideosMdsCmd
       
   241     {    
       
   242     public: // Constructors and destructor
       
   243 
       
   244         /**
       
   245         * Constructor
       
   246         */
       
   247         CVcxMyVideosMdsCmdRemoveAlbums() {}
       
   248 
       
   249         /**
       
   250         * Destructor
       
   251         */
       
   252         virtual ~CVcxMyVideosMdsCmdRemoveAlbums() {}
       
   253 
       
   254     public:
       
   255         /**
       
   256         * Stored RemoveAlbumsL function parameters, see meanings from vcxmyvideosmdsalbums.h file.
       
   257         */
       
   258         CMPXMedia* iMpxCmd; //not own
       
   259     };
       
   260 
       
   261 /**
       
   262 * Queues MDS commands.
       
   263 *
       
   264 * @lib mpxmyvideoscollectionplugin.lib
       
   265 */
       
   266 NONSHARABLE_CLASS(CVcxMyVideosMdsCmdQueue) : public CBase
       
   267     {    
       
   268     public: // Constructors and destructor
       
   269 
       
   270         /**
       
   271         * Two-phased constructor
       
   272         * @return object constructed
       
   273         */
       
   274         static CVcxMyVideosMdsCmdQueue* NewL( CVcxMyVideosMdsDb& aMdsDb );
       
   275 
       
   276         /**
       
   277         * Destructor
       
   278         */
       
   279         virtual ~CVcxMyVideosMdsCmdQueue();
       
   280 
       
   281     public: // new methods
       
   282         
       
   283         /**
       
   284         * Executes command if queue is empty, otherwise adds it to queue.
       
   285         * Ownership of aCmd moves to this object.
       
   286         *
       
   287         * @param aCmd  Command to execute.
       
   288         */
       
   289         void ExecuteCmdL( CVcxMyVideosMdsCmd* aCmd );
       
   290         
       
   291         /**
       
   292         * Called when command finishes. Executes next command from the queue.
       
   293         */
       
   294         void CmdFinished();
       
   295         
       
   296         /**
       
   297          * Removes commands from command queue.
       
   298          * 
       
   299          * @param aType Defines what kind of commands are removed from the command queue.
       
   300          */
       
   301         void Cancel( CVcxMyVideosMdsDb::TRequestType aType = CVcxMyVideosMdsDb::EAll );
       
   302                         
       
   303     private:
       
   304 
       
   305         /**
       
   306         * Constructor
       
   307         */
       
   308         CVcxMyVideosMdsCmdQueue( CVcxMyVideosMdsDb& aMdsDb );
       
   309 
       
   310         /**
       
   311         * Symbian 2nd phase constructor.
       
   312         */
       
   313         void ConstructL();
       
   314         
       
   315         /**
       
   316         * Executes the command.
       
   317         *
       
   318         * @param aCmd  Command to execute, ownership does not move.
       
   319         */
       
   320         void DoExecuteCmdL( CVcxMyVideosMdsCmd* aCmd );
       
   321                     
       
   322     private:
       
   323         
       
   324         /**
       
   325         * Owner of this object.
       
   326         */
       
   327         CVcxMyVideosMdsDb& iMdsDb;
       
   328         
       
   329         /**
       
   330         * Command queue. Own.
       
   331         */
       
   332         RArray<CVcxMyVideosMdsCmd*> iQueue;
       
   333         
       
   334         /**
       
   335         * Set to ETrue when command is started and to EFalse
       
   336         * when command finishes.
       
   337         */
       
   338         TBool iCmdInProgress;
       
   339     };
       
   340 
       
   341 #endif   // VCXMYVIDEOSMDSCMDQUEUE_H
       
   342 
       
   343