summaryrefslogtreecommitdiff
path: root/iot_barcode_daemon
diff options
context:
space:
mode:
authorxengineering <mail2xengineering@protonmail.com>2020-10-30 10:49:55 +0100
committerxengineering <mail2xengineering@protonmail.com>2020-10-30 11:00:01 +0100
commit6829d05453658a9f9672c847299c652b15126db1 (patch)
tree60d0f4ae1ec6950648e954c9a6528ce5a8e628ce /iot_barcode_daemon
parent84b9ddcc2905f5d8667cfef1359b724c23d27365 (diff)
downloadiot-barcode-scanner-6829d05453658a9f9672c847299c652b15126db1.tar
iot-barcode-scanner-6829d05453658a9f9672c847299c652b15126db1.tar.zst
iot-barcode-scanner-6829d05453658a9f9672c847299c652b15126db1.zip
Introduce iot-barcode.target
Diffstat (limited to 'iot_barcode_daemon')
-rwxr-xr-xiot_barcode_daemon46
1 files changed, 0 insertions, 46 deletions
diff --git a/iot_barcode_daemon b/iot_barcode_daemon
deleted file mode 100755
index 5b08111..0000000
--- a/iot_barcode_daemon
+++ /dev/null
@@ -1,46 +0,0 @@
-#!/usr/bin/python3
-
-
-"""Executable to transmit the Barcode Data to MQTT without root Priviledges"""
-
-
-from iot_barcode.static import KEYMAP
-import iot_barcode.config as config
-from iot_barcode.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()