diff --git a/module/module.py b/module/module.py index 814ddaf..a7bbb84 100644 --- a/module/module.py +++ b/module/module.py @@ -23,13 +23,13 @@ logging.debug("- %s loaded", __name__) class Module: """!Main module class""" - _modulesActive = 0 + _modulesActive = [] def __init__(self, moduleName, config): """!init preload some needed locals and then call onLoad() directly""" self._moduleName = moduleName self.config = config - self._modulesActive += 1 + self._modulesActive.append(self) # for time counting self._cumTime = 0 @@ -46,11 +46,11 @@ class Module: def __del__(self): """!Destructor calls onUnload() directly""" logging.debug("[%s] onUnload()", self._moduleName) - self._modulesActive -= 1 + self._modulesActive.remove(self) self.onUnload() def _run(self, bwPacket): - """!start an rund of the module. + """!start an run of the module. @param bwPacket: A BOSWatch packet instance @return bwPacket or False""" @@ -84,17 +84,17 @@ class Module: def onLoad(self): """!Called by import of the module - Must be inherit""" + can be inherited""" pass def doWork(self, bwPacket): """!Called module run - Must be inherit + can be inherited @param bwPacket: bwPacket instance""" logging.warning("no functionality in module %s", self._moduleName) def onUnload(self): - """!Called by destruction of the module - Must be inherit""" + """!Called on shutdown of boswatch + can be inherited""" pass diff --git a/plugin/plugin.py b/plugin/plugin.py index f0a6de6..b6a5898 100644 --- a/plugin/plugin.py +++ b/plugin/plugin.py @@ -25,13 +25,13 @@ logging.debug("- %s loaded", __name__) class Plugin: """!Main plugin class""" - _pluginsActive = 0 + _pluginsActive = [] def __init__(self, pluginName, config): """!init preload some needed locals and then call onLoad() directly""" self._pluginName = pluginName self.config = config - self._pluginsActive += 1 + self._pluginsActive.append(self) # to save the packet while alarm is running for other functions self._bwPacket = None @@ -56,7 +56,7 @@ class Plugin: def __del__(self): """!Destructor calls onUnload() directly""" logging.debug("[%s] onUnload()", self._pluginName) - self._pluginsActive -= 1 + self._pluginsActive.remove(self) self.onUnload() def _run(self, bwPacket): @@ -137,50 +137,50 @@ class Plugin: def onLoad(self): """!Called by import of the plugin - Must be inherit""" + can be inherited""" pass def setup(self): """!Called before alarm - Must be inherit""" + can be inherited""" pass def fms(self, bwPacket): """!Called on FMS alarm - Must be inherit + can be inherited @param bwPacket: bwPacket instance""" logging.warning("ZVEI not implemented in %s", self._pluginName) def pocsag(self, bwPacket): """!Called on POCSAG alarm - Must be inherit + can be inherited @param bwPacket: bwPacket instance""" logging.warning("POCSAG not implemented in %s", self._pluginName) def zvei(self, bwPacket): """!Called on ZVEI alarm - Must be inherit + can be inherited @param bwPacket: bwPacket instance""" logging.warning("ZVEI not implemented in %s", self._pluginName) def msg(self, bwPacket): """!Called on MSG packet - Must be inherit + can be inherited @param bwPacket: bwPacket instance""" logging.warning("MSG not implemented in %s", self._pluginName) def teardown(self): """!Called after alarm - Must be inherit""" + can be inherited""" pass def onUnload(self): - """!Called by destruction of the plugin - Must be inherit""" + """!Called on shutdown of boswatch + can be inherited""" pass def parseWildcards(self, msg):