mirror of
https://github.com/Schrolli91/BOSWatch.git
synced 2026-04-05 06:25:10 +00:00
change pluginLoader and exception-handling
- if the function plugin.onLoad() throws an exception the plugin will skipped - change exception-handling for pluginLoader
This commit is contained in:
parent
a1d610ee6a
commit
09b9cc5f7d
9 changed files with 100 additions and 72 deletions
|
|
@ -21,24 +21,20 @@ from includes import globals # Global variables
|
|||
|
||||
##
|
||||
#
|
||||
# onLoad function of plugin
|
||||
# will be called by the pluginLoader
|
||||
# onLoad (init) function of plugin
|
||||
# will be called one time by the pluginLoader on start
|
||||
#
|
||||
def onLoad():
|
||||
"""
|
||||
While loading the plugins by pluginLoader.loadPlugins()
|
||||
this onLoad() routine are called
|
||||
this onLoad() routine is called one time for initialize the plugin
|
||||
|
||||
@requires: nothing
|
||||
|
||||
@return: nothing
|
||||
"""
|
||||
try:
|
||||
# we have to do nothing here...
|
||||
pass
|
||||
except:
|
||||
logging.error("unknown error")
|
||||
logging.debug("unknown error", exc_info=True)
|
||||
# nothing to do for this plugin
|
||||
return
|
||||
|
||||
##
|
||||
#
|
||||
|
|
|
|||
|
|
@ -20,24 +20,21 @@ from includes import globals # Global variables
|
|||
|
||||
##
|
||||
#
|
||||
# onLoad function of plugin
|
||||
# will be called by the pluginLoader
|
||||
# onLoad (init) function of plugin
|
||||
# will be called one time by the pluginLoader on start
|
||||
#
|
||||
def onLoad():
|
||||
"""
|
||||
While loading the plugins by pluginLoader.loadPlugins()
|
||||
this onLoad() routine are called
|
||||
this onLoad() routine is called one time for initialize the plugin
|
||||
|
||||
@requires: nothing
|
||||
|
||||
@return: nothing
|
||||
"""
|
||||
try:
|
||||
# we have to do nothing here...
|
||||
pass
|
||||
except:
|
||||
logging.error("unknown error")
|
||||
logging.debug("unknown error", exc_info=True)
|
||||
# nothing to do for this plugin
|
||||
return
|
||||
|
||||
|
||||
##
|
||||
#
|
||||
|
|
|
|||
|
|
@ -21,25 +21,22 @@ from includes import globals # Global variables
|
|||
|
||||
##
|
||||
#
|
||||
# onLoad function of plugin
|
||||
# will be called by the pluginLoader
|
||||
# onLoad (init) function of plugin
|
||||
# will be called one time by the pluginLoader on start
|
||||
#
|
||||
def onLoad():
|
||||
"""
|
||||
While loading the plugins by pluginLoader.loadPlugins()
|
||||
this onLoad() routine are called
|
||||
this onLoad() routine is called one time for initialize the plugin
|
||||
|
||||
@requires: nothing
|
||||
|
||||
@return: nothing
|
||||
"""
|
||||
try:
|
||||
# we have to do nothing here...
|
||||
pass
|
||||
except:
|
||||
logging.error("unknown error")
|
||||
logging.debug("unknown error", exc_info=True)
|
||||
|
||||
# nothing to do for this plugin
|
||||
return
|
||||
|
||||
|
||||
##
|
||||
#
|
||||
# Private helper function for a printable Timestamp
|
||||
|
|
@ -47,6 +44,7 @@ def onLoad():
|
|||
def curtime():
|
||||
return time.strftime("%Y-%m-%d %H:%M:%S")
|
||||
|
||||
|
||||
##
|
||||
#
|
||||
# do send mail
|
||||
|
|
|
|||
|
|
@ -14,26 +14,23 @@ import socket
|
|||
|
||||
from includes import globals # Global variables
|
||||
|
||||
##
|
||||
###
|
||||
#
|
||||
# onLoad function of plugin
|
||||
# will be called by the pluginLoader
|
||||
# onLoad (init) function of plugin
|
||||
# will be called one time by the pluginLoader on start
|
||||
#
|
||||
def onLoad():
|
||||
"""
|
||||
While loading the plugins by pluginLoader.loadPlugins()
|
||||
this onLoad() routine are called
|
||||
this onLoad() routine is called one time for initialize the plugin
|
||||
|
||||
@requires: nothing
|
||||
|
||||
@return: nothing
|
||||
"""
|
||||
try:
|
||||
# we have to do nothing here...
|
||||
pass
|
||||
except:
|
||||
logging.error("unknown error")
|
||||
logging.debug("unknown error", exc_info=True)
|
||||
# nothing to do for this plugin
|
||||
return
|
||||
|
||||
|
||||
##
|
||||
#
|
||||
|
|
|
|||
|
|
@ -17,24 +17,21 @@ from includes import globals # Global variables
|
|||
|
||||
##
|
||||
#
|
||||
# onLoad function of plugin
|
||||
# will be called by the pluginLoader
|
||||
# onLoad (init) function of plugin
|
||||
# will be called one time by the pluginLoader on start
|
||||
#
|
||||
def onLoad():
|
||||
"""
|
||||
While loading the plugins by pluginLoader.loadPlugins()
|
||||
this onLoad() routine are called
|
||||
this onLoad() routine is called one time for initialize the plugin
|
||||
|
||||
@requires: nothing
|
||||
|
||||
@return: nothing
|
||||
"""
|
||||
try:
|
||||
# we have to do nothing here...
|
||||
pass
|
||||
except:
|
||||
logging.error("unknown error")
|
||||
logging.debug("unknown error", exc_info=True)
|
||||
# nothing to do for this plugin
|
||||
return
|
||||
|
||||
|
||||
##
|
||||
#
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
Handover to Plugin:
|
||||
-------------------
|
||||
typ = [FMS|ZVEI|POC]
|
||||
freq = [Freq in Hz]
|
||||
data = {"KEY1":"VALUE1","KEY2":"VALUE2"}
|
||||
|
||||
|
||||
The following informations are included in the var "data".
|
||||
They can be used by their Index Names: data['OPTION']
|
||||
|
||||
|
|
@ -29,6 +29,7 @@ POCSAG:
|
|||
|
||||
|
||||
Global Objects:
|
||||
---------------
|
||||
|
||||
1.)
|
||||
import logging # Global logger
|
||||
|
|
@ -38,4 +39,40 @@ Loglevel: debug|info|warning|error|exception|critical
|
|||
2.)
|
||||
import globals # Global variables
|
||||
reads Data from the config.ini
|
||||
VALUE = globals.config.get("SECTION", "OPTION")
|
||||
VALUE = globals.config.get("SECTION", "OPTION")
|
||||
|
||||
|
||||
General for plugins:
|
||||
--------------------
|
||||
All Plugins have to implement the following functions (see template.py):
|
||||
|
||||
def onLoad():
|
||||
"""
|
||||
While loading the plugins by pluginLoader.loadPlugins()
|
||||
this onLoad() routine is called one time for initialize the plugin
|
||||
|
||||
@requires: nothing
|
||||
|
||||
@return: nothing
|
||||
@exception: Exception if init has an fatal error so that the plugin couldn't work
|
||||
|
||||
"""
|
||||
|
||||
def run(typ,freq,data):
|
||||
"""
|
||||
This function is the implementation of the Plugin.
|
||||
|
||||
If necessary the configuration hast to be set in the config.ini.
|
||||
|
||||
@type typ: string (FMS|ZVEI|POC)
|
||||
@param typ: Typ of the dataset
|
||||
@type data: map of data (structure see interface.txt)
|
||||
@param data: Contains the parameter for dispatch
|
||||
@type freq: string
|
||||
@keyword freq: frequency of the SDR Stick
|
||||
|
||||
@requires: If necessary the configuration hast to be set in the config.ini.
|
||||
|
||||
@return: nothing
|
||||
@exception: nothing, make sure this function will never thrown an exception
|
||||
"""
|
||||
|
|
@ -18,24 +18,21 @@ from includes import globals # Global variables
|
|||
|
||||
##
|
||||
#
|
||||
# onLoad function of plugin
|
||||
# will be called by the pluginLoader
|
||||
# onLoad (init) function of plugin
|
||||
# will be called one time by the pluginLoader on start
|
||||
#
|
||||
def onLoad():
|
||||
"""
|
||||
While loading the plugins by pluginLoader.loadPlugins()
|
||||
this onLoad() routine are called
|
||||
this onLoad() routine is called one time for initialize the plugin
|
||||
|
||||
@requires: nothing
|
||||
|
||||
@return: nothing
|
||||
"""
|
||||
try:
|
||||
# we have to do nothing here...
|
||||
pass
|
||||
except:
|
||||
logging.error("unknown error")
|
||||
logging.debug("unknown error", exc_info=True)
|
||||
# nothing to do for this plugin
|
||||
return
|
||||
|
||||
|
||||
##
|
||||
#
|
||||
|
|
|
|||
|
|
@ -26,17 +26,19 @@ from includes import globals # Global variables
|
|||
|
||||
##
|
||||
#
|
||||
# onLoad function of plugin
|
||||
# will be called by the pluginLoader
|
||||
# onLoad (init) function of plugin
|
||||
# will be called one time by the pluginLoader on start
|
||||
#
|
||||
def onLoad():
|
||||
"""
|
||||
While loading the plugins by pluginLoader.loadPlugins()
|
||||
this onLoad() routine are called
|
||||
this onLoad() routine is called one time for initialize the plugin
|
||||
|
||||
@requires: nothing
|
||||
|
||||
@return: nothing
|
||||
@exception: Exception if init has an fatal error so that the plugin couldn't work
|
||||
|
||||
"""
|
||||
try:
|
||||
########## User onLoad CODE ##########
|
||||
|
|
@ -45,6 +47,7 @@ def onLoad():
|
|||
except:
|
||||
logging.error("unknown error")
|
||||
logging.debug("unknown error", exc_info=True)
|
||||
raise
|
||||
|
||||
##
|
||||
#
|
||||
|
|
@ -67,6 +70,7 @@ def run(typ,freq,data):
|
|||
@requires: If necessary the configuration hast to be set in the config.ini.
|
||||
|
||||
@return: nothing
|
||||
@exception: nothing, make sure this function will never thrown an exception
|
||||
"""
|
||||
try:
|
||||
#
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue