videoplayerapp/mpxvideoplayer/inc/mpxvideoplayerappuiengine.h
changeset 0 96612d01cf9f
child 2 dec420019252
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 "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:  App UI engine
       
    15 *
       
    16 */
       
    17 
       
    18 // Version : %version: da1mmcf#26 %
       
    19 
       
    20 
       
    21 #ifndef CMPXVIDEOPLAYERAPPUIENGINE_H
       
    22 #define CMPXVIDEOPLAYERAPPUIENGINE_H
       
    23 
       
    24 #include <e32base.h>
       
    25 #include <mpxplaybackutility.h>
       
    26 #include <mpxviewutility.h>
       
    27 #include <mpxcollectionutility.h>
       
    28 #include <mpxmessage2.h>
       
    29 #include <mpxcollectionplaylist.h>
       
    30 #include <mediarecognizer.h>
       
    31 #include <mpxviewactivationobserver.h>
       
    32 #include <mpxcollectionobserver.h>
       
    33 #include <mpxcollectionuihelperobserver.h>
       
    34 
       
    35 #ifdef __APPUIENGINESTIF__
       
    36 #include "mpxvideoplayerappui_stub.h"
       
    37 #else
       
    38 #include "mpxvideoplayerappui.h"
       
    39 #endif
       
    40 
       
    41 class CMpxVideoEmbeddedPdlHandler;
       
    42 class MMPXCollectionUiHelper;
       
    43 class CAiwGenericParamList;
       
    44 class CVideoPlaylistUtility;
       
    45 class RConnection;
       
    46 
       
    47 /**
       
    48 *  Application UI class.
       
    49 *
       
    50 *  @lib mpxvideoplayer.exe
       
    51 *  @since MpxVideoPlayer 0.1
       
    52 */
       
    53 class CMpxVideoPlayerAppUiEngine : public CBase,
       
    54                                    public MMPXViewActivationObserver,
       
    55                                    public MMPXCollectionObserver ,
       
    56                                    public MMPXCHelperEmbeddedOpenObserver
       
    57 {
       
    58     public:        // Constructors and destructor
       
    59         static CMpxVideoPlayerAppUiEngine* NewL( CMpxVideoPlayerAppUi* aAppUi );
       
    60 
       
    61         /**
       
    62         * Destructor.
       
    63         */
       
    64         virtual ~CMpxVideoPlayerAppUiEngine();
       
    65 
       
    66     public:
       
    67         /*
       
    68          *  Retrieve the playback utility pointer
       
    69          */
       
    70         inline MMPXPlaybackUtility* PlaybackUtility();
       
    71 
       
    72         /**
       
    73          * Opens the specified file in response to a corresponding message.
       
    74          *
       
    75          * @param aFile File to be opened.
       
    76          * @param aParams aiw generic parameters for the file
       
    77          */
       
    78         void OpenFileL( RFile& aFile, const CAiwGenericParamList* aParams );
       
    79 
       
    80         /**
       
    81          * Opens the specified file in response to a corresponding message.
       
    82          *
       
    83          * @param aFile File to be opened.
       
    84          */
       
    85         void OpenFileL( const TDesC& aFileName );
       
    86 
       
    87         /**
       
    88          * Opens the specified mpx media object.
       
    89          *
       
    90          * @param aMedia Media to be opened.
       
    91          */
       
    92         void OpenMediaL( const CMPXMedia& aMedia );
       
    93 
       
    94         /*
       
    95          *  Activate the proper playback view
       
    96          */
       
    97         void ActivatePlaybackViewL();
       
    98 
       
    99         /**
       
   100          * Sets mpx components ready for application shutdown
       
   101          */
       
   102         void PrepareCloseMpxL();
       
   103 
       
   104         /**
       
   105          * Sets AppUiEngine in stand alone "mode"
       
   106          */
       
   107         void StartStandAloneL();
       
   108 
       
   109         /**
       
   110          * Handle media properties.
       
   111          */
       
   112         void DoHandleCollectionMediaL( const CMPXMedia& aMedia );
       
   113 
       
   114         /**
       
   115          * Steps one level up in collection path
       
   116          */
       
   117         void StepBackCollectionPathL();
       
   118 
       
   119         /**
       
   120          * Process activation message.
       
   121          * @param aMsg reference to activation message
       
   122          */
       
   123         void ProcessActivationMessageL( const TDesC8 &aMsg );
       
   124 
       
   125         /*
       
   126          * Handle embedded playback message
       
   127          * @param aMessageUid message identification uid
       
   128          * @param aMessageParameters  aiw generic parameters
       
   129          */
       
   130         TBool HandleMessageL( TUid aMessageUid,
       
   131                               const TDesC8& aMessageParameters );
       
   132 
       
   133         /**
       
   134          * From MMPXViewActivationObserver
       
   135          * Handle view activation.
       
   136          *
       
   137          * @since 3.1
       
   138          * @param aCurrentViewType Current view type Uid.
       
   139          * @param aPreviousViewType Previous view type Uid.
       
   140          */
       
   141         void HandleViewActivation( const TUid& aCurrentViewType, const TUid& aPreviousViewType );
       
   142 
       
   143 
       
   144         /**
       
   145          *  From MPXCollectionObserver
       
   146          *  @since S60 3.2.3
       
   147          *  @param aMessage collection message, ownership not transferred.
       
   148          *         Please check aMsg is not NULL before using it. If aErr is not
       
   149          *         KErrNone, plugin might still call back with more info in the aMsg.
       
   150          *  @param aErr system error code
       
   151          */
       
   152         void HandleCollectionMessage( CMPXMessage* aMsg, TInt /*aErr*/ );
       
   153 
       
   154         /**
       
   155          * From MMPXCollectionObserver
       
   156          * Handle media properties.
       
   157          *
       
   158          * @since 3.1
       
   159          * @param aMedia  media properties.
       
   160          * @param aError Error code.
       
   161          */
       
   162         void HandleCollectionMediaL( const CMPXMedia& aMedia, TInt aError );
       
   163 
       
   164          /**
       
   165          * From MMPXCollectionObserver
       
   166          * Handles the collection entries being opened.
       
   167          *
       
   168          * @since 3.1
       
   169          * @param aEntries Collection entries opened.
       
   170          * @param aIndex Focused entry.
       
   171          * @param aComplete ETrue no more entries. EFalse more entries
       
   172          *                  expected.
       
   173          * @param aError Error code.
       
   174          */
       
   175         void HandleOpenL( const CMPXMedia& aEntries,
       
   176                           TInt aIndex,
       
   177                           TBool aComplete,
       
   178                           TInt aError );
       
   179 
       
   180         /**
       
   181          * From MMPXCollectionObserver
       
   182          * Handles the item being opened.
       
   183          *
       
   184          * @since 3.1
       
   185          * @param aPlaylist Collection playlist, owner ship is transfered.
       
   186          * @param aError Error code.
       
   187          */
       
   188         void HandleOpenL( const CMPXCollectionPlaylist& aPlaylist, TInt aError);
       
   189 
       
   190         // from base class MMPXCHelperEmbeddedOpenObserver
       
   191             /**
       
   192             * From MMPXCHelperEmbeddedOpenObserver
       
   193             * Handles errors from opening in embedded mode
       
   194             *
       
   195             * @since 3.1
       
   196             * @param aErr Error code
       
   197             * @param aCategory Type of item to be opened.
       
   198             */
       
   199         void HandleEmbeddedOpenL( TInt aErr, TMPXGeneralCategory aCategory  );
       
   200 
       
   201         void CreateEmbeddedPdlPlaybackUtilityMemberVariablesL();
       
   202 
       
   203         /*
       
   204          * Handles the "back" button.
       
   205          */
       
   206         void HandleSoftKeyBackL();
       
   207 
       
   208         /*
       
   209          *  Processes shell commands.
       
   210          *  @param aCommand
       
   211          *  @param aDocumentName
       
   212          *  @param aTail
       
   213          *  @return  ETrue if document name exists
       
   214          */
       
   215         TBool ProcessCommandParametersL( TApaCommand aCommand,
       
   216                                          TFileName& aDocumentName,
       
   217                                          const TDesC8& aTail );
       
   218 
       
   219         /*
       
   220          *  Provides the static function for the callback to exit the application
       
   221          *  Called by CIdle iIdle
       
   222          *  @since 9.2
       
   223          *  @param aPtr Pointer to callback class
       
   224          *  @return KErrNone
       
   225          */
       
   226         static TInt ExitApplicationL( TAny* aPtr );
       
   227 
       
   228         /*
       
   229          * returns the viewdepth from the viewutlity
       
   230          */
       
   231         TInt ViewHistoryDepth();
       
   232 
       
   233         void ClearPdlInformation();
       
   234 
       
   235         /**
       
   236          *  Checks if application has to exit to Matrix root menu
       
   237          */
       
   238         TBool ExitToMatrixMenu();
       
   239 
       
   240         void InitializeFileL( const TDesC& aFileName );
       
   241 
       
   242     private:
       
   243         /**
       
   244          * Constructor
       
   245          */
       
   246         CMpxVideoPlayerAppUiEngine( CMpxVideoPlayerAppUi* aAppUi );
       
   247 
       
   248         /**
       
   249          * Default constructor
       
   250          */
       
   251         CMpxVideoPlayerAppUiEngine( );
       
   252 
       
   253         /**
       
   254          * By default Symbian 2nd phase constructor is private.
       
   255          */
       
   256         void ConstructL();
       
   257 
       
   258 
       
   259         void HandleMultiLinksFileL( const TDesC& aFileName,
       
   260                                     CMediaRecognizer::TMediaType aMediaType );
       
   261 
       
   262         void HandleMultiLinksFileL( RFile& aFile,
       
   263                                     CMediaRecognizer::TMediaType aMediaType );
       
   264 
       
   265         void DoHandleMultiLinksFileL( CVideoPlaylistUtility* aPlaylistUtil,
       
   266                                       TBool aSingleLink,
       
   267                                       TBool aLocalFile );
       
   268 
       
   269         TPtrC GetLinkLC( const TDesC& aFileName,
       
   270                          CMediaRecognizer::TMediaType aMediaType,
       
   271                          TBool aUseFileHandle = EFalse );
       
   272 
       
   273         /*
       
   274          *  Sets the access point member variable
       
   275          */
       
   276         void SetAccessPointL();
       
   277 
       
   278         /**
       
   279          *  Checks if the the AP is WLAN
       
   280          *
       
   281          *  @param aAPId - the ID of access point to be evaluated
       
   282          *  @return ETrue if the bearer type is WLAN for this access point
       
   283          */
       
   284         TBool IsWLANAccessPointL(TInt aAPId);
       
   285 
       
   286         /**
       
   287          *  Reads the default AP
       
   288          *
       
   289          *  @return ID of the default Access Point read from the config file
       
   290          */
       
   291         TInt GetDefaultAccessPointL();
       
   292 
       
   293         /**
       
   294          *  Converts UID of the AP to and Access Point Id
       
   295          *
       
   296          *  @return ID of the Access Point
       
   297          */
       
   298         TInt GetAccessPointIdForUIDL(TUint32 aAPUid);
       
   299 
       
   300         /**
       
   301          *  Tries to get AP ID for connection.
       
   302          *  If default AP is not available, AP is queried from the user.
       
   303          *
       
   304          *  @return ID of the Access Point
       
   305          */
       
   306         TUint32 TryToGetAccessPointL();
       
   307 
       
   308         TInt HandleAiwGenericParamListL( const CAiwGenericParamList* aParams );
       
   309 
       
   310         /**
       
   311         * Handle collection message
       
   312         *
       
   313         * @param aMessage collection message
       
   314         */
       
   315        void DoHandleCollectionMessageL( CMPXMessage* aMessage );
       
   316 
       
   317        void CreatePlaybackUtilityMemberVariablesL();
       
   318 
       
   319        void CreateCollectionUtilityMemberVariablesL();
       
   320 
       
   321        void CreateRemoteControlListenerL();
       
   322 
       
   323        /*
       
   324         *  Activates an active object to exit the application
       
   325         *  @since 5.0
       
   326         */
       
   327        void ActivateExitActiveObject();
       
   328 
       
   329        /*
       
   330         *  Called to stop and exit the application
       
   331         *  @since 9.2
       
   332         *  @return void
       
   333         */
       
   334        virtual void DoExitApplicationL();
       
   335 
       
   336        /*
       
   337        * used to send media info to plugin
       
   338        */
       
   339        void UpdatePbPluginMediaL();
       
   340 
       
   341        /*
       
   342        * Sends custom command to active view
       
   343        *
       
   344        * @param aMsg custom message data
       
   345        */
       
   346        void SendCustomCommandToActiveViewL( const TDesC8& aMsg );
       
   347 
       
   348        /*
       
   349        * Gets IAP ID from active connection.
       
   350        *
       
   351        * @param aConn   Connection to query.
       
   352        */
       
   353        TUint32 QueryIap( RConnection& aConn );
       
   354 
       
   355        void InitializeStreamingLinkL( const TDesC& aUri );
       
   356        void InitializePlaylistL( const CMPXCollectionPlaylist& aPlaylist, TBool aPlay );
       
   357 
       
   358     private:       // data
       
   359 
       
   360         CMpxVideoPlayerAppUi*         iAppUi;
       
   361 
       
   362         //
       
   363         //  Owned Utilities
       
   364         //
       
   365         MMPXPlaybackUtility*     iPlaybackUtility;
       
   366         MMPXViewUtility*         iViewUtility;
       
   367         MMPXCollectionUtility*   iCollectionUtility;
       
   368         MMPXCollectionUiHelper*  iCollectionUiHelper;  // own
       
   369 
       
   370         TUid iVideoCollectionId;
       
   371 
       
   372         CIdle*                        iExitAo;
       
   373         CMediaRecognizer*             iRecognizer;       // own
       
   374         CMpxVideoEmbeddedPdlHandler*  iPdlHandler;       // own
       
   375 
       
   376         TInt                     iAccessPointId;
       
   377         TInt                     iExtAccessPointId;
       
   378         TBool                    iMultilinkPlaylist;
       
   379         TBool                    iSeekable;
       
   380         TBool                    iUpdateSeekInfo;
       
   381         TBool                    iExitToMatrixMenu;
       
   382 };
       
   383 
       
   384 //
       
   385 //  Inline methods
       
   386 //
       
   387 inline
       
   388 MMPXPlaybackUtility* CMpxVideoPlayerAppUiEngine::PlaybackUtility()
       
   389 {
       
   390     return iPlaybackUtility;
       
   391 }
       
   392 
       
   393 #endif             // CMPXVIDEOPLAYERAPPUIENGINE_H