HSL 2.0 framework
Description of the framework
Public Member Functions |List of all members
hsl20_4_timer.hsl20_4_timer.Interval Class Reference

All methods of the interval object. More

..

Public Member Functions

def__init__ (self, framework)
Constructor. More...
defset_interval (self, time, callback, arguments=())
Sets the interval time and the callback method to be called after the interval timer starts. More...
defstop (self)
Stops the interval timer. More...
defstart (self)
Starts the interval timer. More...

Detailed Description

All methods of the interval object

An example for the implementation of an interval timer is enclosed: 10709_MyIntervaltimer.py

If a 1 is sent to input 1, an interval timer is generated and started, which triggers at an interval whose length (in seconds) is determined by input 2 and writes an output with the value '1'
The timer can be stopped by sending a '0' to input 1

Note
The execution time may differ from the defined time
The class works asynchronously. None of the methods offered are blocked

Constructor & Destructor Documentation

◆ __init__()

def hsl20_4_timer.hsl20_4_timer.Interval.__init__ ( self,
framework
)

Constructor

Warning
This class should not be instantiated directly

Member Function Documentation

◆ set_interval()

def hsl20_4_timer.hsl20_4_timer.interval.set_interval ( self,
time,
callback,
arguments = ()
)

Sets the interval time and the callback method to be called after the interval timer has started

Note
If at the time of execution of an interval timer (i.e. at the end of an interval) the action triggered at the end of the previous interval has not yet been completed, the new action is skipped!
Parameters
timeint
Time in ms
callback
After time has expired, the callback method is called
argumentstuple
Optional. The elements of the tuple are passed as parameters to the callback method when called
Exceptions
RuntimeErrorIf this method is called while the interval timer is already running, a RuntimeError exception is thrown

◆ start()

def hsl20_4_timer.hsl20_4_timer.interval.start ( self)

Starts the interval timer

The callback is called for the first time after the time defined in the set_interval method

Note
If the interval timer is already running, it is stopped and restarted
Exceptions
AttributeErrorIs triggered if no callback or timeout has been defined

◆ stop()

def hsl20_4_timer.hsl20_4_timer.interval.stop ( self)

Stops the interval timer


The documentation for this class was generated from the following file: