phoneapp/phoneuicontrol/src/cphonedtmfwaitchartimer.cpp
changeset 37 ba76fc04e6c2
child 51 f39ed5e045e0
equal deleted inserted replaced
36:2eacb6118286 37:ba76fc04e6c2
       
     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: CPhoneDtmfWaitCharTimer implementation.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include "cphonedtmfwaitchartimer.h"
       
    21 #include "phoneconstants.h"
       
    22 #include "phonelogger.h"
       
    23 #include "cphonestatehandle.h"
       
    24 
       
    25 // ================= MEMBER FUNCTIONS =======================
       
    26 
       
    27 // -----------------------------------------------------------------------------
       
    28 // CPhoneDtmfWaitCharTimer::CPhoneDtmfWaitCharTimer
       
    29 // C++ default constructor can NOT contain any code, that
       
    30 // might leave.
       
    31 // -----------------------------------------------------------------------------
       
    32 //
       
    33 CPhoneDtmfWaitCharTimer::CPhoneDtmfWaitCharTimer( MPhoneStateMachine* aStateMachine ) :
       
    34     iTimer( NULL ),
       
    35     iStateMachine( aStateMachine )
       
    36     {
       
    37         
       
    38     }
       
    39 
       
    40 // Destructor
       
    41 CPhoneDtmfWaitCharTimer::~CPhoneDtmfWaitCharTimer()
       
    42     {
       
    43     if( iTimer )
       
    44         {
       
    45         if( iTimer->IsActive() )
       
    46             {
       
    47             iTimer->CancelTimer();              
       
    48             }
       
    49         }
       
    50         delete iTimer;
       
    51     }
       
    52 
       
    53 // -----------------------------------------------------------
       
    54 // CPhoneDtmfWaitCharTimer::NewL()
       
    55 // Two-phased constructor
       
    56 // (other items were commented in a header).
       
    57 // -----------------------------------------------------------
       
    58 //
       
    59 CPhoneDtmfWaitCharTimer* CPhoneDtmfWaitCharTimer::NewL( 
       
    60     MPhoneStateMachine* aStateMachine )
       
    61     {
       
    62     CPhoneDtmfWaitCharTimer* self = 
       
    63         new( ELeave ) CPhoneDtmfWaitCharTimer( aStateMachine );
       
    64     
       
    65     CleanupStack::PushL( self );
       
    66     self->ConstructL();
       
    67     CleanupStack::Pop( self );
       
    68     
       
    69     return self;
       
    70     }
       
    71 
       
    72 // ---------------------------------------------------------
       
    73 // CPhoneDtmfWaitCharTimer::ConstructL()
       
    74 // EPOC default constructor can leave.
       
    75 // (other items were commented in a header).
       
    76 // ---------------------------------------------------------
       
    77 //
       
    78 void CPhoneDtmfWaitCharTimer::ConstructL()
       
    79     {
       
    80     }
       
    81 
       
    82 // ---------------------------------------------------------
       
    83 // CPhoneNoteTimer::HandleTimeOutL
       
    84 // ---------------------------------------------------------
       
    85 //
       
    86 void CPhoneDtmfWaitCharTimer::HandleTimeOutL()
       
    87     {
       
    88     __LOGMETHODSTARTEND( EPhoneControl, 
       
    89         "CPhoneDtmfWaitCharTimer::HandleTimeOutL( ) ");
       
    90     
       
    91     iStateMachine->SendPhoneEngineMessage( 
       
    92         MPEPhoneModel::EPEMessageContinueDTMFSending );
       
    93     }
       
    94 
       
    95 // ---------------------------------------------------------
       
    96 // CPhoneDtmfWaitCharTimer::ButtonPressedL
       
    97 // ---------------------------------------------------------
       
    98 //
       
    99 void CPhoneDtmfWaitCharTimer::ButtonPressedL()
       
   100     {
       
   101     if( !iTimer )
       
   102         {
       
   103         iTimer = CPhoneTimer::NewL();           
       
   104         }
       
   105     else
       
   106         {
       
   107         if( iTimer->IsActive() )
       
   108             {
       
   109             iTimer->CancelTimer();              
       
   110             }
       
   111         }   
       
   112     
       
   113     iTimer->After( KDtmfWaitNoteTimeoutValue, this );   
       
   114     }
       
   115 
       
   116 // End of File