BOSWatch/plugins/interface.txt
2015-07-02 21:39:43 +02:00

115 lines
2.7 KiB
Plaintext

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']
ZVEI:
- zvei
- description
FMS:
- fms
- status
- direction
- directionText
- tsi
- description
POCSAG:
- ric
- function
- functionChar
- msg
- bitrate
- description
Global Objects:
---------------
1.)
import logging # Global logger
Message into Log: logging.LOGLEVEL("MESSAGE")
Loglevel: debug|info|warning|error|exception|critical
2.)
import globals # Global variables
reads Data from the config.ini
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
"""
Global Functions for plugins:
-----------------------------
# for format see https://docs.python.org/2/library/time.html#time.strftime
#
from includes.helper import timeHandler
timeHandler.curtime("FORMAT") # without format string the function returns with "%d.%m.%Y %H:%M:%S"
timeHandler.getDate() # Gets the date in "%d.%m.%Y"
timeHandler.getTime() # Gets the time in %H:%M:%S
timeHandler.getTimestamp() # Gets a integer timestamp
# replace all the standard wildcards in the given text
# the function needs the data[] var
# %TIME% = Time (by script)
# %DATE% = Date (by script)
#
# %FMS% = FMS Code
# %STATUS% = FMS Status
# %DIR% = Direction of the telegram (0/1)
# %DIRT% = Direction of the telegram (Text-String)
# %TSI% = Tactical Short Information (I-IV)
#
# %ZVEI% = ZVEI 5-tone Code
#
# %RIC% = Pocsag RIC
# %FUNC% = Pocsac function/Subric (1-4)
# %FUNCCHAR% = Pocsac function/Subric als character (a-d)
# %MSG% = Message of the Pocsag telegram
# %BITRATE% = Bitrate of the Pocsag telegram
# %DESCR% = Description from csv-file
#
from includes.helper import wildcardHandler
wildcardHandler.replaceWildcards("TEXT",data[])