Echelon i.LON SmartServer User's Guide Page 236

  • Download
  • Add to my manuals
  • Print
  • Page
    / 266
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 235
222 Appendix A - Programmer’s Reference
in the Initialize(), Work(), and OnTimer()routines of an FPM application, and you can use
it in the Initialize()routine of an FPM driver.
SYNTAX
START_TIMER(timeVar, mode, timeoutMillis, funcName)
The timeVar parameter specifies the name of the timer to be started.
The mode parameter specifies the type of the timer. You can enter FPM_TF_REPEAT for a
repeating timer, or you can enter FPM_TF_ONETIME for a timer that is used just once.
The nTimeoutMillis parameter specifies the timer interval in milliseconds. You should set
this parameter to a minimum of 100ms.
The funcName parameter specifies the name of the user-defined timer handler method that is
called when this expires.
TIMER HANDLER SYNTAX
Timers started with the START_TIMER() macro must be handled with a user-defined timer
handler method that has the following signature:
void <funcName>()
You must declare your user-defined timer handler method in the “Implements the user
functionality” section of the .h file.
EXAMPLE
The following example demonstrates a START_TIMER()macro that starts a timer that repeats
every 3 seconds and is handled by the OnMyTimer3()user-defined timer handler method.
CFPM_Timer m_oTimer3; // declared in header file
, m_oTimer3(this) // initialized in source file
...
START_TIMER(m_oTimer3, FPM_TF_REPEAT, 3000, OnMyTimer3);
...
void OnMyTimer3(); // declared in header file
Expired()
You can use the Expired() method of the CFPM_Timer class to check whether a timer has
expired. You can use this method in the Work()and OnTimer()routines of an FPM application.
If this method returns true, you can handle the timer accordingly. For example, you can re-start an
expired one-time timer using the Start() method.
SYNTAX
bool Expired()
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 an Expired()method in an OnTimer() routine that
checks whether a one-time timer has expired and re-starts it if it has expired.
CFPM_Timer m_oTimer2; //declared in header file
void CUFPT_FPM_Application::Initialize()
{
Page view 235
1 2 ... 231 232 233 234 235 236 237 238 239 240 241 ... 265 266

Comments to this Manuals

No comments