BOSWatch 3
Python Script to receive and decode German BOS Information with rtl_fm and multimon-NG
 
Loading...
Searching...
No Matches
boswatch.decoder.zveiDecoder.ZveiDecoder Class Reference

ZVEI decoder class. More...

Static Public Member Functions

def decode (data)
 Decodes ZVEI.
 

Static Protected Member Functions

def _solveDoubleTone (data)
 Remove the doubleTone sign (here its the 'E')
 

Detailed Description

ZVEI decoder class.

This class decodes ZVEI data.
First step is to validate the data and _check if the format is correct.
After that the double-tone-sign 'E' is replaced.
In the last step a valid BOSWatch packet is created and returned

Member Function Documentation

◆ decode()

def boswatch.decoder.zveiDecoder.ZveiDecoder.decode (   data)
static

Decodes ZVEI.

    @param data: ZVEI for decoding
    @return BOSWatch ZVEI packet or None
35 def decode(data):
36 r"""!Decodes ZVEI
37
38 @param data: ZVEI for decoding
39 @return BOSWatch ZVEI packet or None"""
40 if re.search("[0-9E]{5}", data[7:12]):
41 logging.debug("found valid ZVEI")
42
43 bwPacket = Packet()
44 bwPacket.set("mode", "zvei")
45 bwPacket.set("tone", ZveiDecoder._solveDoubleTone(data[7:12]))
46
47 return bwPacket
48
49 logging.warning("no valid ZVEI")
50 return None
51

◆ _solveDoubleTone()

def boswatch.decoder.zveiDecoder.ZveiDecoder._solveDoubleTone (   data)
staticprotected

Remove the doubleTone sign (here its the 'E')

    @param data: ZVEI for double tone sign replacement
    @return Double Tone replaced ZVEI
53 def _solveDoubleTone(data):
54 r"""!Remove the doubleTone sign (here its the 'E')
55
56 @param data: ZVEI for double tone sign replacement
57 @return Double Tone replaced ZVEI"""
58 if "E" in data:
59 data_old = data
60 for i in range(1, len(data)):
61 if data[i] == "E":
62 data = data.replace("E", data[i - 1], 1)
63 logging.debug("solve doubleTone: %s -> %s", data_old, data)
64 return data