natfw/natfwturnplugin/inc/natfwturnactivedestinationtimer.h
changeset 0 1bce908db942
equal deleted inserted replaced
-1:000000000000 0:1bce908db942
       
     1 /*
       
     2 * Copyright (c) 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:    Is used to time actions related to setting Active
       
    15 *                Destination request.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 #ifndef C_NATFWTURNACTIVEDESTINATIONHTIMER_H
       
    23 #define C_NATFWTURNACTIVEDESTINATIONHTIMER_H
       
    24 
       
    25 #include <e32base.h>
       
    26 
       
    27 class MNATFWTimerObserver;
       
    28 
       
    29 /**
       
    30  *  Active Destination Timer class for TURN plug-in.
       
    31  *
       
    32  *  Triggers actions required with setting Active Destination request.
       
    33  *  Gets interval in microseconds from CNATFWTurnConnectionHandler.
       
    34  *
       
    35  *  @lib turnplugin.lib
       
    36  *  @since S60 v3.2
       
    37  */
       
    38 class CNATFWTurnActiveDestinationTimer : public CActive
       
    39     {
       
    40 
       
    41 public:
       
    42 
       
    43     /**
       
    44      * Creates a new instance of NAT FW TURN Active Destination Timer.
       
    45      *
       
    46      * @since S60 v3.2
       
    47      * @param aObserver Observer for callbacks to timer's user
       
    48      * @return A new instance, ownership is transferred.
       
    49      */
       
    50     static CNATFWTurnActiveDestinationTimer* NewL(
       
    51         MNATFWTimerObserver& aObserver );
       
    52         
       
    53     /**
       
    54      * Creates a new instance of NAT FW TURN Active Destination Timer
       
    55      * pushes it to CleanupStack.
       
    56      *
       
    57      * @since S60 v3.2
       
    58      * @param aObserver Observer for callbacks to timer's user
       
    59      * @return A new instance, ownership is transferred.
       
    60      */
       
    61     static CNATFWTurnActiveDestinationTimer* NewLC(
       
    62         MNATFWTimerObserver& aObserver );
       
    63 
       
    64     ~CNATFWTurnActiveDestinationTimer();
       
    65 
       
    66     /**
       
    67      * Waits for given time (aInterval) and calls SetActive().
       
    68      * If interval is 0, timer is cancelled.
       
    69      *
       
    70      * @since S60 v3.2
       
    71      * @param  aInterval        Interval in microseconds
       
    72      * @param  aStreamId        To identify the binding that the
       
    73      *                          timer triggering is related to
       
    74      * @param  aConnectionId    To identify the binding that the
       
    75      *                          timer triggering is related to
       
    76      */
       
    77     void StartTimer( TUint32 aInterval, TUint aStreamId,
       
    78         TUint aConnectionId );
       
    79 
       
    80 protected:
       
    81 
       
    82     /**
       
    83      * from CActive
       
    84      */
       
    85     void RunL();
       
    86     
       
    87     /**
       
    88      * from CActive
       
    89      */
       
    90     void DoCancel();
       
    91 
       
    92 private:
       
    93 
       
    94     CNATFWTurnActiveDestinationTimer( MNATFWTimerObserver& aObserver );
       
    95 
       
    96     void ConstructL();
       
    97 
       
    98 private: // data
       
    99 
       
   100     /**
       
   101      * Asynchronous timer service.
       
   102      */
       
   103     RTimer iTimer;
       
   104 
       
   105     /**
       
   106      * MNATFWTimerObserver reference.
       
   107      */
       
   108     MNATFWTimerObserver& iObserver;
       
   109 
       
   110     /**
       
   111      * Stream ID.
       
   112      */
       
   113     TUint iStreamId;
       
   114 
       
   115     /**
       
   116      * Connection ID.
       
   117      */
       
   118     TUint iConnectionId;
       
   119 
       
   120     };
       
   121 
       
   122 #endif // C_NATFWTURNACTIVEDESTINATIONHTIMER_H