keepalive/flextimer/server/engine/inc/flextimeritem.h
changeset 32 5c4486441ae6
equal deleted inserted replaced
31:c16e04725da3 32:5c4486441ae6
       
     1 /*
       
     2  * Copyright (c) 2010 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  * Description:
       
    13  * This class contains definition of CFlexTimerItem.
       
    14  *
       
    15  */
       
    16 
       
    17 // Protection against nested includes
       
    18 #ifndef FLEXTIMERITEM_H
       
    19 #define FLEXTIMERITEM_H
       
    20 
       
    21 // System includes
       
    22 #include <e32base.h>
       
    23 
       
    24 // User includes
       
    25 // None
       
    26 
       
    27 // Forward declarations
       
    28 class MFlexTimerServiceCB;
       
    29 
       
    30 // Class declaration
       
    31 /**
       
    32  *  Timer item that contains expiry time, window size and other timer specific
       
    33  *  parameters. Class implements container for one timer information in
       
    34  *  FlexTimerServer.
       
    35  */
       
    36 class CFlexTimerItem : public CBase
       
    37     {
       
    38 public:
       
    39 
       
    40     /** Constructor
       
    41      *
       
    42      * Constructs new timer item that contains all information needed to
       
    43      * decide when to launch timer.
       
    44      *
       
    45      * @param aAbsoluteMinTime Left side of the timer launch window.
       
    46      * @param aAbsoluteMaxTime Right side of the timer launch window.
       
    47      * @param aCancelAtSystemTimeChange Whether system time change should
       
    48      * trigger abort.
       
    49      * @param aFlexTimerServiceCB Call back interface. Used to inform about
       
    50      * timeout, abort etc.
       
    51      * @return New CFlexTimer object.
       
    52      */
       
    53     static CFlexTimerItem* NewL( const TTime& aAbsoluteMinTime,
       
    54         const TTime& aAbsoluteMaxTime,
       
    55         TBool aCancelAtSystemTimeChange,
       
    56         const MFlexTimerServiceCB* aFlexTimerServiceCB );
       
    57 
       
    58     /** Destructor
       
    59      * Destructs timer item.
       
    60      */
       
    61     virtual ~CFlexTimerItem();
       
    62 
       
    63 public:
       
    64     /**
       
    65      * Gets the earliest possible moment when this timer can expire. 
       
    66      * Places value to reference parameter. 
       
    67      *
       
    68      * @param aMinAbsoluteTime After function returns this parameter contains
       
    69      * absolute earliest moment when this timer can expire         
       
    70      */
       
    71     inline void GetMinAbsoluteTime( TTime& aMinAbsoluteTime );
       
    72 
       
    73     /**
       
    74      * Gets the latest possible moment when this timer must expire. 
       
    75      * Places value to reference parameter. 
       
    76      *
       
    77      * @param aMaxAbsoluteTime After function returns this parameter contains
       
    78      * absolute latest moment when this timer must expire       
       
    79      */
       
    80     inline void GetMaxAbsoluteTime( TTime& aMaxAbsoluteTime );
       
    81 
       
    82     /**
       
    83      * Checks whether this timer should be aborted if system time changes
       
    84      *
       
    85      * @return 
       
    86      * ETrue - If timer should be aborted when system time changes
       
    87      * EFalse - If timer should not be cancelled when system time changes        
       
    88      */
       
    89     inline TBool IsAbortedAtSystemTimeChange();
       
    90 
       
    91     /**
       
    92      * Returns timers corresponding CB session pointer.
       
    93      *
       
    94      * @return pointer to session that initiated this timer       
       
    95      */
       
    96     const MFlexTimerServiceCB* GetCB();
       
    97 
       
    98 private:
       
    99     /**
       
   100      * Private contructor. Constructs new timer item that contains all
       
   101      * information needed to decide when to launch timer.
       
   102      *
       
   103      * @param aAbsoluteMinTime Left side of the timer launch window.
       
   104      * @param aAbsoluteMaxTime Right side of the timer launch window.
       
   105      * @param aCancelAtSystemTimeChange Whether system time change should
       
   106      * trigger abort.
       
   107      * @param aFlexTimerServiceCB Call back interface. Used to inform about
       
   108      * timeout, abort etc.
       
   109      *
       
   110      * @return New CFlexTimer object.
       
   111      * 
       
   112      */
       
   113     CFlexTimerItem( const TTime& aAbsoluteMinTime,
       
   114         const TTime& aAbsoluteMaxTime,
       
   115         TBool aCancelAtSystemTimeChange,
       
   116         const MFlexTimerServiceCB* aFlexTimerServiceCB );
       
   117 
       
   118 public:
       
   119     //Data
       
   120     /**
       
   121      * Single linked list link object for timers lists
       
   122      */
       
   123     TSglQueLink iLink;
       
   124 
       
   125 private:
       
   126     // Data
       
   127     /**
       
   128      * Whether timer should be aborted when system time changes.
       
   129      */
       
   130     TBool iAbortAtSystemTimeChange;
       
   131 
       
   132     /**
       
   133      * Left side of the time window when timer can be fired
       
   134      */
       
   135     TTime iAbsoluteMinTime;
       
   136 
       
   137     /**
       
   138      * Right side of the time window when timer can be fired
       
   139      */
       
   140     TTime iAbsoluteMaxTime;
       
   141 
       
   142     /**
       
   143      * pointer to the session interface that is used to inform timeout
       
   144      */
       
   145     const MFlexTimerServiceCB* iMFlexTimerServiceCB;
       
   146     };
       
   147 
       
   148 #include "flextimeritem.inl"
       
   149 
       
   150 #endif  //FLEXTIMERITEM_H