Started implementing message class, parsing rx and tx pgn list
This commit is contained in:
17
parser.py
17
parser.py
@@ -26,6 +26,22 @@ def parse_60928(buf, device):
|
||||
device.sysinstance = buf[7] & 0x0f # 4bit
|
||||
return struct.unpack_from('>Q', buf, 0)[0]
|
||||
|
||||
def parse_126464(buf, device):
|
||||
# PGN Lists: tx and rx
|
||||
# Byte 1: 0 = Transmit PGN list
|
||||
# 1 = Receive PGN list
|
||||
functioncode = buf[0]
|
||||
# set of 24bit PGNs (little endian)
|
||||
values = { buf[i] | (buf[i+1] << 8) | (buf[i+2] << 16)
|
||||
for i in range(1, len(buf)-4, 3) }
|
||||
if functioncode == 0:
|
||||
device.pgns_transmit = values
|
||||
elif functioncode == 1:
|
||||
device.pgns_receive = values
|
||||
else:
|
||||
return
|
||||
device.has_pgnlist = True
|
||||
|
||||
def parse_126983(buf, source):
|
||||
# Alert
|
||||
# PGN 126984 is response
|
||||
@@ -93,7 +109,6 @@ def parse_126992(buf, source):
|
||||
def parse_126993(buf, device):
|
||||
# Heartbeat
|
||||
print(f"Heartbeat from {device.address}")
|
||||
print(buf)
|
||||
|
||||
def parse_126996(buf, device):
|
||||
# Product information
|
||||
|
||||
Reference in New Issue
Block a user