From 97fc42cdb334f9b13844b2bd4306d6d564f528ec Mon Sep 17 00:00:00 2001 From: NeonJarbas <59943014+NeonJarbas@users.noreply.github.com> Date: Mon, 14 Mar 2022 16:04:57 +0000 Subject: [PATCH] feat/PHAL_validator (#42) Co-authored-by: jarbasai --- ovos_plugin_manager/templates/phal.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ovos_plugin_manager/templates/phal.py b/ovos_plugin_manager/templates/phal.py index edece1cc..71b46c38 100644 --- a/ovos_plugin_manager/templates/phal.py +++ b/ovos_plugin_manager/templates/phal.py @@ -3,6 +3,15 @@ from ovos_utils.messagebus import get_mycroft_bus +class PHALValidator: + @staticmethod + def validate(config=None): + """ this method is called before loading the plugin. + If it returns False the plugin is not loaded. + This allows a plugin to run platform checks""" + return config.get("enabled", True) + + class PHALPlugin: """ This base class is intended to be used to interface with the hardware @@ -10,6 +19,7 @@ class PHALPlugin: are expected be sent to a PHAL plugin. All of the handlers are optional and for convenience only """ + validator = PHALValidator def __init__(self, bus=None, name=""): self._mouth_events = False