simpleengine/siputils/inc/simplerefreshtimer.h
changeset 0 c8caa15ef882
equal deleted inserted replaced
-1:000000000000 0:c8caa15ef882
       
     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:    Refreshtimer.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #ifndef CSimpleRefreshTimer_H
       
    22 #define CSimpleRefreshTimer_H
       
    23 
       
    24 // INLUCDES
       
    25 #include <e32base.h>
       
    26 #include <e32std.h>
       
    27 
       
    28 // FORWARD DECLARATIONS
       
    29 class RTimer;
       
    30 class MSimpleSipConnCallback;
       
    31 class CSimpleRequest;
       
    32 
       
    33 /**
       
    34  *  Refresh timer
       
    35  *
       
    36  *  Triggers SIP PUBLISH requests before they expire.
       
    37  *
       
    38  *  @lib siputils
       
    39  *  @since S60 3.2
       
    40  */
       
    41 class CSimpleRefreshTimer : public CActive
       
    42     {
       
    43 
       
    44 //  friend classes go here:
       
    45 
       
    46 public:
       
    47 
       
    48 
       
    49     CSimpleRefreshTimer(
       
    50         MSimpleSipConnCallback& aEngine, CSimpleRequest& aReq );
       
    51 
       
    52     virtual ~CSimpleRefreshTimer();
       
    53 
       
    54     /**
       
    55      * Start timer.
       
    56      *
       
    57      * @since S60 3.2
       
    58      * @param aSec seconds
       
    59      */
       
    60     void Start( TInt aSec );
       
    61 
       
    62 protected:
       
    63 
       
    64 // from base class CActive
       
    65 
       
    66     /**
       
    67      * From CActive.
       
    68      * Implements cancellation of an outstanding request.
       
    69      *
       
    70      * @since S60 3.2
       
    71      */
       
    72     void DoCancel( );
       
    73 
       
    74     /**
       
    75      * From CActive.
       
    76      * Handles an active object's request completion event.
       
    77      *
       
    78      * @since S60 3.2
       
    79      */
       
    80     void RunL( );
       
    81 
       
    82     /**
       
    83      * From CActive.
       
    84      * Error routine for RunL exceptions
       
    85      *
       
    86      * @since S60 3.2
       
    87      * @param aError error code
       
    88      */
       
    89     TInt RunError(TInt aError);
       
    90 
       
    91 
       
    92 private: // data
       
    93 
       
    94     /**
       
    95      * The actual timer
       
    96      */
       
    97     RTimer                  iTimer;
       
    98     
       
    99     /**
       
   100      * Seconds to wait
       
   101      */     
       
   102     TInt                    iSeconds;
       
   103     
       
   104     /**
       
   105      * Engine core
       
   106      */
       
   107     MSimpleSipConnCallback& iEngine;
       
   108     
       
   109     /**
       
   110      * The corresponding client request
       
   111      */
       
   112     CSimpleRequest&         iRequest;
       
   113 
       
   114 #ifdef _DEBUG
       
   115     friend class T_CSimpleRefreshTimer;
       
   116 #endif
       
   117     };
       
   118     
       
   119 /**
       
   120  *  Expiry timer
       
   121  *
       
   122  *  Triggers requests after they expire.
       
   123  *
       
   124  *  @lib ?siputils
       
   125  *  @since S60 v3.2
       
   126  */
       
   127 class CSimpleExpiryTimer : public CActive
       
   128     {
       
   129 
       
   130 //  friend classes go here:
       
   131 
       
   132 public:
       
   133 
       
   134     CSimpleExpiryTimer(
       
   135         MSimpleSipConnCallback& aEngine, CSimpleRequest& aReq );
       
   136 
       
   137     virtual ~CSimpleExpiryTimer();
       
   138 
       
   139     /**
       
   140      * Start timer.
       
   141      *
       
   142      * @since S60 3.2
       
   143      * @param aSec seconds
       
   144      */
       
   145     void Start( TInt aSec );
       
   146 
       
   147 protected:
       
   148 
       
   149 // from base class CActive
       
   150 
       
   151     /**
       
   152      * From CActive.
       
   153      * Implements cancellation of an outstanding request.
       
   154      *
       
   155      * @since S60 3.2
       
   156      */
       
   157     void DoCancel( );
       
   158 
       
   159     /**
       
   160      * From CActive.
       
   161      * Handles an active object's request completion event.
       
   162      *
       
   163      * @since S60 3.2
       
   164      */
       
   165     void RunL( );
       
   166 
       
   167     /**
       
   168      * From CActive.
       
   169      * Error routine for RunL exceptions
       
   170      *
       
   171      * @since S60 3.2
       
   172      * @param aError error code
       
   173      */
       
   174     TInt RunError(TInt aError);
       
   175 
       
   176 private: // data
       
   177 
       
   178     /**
       
   179      * The actual timer
       
   180      */
       
   181     RTimer                  iTimer;
       
   182     
       
   183     /**
       
   184      * Seconds to wait
       
   185      */     
       
   186     TInt                    iSeconds;
       
   187     
       
   188     /**
       
   189      * Engine core
       
   190      */
       
   191     MSimpleSipConnCallback& iEngine;
       
   192     
       
   193     /**
       
   194      * The corresponding client request
       
   195      */
       
   196     CSimpleRequest&         iRequest;
       
   197 
       
   198 #ifdef _DEBUG
       
   199     friend class T_CSimpleRefreshTimer;
       
   200 #endif
       
   201     };    
       
   202 
       
   203 #endif