mirror of
https://github.com/BOSWatch/BW3-Core.git
synced 2025-12-06 07:12:04 +01:00
edit comments in plugin/module base class
This commit is contained in:
parent
7d8544123b
commit
c4fa8c4898
|
|
@ -23,13 +23,13 @@ logging.debug("- %s loaded", __name__)
|
||||||
class Module:
|
class Module:
|
||||||
"""!Main module class"""
|
"""!Main module class"""
|
||||||
|
|
||||||
_modulesActive = 0
|
_modulesActive = []
|
||||||
|
|
||||||
def __init__(self, moduleName, config):
|
def __init__(self, moduleName, config):
|
||||||
"""!init preload some needed locals and then call onLoad() directly"""
|
"""!init preload some needed locals and then call onLoad() directly"""
|
||||||
self._moduleName = moduleName
|
self._moduleName = moduleName
|
||||||
self.config = config
|
self.config = config
|
||||||
self._modulesActive += 1
|
self._modulesActive.append(self)
|
||||||
|
|
||||||
# for time counting
|
# for time counting
|
||||||
self._cumTime = 0
|
self._cumTime = 0
|
||||||
|
|
@ -46,11 +46,11 @@ class Module:
|
||||||
def __del__(self):
|
def __del__(self):
|
||||||
"""!Destructor calls onUnload() directly"""
|
"""!Destructor calls onUnload() directly"""
|
||||||
logging.debug("[%s] onUnload()", self._moduleName)
|
logging.debug("[%s] onUnload()", self._moduleName)
|
||||||
self._modulesActive -= 1
|
self._modulesActive.remove(self)
|
||||||
self.onUnload()
|
self.onUnload()
|
||||||
|
|
||||||
def _run(self, bwPacket):
|
def _run(self, bwPacket):
|
||||||
"""!start an rund of the module.
|
"""!start an run of the module.
|
||||||
|
|
||||||
@param bwPacket: A BOSWatch packet instance
|
@param bwPacket: A BOSWatch packet instance
|
||||||
@return bwPacket or False"""
|
@return bwPacket or False"""
|
||||||
|
|
@ -84,17 +84,17 @@ class Module:
|
||||||
|
|
||||||
def onLoad(self):
|
def onLoad(self):
|
||||||
"""!Called by import of the module
|
"""!Called by import of the module
|
||||||
Must be inherit"""
|
can be inherited"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def doWork(self, bwPacket):
|
def doWork(self, bwPacket):
|
||||||
"""!Called module run
|
"""!Called module run
|
||||||
Must be inherit
|
can be inherited
|
||||||
|
|
||||||
@param bwPacket: bwPacket instance"""
|
@param bwPacket: bwPacket instance"""
|
||||||
logging.warning("no functionality in module %s", self._moduleName)
|
logging.warning("no functionality in module %s", self._moduleName)
|
||||||
|
|
||||||
def onUnload(self):
|
def onUnload(self):
|
||||||
"""!Called by destruction of the module
|
"""!Called on shutdown of boswatch
|
||||||
Must be inherit"""
|
can be inherited"""
|
||||||
pass
|
pass
|
||||||
|
|
|
||||||
|
|
@ -25,13 +25,13 @@ logging.debug("- %s loaded", __name__)
|
||||||
class Plugin:
|
class Plugin:
|
||||||
"""!Main plugin class"""
|
"""!Main plugin class"""
|
||||||
|
|
||||||
_pluginsActive = 0
|
_pluginsActive = []
|
||||||
|
|
||||||
def __init__(self, pluginName, config):
|
def __init__(self, pluginName, config):
|
||||||
"""!init preload some needed locals and then call onLoad() directly"""
|
"""!init preload some needed locals and then call onLoad() directly"""
|
||||||
self._pluginName = pluginName
|
self._pluginName = pluginName
|
||||||
self.config = config
|
self.config = config
|
||||||
self._pluginsActive += 1
|
self._pluginsActive.append(self)
|
||||||
|
|
||||||
# to save the packet while alarm is running for other functions
|
# to save the packet while alarm is running for other functions
|
||||||
self._bwPacket = None
|
self._bwPacket = None
|
||||||
|
|
@ -56,7 +56,7 @@ class Plugin:
|
||||||
def __del__(self):
|
def __del__(self):
|
||||||
"""!Destructor calls onUnload() directly"""
|
"""!Destructor calls onUnload() directly"""
|
||||||
logging.debug("[%s] onUnload()", self._pluginName)
|
logging.debug("[%s] onUnload()", self._pluginName)
|
||||||
self._pluginsActive -= 1
|
self._pluginsActive.remove(self)
|
||||||
self.onUnload()
|
self.onUnload()
|
||||||
|
|
||||||
def _run(self, bwPacket):
|
def _run(self, bwPacket):
|
||||||
|
|
@ -137,50 +137,50 @@ class Plugin:
|
||||||
|
|
||||||
def onLoad(self):
|
def onLoad(self):
|
||||||
"""!Called by import of the plugin
|
"""!Called by import of the plugin
|
||||||
Must be inherit"""
|
can be inherited"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def setup(self):
|
def setup(self):
|
||||||
"""!Called before alarm
|
"""!Called before alarm
|
||||||
Must be inherit"""
|
can be inherited"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def fms(self, bwPacket):
|
def fms(self, bwPacket):
|
||||||
"""!Called on FMS alarm
|
"""!Called on FMS alarm
|
||||||
Must be inherit
|
can be inherited
|
||||||
|
|
||||||
@param bwPacket: bwPacket instance"""
|
@param bwPacket: bwPacket instance"""
|
||||||
logging.warning("ZVEI not implemented in %s", self._pluginName)
|
logging.warning("ZVEI not implemented in %s", self._pluginName)
|
||||||
|
|
||||||
def pocsag(self, bwPacket):
|
def pocsag(self, bwPacket):
|
||||||
"""!Called on POCSAG alarm
|
"""!Called on POCSAG alarm
|
||||||
Must be inherit
|
can be inherited
|
||||||
|
|
||||||
@param bwPacket: bwPacket instance"""
|
@param bwPacket: bwPacket instance"""
|
||||||
logging.warning("POCSAG not implemented in %s", self._pluginName)
|
logging.warning("POCSAG not implemented in %s", self._pluginName)
|
||||||
|
|
||||||
def zvei(self, bwPacket):
|
def zvei(self, bwPacket):
|
||||||
"""!Called on ZVEI alarm
|
"""!Called on ZVEI alarm
|
||||||
Must be inherit
|
can be inherited
|
||||||
|
|
||||||
@param bwPacket: bwPacket instance"""
|
@param bwPacket: bwPacket instance"""
|
||||||
logging.warning("ZVEI not implemented in %s", self._pluginName)
|
logging.warning("ZVEI not implemented in %s", self._pluginName)
|
||||||
|
|
||||||
def msg(self, bwPacket):
|
def msg(self, bwPacket):
|
||||||
"""!Called on MSG packet
|
"""!Called on MSG packet
|
||||||
Must be inherit
|
can be inherited
|
||||||
|
|
||||||
@param bwPacket: bwPacket instance"""
|
@param bwPacket: bwPacket instance"""
|
||||||
logging.warning("MSG not implemented in %s", self._pluginName)
|
logging.warning("MSG not implemented in %s", self._pluginName)
|
||||||
|
|
||||||
def teardown(self):
|
def teardown(self):
|
||||||
"""!Called after alarm
|
"""!Called after alarm
|
||||||
Must be inherit"""
|
can be inherited"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def onUnload(self):
|
def onUnload(self):
|
||||||
"""!Called by destruction of the plugin
|
"""!Called on shutdown of boswatch
|
||||||
Must be inherit"""
|
can be inherited"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def parseWildcards(self, msg):
|
def parseWildcards(self, msg):
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue