mmserv/tms/tmscallserver/src/delaytimer.cpp
branchRCL_3
changeset 17 3570217d8c21
parent 13 f5c5c82a163e
child 18 2eb3b066cc7d
equal deleted inserted replaced
13:f5c5c82a163e 17:3570217d8c21
     1 /*
       
     2  * Copyright (c) 2009 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: Telephony Multimedia Service
       
    15  *
       
    16  */
       
    17 
       
    18 // INCLUDE FILES
       
    19 #include "delaytimer.h"
       
    20 #include "tmsutility.h"
       
    21 
       
    22 using namespace TMS;
       
    23 
       
    24 // -----------------------------------------------------------------------------
       
    25 // TMSCallDelayTimer::NewL
       
    26 // Two-phased constructor.
       
    27 // -----------------------------------------------------------------------------
       
    28 //
       
    29 TMSCallDelayTimer* TMSCallDelayTimer::NewL()
       
    30     {
       
    31     TRACE_PRN_FN_ENT;
       
    32     TMSCallDelayTimer* self = new (ELeave) TMSCallDelayTimer;
       
    33     CleanupStack::PushL(self);
       
    34     self->ConstructL();
       
    35     CleanupStack::Pop(self);
       
    36     TRACE_PRN_FN_EXT;
       
    37     return self;
       
    38     }
       
    39 
       
    40 // -----------------------------------------------------------------------------
       
    41 // TMSCallDelayTimer::TMSCallDelayTimer()
       
    42 // C++ constructor.
       
    43 // (other items were commented in a header).
       
    44 // -----------------------------------------------------------------------------
       
    45 //
       
    46 TMSCallDelayTimer::TMSCallDelayTimer() :
       
    47     CActive(CActive::EPriorityStandard)
       
    48     {
       
    49     TRACE_PRN_FN_ENT;
       
    50     CActiveScheduler::Add(this);
       
    51     TRACE_PRN_FN_EXT;
       
    52     }
       
    53 
       
    54 // -----------------------------------------------------------------------------
       
    55 // TMSCallDelayTimer::ConstructL
       
    56 // Symbian 2nd phase constructor can leave.
       
    57 // -----------------------------------------------------------------------------
       
    58 //
       
    59 void TMSCallDelayTimer::ConstructL()
       
    60     {
       
    61     TRACE_PRN_FN_ENT;
       
    62     User::LeaveIfError(iShutDownTimer.CreateLocal());
       
    63     TRACE_PRN_FN_EXT;
       
    64     }
       
    65 
       
    66 // -----------------------------------------------------------------------------
       
    67 // TMSCallDelayTimer::~TMSCallDelayTimer
       
    68 // Destructor
       
    69 // -----------------------------------------------------------------------------
       
    70 //
       
    71 TMSCallDelayTimer::~TMSCallDelayTimer()
       
    72     {
       
    73     TRACE_PRN_FN_ENT;
       
    74     Cancel();
       
    75     iShutDownTimer.Close();
       
    76     TRACE_PRN_FN_EXT;
       
    77     }
       
    78 
       
    79 // -----------------------------------------------------------------------------
       
    80 // TMSCallDelayTimer::SetDelay
       
    81 // Request a timeout after aDelay
       
    82 // (other items were commented in a header).
       
    83 // -----------------------------------------------------------------------------
       
    84 //
       
    85 void TMSCallDelayTimer::SetDelay(TTimeIntervalMicroSeconds32 aDelay)
       
    86     {
       
    87     TRACE_PRN_FN_ENT;
       
    88     if (!IsActive())
       
    89         {
       
    90         iStatus = KRequestPending;
       
    91         SetActive();
       
    92         iShutDownTimer.After(iStatus, aDelay);
       
    93         }
       
    94     TRACE_PRN_FN_EXT;
       
    95     }
       
    96 
       
    97 // -----------------------------------------------------------------------------
       
    98 // TMSCallDelayTimer::RunL
       
    99 // Called by Active object framework when timer times out.
       
   100 // (other items were commented in a header).
       
   101 // -----------------------------------------------------------------------------
       
   102 //
       
   103 void TMSCallDelayTimer::RunL()
       
   104     {
       
   105     TRACE_PRN_FN_ENT;
       
   106     CActiveScheduler::Stop();
       
   107     TRACE_PRN_FN_EXT;
       
   108     }
       
   109 
       
   110 // -----------------------------------------------------------------------------
       
   111 // TMSCallDelayTimer::DoCancel
       
   112 // Called by the Active object framework when user cancels active object.
       
   113 // (other items were commented in a header).
       
   114 // -----------------------------------------------------------------------------
       
   115 //
       
   116 void TMSCallDelayTimer::DoCancel()
       
   117     {
       
   118     TRACE_PRN_FN_ENT;
       
   119     iShutDownTimer.Cancel();
       
   120     TRACE_PRN_FN_EXT;
       
   121     }
       
   122 
       
   123 //  End of File