mmsharing/mmshmanagersrv/src/musmanagerserverclosetimer.cpp
changeset 22 496ad160a278
parent 0 f0cf47e981f9
child 21 ce86b6d44a6d
equal deleted inserted replaced
15:ccd8e69b5392 22:496ad160a278
       
     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:  ?Description
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDES
       
    20 #include "musmanagerserverclosetimer.h"
       
    21 
       
    22 const TUint KMicroSecondsInMilliSecond = 1000; 
       
    23 
       
    24 // ----------------------------------------------------------------------------
       
    25 // CMusManagerServerCloseTimer::NewL
       
    26 // ----------------------------------------------------------------------------
       
    27 //
       
    28 CMusManagerServerCloseTimer* CMusManagerServerCloseTimer::NewL()
       
    29     {
       
    30     CMusManagerServerCloseTimer* self = CMusManagerServerCloseTimer::NewLC ();
       
    31     CleanupStack::Pop (self);
       
    32     return self;
       
    33     }
       
    34 
       
    35 // ----------------------------------------------------------------------------
       
    36 // CMusManagerServerCloseTimer::NewLC
       
    37 // ----------------------------------------------------------------------------
       
    38 //
       
    39 CMusManagerServerCloseTimer* CMusManagerServerCloseTimer::NewLC ()
       
    40     {
       
    41     CMusManagerServerCloseTimer* self = new(ELeave)CMusManagerServerCloseTimer;
       
    42     CleanupStack::PushL (self);
       
    43     self->ConstructL ();
       
    44     return self;
       
    45     }
       
    46     
       
    47 // ----------------------------------------------------------------------------
       
    48 // CMusManagerServerCloseTimer::ConstructL
       
    49 // ----------------------------------------------------------------------------
       
    50 //
       
    51 void CMusManagerServerCloseTimer::ConstructL ()
       
    52     {
       
    53 	User::LeaveIfError (iTimer.CreateLocal());
       
    54     }
       
    55     
       
    56     
       
    57 // ----------------------------------------------------------------------------
       
    58 // CMusManagerServerCloseTimer::ConstructL
       
    59 // ----------------------------------------------------------------------------
       
    60 //
       
    61 CMusManagerServerCloseTimer::CMusManagerServerCloseTimer ()
       
    62 : CActive(EPriorityStandard)
       
    63     {
       
    64 	CActiveScheduler::Add(this);
       
    65     }
       
    66 
       
    67 
       
    68 // ----------------------------------------------------------------------------
       
    69 // CMusManagerServerCloseTimer::~CMusManagerServerCloseTimer
       
    70 // ----------------------------------------------------------------------------
       
    71 //
       
    72 CMusManagerServerCloseTimer::~CMusManagerServerCloseTimer ()
       
    73     {
       
    74 	CActive::Cancel();
       
    75 	iTimer.Close();
       
    76     }
       
    77     
       
    78 // ----------------------------------------------------------------------------
       
    79 // CMusManagerServerCloseTimer::StopActiveSchedulerAfter
       
    80 // ----------------------------------------------------------------------------
       
    81 //
       
    82 void CMusManagerServerCloseTimer::StopActiveSchedulerAfter (TUint aMilliSeconds)
       
    83     {
       
    84     TTimeIntervalMicroSeconds32 time( 
       
    85         KMicroSecondsInMilliSecond 
       
    86         * aMilliSeconds );
       
    87         
       
    88     if (!IsActive())
       
    89         {
       
    90         iTimer.After(iStatus,time);
       
    91         SetActive ();
       
    92         }
       
    93     }
       
    94 
       
    95 // ----------------------------------------------------------------------------
       
    96 // CMusManagerServerCloseTimer::RunL
       
    97 // ----------------------------------------------------------------------------
       
    98 //
       
    99 void CMusManagerServerCloseTimer::RunL ()
       
   100     {
       
   101 	CActiveScheduler::Stop();
       
   102     }
       
   103 
       
   104 // ----------------------------------------------------------------------------
       
   105 // CMusManagerServerCloseTimer::DoCancel
       
   106 // ----------------------------------------------------------------------------
       
   107 //	
       
   108 void CMusManagerServerCloseTimer::DoCancel ()
       
   109     {
       
   110 	iTimer.Cancel();
       
   111     }
       
   112 
       
   113 //  End of File  
       
   114