add downlink format check

This commit is contained in:
Junzi Sun 2019-06-06 11:46:44 +02:00
parent 57ad40ec57
commit 24806f7e88

View File

@ -6,6 +6,7 @@ import os
import sys
import socket
import time
import pyModeS as pms
from threading import Thread
import traceback
@ -138,8 +139,12 @@ class BaseClient(Thread):
# Other message tupe
continue
if len(msg) not in [14, 28]:
# incomplete message
df = pms.df(msg)
# skip incomplete message
if df in [0, 4, 5, 11] and len(msg) != 14:
continue
if df in [16, 17, 18, 19, 20, 21, 24] and len(msg) != 28:
continue
messages.append([msg, ts])
@ -274,7 +279,7 @@ class BaseClient(Thread):
# Provides the user an option to supply the environment
# variable PYMODES_DEBUG to halt the execution
# for debugging purposes
debug_intent = os.environ.get('PYMODES_DEBUG', None)
debug_intent = os.environ.get('PYMODES_DEBUG', 'false')
if debug_intent.lower() == 'true':
traceback.print_exc()
sys.exit()