summaryrefslogtreecommitdiff
path: root/addons/hw_drivers/controllers/loading.py
diff options
context:
space:
mode:
authorJosse Colpaert <jco@odoo.com>2018-09-25 18:37:21 +0200
committerJosse Colpaert <jco@odoo.com>2018-09-25 23:01:40 +0200
commit3d9ebb11b6e92083209c3e441ddea26022ec2f14 (patch)
treed7c8221b89c316ff108c6720a398a526e724b99b /addons/hw_drivers/controllers/loading.py
parent728e2e7a2a4342d687374b21742ad8080df789dc (diff)
[ADD] hw_drivers: drivers management module for the IoT Box
- Routes to get device/driver statuses from the browser - Framework for managing and downloading drivers for devices connected to the IoT Box - Automatic detection of printers and cameras in the network - Built-in detection for USB and Bluetooth LE devices and checking if a driver matches the device - Authentication of the box into Odoo - Inform Odoo of the connected devices and giving them a unique identifier so they can be called from the browser Thanks to qle, specially for fswebcam and cups
Diffstat (limited to 'addons/hw_drivers/controllers/loading.py')
-rw-r--r--addons/hw_drivers/controllers/loading.py34
1 files changed, 34 insertions, 0 deletions
diff --git a/addons/hw_drivers/controllers/loading.py b/addons/hw_drivers/controllers/loading.py
new file mode 100644
index 00000000000..cd02d3dd82f
--- /dev/null
+++ b/addons/hw_drivers/controllers/loading.py
@@ -0,0 +1,34 @@
+import importlib.util
+import os
+from .driver import BtManager
+from .driver import USBDeviceManager
+from odoo import modules
+
+driversList = os.listdir("/home/pi/odoo/addons/hw_drivers/drivers")
+for driver in driversList:
+ path = "/home/pi/odoo/addons/hw_drivers/drivers/" + driver
+ spec = importlib.util.spec_from_file_location(driver, path)
+ if spec:
+ foo = importlib.util.module_from_spec(spec)
+ spec.loader.exec_module(foo)
+
+
+if not getattr(modules, '_iot_daemon_started', False):
+ # ----------------------------------------------------------
+ # Bluetooth start
+ # ----------------------------------------------------------
+ bm = BtManager()
+ bm.daemon = True
+ bm.start()
+
+ #----------------------------------------------------------
+ #USB start
+ #----------------------------------------------------------
+
+ udm = USBDeviceManager()
+ udm.daemon = True
+ udm.start()
+
+ # Did this because of the
+ modules._iot_daemon_started = True
+