diff options
author | xengineering <mail2xengineering@protonmail.com> | 2020-10-29 12:11:32 +0100 |
---|---|---|
committer | xengineering <mail2xengineering@protonmail.com> | 2020-10-29 12:15:46 +0100 |
commit | 84b9ddcc2905f5d8667cfef1359b724c23d27365 (patch) | |
tree | 4e5a4c9ba39d8ec8c1a63a2bda4d7e9fc402ae40 /barcode_transmit_daemon.py | |
parent | 56503ecf9bccd9a318142e2946f84e5f57be5eeb (diff) | |
download | iot-barcode-scanner-84b9ddcc2905f5d8667cfef1359b724c23d27365.tar iot-barcode-scanner-84b9ddcc2905f5d8667cfef1359b724c23d27365.tar.zst iot-barcode-scanner-84b9ddcc2905f5d8667cfef1359b724c23d27365.zip |
Setup basic Systemd Units
Diffstat (limited to 'barcode_transmit_daemon.py')
-rwxr-xr-x | barcode_transmit_daemon.py | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/barcode_transmit_daemon.py b/barcode_transmit_daemon.py deleted file mode 100755 index a2d7eb6..0000000 --- a/barcode_transmit_daemon.py +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/python3 - - -"""Executable to transmit the Barcode Data to MQTT without root Priviledges""" - - -from iot_barcode_scanner.static import KEYMAP -import iot_barcode_scanner.config as config -from iot_barcode_scanner.mqtt import MqttService - - -def main(): - try: - - # read config - cfg = config.get_config() - fifo_path = cfg["scanner"]["fifo_path"] - topic = cfg["mqtt"]["topic"] - - # setup mqtt - mqtt_service = MqttService(cfg) - mqtt_service.run() - - barcode = "" - - while True: - with open(fifo_path, "r") as fifo: - keycode = fifo.read() - character = KEYMAP[keycode] - if character is "\n": - mqtt_service.client.publish( - topic, - payload=barcode, - qos=0, - retain=False - ) - barcode = "" - else: - barcode += character - - except KeyboardInterrupt: - pass - - -if __name__ == "__main__": - main() |