Up | Draw | Overlay | Tool | Toollist | Timer | SPB | Camera | CameraImage | Bitmap | Historylist - ImageBuffer | Clipboard | ScorpionGeometry | Statistics | Curve | States | Logging | Panels | Shared Memory | BarCode Reader | StdCtrls

Release Notes
 

  

 
Timer
The Timer module contains classes and methods for user defined timers.

When a user defined timer event occurs, the Central Event System.Timer is called unless the timer objects onTimer property is set.

Unlike other timers in the system, these timers will be called in between the execution of each tool during toolbox execution. The accuration of timer intervals depends of the analysis time of the individual tools, if a tool starts execution just before a timer expires, the timer event will be delayed with the analysis time of the tool. 

The TimerList class

Use the function GetTimerList() to retrieve the an instance of the class.

Attribute Access Type Description
count R int number of added timers in list

 

Method Returns Description
addTimer(name,[interval,active]) Timer returns a timer object. If the name already exists the method returns None.
get(index) Timer returns the timer object created by addTimer. If the timer don't exists the method returns None.
getTimer(name) Timer returns the timer object created by addTimer. If the timer don't exists the method returns None. 
killTimer(name) 0/1 returns true (1) if timer exists, else false (0)
killTimers() cnt Kills all timers. Returns no of timers killed or -1 on error

The Timer class

This class is returned from the method GetTimer(name) or from TimerList class methods.

Attribute Access Type Description
name R string name of timer
interval R/W int interval period in ms 
active R/W int 1 if enabled, 0 if disabled
count R/W uint trigger counter, incremented by one for each trigger, unsigned integer
tag R/W int user defined tag, might be used as trigger counter
onTimer W callback python callback method for timer events. If set the timer events will not occur in the Central's "System.Timer".

Example 1: Create two System Timers

timers=GetTimerList()
timers.addTimer('T0') #interval default 1 sec
timers.addTimer('T1',5000) #interval 5 sec

More on System.Timer

 

Scorpion Vision Version XII : Build 665 - Date: 20170919
Scorpion Vision Software® is a registered trademark of Tordivel AS.
Copyright © 2000 - 2017 Tordivel AS.