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

FMS decoder class. More...

Static Public Member Functions

def decode (data)
 Decodes FMS.
 

Detailed Description

FMS decoder class.

This class decodes FMS data.
First step is to validate the data and _check if the format is correct.
In the last step a valid BOSWatch packet is created and returned

Member Function Documentation

◆ decode()

def boswatch.decoder.fmsDecoder.FmsDecoder.decode (   data)
static

Decodes FMS.

    @param data: FMS for decoding
    @return BOSWatch FMS packet or None
34 def decode(data):
35 r"""!Decodes FMS
36
37 @param data: FMS for decoding
38 @return BOSWatch FMS packet or None"""
39 if "CRC correct" in data:
40 service = data[19]
41 country = data[36]
42 location = data[61:63]
43 vehicle = data[72:76]
44 status = data[84]
45 direction = data[101]
46 directionText = data[103:110]
47 tacticalInfo = data[114:117]
48 fms_id = service + country + location + vehicle + status + direction
49
50 if re.search("[0-9a-f]{8}[0-9a-f][01]", fms_id):
51 logging.debug("found valid FMS")
52
53 bwPacket = Packet()
54 bwPacket.set("mode", "fms")
55 bwPacket.set("fms", fms_id)
56 bwPacket.set("service", service)
57 bwPacket.set("country", country)
58 bwPacket.set("location", location)
59 bwPacket.set("vehicle", vehicle)
60 bwPacket.set("status", status)
61 bwPacket.set("direction", direction)
62 bwPacket.set("directionText", directionText)
63 bwPacket.set("tacticalInfo", tacticalInfo)
64
65 return bwPacket
66
67 logging.warning("no valid FMS")
68 return None
69 logging.warning("CRC Error")
70 return None