interface_handler module

class interface_handler.Interface_handler(xml_reader: xml_reader.Xml_reader)

Bases: object

handles the access to the various interfaces (e.g. GPIO)

class Pin

Bases: enum.Enum

list of all usable pins

enables restricting methods to these pins

GPIO_10 = 19
GPIO_11 = 23
GPIO_12 = 32
GPIO_13 = 33
GPIO_14 = 8
GPIO_15 = 10
GPIO_16 = 36
GPIO_17 = 11
GPIO_18 = 12
GPIO_19 = 35
GPIO_2 = 3
GPIO_20 = 38
GPIO_21 = 40
GPIO_22 = 15
GPIO_23 = 16
GPIO_24 = 18
GPIO_25 = 22
GPIO_26 = 37
GPIO_27 = 13
GPIO_3 = 5
GPIO_4 = 7
GPIO_5 = 29
GPIO_6 = 31
GPIO_7 = 26
GPIO_8 = 24
GPIO_9 = 21
buffering()

method that buffers the device outputs

init_buffer()

initializes the buffer thread

init_gpio()

initializes the GPIO pins

read(device_name: str) → dict

reads the current value from the pins of one device

Parameters:

device_name (string) – the name of the device

Raises:
  • NameError – the device cannot be found in the config.xml
  • ValueError – the device does not support reading
Returns:

{‘pin’: ‘value’}

Return type:

dict

read_buffer(device_name: str) → dict

reads the current buffer content for a given device

Parameters:

device_name (str) – the name of the device

Raises:
  • NameError – the device cannot be found in the config.xml
  • ValueError – the device has no buffer
Returns:

the buffer of the device

Return type:

dict

write(device_name: str, output)

writes an output to a given device

Parameters:
  • device_name (str) – the name of the relevant device
  • value (<type depends on protocol>) – the value to be written
Raises:
  • NameError – the device name could not be found in the config.xml
  • TypeError – the given Value has the wrong type for the protocol
  • ValueError – the value cannot be written to the device
Returns:

value if everything worked correctly

Return type:

<type depends on protocol>