upnpmpxplugins/upnpplaybackplugins/inc/upnpmusicperiodizer.h
branchIOP_Improvements
changeset 40 08b5eae9f9ff
parent 39 6369bfd1b60d
child 41 b4d83ea1d6e2
equal deleted inserted replaced
39:6369bfd1b60d 40:08b5eae9f9ff
     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:      Periodic timer support resource
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 #ifndef __UPNPMUSICPERIODIZER_H__
       
    24 #define __UPNPMUSICPERIODIZER_H__
       
    25 
       
    26 // INCLUDES
       
    27 #include <e32base.h>
       
    28 #include "upnpmusicperiodizer.h"
       
    29 
       
    30 // FORWARD DECLARATIONS
       
    31 class MUPnPMusicPeriodizerObserver;
       
    32 
       
    33 /**
       
    34  * A class that provides periodic notifications.
       
    35  *
       
    36  * Once started, notifies an abstract interface periodically
       
    37  * but only when Continue is called. This avoids situation
       
    38  * where previous operation is still in progress when the next
       
    39  * notification arrives.
       
    40  *
       
    41  * @lib upnpmusicplugins.lib
       
    42  * @since S60 v3.1
       
    43  */
       
    44 class CUPnPMusicPeriodizer : public CTimer
       
    45     {
       
    46 
       
    47 public:
       
    48 
       
    49    /**
       
    50     * Static constructor
       
    51     *
       
    52     * @since Series 60 3.1
       
    53     * @param aObserver the party to be notified on timer trigger
       
    54     * @param aTimerWavelength the timer delay in microseconds
       
    55     */
       
    56     static CUPnPMusicPeriodizer* NewL(
       
    57         MUPnPMusicPeriodizerObserver& aObserver,
       
    58         TInt32 aTimerWavelength );
       
    59     
       
    60    /**
       
    61     * Static constructor
       
    62     *
       
    63     * @since Series 60 3.1
       
    64     * @param aObserver the party to be notified on timer trigger
       
    65     * @param aTimerWavelength the timer delay in microseconds
       
    66     */
       
    67     static CUPnPMusicPeriodizer* NewLC(
       
    68         MUPnPMusicPeriodizerObserver& aObserver,
       
    69         TInt32 aTimerWavelength );
       
    70 
       
    71     /**
       
    72      * Destructor
       
    73      *
       
    74      * @since Series 60 3.1
       
    75      */ 
       
    76     virtual ~CUPnPMusicPeriodizer();
       
    77 
       
    78 private:
       
    79 
       
    80    /**
       
    81     * Constructor
       
    82     *
       
    83     * @since Series 60 3.1
       
    84     * @param aObserver the party to be notified on timer trigger
       
    85     * @param aTimerWavelength the timer delay in microseconds
       
    86     */
       
    87     CUPnPMusicPeriodizer(
       
    88         MUPnPMusicPeriodizerObserver& aObserver,
       
    89         TInt32 aTimerWavelength );
       
    90 
       
    91     /**
       
    92      * 2nd phase constructor
       
    93      *
       
    94      * @since Series 60 3.1
       
    95      */   
       
    96     void ConstructL();
       
    97 
       
    98 public:
       
    99 
       
   100     /**
       
   101      * Starts the periodizer
       
   102      *
       
   103      * @since Series 60 3.1
       
   104      */
       
   105     void Start();
       
   106 
       
   107     /**
       
   108      * Continues a next step for the periodizer
       
   109      *
       
   110      * @since Series 60 3.1
       
   111      */
       
   112     void Continue();
       
   113 
       
   114     /**
       
   115      * Stops periodizer
       
   116      *
       
   117      * @since Series 60 3.1
       
   118      */
       
   119     void Stop();
       
   120 
       
   121 protected: // personal method
       
   122 
       
   123     /**
       
   124      * Receives the timer triggering
       
   125      *
       
   126      * @since Series 60 3.1
       
   127      */
       
   128     void RunL();
       
   129 
       
   130 
       
   131 private: // data
       
   132 
       
   133     /**
       
   134      * Observer of the timer
       
   135      */
       
   136     MUPnPMusicPeriodizerObserver& iObserver;
       
   137 
       
   138     /**
       
   139      * Timer wavelength as milliseconds to wait between notifications
       
   140      */
       
   141     TInt32 iTimerWavelength;
       
   142 
       
   143     };
       
   144 
       
   145 /**
       
   146  * The interface to receive timer notifications
       
   147  */
       
   148 class MUPnPMusicPeriodizerObserver
       
   149     {
       
   150 
       
   151 public:
       
   152 
       
   153    /**
       
   154     * Timer has triggered
       
   155     *
       
   156     * @since Series 60 3.1
       
   157     */
       
   158     virtual void HandlePeriod() = 0;
       
   159     
       
   160    /**
       
   161     * Timer has triggered
       
   162     *
       
   163     * @since Series 60 3.2.3
       
   164     */
       
   165     virtual void HandlePeriodForEnd(){}
       
   166 
       
   167     };
       
   168 
       
   169 
       
   170 #endif // __UPNPMUSICPERIODIZER_H__
       
   171