Backend Source-code

LoggerPlugin.py

This class is imported by any plugin written for RTOC.

It includes all functions to interact with RTOC. Every plugin must inherit this class! Your plugin must look like this

::

    from RTOC.LoggerPlugin import LoggerPlugin

    class Plugin(LoggerPlugin):
        def __init__(self, *args, **kwargs):
            LoggerPlugin.__init__(self, *args, **kwargs)
            ...
        ...

If you need to pass arguments to your class initialization, use kwargs. (‘stream’, ‘plot’, ‘event’, ‘telegramBot’ cannot be used as kwarg-name)

jsonsocket.py

RTOC.RTLogger Submodules

RTOC.RTLogger.Daemon module

Generic linux daemon base class for python 3.x.

Source: https://web.archive.org/web/20160320091458/http://www.jejik.com/files/examples/daemon3x.py

class Daemon(pidfile)[source]

Bases: object

A generic daemon class.

Usage: subclass the daemon class and override the run() method.

daemonize()[source]

Deamonize class. UNIX double fork mechanism.

delpid()[source]
restart()[source]

Restart the daemon.

run()[source]

You should override this method when you subclass Daemon.

It will be called after the process has been daemonized by start() or restart().

start()[source]

Start the daemon.

stop()[source]

Stop the daemon.

RTOC.RTLogger.DeviceFunctions module

RTOC.RTLogger.EventActionFunctions module

class EventActionFunctions[source]

Bases: object

This class contains all global event/action-specific functions of RTLogger

addGlobalAction(name='testAction', listenID='testID', script='', parameters='', active=True)[source]
addGlobalEvent(name='testEvent', cond='', text='TestEvent', priority=0, retur='', id='testID', trigger='rising', sname='', dname='', active=True)[source]
checkGlobalActions(actions)[source]

Checks if actions are valid. Will add the key ‘errors’ to each event. ‘errors’ will be True, if it’s not valid.

Parameters:actions (dict) – actions to be checked.
Returns:Input-actions + ‘errors’-key
Return type:actions (dict)
checkGlobalEvents(events)[source]

Checks if events are valid. Will add the key ‘errors’ to each event. ‘errors’ will be True, if it’s not valid.

Parameters:events (dict) – events to be checked.
Returns:Input-events + ‘errors’-key
Return type:events (dict)
editGlobalAction(name='testAction', listenID='testID', script='', parameters='', active=True)[source]
editGlobalEvent(name='testEvent', cond='', text='TestEvent', priority=0, retur='', id='testID', trigger='rising', sname='', dname='', active=True)[source]
loadGlobalActions()[source]

Loads global actions from file and stores them in dict ‘self.globalActions’

loadGlobalEvents()[source]

Loads global events from file and stores them in dict ‘self.globalEvents’

performGlobalActions(id, value)[source]
performGlobalEvents(y, unit, devicename, signalname, x=None)[source]

Performs global events, if their conditions are fullfilled. This function is called any time data is added to signals.

Parameters:
  • y (float) – y-value of signal (not needed)
  • unit (str) – unit of signal (not needed)
  • devicename (str) – devicename of signal
  • signalname (str) – signalname of signal
  • x (float) – x-value of signal (not needed)
printGlobalActions()[source]
printGlobalEvents(wo=True)[source]
removeGlobalAction(key)[source]
removeGlobalEvent(key)[source]
resetGlobalEventState()[source]
saveGlobalActions()[source]

Saves global actions from ‘self.globalActions’ to file.

saveGlobalEvents()[source]

Saves global events from ‘self.globalEvents’ to file.

triggerGlobalAction(key)[source]
triggerGlobalEvent(key)[source]
translate(id, text)[source]

RTOC.RTLogger.NetworkFunctions module

RTOC.RTLogger.RTLogger module

RTOC.RTLogger.RTOC_Web module

RTOC.RTLogger.RTOC_Web_standalone module

RTOC.RTLogger.RTRemote module

RTOC.RTLogger.RT_data module

RTOC.RTLogger.ScriptFunctions module

class ScriptFunctions[source]

Bases: object

This class contains all script-execution-specific functions of RTLogger

checkCondition(conditionStr)[source]
createConditionFunction(s)[source]
createFunction(s)[source]
executeScript(scriptStr)[source]
generateCode(s, condition=False)[source]
generateTriggerCode(scriptStr)[source]
printfunction()[source]
replaceGlobalVariables(s)[source]
replaceLibraryFunctions(s)[source]
replaceLoggerFunctions(s)[source]
replacePluginMethods(s)[source]
replacePluginParameters(s)[source]
replaceSignalNames(s)[source]
replaceTelegramFunctions(s)[source]
triggerExpressionHandler(expression)[source]

RTOC.RTLogger.importCode module

importCode(code, name, add_to_sys_modules=0)[source]

Import dynamically generated code as a module. code is the object containing the code (a string, a file handle or an actual compiled code object, same types as accepted by an exec statement). The name is the name to give to the module, and the final argument says wheter to add it to sys.modules or not. If it is added, a subsequent import statement using name will return this module. If it is not added to sys.modules import will try to load it in the normal fashion.

import foo

is equivalent to

foofile = open(“/path/to/foo.py”) foo = importCode(foofile,”foo”,1)

Returns a newly generated module.

RTOC.RTLogger.loggerlib module

RTOC.RTLogger.scriptLibrary module

RTOC.RTLogger.telegramBot module