beautypg.com

Stop (), Stopalltimers(), Isrunning() – Echelon i.LON SmartServer 2.0 User Manual

Page 237

background image

i.LON SmartServer 2.0 Programming Tools User’s Guide

223

m_oTimer2.Start(FPM_TF_ONETIME, 0);
}

void CUFPT_FPM_Application::OnTimer()
{
if

(m_oTimer2.Expired())

{

m_oTimer2.Start(FPM_TF_ONETIME, 2000);

}
}

Stop ()

You can use the Stop()method of the CFPM_Timer class to stop a timer that is running. You can
use this method in the Work(), OnTimer(), Shutdown() routines of an FPM application, and
you can use it in the Shutdown()routine of an FPM driver.

SYNTAX

bool Stop()

If the timer has expired, the method returns TRUE. If the timer has not yet expired or if the timer
has been stopped, the method returns FALSE.

EXAMPLE

The following example demonstrates how you can use the Stop()method to stop a timer that is
running.

m_oTimer1.Stop();

StopAllTimers()

You can use the StopAllTimers()method of the CFPM_Timer class to stop all currently active
timers. You can use this method in the Work(), OnTimer(), Shutdown() routines of an FPM
application, and you can use it in the Shutdown()routine of an FPM driver.

SYNTAX

bool StopAllTimers()

If any timer has expired, the method returns TRUE. If no timer has expired or has been stopped,
the method returns FALSE.

EXAMPLE

The following example demonstrates a StopAllTimers()method that stops all existing timers.

StopAllTimers();

IsRunning()

You can use the IsRunning()method to check whether a timer is running or has been stopped.
This method may be useful during runtime.

SYNTAX

bool IsRunning()

If the referenced timer is running, the method returns TRUE. If the timer has expired or has been
stopped, the method returns FALSE.

EXAMPLE

The following example demonstrates an IsRunning()method that checks whether a timer is
running and executes some code if it is.