syncmlfw/common/obex/obexcommserver/src/NSmlTimeOut.cpp
changeset 0 b497e44ab2fc
equal deleted inserted replaced
-1:000000000000 0:b497e44ab2fc
       
     1 /*
       
     2 * Copyright (c) 2002-2004 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:  SyncML Obex server internal server module
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include <nsmldebug.h>
       
    21 #include "nsmlobexcommserver.h"
       
    22 
       
    23 
       
    24 // ============================ MEMBER FUNCTIONS ===============================
       
    25 
       
    26 // -----------------------------------------------------------------------------
       
    27 // CNSmlTimeOut* CNSmlTimeOut::NewL
       
    28 // Two-phased constructor.
       
    29 // -----------------------------------------------------------------------------
       
    30 //
       
    31 CNSmlTimeOut* CNSmlTimeOut::NewL()
       
    32 	{
       
    33 	_DBG_FILE("CNSmlTimeOut::NewL(): begin");
       
    34 	CNSmlTimeOut* self = new (ELeave) CNSmlTimeOut();
       
    35 	CleanupStack::PushL(self);
       
    36 	User::LeaveIfError(self->iTimer.CreateLocal());
       
    37 	CleanupStack::Pop(); // self
       
    38 	_DBG_FILE("CNSmlTimeOut::NewL(): end");
       
    39 	return self;
       
    40 	}
       
    41 
       
    42 // -----------------------------------------------------------------------------
       
    43 // CNSmlTimeOut::CNSmlTimeOut
       
    44 // C++ default constructor.
       
    45 // -----------------------------------------------------------------------------
       
    46 //
       
    47 CNSmlTimeOut::CNSmlTimeOut() : CActive(EPriorityStandard)
       
    48 	{
       
    49 	_DBG_FILE("CNSmlTimeOut::CNSmlTimeOut(): begin");
       
    50 	CActiveScheduler::Add(this);
       
    51 	_DBG_FILE("CNSmlTimeOut::CNSmlTimeOut(): end");
       
    52 	}
       
    53 
       
    54 // -----------------------------------------------------------------------------
       
    55 // CNSmlTimeOut::~CNSmlTimeOut
       
    56 // Destructor.
       
    57 // -----------------------------------------------------------------------------
       
    58 //
       
    59 CNSmlTimeOut::~CNSmlTimeOut()
       
    60 	{
       
    61 	_DBG_FILE("CNSmlTimeOut::~CNSmlTimeOut(): begin");
       
    62 	Cancel();
       
    63 	_DBG_FILE("CNSmlTimeOut::~CNSmlTimeOut(): end");
       
    64 	}
       
    65 
       
    66 // -----------------------------------------------------------------------------
       
    67 // CNSmlTimeOut::RunL
       
    68 // -----------------------------------------------------------------------------
       
    69 //
       
    70 void CNSmlTimeOut::RunL()
       
    71 	{
       
    72 	_DBG_FILE("CNSmlTimeOut::RunL(): begin");
       
    73 	if( iStatus.Int() == KErrNone )
       
    74 		{
       
    75 		(iThis->*iCallback)();
       
    76 		}
       
    77 	_DBG_FILE("CNSmlTimeOut::RunL(): end");
       
    78 	}
       
    79 
       
    80 // -----------------------------------------------------------------------------
       
    81 // CNSmlTimeOut::DoCancel
       
    82 // -----------------------------------------------------------------------------
       
    83 //
       
    84 void CNSmlTimeOut::DoCancel()
       
    85 	{
       
    86 	_DBG_FILE("CNSmlTimeOut::DoCancel(): begin");
       
    87 	iTimer.Cancel();
       
    88 	_DBG_FILE("CNSmlTimeOut::DoCancel(): end");
       
    89 	}
       
    90 
       
    91 // -----------------------------------------------------------------------------
       
    92 // CNSmlTimeOut::StartTimeoutHandling
       
    93 // -----------------------------------------------------------------------------
       
    94 //
       
    95 void CNSmlTimeOut::StartTimeoutHandling( CNSmlObexCommSession* aThis, TNSmlTimeoutCallback aCallback )
       
    96 	{
       
    97 	_DBG_FILE("CNSmlTimeOut::StartTimeoutHandling(): begin");
       
    98 	iThis = aThis;
       
    99 	iCallback = aCallback;
       
   100 	if ( !IsActive() )
       
   101 	    {
       
   102     	iTimer.After(iStatus, KTimeOutInSeconds*1000000);
       
   103 	    SetActive();
       
   104 	    }
       
   105 	_DBG_FILE("CNSmlTimeOut::StartTimeoutHandling(): end");
       
   106 	}