coreapplicationuis/Rfs/src/rfscontimer.cpp
branchRCL_3
changeset 18 0818dd463d41
child 19 924385140d98
equal deleted inserted replaced
17:5e7d68cc22e0 18:0818dd463d41
       
     1 /*
       
     2 * Copyright (c) 2005-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 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *		Implements CRFsScript class which controls the parsing of the Rfs scripts
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #include "rfsConTimer.h"
       
    21 #include "RfsTraces.h"
       
    22 
       
    23 const TInt KRfsConnectionTimeOut = 60000000;
       
    24 
       
    25 CRfsConTimer :: CRfsConTimer(CRfsConnectionObserver * aRfsConnectionObserver):CActive( EPriorityStandard )
       
    26     {
       
    27     iRfsConnectionObserver = aRfsConnectionObserver;
       
    28     iTimer.CreateLocal();
       
    29 	CActiveScheduler::Add( this );
       
    30     }
       
    31 
       
    32 CRfsConTimer :: ~CRfsConTimer()
       
    33     {
       
    34     TRACES("CRfsConTimer :: ~CRfsConTimer()");
       
    35     
       
    36     iRfsConnectionObserver = NULL;
       
    37     Cancel();        
       
    38     iTimer.Close();        
       
    39     }
       
    40 
       
    41 CRfsConTimer*  CRfsConTimer::NewL(CRfsConnectionObserver * aRfsConnectionObserver)
       
    42     {
       
    43     TRACES("CRfsConTimer :: NewL()");
       
    44     
       
    45     CRfsConTimer* self = new (ELeave) CRfsConTimer(aRfsConnectionObserver );
       
    46     return self;
       
    47     }
       
    48 
       
    49 void CRfsConTimer :: IssueTimerRequest()
       
    50     {
       
    51     TRACES("CRfsConTimer :: IssueTimerRequest()");
       
    52     
       
    53     if(!IsActive())
       
    54         {
       
    55         iTimer.After(iStatus, KRfsConnectionTimeOut);
       
    56         SetActive();
       
    57         }
       
    58     }
       
    59 void CRfsConTimer :: RunL()
       
    60     {
       
    61     TRACES("CRfsConTimer :: RunL()");
       
    62 	
       
    63     if(iRfsConnectionObserver->iState == ESipConnectionClose  && iRfsConnectionObserver->iIsPDPFeatureEnabled)
       
    64         {
       
    65         // If SIP doesn't respond with in the set time, RunL will be called,
       
    66         // Rfs cancels the outstanding SIP request and If PDP connection exists,
       
    67         // Rfs will inform the PDP and start the timer.
       
    68     
       
    69         iRfsConnectionObserver->Cancel();            
       
    70         iRfsConnectionObserver->iState = EPdpConnectionClose;
       
    71         iRfsConnectionObserver->Subscribe();
       
    72         iTimer.After(iStatus, KRfsConnectionTimeOut);    
       
    73         SetActive();
       
    74         }
       
    75     else
       
    76         {
       
    77         iRfsConnectionObserver->Cancel();
       
    78         }        
       
    79     }
       
    80 
       
    81 void CRfsConTimer :: DoCancel()
       
    82     {
       
    83     TRACES("CRfsConTimer :: DoCancel()");
       
    84     
       
    85     if(IsActive())
       
    86         {
       
    87         iTimer.Cancel();
       
    88         }
       
    89     }