BOSWatch 3
Python Script to receive and decode German BOS Information with rtl_fm and multimon-NG
 
Loading...
Searching...
No Matches
module.descriptor.BoswatchModule Class Reference

Adds descriptions to bwPackets. More...

Public Member Functions

def __init__ (self, config)
 Do not change anything here!
 
def onLoad (self)
 Called by import of the plugin.
 
def doWork (self, bwPacket)
 start an run of the module.
 
def onUnload (self)
 Called by destruction of the plugin.
 
def __init__ (self, moduleName, config)
 init preload some needed locals and then call onLoad() directly
 
def onLoad (self)
 Called by import of the module can be inherited.
 
def doWork (self, bwPacket)
 Called module run can be inherited.
 
def onUnload (self)
 Called on shutdown of boswatch can be inherited.
 

Additional Inherited Members

- Static Public Member Functions inherited from module.moduleBase.ModuleBase
def registerWildcard (newWildcard, bwPacketField)
 Register a new wildcard.
 
- Data Fields inherited from module.moduleBase.ModuleBase
 config
 
- Protected Member Functions inherited from module.moduleBase.ModuleBase
def _cleanup (self)
 Cleanup routine calls onUnload() directly.
 
def _run (self, bwPacket)
 start an run of the module.
 
def _getStatistics (self)
 Returns statistical information's from last module run.
 
- Protected Attributes inherited from module.moduleBase.ModuleBase
 _moduleName
 
 _cumTime
 
 _moduleTime
 
 _runCount
 
 _moduleErrorCount
 
- Static Protected Attributes inherited from module.moduleBase.ModuleBase
list _modulesActive = []
 

Detailed Description

Adds descriptions to bwPackets.

Constructor & Destructor Documentation

◆ __init__()

def module.descriptor.BoswatchModule.__init__ (   self,
  config 
)

Do not change anything here!

Reimplemented from module.moduleBase.ModuleBase.

30 def __init__(self, config):
31 r"""!Do not change anything here!"""
32 super().__init__(__name__, config) # you can access the config class on 'self.config'
33

Member Function Documentation

◆ onLoad()

def module.descriptor.BoswatchModule.onLoad (   self)

Called by import of the plugin.

Reimplemented from module.moduleBase.ModuleBase.

34 def onLoad(self):
35 r"""!Called by import of the plugin"""
36 for descriptor in self.config:
37 if descriptor.get("wildcard", default=None):
38 self.registerWildcard(descriptor.get("wildcard"), descriptor.get("descrField"))
39

◆ doWork()

def module.descriptor.BoswatchModule.doWork (   self,
  bwPacket 
)

start an run of the module.

    @param bwPacket: A BOSWatch packet instance

Reimplemented from module.moduleBase.ModuleBase.

40 def doWork(self, bwPacket):
41 r"""!start an run of the module.
42
43 @param bwPacket: A BOSWatch packet instance"""
44 for descriptor in self.config:
45 if not bwPacket.get(descriptor.get("scanField")):
46 break # scanField is not available in this packet
47 bwPacket.set(descriptor.get("descrField"), bwPacket.get(descriptor.get("scanField")))
48 for description in descriptor.get("descriptions"):
49 if str(description.get("for")) == bwPacket.get(descriptor.get("scanField")):
50 logging.debug("Description '%s' added in packet field '%s'",
51 description.get("add"), descriptor.get("descrField"))
52 bwPacket.set(descriptor.get("descrField"), description.get("add"))
53 break # this descriptor has found a description - run next descriptor
54 return bwPacket
55

◆ onUnload()

def module.descriptor.BoswatchModule.onUnload (   self)

Called by destruction of the plugin.

Reimplemented from module.moduleBase.ModuleBase.

56 def onUnload(self):
57 r"""!Called by destruction of the plugin"""
58 pass