mpx/playbackframework/playbackengine/inc/mpxautoresumehandler.h
changeset 0 a2952bb97e68
child 17 780c925249c1
equal deleted inserted replaced
-1:000000000000 0:a2952bb97e68
       
     1 /*
       
     2 * Copyright (c) 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:  Auto resume handler
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CMPXAUTORESUMEHANDLER_H
       
    21 #define CMPXAUTORESUMEHANDLER_H
       
    22 
       
    23 // INCLUDES
       
    24 #include <e32base.h>
       
    25 #include <mpxpskeyobserver.h>
       
    26 #include <mpxplaybackframeworkdefs.h>
       
    27 
       
    28 // FORWARD DECLARATIONS
       
    29 class CMPXPlaybackEngine;
       
    30 class CMPXPSKeyWatcher;
       
    31 
       
    32 /**
       
    33 *  CMPXAutoResumeHandler.
       
    34 *  Class for processing call state events.
       
    35 *
       
    36 *  @since 3.0
       
    37 */
       
    38 NONSHARABLE_CLASS(CMPXAutoResumeHandler) :  public CBase,
       
    39                                             public MMPXPSKeyObserver
       
    40 
       
    41     {
       
    42 public:
       
    43     /**
       
    44     * Creates instance of the CMPXAutoResumeHandler class.
       
    45     *
       
    46     * @param aEngine reference to playback engine
       
    47     * @param aMixerSupport flag to support mixer
       
    48     * @return Returns the instance just created.
       
    49     */
       
    50     static CMPXAutoResumeHandler* NewL(CMPXPlaybackEngine& aEngine,
       
    51                                        TBool aMixerSupport);
       
    52 
       
    53     /**
       
    54     * Destructor.
       
    55     */
       
    56     virtual ~CMPXAutoResumeHandler();
       
    57     
       
    58     /**
       
    59     * Handle open file complete
       
    60     */
       
    61     void HandleOpenFileComplete();
       
    62     
       
    63     /**
       
    64     * Handle playback state change
       
    65     * @param aState new state    
       
    66     */
       
    67     void HandlePlaybackStateChange(TMPXPlaybackState aState);
       
    68 
       
    69     /**
       
    70     * Handle complete of playing a song
       
    71     * @aError error code
       
    72     */
       
    73     void HandlePlaybackComplete(TInt aError);
       
    74 
       
    75     /**
       
    76     * Resume timer cancel.
       
    77     */
       
    78     void CancelResumeTimer();
       
    79 
       
    80     /**
       
    81      * Set autoresume value
       
    82      */
       
    83     void SetAutoResume(TBool aAutoResume);
       
    84 
       
    85 private: // constructors
       
    86 
       
    87     /**
       
    88     * C++ default constructor.
       
    89     *
       
    90     * @param aEngine reference to playback engine
       
    91     * @param aMixerSupport flag to support mixer
       
    92     */
       
    93     CMPXAutoResumeHandler(CMPXPlaybackEngine& aEngine, TBool aMixerSupport);
       
    94 
       
    95     /**
       
    96     * Symbian OS constructor.
       
    97     */
       
    98     void ConstructL();
       
    99 
       
   100 private: // From base classes
       
   101 
       
   102     /**
       
   103     * From MMPXPSKeyObserver
       
   104     * Handle PS event
       
   105     *
       
   106     * @param aUid The UID that identifies the property category
       
   107     * @param aKey The property sub-key
       
   108     */
       
   109     void HandlePSEvent(TUid aUid, TInt aKey);
       
   110 
       
   111 private:  // New functions
       
   112 
       
   113     /**
       
   114     * Handle call state or type change.
       
   115     */
       
   116     void DoHandleStateChangeL();
       
   117 
       
   118     /**
       
   119     * Check if we should go to pause in
       
   120     * given call state
       
   121     */
       
   122     TBool ShouldPause();
       
   123 
       
   124     /**
       
   125     * Handle resume timer callback
       
   126     */
       
   127     void HandleResumeTimerCallback();
       
   128 
       
   129     /**
       
   130     * Callback for resume timer.
       
   131     */
       
   132     static TInt ResumeTimerCallback(TAny* aPtr);
       
   133 
       
   134     /**
       
   135     * Checks if current player is remote: playback shouldn't be paused
       
   136     * in that case
       
   137     */
       
   138     TBool IsPlaybackRemote();
       
   139 
       
   140 private: // data
       
   141     CMPXPlaybackEngine&  iEngine;
       
   142     TBool iMixerSupport;
       
   143     TBool iPausedForCall;
       
   144     CMPXPSKeyWatcher* iStateObserver; // owned
       
   145     CMPXPSKeyWatcher* iTypeObserver;  // owned
       
   146     TTime iKErrDiedTime;
       
   147     TBool iAutoResume;
       
   148 
       
   149     // Timer for resume operation. Owned.
       
   150     CPeriodic* iResumeTimer;
       
   151     };
       
   152 
       
   153 #endif      // CMPXAUTORESUMEHANDLER_H   
       
   154             
       
   155 // End of File