HSL 2.0 framework Description of the framework

Public Member Functions |List of all members
hsl20_4_timer.hsl20_4_timer.Timer Class Reference

All methods of the Timer object. More..

## Public Member Functions
def | __init__ (self, framework)
| Constructor. More...
def | set_timer (self, timeout, callback, arguments=())
| Sets the time and the callback method to be called after the timer starts. More...
def | stop (self)
| Stops the timer. More...
def | start (self)
| Starts the timer. More...

## Detailed Description

All methods of the timer object

An example for the implementation of a timer is enclosed: 10708_MyTimer.py
The example code creates a timer at the first input telegram at input 1 or 2 and starts it. The timer is restarted with each subsequent telegram
Thus the timer is only triggered if no further telegram arrives at the input within the time defined at input 3. If a 1 is sent at input 4, a running timer is stopped

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.Timer.__init__ | ( |  | self,
|  |  | framework
| ) |  |

Constructor

Warning
  This class should not be instantiated directly

## Member Function Documentation

## ◆ set_timer()

def hsl20_4_timer.hsl20_4_timer.timer.set_timer | ( |  | self,
|  |  | timeout,
|  |  | callback,
|  |  | arguments = `()`
| ) |  |

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

Parameters

  timeout | int Time in ms
  callback | function Callback
  arguments | tuple Optional. The elements of the tuple are passed as parameters to the callback method when called

Exceptions

  RuntimeError | If this method is called while the timer is already running, a RuntimeError exception is thrown

## ◆ start()

def hsl20_4_timer.hsl20_4_timer.timer.start | ( |  | self | ) |

Starts the timer

Note
  If the timer is already running, it is stopped and restarted

Exceptions

  AttributeError | Is triggered if no callback or timeout has been defined

## ◆ stop()

def hsl20_4_timer.hsl20_4_timer.timer.stop | ( |  | self | ) |

Stops the timer

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

- hsl20_4_timer.py