ImagePrint/ImagePrintEngine/DeviceProtocols/upnpprotocolfw2/inc/cuptimer.h
branchRCL_3
changeset 28 d59c248c9d36
parent 0 d11fb78c4374
equal deleted inserted replaced
27:159fc2f68139 28:d59c248c9d36
       
     1 /*
       
     2 * Copyright (c) 2002-2007 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:  Declares CUPTimer class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CUPTIMER_H
       
    20 #define CUPTIMER_H
       
    21 
       
    22 #include <e32base.h>
       
    23 
       
    24 class CUpnpItem;
       
    25 
       
    26 class MUPTimerObserver
       
    27 	{
       
    28 	public:
       
    29 	    
       
    30 	    /**
       
    31     	* Method which is called when timer in CUPTimer expires
       
    32     	*/
       
    33 		virtual void TimerExpiredL(CUpnpItem* aItemToShare) = 0;
       
    34 	};
       
    35 	
       
    36 class CUPTimer :  public CActive
       
    37 	{
       
    38 	
       
    39 	public:
       
    40 
       
    41     /**
       
    42     * Static method for creating an instance
       
    43     * @return CUPTimer object
       
    44     */
       
    45     static CUPTimer* NewL();
       
    46 
       
    47     /**
       
    48     * Static method for creating an instance
       
    49     * @return CUPTimer object
       
    50     */
       
    51     static CUPTimer* NewLC();
       
    52 
       
    53     /**
       
    54     * Destructor
       
    55     */
       
    56     ~CUPTimer();
       
    57 
       
    58     /**
       
    59     * Method for seting the active object active
       
    60     */
       
    61     void SetActiveNow();
       
    62 
       
    63     /**
       
    64     * RunL
       
    65     */
       
    66     void RunL();
       
    67 
       
    68     /**
       
    69     * RunError
       
    70     * @param aError  Symbian error code which should indicate what happened
       
    71     */
       
    72     TInt RunError(TInt aError);
       
    73     
       
    74     /**
       
    75     * DoCancel
       
    76     */
       
    77     void DoCancel();
       
    78 
       
    79     /**
       
    80     * Method which will wait until given microseconds have passed and then call the given callback
       
    81     * @param aObserver  Observer class which called when timer expires
       
    82     * @param aTimeOut  Interval which waited before observer is called
       
    83     * @param aStatus  Request status object
       
    84     */    
       
    85     void WaitUntilTimeExpired(MUPTimerObserver* aObserver, 
       
    86     						  TTimeIntervalMicroSeconds32 aTimeOut,
       
    87     						  CUpnpItem* aItemToShare);//, 
       
    88     //						  TRequestStatus &aStatus);
       
    89     
       
    90     /**
       
    91     * CPeriodic timed out when this method is called
       
    92     * @param aPtr  Any pointer
       
    93     * @return Error code
       
    94     */
       
    95     static TInt TimedOut(TAny* aPtr);
       
    96 
       
    97     /**
       
    98     *  For canceling the request
       
    99     */ 
       
   100     void CancelTimer();
       
   101        
       
   102 private:
       
   103 
       
   104     /**
       
   105     *  ConstructL
       
   106     */
       
   107     void ConstructL();
       
   108     
       
   109     /**
       
   110     * Private constructor
       
   111     */    
       
   112     CUPTimer();
       
   113     
       
   114 private:
       
   115 
       
   116     /**
       
   117     * Pointer to a observer class
       
   118     */
       
   119     MUPTimerObserver* iObserver;
       
   120     
       
   121     /**
       
   122     * Instance of periodic timer
       
   123     */
       
   124 	CPeriodic* iTimeOutTimer;
       
   125 	
       
   126 	CUpnpItem* iItemToShare;
       
   127 
       
   128 	};
       
   129 
       
   130 #endif // CUPTIMER_H
       
   131 
       
   132 //  End of File