You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
1.0 KiB
Python

#!/usr/bin/env python3
import json
import pathlib
import threading
from . import config
from . import controller
from . import dect
class FieldPOC:
config = None
extensions = None
def __init__(self, config_file_path, extensions_file_path):
self.config_file_path = pathlib.Path(config_file_path)
self._load_config()
self.extensions_file_path = pathlib.Path(extensions_file_path)
self._load_extensions()
self.stop = threading.Event()
self._controller = controller.Controller(self)
self._dect = dect.Dect(self)
def run(self):
self._controller_thread = threading.Thread(target=self._controller.run)
self._controller_thread.start()
self._dect_thread = threading.Thread(target=self._dect.run)
self._dect_thread.start()
def _load_config(self):
self.config = config.Config(json.loads(self.config_file_path.read_text()))
def _load_extensions(self):
self.extensions = config.Extensions(json.loads(self.extensions_file_path.read_text()))