cameratimer.cpp

来自「series60 应用程序开发的源代码 series60 应用程序开发的源代码」· C++ 代码 · 共 141 行

CPP
141
字号
/**
* 
* @brief Definition of CCameraTimer
*
* Copyright (c) EMCC Software Ltd 2003
* @version 1.0
*/

// INCLUDE FILES

// Class include
#include "CameraTimer.h"

// System includes

// User includes
#include "CameraObserver.h"

// Constants

// ================= MEMBER FUNCTIONS =======================

/**
* Symbian OS 2 phase constructor.
* Constructs the CCameraManger using the NewLC method, popping
* the constructed object from the CleanupStack before returning it.
* 
* @param aObserver the observer of the cameramanager
* @return The newly constructed CCameraTimer
*/
CCameraTimer* CCameraTimer::NewL(MCameraTimerObserver& aTimerObserver)
{
    CCameraTimer* self = NewLC(aTimerObserver);
    CleanupStack::Pop(self);
    return self;
}

/**
* Symbian OS 2 phase constructor.
* Constructs the CCameraTimer using the constructor and ConstructL 
* method, leaving the constructed object on the CleanupStack before returning it.
* 
* @param aObserver the observer of the cameratimer
* @return The newly constructed CCameraTimer
*/
CCameraTimer* CCameraTimer::NewLC(MCameraTimerObserver& aTimerObserver)
{
    CCameraTimer* self = new (ELeave) CCameraTimer(aTimerObserver);
    CleanupStack::PushL(self);
    self->ConstructL();
    return self;
}

/**
* Constructs the cameratimer
*
* @param aObserver the observer of the cameratimer
*/
CCameraTimer::CCameraTimer(MCameraTimerObserver& aTimerObserver)
    : CTimer(CActive::EPriorityStandard), iTimerObserver(aTimerObserver) 
      // Construct  zero-priority active object
{
}

/** 
* Destructor.  Cancels the timer
*/
CCameraTimer::~CCameraTimer()
{
    // Make sure we're cancelled
    Cancel();
}

/**
* Symbian OS 2nd phase constructor. Calls the 
* base constructer and adds to the ActiveScheduler
* 
*/    
void CCameraTimer::ConstructL()
{
       iTimerInterval = KDefaultDelay;

      // Base class second-phase construction.
    CTimer::ConstructL();

      // Add active object to active scheduler
    CActiveScheduler::Add(this); 
}

/**
* Called from CActive::Cancel() is called, allowing this object 
* to provide specific cleanup activity.
*
* 
*/    
void CCameraTimer::DoCancel()
{
      // Base class
    CTimer::DoCancel(); 
}

/**
* Sets the time delay  
* 
*/
void CCameraTimer::SetDelay(TInt aTimerInterval)
{
    iTimerInterval = aTimerInterval;
}

/**
* requests an event after a time interval 
* 
*/
void CCameraTimer::StartTimer()
{
    // Request a wait
    CTimer::After( iTimerInterval);
}

/**
* Called when the an asyncronous request completes, i.e. when the 
* time requested has elapsed.
* 
*/
void CCameraTimer::RunL()
{
    iTimerObserver.TimerCompleted();
}

/**
* Called if RunL leaves
*/
TInt CCameraTimer::RunError(TInt /*aError*/)
{
    // This function will never be called as CCameraTimer::RunL()
    // contains contains no functions that can leave. 
    return KErrNone;
}

// End of file.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?