homescreenplugins/videochplugin/inc/videocontentharvestermpxclient.h
changeset 0 96612d01cf9f
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 
       
    21 #ifndef C_VCXNSCONTENTHARVESTERMPXCLIENT_H
       
    22 #define C_VCXNSCONTENTHARVESTERMPXCLIENT_H
       
    23 
       
    24 #include <e32base.h>
       
    25 #include <mpxcollectionobserver.h>
       
    26 #include <MediatorEventConsumer.h>
       
    27 
       
    28 class MMPXCollectionUtility;
       
    29 class CVcxNsChPublishableData;
       
    30 class CVcxNsChPublisher;
       
    31 class CVcxNsChMCategoryListener;
       
    32 class CVcxNsContentHarvesterPlugin;
       
    33 
       
    34 /**
       
    35  *  CVcxNsContentHarvesterMpxClient
       
    36  * 
       
    37  *  @lib vcxnscontentharvesterplugin.dll
       
    38  *  @since S60 5.0
       
    39  */
       
    40 class CVcxNsContentHarvesterMpxClient : public CBase,
       
    41                                         public MMPXCollectionObserver,
       
    42                                         public MMediatorEventObserver
       
    43     {
       
    44 
       
    45 public:
       
    46 
       
    47 
       
    48     static CVcxNsContentHarvesterMpxClient* NewL( CVcxNsChPublisher* aPublisher,
       
    49                                                   CVcxNsChPublishableData* aPublishableData,
       
    50                                                   CVcxNsContentHarvesterPlugin* aPlugin );
       
    51 
       
    52     virtual ~CVcxNsContentHarvesterMpxClient();
       
    53     
       
    54 public: // From MMPXCollectionObserver
       
    55 
       
    56     /**
       
    57      * From MMPXCollectionObserver->MMPXCollectionMediaObserver
       
    58      * Handle extended media properties
       
    59      *
       
    60      * @param aMedia media 
       
    61      * @param aError error code    
       
    62      */
       
    63     void HandleCollectionMediaL( const CMPXMedia& aMedia, TInt aError );
       
    64 
       
    65     /** 
       
    66      * From MMPXCollectionUtilityObserver.
       
    67      * Handle collection message
       
    68      * NOTE: only one of HandleCollectionMessage callback can be implemented
       
    69      * 
       
    70      * @param aMessage collection message, ownership not transferred. 
       
    71      *        Please check aMsg is not NULL before using it. If aErr is not 
       
    72      *        KErrNone, plugin might still call back with more info in the aMsg.
       
    73      * @param aErr system error code.
       
    74      */
       
    75     void HandleCollectionMessage( CMPXMessage* aMsg, TInt aErr ); 
       
    76 
       
    77     /**
       
    78      * From MMPXCollectionUtilityObserver.
       
    79      * Handles the collection entries being opened. Typically called
       
    80      * when client has Open()'d a folder
       
    81      *
       
    82      * @param aEntries collection entries opened
       
    83      * @param aIndex focused entry
       
    84      * @param aComplete ETrue no more entries. EFalse more entries
       
    85      *                  expected
       
    86      * @param aError error code   
       
    87      */
       
    88     void HandleOpenL( const CMPXMedia& aEntries,
       
    89                       TInt aIndex,
       
    90                       TBool aComplete,
       
    91                       TInt aError );
       
    92 
       
    93     /**
       
    94      * From MMPXCollectionUtilityObserver.
       
    95      * Handles the item being opened. Typically called
       
    96      * when client has Open()'d an item. Client typically responds by
       
    97      * 'playing' the item via the playlist
       
    98      *
       
    99      * @param aPlaylist collection playlist
       
   100      * @param aError error code   
       
   101      */                         
       
   102     void HandleOpenL( const CMPXCollectionPlaylist& aPlaylist,
       
   103                       TInt aError );
       
   104 
       
   105     /**
       
   106      * From MMPXCollectionUtilityObserver.
       
   107      * Handle completion of a asynchronous command
       
   108      *
       
   109      * @param aCommandResult result of the command, NULL if error
       
   110      * @param aError error code    
       
   111      */
       
   112     void HandleCommandComplete( CMPXCommand* aCommandResult, 
       
   113                                 TInt aError );
       
   114     
       
   115     /**
       
   116      * From MMediatorEventObserver
       
   117      * 
       
   118      * Catches the events
       
   119      */
       
   120     void MediatorEventL( TUid aDomain,
       
   121                          TUid aCategory, 
       
   122                          TInt aEventId, 
       
   123                          const TDesC8& aData );
       
   124 
       
   125 private:
       
   126 
       
   127     enum TVcxNsCollectionOpenStatus
       
   128         {
       
   129         EVcxNsCollectionNotOpen = 0,
       
   130         EVcxNsCollectionOpening,
       
   131         EVcxNsCollectionOpened            
       
   132         };
       
   133 
       
   134     CVcxNsContentHarvesterMpxClient( CVcxNsChPublisher* aPublisher,
       
   135                                      CVcxNsChPublishableData* aPublishableData,
       
   136                                      CVcxNsContentHarvesterPlugin* aPlugin );
       
   137 
       
   138     void ConstructL();
       
   139     
       
   140     /** 
       
   141      * Called by HandleCollectionMessage(). Handles collection messages.
       
   142      * 
       
   143      * @param aMessage collection message.
       
   144      * @param aError system error code.
       
   145      */
       
   146     void HandleCollectionMessageL( CMPXMessage* aMessage, TInt aError );
       
   147 
       
   148     /** 
       
   149      * Called by HandleCollectionMessageL(). Handles single collection message.
       
   150      * 
       
   151      * @param aMessage collection message.
       
   152      * @param aError system error code.
       
   153      */
       
   154     void HandleSingleCollectionMessageL( CMPXMessage* aMessage, TInt aError );
       
   155     
       
   156     /**
       
   157      * Handles item addition message, called by HandleCollectionMessage().
       
   158      * 
       
   159      * @param aMessage collection message, ownership not transferred. 
       
   160      *        Please check aMsg is not NULL before using it. If aErr is not 
       
   161      *        KErrNone, plugin might still call back with more info in the aMsg.
       
   162      * @param aErr system error code. 
       
   163      */
       
   164     void HandleMyVideosItemsAppendedL( CMPXMessage* aMessage, TInt aError );        
       
   165     
       
   166     /**
       
   167      * Handles item changed message, called by HandleCollectionMessage().
       
   168      * 
       
   169      * @param aMessage collection message, ownership not transferred. 
       
   170      *        Please check aMsg is not NULL before using it. If aErr is not 
       
   171      *        KErrNone, plugin might still call back with more info in the aMsg.
       
   172      * @param aErr system error code. 
       
   173      */
       
   174     void HandleMyVideosItemsChangedL( CMPXMessage* aMessage, TInt aError ); 
       
   175     
       
   176     /**
       
   177      * Handles item deleted or modified message, called by HandleMyVideosItemsChangedL().
       
   178      * 
       
   179      * @param aMessage collection message, ownership not transferred. 
       
   180      *        Please check aMsg is not NULL before using it. If aErr is not 
       
   181      *        KErrNone, plugin might still call back with more info in the aMsg.
       
   182      */
       
   183     void HandleContentModifiedL( CMPXMessage* aMessage ); 
       
   184     
       
   185     /**
       
   186      * OpenCollectionL
       
   187      */
       
   188     void OpenCollectionL();
       
   189     
       
   190     /**
       
   191      * CloseCollection
       
   192      */
       
   193     void CloseCollection();
       
   194     
       
   195     /**
       
   196      * Returns the current level of collection.
       
   197      */
       
   198     TInt CollectionLevelL();
       
   199     
       
   200     /**
       
   201      * UpdateCategoryL
       
   202      */
       
   203     void UpdateCategoryL();
       
   204     
       
   205     /**
       
   206      * SearchAndStoreCategoryL
       
   207      */
       
   208     void SearchAndStoreCategoryL( CMPXMediaArray* categoryArray );
       
   209     
       
   210     /**
       
   211      * UpdateNewVideoCount
       
   212      */
       
   213     void UpdateNewVideoCountL();
       
   214 
       
   215 private: // data
       
   216 
       
   217     /**
       
   218      * Instance of MPX collection util interface.
       
   219      */
       
   220     MMPXCollectionUtility* iCollectionUtility;
       
   221     
       
   222     /**
       
   223      * Observed category
       
   224      */
       
   225     CMPXMedia* iObservedCategory;
       
   226     
       
   227     /**
       
   228      * Variable for storing collection opening status.
       
   229      */
       
   230     TVcxNsCollectionOpenStatus iCollectionOpenStatus;
       
   231     
       
   232     /**
       
   233      * CVcxNsChPublisher. Not owned.
       
   234      */
       
   235     CVcxNsChPublisher* iPublisher;
       
   236     
       
   237     /**
       
   238      * CVcxNsChPublishableData. Not owned.
       
   239      */
       
   240     CVcxNsChPublishableData* iPublishableData;
       
   241     
       
   242     /**
       
   243      * Mediator helper object for registering and subscribing 
       
   244      * mpx collection related mediator events
       
   245      */
       
   246     CVcxNsChMCategoryListener* iMCategoryListener;
       
   247     
       
   248     /**
       
   249      * Mediator helper object for registering and subscribing 
       
   250      * action handler related mediator events
       
   251      */
       
   252     CVcxNsChMCategoryListener* iAhCategoryListener;
       
   253     
       
   254     /**
       
   255      * iOngoingDownloads.
       
   256      */
       
   257     TBool iOngoingDownloads;
       
   258     
       
   259     /**
       
   260      * iTvVideoSuiteLoaded.
       
   261      */
       
   262     TBool iTvVideoSuiteLoaded;
       
   263     
       
   264     /**
       
   265      * Parent Plugin. Not own.
       
   266      */
       
   267     CVcxNsContentHarvesterPlugin* iPlugin;
       
   268 
       
   269     };
       
   270 
       
   271 #endif // C_VCXNSCONTENTHARVESTERMPXCLIENT_H