Decodes FMS.
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