upnpframework/upnpcommonui/inc/upnpvideoplayerdialog.h
branchIOP_Improvements
changeset 40 08b5eae9f9ff
parent 39 6369bfd1b60d
child 41 b4d83ea1d6e2
equal deleted inserted replaced
39:6369bfd1b60d 40:08b5eae9f9ff
     1 /*
       
     2 * Copyright (c) 2005-2006 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:  Header file for UPnP Video player class implementation
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef __UPNP_VIDEOPLAYER_DIALOG_H__
       
    20 #define __UPNP_VIDEOPLAYER_DIALOG_H__
       
    21 
       
    22 // INCLUDES
       
    23 #include <aknViewAppUi.h>
       
    24 #include "upnpavrenderingsessionobserver.h"
       
    25 #include<remconcoreapitargetobserver.h>    //for MRemConCoreApiTargetObserver
       
    26 
       
    27 // FORWARD DECLARATIONS
       
    28 class CCustomCtrlDlgCustomControl;
       
    29 class MUPnPAVRenderingSession;
       
    30 class MUPnPAVController;
       
    31 class CUpnpObject;
       
    32 class CUpnpAVDevice;
       
    33 class CUPnPCommonUI;
       
    34 class MProgressDialogCallback;
       
    35 class CEikLabel;
       
    36 
       
    37 class CAknVolumePopup;
       
    38 class CRemConCoreApiTarget;
       
    39 class CRemConInterfaceSelector;
       
    40 class CUPnPPeriodic;
       
    41 
       
    42 /**
       
    43 * Video player class of Common UI library
       
    44 */
       
    45 NONSHARABLE_CLASS( CUPnPVideoPlayerDlg ) : public CAknDialog,
       
    46                                     public MUPnPAVRenderingSessionObserver,
       
    47                                     public MProgressDialogCallback
       
    48                                   , public MRemConCoreApiTargetObserver
       
    49     {
       
    50 
       
    51     public:  // Constructors and destructor
       
    52 
       
    53         /**
       
    54         * C++ default constructors.
       
    55         */
       
    56         CUPnPVideoPlayerDlg( MUPnPAVRenderingSession& aRenderingSession,
       
    57                              const CUpnpObject& aObject,
       
    58                              CUPnPCommonUI& aCommonUI );
       
    59 
       
    60         
       
    61         /**
       
    62         * Two-phased constructors.
       
    63         */
       
    64         static CUPnPVideoPlayerDlg* NewL(
       
    65                             MUPnPAVRenderingSession& aRenderingSession,
       
    66                             const CUpnpObject& aObject,
       
    67                             CUPnPCommonUI& aCommonUI );
       
    68 
       
    69         /**
       
    70         * Destructor.
       
    71         */
       
    72         virtual ~CUPnPVideoPlayerDlg();
       
    73 
       
    74     public: // Methods from MUPnPAVRenderingSessionObserver
       
    75 
       
    76         /**
       
    77          * UPnP AV Controller calls this method to return the result for the
       
    78          * 'get volume' request. Parameter contains the volume level of the
       
    79          * media renderer device to which the 'get volume' request was sent.
       
    80          *
       
    81          * @since Series 60 3.1
       
    82          * @param aError error code
       
    83          * @param aVolumeLevel TInt volume level (between 0 - 100)
       
    84          * @param aActionResponse EFalse if caused by pressing hardware key
       
    85          *                        ETrue if caused by rendering session
       
    86          */
       
    87         void VolumeResult( TInt aError, TInt aVolumeLevel, 
       
    88                            TBool aActionResponse );
       
    89 
       
    90         /**
       
    91          * UPnP AV Controller calls this method to indicate that the requested
       
    92          * interaction operation (play, stop, etc.) is complete. In other
       
    93          * words, the target rendering device has changed it's state
       
    94          * accordingly.
       
    95          *
       
    96          * @since Series 60 3.1
       
    97          * @param aErrorCode TInt error code
       
    98          * @param aOperation TInt operation (TAVInteractOperation)
       
    99          * @return None
       
   100          */
       
   101         void InteractOperationComplete(
       
   102                             TInt aErrorCode,
       
   103                             TUPnPAVInteractOperation aOperation );
       
   104 
       
   105         /**
       
   106          * UPnP AV Controller calls this method to return the result for the
       
   107          * 'get mute' request. Parameter contains the state of the mute of the
       
   108          * media renderer device to which the 'get mute' request was sent.
       
   109          *
       
   110          * @since Series 60 3.1
       
   111          * @param aError error code
       
   112          * @param aMute TBool the state of the mute (ETrue or EFalse)
       
   113          * @param aActionResponse EFalse if caused by pressing hardware key
       
   114          *                        ETrue if caused by rendering session
       
   115          */
       
   116         void MuteResult( TInt aError, TBool aMute, TBool aActionResponse );
       
   117 
       
   118         /**
       
   119          * UPnP AV Controller calls this method as a response to Position
       
   120          * Info action. The current position and the total length of the
       
   121          * track that is currently playing is returned. The results are in
       
   122          * (hh:mm:ss) format.
       
   123          *
       
   124          * UPnPAVController releases the memory allocated for aTrackPosition
       
   125          * and aTrackLength.
       
   126          *
       
   127          * @since Series 60 3.1
       
   128          * @param aStatus TInt error code
       
   129          * @param aTrackPosition TDesC8& track position
       
   130          * @param aTrackLength TDesC8& track length
       
   131          */
       
   132         void PositionInfoResult( TInt aError,
       
   133                                  const TDesC8& aTrackPosition,
       
   134                                  const TDesC8& aTrackLength );
       
   135 
       
   136         /**
       
   137          * UPnP AV Controller calls this method to return the result for the
       
   138          * 'set uri' request.
       
   139          *
       
   140          * @since Series 60 3.1
       
   141          * @param aError error code
       
   142          * @return None
       
   143          */
       
   144         void SetURIResult( TInt aError );
       
   145 
       
   146         /**
       
   147          * UPnP AV Controller calls this method to return the result for the
       
   148          * 'set next uri' request.
       
   149          *
       
   150          * @since Series 60 3.1
       
   151          * @param aError error code
       
   152          * @return None
       
   153          */
       
   154         void SetNextURIResult( TInt /*aError*/ ){};
       
   155        
       
   156        /**
       
   157          * Notifies that the Media Renderer we have a session with has
       
   158          * disappeared. Session is now unusable and must be closed. 
       
   159          *
       
   160          * @since Series 60 3.1
       
   161          * @return None
       
   162          */  
       
   163         void MediaRendererDisappeared(
       
   164             TUPnPDeviceDisconnectedReason aReason );
       
   165         
       
   166         /**
       
   167          * Notifies that the Local Media Server has been put on sharing state
       
   168          *
       
   169          * @since Series 60 3.1
       
   170          * @param aReason reason code
       
   171          * @return None
       
   172          */
       
   173         void ReserveLocalMSServicesCompleted( TInt /*aError*/ ){};
       
   174        
       
   175     public: // Functions from base classes
       
   176 
       
   177         /**
       
   178         * CreateCustomControlL
       
   179         *
       
   180         * Draw this CUPnPVideoPlayerDlg to the screen.
       
   181         * @param aRect the rectangle of this view that needs updating
       
   182         */
       
   183         SEikControlInfo CreateCustomControlL( TInt aControlType );
       
   184 
       
   185         /**
       
   186         * From CAknDialog, handles key events.
       
   187         * @param TKeyEvent, Event to handled.
       
   188         * @param TEventCode, Type of the key event.
       
   189         * @return TKeyResponse, response code (EKeyWasConsumed,
       
   190         *         EKeyWasNotConsumed).
       
   191         */
       
   192         TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent,
       
   193                                      TEventCode aType );
       
   194         
       
   195     public:  //new function
       
   196         
       
   197         /**
       
   198          * Called from CommonUI to destroy the video dialog itself
       
   199          * both in single Media server disappears or WLAN lost case
       
   200          * @since Series 60 3.1
       
   201          * @param aError exit reason (KErrSessionClosed and
       
   202          *                            KErrDisconnected)
       
   203          * @return None
       
   204          */   
       
   205         void DismissItselfL( TInt aError );
       
   206         
       
   207         /**
       
   208          * Handle different errors
       
   209          * @since Series 60 3.1
       
   210          * @param exiting reason
       
   211          * @return none
       
   212          */
       
   213         void HandleErrorL( TInt aError );
       
   214       
       
   215     protected: // Functions from base classes
       
   216 
       
   217         /**
       
   218         * From CoeControl
       
   219         * @param None
       
   220         * @return None
       
   221         */
       
   222         void HandleResourceChange(TInt aType);
       
   223 
       
   224         /**
       
   225         * From CAknDialog
       
   226         * @param None
       
   227         * @return None
       
   228         */
       
   229         void SizeChanged();
       
   230 
       
   231     protected:  // Functions from base classes
       
   232 
       
   233         /**
       
   234         * From CEikDialog, handles layout initialization
       
   235         * @param None
       
   236         * @return None
       
   237         */
       
   238         void PreLayoutDynInitL();
       
   239 
       
   240         /**
       
   241         * From CAknDialog, handles focus changes of the dialog
       
   242         * @param aButtonId, pressed button id
       
   243         * @return True if ready to close dialog, False otherwise
       
   244         */
       
   245         TBool OkToExitL( TInt aButtonId );
       
   246 
       
   247     private:    // New Functions
       
   248 
       
   249         /**
       
   250         * Updates navi pane
       
   251         *
       
   252         * @since Series 60 3.1
       
   253         * @param None
       
   254         * @return None
       
   255         */
       
   256         void UpdateNaviPaneL( );
       
   257 
       
   258         /**
       
   259         * Check the status pane capabilities.
       
   260         *
       
   261         * @since Series 60 3.1
       
   262         * @param aPaneId Status pane Id.
       
   263         * @return indication of success
       
   264         */
       
   265         TBool CheckStatusPaneCapabilities( const TPaneId& aPaneId );
       
   266 
       
   267         /**
       
   268         * Set navigation label from descriptor.
       
   269         *
       
   270         * @since Series 60 3.1
       
   271         * @param aText Text to be displayed on the navi label.
       
   272         * @return none
       
   273         */
       
   274         void SetNaviLabelL( const TDesC& aText );
       
   275 
       
   276         
       
   277         /**
       
   278          * UPnP AV Controller calls this method to indicate that the requested
       
   279          * interaction operation (play, stop, etc.) is complete. In other
       
   280          * words, the target rendering device has changed it's state
       
   281          * accordingly.
       
   282          *
       
   283          * @since Series 60 3.1
       
   284          * @param aErrorCode TInt error code
       
   285          * @param aOperation TInt operation (TAVInteractOperation)
       
   286          * @return None
       
   287          */
       
   288         void InteractOperationCompleteL(
       
   289                             TInt aErrorCode,
       
   290                             TUPnPAVInteractOperation aOperation );
       
   291                             
       
   292         /**
       
   293          * UPnP AV Controller calls this method to return the result for the
       
   294          * 'set uri' request.
       
   295          *
       
   296          * @since Series 60 3.1
       
   297          * @param aError error code
       
   298          * @return None
       
   299          */
       
   300         void SetURIResultL( TInt aError );
       
   301         
       
   302         /**
       
   303          * For set cba string, encapsulation it in this function.
       
   304          *
       
   305          * @since Series 60 3.2
       
   306          * @param None
       
   307          * @return None
       
   308          */
       
   309         void ContinueAfterPauseL();
       
   310                         
       
   311     private:
       
   312 
       
   313         /**
       
   314         * 2nd phase constructors.
       
   315         */
       
   316         void ConstructL();
       
   317 
       
   318         /**
       
   319         * Clears dialog title
       
   320         *
       
   321         * @since Series 60 3.1
       
   322         * @param none
       
   323         * @return none
       
   324         */
       
   325         void ClearTitleL();
       
   326 
       
   327         /**
       
   328         * Updates softkey texts
       
   329         *
       
   330         * @since Series 60 3.1
       
   331         * @param TInt, state
       
   332         * @return none
       
   333         */
       
   334         void UpdateSoftkeysL(TInt aState);
       
   335 
       
   336         /**
       
   337         * Timer callback for volume indicator hiding.
       
   338         *
       
   339         * @since Series 60 3.1
       
   340         * @return TInt, error code
       
   341         */
       
   342         static TInt HideVolumeIdicator(TAny* aPtr);
       
   343 
       
   344         /**
       
   345         * Shows volume indicator
       
   346         *
       
   347         * @since Series 60 3.1
       
   348         * @param none
       
   349         * @return none
       
   350         */
       
   351         void ShowVolumeIndicatorL();
       
   352 
       
   353         /**
       
   354         * Timer callback
       
   355         *
       
   356         * @since Series 60 3.1
       
   357         * @param TAny*, caller
       
   358         * @return TInt
       
   359         */
       
   360         static TInt TimerIndicatorL(TAny* aPtr);
       
   361 
       
   362         /**
       
   363         * Resolves the target UPnP device capabilites
       
   364         * @since Series 60 3.1
       
   365         * @param None
       
   366         * @return none
       
   367         */
       
   368         void ResolveTargetDeviceCapabilitiesL();
       
   369         
       
   370         /**
       
   371         * Stop the video playback wait note
       
   372         * @since Series 60 3.1
       
   373         * @param None
       
   374         * @return none
       
   375         */
       
   376         void FinishWaitNoteL();
       
   377         
       
   378         /**
       
   379          * Prepare the video playback
       
   380          *
       
   381          * @since Series 60 3.1
       
   382          * @param None
       
   383          * @return None
       
   384          */
       
   385         void PreparePlayBackL();
       
   386         
       
   387         /**
       
   388          * Start wait note
       
   389          *
       
   390          * @since Series 60 3.1
       
   391          * @param None
       
   392          * @return An error code
       
   393          */
       
   394         TInt StartWaitNoteL();
       
   395         
       
   396         /**
       
   397          * Start displaying timer on the navi pane
       
   398          *
       
   399          * @since Series 60 3.1
       
   400          * @param None
       
   401          * @return None
       
   402          */
       
   403         void StartDisplayTimer();
       
   404         
       
   405         /**
       
   406         * Calls respective observer function
       
   407         *
       
   408         * @since Series 60 3.1
       
   409         * @param none
       
   410         * @return none
       
   411         */
       
   412         void DoChangeVolumeL();
       
   413         
       
   414         /**
       
   415         * Timer callback
       
   416         *
       
   417         * @since Series 60 3.1
       
   418         * @param TAny*, caller
       
   419         * @return TInt
       
   420         */
       
   421         static TInt ChangeVolume( TAny* aPtr );
       
   422         
       
   423     public: // Call back methods of MAknProgressDialogCallback
       
   424 
       
   425         /**
       
   426          * ProgressDialog call back method.
       
   427          * Get's called when a dialog is dismissed.
       
   428          *
       
   429          * @since S60 3.1
       
   430          * @param aButtonId (TInt) ID of the button pressed
       
   431          */
       
   432         void DialogDismissedL( TInt aButtonId );
       
   433     
       
   434     private:// From MRemConCoreApiTargetObserver
       
   435         
       
   436         
       
   437         /**
       
   438         * Side volume key API from MRemConCoreApiTargetObserver
       
   439         * @since 3.2
       
   440         * @see MRemConCoreApiTargetObserver
       
   441         */
       
   442         virtual void MrccatoCommand(TRemConCoreApiOperationId aOperationId, 
       
   443                              TRemConCoreApiButtonAction aButtonAct );         
       
   444     private:    // Data
       
   445 
       
   446         enum TUPnPVideoStates
       
   447             {
       
   448             EUPnPVideoPause = 0x600,
       
   449             EUPnPVideoPlay,
       
   450             EUPnPVideoStop
       
   451             };
       
   452 
       
   453         CUPnPPeriodic*                  iTimer; //owned
       
   454         CAknNavigationDecorator*        iNaviDecorator; //owned
       
   455         CAknNavigationControlContainer* iNaviPane;             // Not owned
       
   456         
       
   457         MUPnPAVRenderingSession&        iRendSession; //not owned
       
   458 
       
   459         const CUpnpObject*              iItem; //not owned
       
   460         const CUpnpAVDevice*            iTargetDevice;         // Not owned
       
   461         const CUpnpAVDevice*            iSourceDevice;         // Not owned
       
   462 
       
   463         HBufC*                          iMinSecFormatString; //owned
       
   464         HBufC*                          iHourMinSecFormatString; //owned
       
   465         HBufC*                          iTimerNavi;
       
   466         TInt64                          iPlaybackPosInSeconds;
       
   467         TInt64                          iTotalLengthInSeconds;
       
   468         TInt                            iCurrentVolume;
       
   469         TInt                            iNewVolume;
       
   470         TInt                            iTimerRefresh;
       
   471         
       
   472         CCustomCtrlDlgCustomControl*    iContainer; //not owned
       
   473         
       
   474         //Volume adjust indicator
       
   475         TBool                           iAdjustingVolume;
       
   476         // Target device capabilites
       
   477         TBool                           iPauseCapability;
       
   478         TBool                           iVolumeCapability;
       
   479         // title text before video player
       
   480         HBufC*                          iOriginalTitleText; //owned
       
   481         
       
   482         CUPnPCommonUI&                  iCommonUI;
       
   483         
       
   484         TBool                           iPause; 
       
   485         
       
   486         // Flag if the remote renderer is playing and the elapsed time needs
       
   487         // be updated. This means that the renderer has started the playback 
       
   488         // already and it is not in paused state.
       
   489         TBool                           iRendererPlaying;
       
   490         
       
   491         // The time interval of getting GetPositionInfoL
       
   492         TInt                            iGetPositionInfoInterval;
       
   493         
       
   494         CUPnPCommonUI::TUPnPAction      iAction;
       
   495         
       
   496         CAknWaitDialog*                 iVideoPlaybackWaitNote; // owned;
       
   497         
       
   498         TInt                            iExitCode;
       
   499         
       
   500         //ETrue if volume is up, EFalse if volume is down
       
   501         TBool                           iVolumeUp;
       
   502            
       
   503         TBool                            iVolumeKeyPressHold;
       
   504         CUPnPPeriodic*                   iVolumeTimer; // owned
       
   505         CAknVolumePopup*                 iVolumePopup; // owned
       
   506         
       
   507         // owned by iInterfaceSelector
       
   508         CRemConCoreApiTarget*            iCoreTarget; 
       
   509         CRemConInterfaceSelector*        iInterfaceSelector; // owned
       
   510         
       
   511     };
       
   512 
       
   513 //////////////////////////////////////////////////////////////////////////////
       
   514 //
       
   515 // -----> CImage (definition)
       
   516 //
       
   517 //////////////////////////////////////////////////////////////////////////////
       
   518 class CImage : public CCoeControl
       
   519     {
       
   520     public:
       
   521 
       
   522         /**
       
   523         * C++ default constructor.
       
   524         */
       
   525         CImage(MUPnPAVRenderingSession& aRendSession);
       
   526 
       
   527         //destructor
       
   528         virtual ~CImage();
       
   529 
       
   530     private: // Methods
       
   531 
       
   532         /**
       
   533         * Draws the display
       
   534         *
       
   535         * @param TRect&, Rectangle to be drawn
       
   536         * @return none
       
   537         */
       
   538         void Draw(const TRect& aRect) const;
       
   539 
       
   540         /**
       
   541         * Draws the display
       
   542         *
       
   543         * @param TRect&, Rectangle to be drawn
       
   544         * @return none
       
   545         */
       
   546         void DrawL(const TRect& aRect) const;
       
   547 
       
   548         /**
       
   549         * Draws the label
       
   550         *
       
   551         * @param TRect&, Rectangle to be drawn
       
   552         * @return none
       
   553         */
       
   554         void DrawLabelL(const TRect& aRect) const;
       
   555 
       
   556      private: // Data
       
   557 
       
   558         // Data members defined and used by this class.
       
   559         MUPnPAVRenderingSession&    iRendSession;
       
   560         CFbsBitmap*                 iBitmap; //owned
       
   561         CFbsBitmap*                 iMask; //owned
       
   562     };
       
   563 
       
   564 //////////////////////////////////////////////////////////////////////////////
       
   565 //
       
   566 // -----> CCustomCtrlDlgCustomControl (definition)
       
   567 //
       
   568 //////////////////////////////////////////////////////////////////////////////
       
   569 class CCustomCtrlDlgCustomControl : public CCoeControl
       
   570     {
       
   571 
       
   572     public:
       
   573 
       
   574         /**
       
   575         * Construct From Resource.
       
   576         */
       
   577         void ConstructFromResourceL( TResourceReader& aReader );
       
   578 
       
   579         /**
       
   580         * Sets AV controller
       
   581         *
       
   582         * @since Series 60 3.1
       
   583         * @param MUPnPAVRenderingSession&, AV controller
       
   584         * @return none
       
   585         */
       
   586         void SetRenderingSession( MUPnPAVRenderingSession& aAVRendSession );
       
   587 
       
   588         //destructor
       
   589         virtual ~CCustomCtrlDlgCustomControl();
       
   590 
       
   591     private:
       
   592 
       
   593         /**
       
   594         * Draws the display
       
   595         *
       
   596         * @param TRect&, Rectangle to be drawn
       
   597         * @return none
       
   598         */
       
   599         void Draw( const TRect& aRect ) const;
       
   600 
       
   601         /**
       
   602         * From CAknDialog
       
   603         * @param none
       
   604         * @return none
       
   605         */
       
   606         void SizeChanged();
       
   607 
       
   608         /**
       
   609         * From CAknDialog
       
   610         * @param none
       
   611         * @return the number of component controls contained by this control
       
   612         */
       
   613         TInt CountComponentControls() const;
       
   614 
       
   615         /**
       
   616         * From CAknDialog
       
   617         * @param the index of the control to get
       
   618         * @return the component control with an index of aIndex
       
   619         */
       
   620         CCoeControl* ComponentControl(TInt aIndex) const;
       
   621 
       
   622     private:
       
   623 
       
   624         // Data members defined and used by this class.
       
   625         CImage*                     iImage; //owned
       
   626         MUPnPAVRenderingSession*    iRendSession; //not owned
       
   627         
       
   628     };
       
   629 
       
   630 #endif // __UPNP_VIDEOPLAYER_DIALOG_H__