camerauis/cameraapp/generic/src/CamTimer.cpp
branchRCL_3
changeset 54 bac7acad7cb3
parent 0 1ddebce53859
child 62 f0c0788c4de2
equal deleted inserted replaced
53:61bc0f252b2b 54:bac7acad7cb3
       
     1 /*
       
     2 * Copyright (c) 2007 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:  Active object for implementing viewfinder timeout and*
       
    15 */
       
    16 
       
    17 
       
    18 // INCLUDE FILES
       
    19 #include <e32std.h>
       
    20 #include "camlogging.h"
       
    21 #include "CamTimer.h"
       
    22 
       
    23 // ================= MEMBER FUNCTIONS =======================
       
    24 
       
    25 // ---------------------------------------------------------------------------
       
    26 // CCamTimer::NewL
       
    27 // Symbian OS two-phased constructor
       
    28 // ---------------------------------------------------------------------------
       
    29 //
       
    30 CCamTimer* CCamTimer::NewL( TInt aTimeout, TCallBack aCallBack )
       
    31     {
       
    32     CCamTimer* self = NewLC( aTimeout, aCallBack );
       
    33     CleanupStack::Pop( self );
       
    34     return self;
       
    35     }
       
    36 
       
    37 // ---------------------------------------------------------------------------
       
    38 // CCamTimer::NewLC
       
    39 // Symbian OS two-phased constructor
       
    40 // ---------------------------------------------------------------------------
       
    41 //
       
    42 CCamTimer* CCamTimer::NewLC( TInt aTimeout, TCallBack aCallBack )
       
    43     {
       
    44     CCamTimer* self = new ( ELeave ) CCamTimer( aTimeout, aCallBack );
       
    45     CleanupStack::PushL( self );
       
    46     self->ConstructL();
       
    47     return self;
       
    48     }
       
    49 
       
    50 // Destructor
       
    51 CCamTimer::~CCamTimer()
       
    52   {
       
    53   PRINT( _L("Camera => ~CCamTimer" ))  
       
    54   Cancel();
       
    55   PRINT( _L("Camera <= ~CCamTimer" ))  
       
    56   }
       
    57 
       
    58 // ---------------------------------------------------------------------------
       
    59 // CCamTimer::StartTimer
       
    60 // Start timer.
       
    61 // ---------------------------------------------------------------------------
       
    62 //
       
    63 void CCamTimer::StartTimer()
       
    64     {
       
    65     After( iTimeout );
       
    66     }
       
    67     
       
    68 // ---------------------------------------------------------------------------
       
    69 // CCamTimer::SetTimeout
       
    70 // Update the timeout period
       
    71 // ---------------------------------------------------------------------------
       
    72 // 
       
    73 void CCamTimer::SetTimeout( TInt aTimeout )
       
    74     {
       
    75     iTimeout = aTimeout;
       
    76     }   
       
    77 
       
    78 // ---------------------------------------------------------------------------
       
    79 // CCamTimer::RunL
       
    80 // From CActive, handle timeout expiration
       
    81 // ---------------------------------------------------------------------------
       
    82 //
       
    83 void CCamTimer::RunL()
       
    84     {
       
    85     iCallBack.CallBack();
       
    86     }
       
    87 
       
    88 // ---------------------------------------------------------------------------
       
    89 // CCamTimer::CCamTimer
       
    90 // C++ constructor
       
    91 // ---------------------------------------------------------------------------
       
    92 //
       
    93 CCamTimer::CCamTimer( TInt aTimeout, TCallBack aCallBack )
       
    94 : CCamTimerBase( EPriorityStandard ), iTimeout( aTimeout ), iCallBack( aCallBack )
       
    95     {
       
    96     }
       
    97 
       
    98 // ---------------------------------------------------------------------------
       
    99 // CCamTimer::ConstructL
       
   100 // Symbian OS 2nd phase constructor
       
   101 // ---------------------------------------------------------------------------
       
   102 //
       
   103 void CCamTimer::ConstructL()
       
   104     {
       
   105     CTimer::ConstructL();
       
   106     CActiveScheduler::Add( this );
       
   107     }
       
   108 
       
   109 // End of File  
       
   110 
       
   111 
       
   112