connectivitymodules/SeCon/services/pcd/src/cscontimeout.cpp
branchRCL_3
changeset 20 4a793f564d72
parent 0 d0791faffa3f
equal deleted inserted replaced
19:0aa8cc770c8a 20:4a793f564d72
       
     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:  CSconTimeOut implementation
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "cscontimeout.h"
       
    20 
       
    21 CSconTimeOut::CSconTimeOut( MTimeOutObserver& aTimeOutObserver ) :
       
    22     CActive(EPriorityStandard), // Standard priority
       
    23     iTimeOutObserver(aTimeOutObserver)
       
    24     {
       
    25     }
       
    26 
       
    27 
       
    28 CSconTimeOut* CSconTimeOut::NewL( MTimeOutObserver& aTimeOutObserver )
       
    29     {
       
    30     CSconTimeOut* self = new (ELeave) CSconTimeOut( aTimeOutObserver );
       
    31     CleanupStack::PushL( self );
       
    32     self->ConstructL();
       
    33     CleanupStack::Pop( self );
       
    34     return self;
       
    35     }
       
    36 
       
    37 void CSconTimeOut::ConstructL()
       
    38     {
       
    39     User::LeaveIfError(iTimer.CreateLocal()); // Initialize timer
       
    40     CActiveScheduler::Add(this); // Add to scheduler
       
    41     }
       
    42 
       
    43 CSconTimeOut::~CSconTimeOut()
       
    44     {
       
    45     Cancel(); // Cancel any request, if outstanding
       
    46     iTimer.Close(); // Destroy the RTimer object
       
    47     }
       
    48 
       
    49 void CSconTimeOut::DoCancel()
       
    50     {
       
    51     iTimer.Cancel();
       
    52     }
       
    53 
       
    54 void CSconTimeOut::Start(TTimeIntervalMicroSeconds32 aDelay)
       
    55     {
       
    56     Cancel(); // Cancel any request, just to be sure
       
    57     iTimer.After(iStatus, aDelay); // Set for later
       
    58     SetActive(); // Tell scheduler a request is active
       
    59     }
       
    60 
       
    61 void CSconTimeOut::RunL()
       
    62     {
       
    63     iTimeOutObserver.TimeOut();
       
    64     }
       
    65 
       
    66 TInt CSconTimeOut::RunError(TInt aError)
       
    67     {
       
    68     return aError;
       
    69     }