Base

Base for drivers.

class mauzr.hardware.driver.DelayedPollingDriver(core, name, poll_interval, receive_delay, init_delay=3000)

Bases: mauzr.hardware.driver.PollingDriver

Base for drivers that poll values regularly and need a delay between value poll and fetch.

Parameters:
  • core (object) – Core instance.
  • name (str) – Log name of this.
  • poll_interval (int) – Delay between polls in milliseconds
  • receive_delay (int) – Delay between poll and receive in milliseconds:
  • init_delay (int) – Delay between inits in milliseconds.
class mauzr.hardware.driver.Driver(core, name, init_delay=3000)

Bases: object

Base for drivers.

Parameters:
  • core (object) – Core instance.
  • name (str) – Log name of this.
  • init_delay (int) – Delay between inits in milliseconds.
_init()

Setup hardware.

_reset()

Reset hardware.

exception mauzr.hardware.driver.DriverError

Bases: Exception

Exception representing an recoverable driver error.

class mauzr.hardware.driver.PollingDriver(core, name, poll_interval, init_delay=3000)

Bases: mauzr.hardware.driver.Driver

Base for drivers that poll values regularly.

Parameters:
  • core (object) – Core instance.
  • name (str) – Log name of this.
  • poll_interval (int) – Delay between polls in milliseconds
  • init_delay (int) – Delay between inits in milliseconds.
_init()

Setup hardware.

_reset()

Reset hardware.

_poll()
mauzr.hardware.driver.guard(exceptions, suppress=False, ignore_ready=False)

Create decorator to handle raised exceptions for drivers.

Parameters:
  • exceptions (tuple) – List of exceptions to catch.
  • suppress (bool) – Don’t reraise exception if True.
  • ignore_ready (bool) – Ignore ready state of driver.
Returns:

Created decorator

Return type:

callable

Controller basics.

class mauzr.hardware.controller.Publisher(core, name)

Bases: object

Base for controllers.

Parameters:
  • core (object) – Core instance.
  • name (str) – Log name of this.
_init()

Init the publisher.

By default this just calls reset().

_reset()

Reset the publisher.

class mauzr.hardware.controller.TimedPublisher(core, name, interval)

Bases: mauzr.hardware.controller.Publisher

Base for controllers with a fixed output rate.

Parameters:
  • core (object) – Core instance.
  • name (str) – Log name of this.
  • interval (int) – Delay between publishes in milliseconds.
_init()

Enable fire task.

_reset()

Disable fire task.

_publish()

When called, inheriting classes shall publish the value.

Raises:NotImplementedError – When not implemented.