diff options
Diffstat (limited to 'iot_barcode_scanner')
-rw-r--r-- | iot_barcode_scanner/__init__.py | 5 | ||||
-rw-r--r-- | iot_barcode_scanner/config.py | 23 | ||||
-rw-r--r-- | iot_barcode_scanner/mqtt.py | 27 | ||||
-rw-r--r-- | iot_barcode_scanner/static.py | 20 |
4 files changed, 0 insertions, 75 deletions
diff --git a/iot_barcode_scanner/__init__.py b/iot_barcode_scanner/__init__.py deleted file mode 100644 index 6f92d9b..0000000 --- a/iot_barcode_scanner/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ - - -from iot_barcode_scanner.config import * -from iot_barcode_scanner.mqtt import * -from iot_barcode_scanner.static import * diff --git a/iot_barcode_scanner/config.py b/iot_barcode_scanner/config.py deleted file mode 100644 index 6b83393..0000000 --- a/iot_barcode_scanner/config.py +++ /dev/null @@ -1,23 +0,0 @@ - - -"""Module to read the Configuration File for the Service""" - - -import sys -import json -from iot_barcode_scanner.static import CONFIG_PATH - - -def get_config(): - """Read Config File and return it as Python Object""" - - try: - with open(CONFIG_PATH, "r") as config_file: - text = config_file.read() - except FileNotFoundError: - print("Config file does not exist.") - sys.exit(1) - - data = json.loads(text) - - return data diff --git a/iot_barcode_scanner/mqtt.py b/iot_barcode_scanner/mqtt.py deleted file mode 100644 index c5a075c..0000000 --- a/iot_barcode_scanner/mqtt.py +++ /dev/null @@ -1,27 +0,0 @@ - - -"""Provide MQTT Functionality for the Package""" - - -import paho.mqtt.client as mqtt - - -class MqttService(): - """Bundle for MQTT Functionality""" - - def __init__(self, config): - self.config = config - self.client = mqtt.Client() - self.client.on_connect = self.on_connect - - def run(self): - self.client.connect( - self.config["mqtt"]["broker"], - self.config["mqtt"]["port"], - 60 - ) - self.client.loop_start() - - def on_connect(self, client, userdata, flags, rc): - print("Connected with result code " + str(rc)) - client.subscribe(self.config["mqtt"]["topic"]) diff --git a/iot_barcode_scanner/static.py b/iot_barcode_scanner/static.py deleted file mode 100644 index af76683..0000000 --- a/iot_barcode_scanner/static.py +++ /dev/null @@ -1,20 +0,0 @@ - - -"""Module to store static Data for the whole Package""" - - -CONFIG_PATH = "/etc/xengineering.eu/iot_barcode_scanner/config.json" - -KEYMAP = { - "KEY_0": "0", - "KEY_1": "1", - "KEY_2": "2", - "KEY_3": "3", - "KEY_4": "4", - "KEY_5": "5", - "KEY_6": "6", - "KEY_7": "7", - "KEY_8": "8", - "KEY_9": "9", - "KEY_ENTER": "\n", -} |