2015-05-18 21:04:10 +02:00
|
|
|
#!/usr/bin/python
|
2015-07-13 10:19:45 +02:00
|
|
|
# -*- coding: UTF-8 -*-
|
2015-05-18 21:04:10 +02:00
|
|
|
|
2015-07-07 14:08:46 +02:00
|
|
|
"""
|
|
|
|
|
template plugin to show the function and usage of plugins
|
2015-07-08 09:45:36 +02:00
|
|
|
feel free to edit to yout own plugin
|
|
|
|
|
please edit theese desciption, the @author-Tag and the @requires-Tag
|
|
|
|
|
For more information take a look into the other plugins
|
2015-07-07 14:08:46 +02:00
|
|
|
|
|
|
|
|
@author: Jens Herrmann
|
|
|
|
|
@author: Bastian Schroll
|
|
|
|
|
|
|
|
|
|
@requires: none
|
|
|
|
|
"""
|
|
|
|
|
|
2015-05-20 15:20:40 +02:00
|
|
|
#
|
2015-07-07 14:08:46 +02:00
|
|
|
# Imports
|
2015-05-20 15:20:40 +02:00
|
|
|
#
|
2015-05-22 16:44:23 +02:00
|
|
|
import logging # Global logger
|
|
|
|
|
from includes import globals # Global variables
|
2015-07-07 14:08:46 +02:00
|
|
|
|
|
|
|
|
# Helper function, uncomment to use
|
|
|
|
|
#from includes.helper import timeHandler
|
|
|
|
|
#from includes.helper import wildcardHandler
|
2015-07-08 09:45:36 +02:00
|
|
|
from includes.helper import configHandler
|
2015-05-22 16:44:23 +02:00
|
|
|
|
2015-06-29 12:19:44 +02:00
|
|
|
##
|
|
|
|
|
#
|
2015-06-29 23:24:48 +02:00
|
|
|
# onLoad (init) function of plugin
|
|
|
|
|
# will be called one time by the pluginLoader on start
|
2015-06-29 12:19:44 +02:00
|
|
|
#
|
|
|
|
|
def onLoad():
|
|
|
|
|
"""
|
|
|
|
|
While loading the plugins by pluginLoader.loadPlugins()
|
2015-06-29 23:24:48 +02:00
|
|
|
this onLoad() routine is called one time for initialize the plugin
|
2015-06-29 12:19:44 +02:00
|
|
|
|
|
|
|
|
@requires: nothing
|
2015-07-02 09:02:49 +02:00
|
|
|
|
2015-06-29 12:19:44 +02:00
|
|
|
@return: nothing
|
2015-06-29 23:24:48 +02:00
|
|
|
@exception: Exception if init has an fatal error so that the plugin couldn't work
|
2015-07-02 09:02:49 +02:00
|
|
|
|
2015-06-29 12:19:44 +02:00
|
|
|
"""
|
|
|
|
|
try:
|
|
|
|
|
########## User onLoad CODE ##########
|
2015-06-29 17:06:11 +02:00
|
|
|
pass
|
2015-06-29 12:19:44 +02:00
|
|
|
########## User onLoad CODE ##########
|
|
|
|
|
except:
|
|
|
|
|
logging.error("unknown error")
|
|
|
|
|
logging.debug("unknown error", exc_info=True)
|
2015-06-29 23:24:48 +02:00
|
|
|
raise
|
2015-06-29 12:19:44 +02:00
|
|
|
|
2015-06-23 18:37:32 +02:00
|
|
|
##
|
|
|
|
|
#
|
|
|
|
|
# Main function of plugin
|
|
|
|
|
# will be called by the alarmHandler
|
|
|
|
|
#
|
2015-05-18 14:56:01 +02:00
|
|
|
def run(typ,freq,data):
|
2015-06-23 18:37:32 +02:00
|
|
|
"""
|
|
|
|
|
This function is the implementation of the Plugin.
|
2015-07-02 09:02:49 +02:00
|
|
|
|
2015-06-23 18:37:32 +02:00
|
|
|
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.
|
2015-07-02 09:02:49 +02:00
|
|
|
|
2015-06-23 18:37:32 +02:00
|
|
|
@return: nothing
|
2015-06-29 23:24:48 +02:00
|
|
|
@exception: nothing, make sure this function will never thrown an exception
|
2015-06-23 18:37:32 +02:00
|
|
|
"""
|
2015-05-18 22:10:23 +02:00
|
|
|
try:
|
2015-07-08 09:45:36 +02:00
|
|
|
if configHandler.checkConfig("template"): #read and debug the config (let empty if no config used)
|
2015-07-02 09:02:49 +02:00
|
|
|
|
|
|
|
|
########## User Plugin CODE ##########
|
2015-06-29 12:19:44 +02:00
|
|
|
if typ == "FMS":
|
|
|
|
|
logging.warning("%s not supported", typ)
|
|
|
|
|
elif typ == "ZVEI":
|
|
|
|
|
logging.warning("%s not supported", typ)
|
|
|
|
|
elif typ == "POC":
|
|
|
|
|
logging.warning("%s not supported", typ)
|
|
|
|
|
else:
|
2015-07-02 09:02:49 +02:00
|
|
|
logging.warning("Invalid Typ: %s", typ)
|
2015-06-29 12:19:44 +02:00
|
|
|
########## User Plugin CODE ##########
|
2015-07-02 09:02:49 +02:00
|
|
|
|
2015-05-18 22:10:23 +02:00
|
|
|
except:
|
2015-06-23 18:37:32 +02:00
|
|
|
logging.error("unknown error")
|
2015-07-02 09:02:49 +02:00
|
|
|
logging.debug("unknown error", exc_info=True)
|