mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
decreased data frame header size
reduced header size 10%
This commit is contained in:
parent
0f72cb8f8a
commit
b0448ee7ce
|
@ -233,13 +233,20 @@ def arq_data_received(data_in, bytes_per_frame):
|
|||
# decode json objects from data frame to inspect if we received a file or message
|
||||
rawdata = json.loads(complete_data_frame)
|
||||
|
||||
# if datatype is a file, we append to RX_BUFFER, which contains files only
|
||||
if rawdata["datatype"] == "file":
|
||||
# if datatype is a file, we append to RX_BUFFER, which contains files only
|
||||
# dt = datatype
|
||||
# --> f = file
|
||||
# --> m = message
|
||||
# fn = filename
|
||||
# ft = filetype
|
||||
# d = data
|
||||
# crc = checksum
|
||||
if rawdata["dt"] == "f":
|
||||
#logging.debug("RECEIVED FILE --> MOVING DATA TO RX BUFFER")
|
||||
static.RX_BUFFER.append([static.DXCALLSIGN,static.DXGRID,int(time.time()), complete_data_frame])
|
||||
|
||||
# if datatype is a file, we append to RX_MSG_BUFFER, which contains messages only
|
||||
if rawdata["datatype"] == "message":
|
||||
if rawdata["dt"] == "m":
|
||||
static.RX_MSG_BUFFER.append([static.DXCALLSIGN,static.DXGRID,int(time.time()), complete_data_frame])
|
||||
#logging.debug("RECEIVED MESSAGE --> MOVING DATA TO MESSAGE BUFFER")
|
||||
|
||||
|
|
29
tnc/sock.py
29
tnc/sock.py
|
@ -140,8 +140,15 @@ class ThreadedTCPRequestHandler(socketserver.BaseRequestHandler):
|
|||
static.DXCALLSIGN = bytes(dxcallsign, 'utf-8')
|
||||
static.DXCALLSIGN_CRC8 = helpers.get_crc_8(
|
||||
static.DXCALLSIGN)
|
||||
|
||||
rawdata = {"datatype": "file", "filename": filename, "filetype": filetype,"data": data, "checksum": checksum}
|
||||
|
||||
# dt = datatype
|
||||
# --> f = file
|
||||
# --> m = message
|
||||
# fn = filename
|
||||
# ft = filetype
|
||||
# d = data
|
||||
# crc = checksum
|
||||
rawdata = {"dt": "f", "fn": filename, "ft": filetype,"d": data, "crc": checksum}
|
||||
dataframe = json.dumps(rawdata)
|
||||
data_out = bytes(dataframe, 'utf-8')
|
||||
|
||||
|
@ -158,15 +165,21 @@ class ThreadedTCPRequestHandler(socketserver.BaseRequestHandler):
|
|||
dxcallsign = received_json["dxcallsign"]
|
||||
mode = int(received_json["mode"])
|
||||
n_frames = int(received_json["n_frames"])
|
||||
data = received_json["data"]
|
||||
checksum = received_json["checksum"]
|
||||
data = received_json["d"] # d = data
|
||||
checksum = received_json["crc"] # crc = checksum
|
||||
|
||||
|
||||
static.DXCALLSIGN = bytes(dxcallsign, 'utf-8')
|
||||
static.DXCALLSIGN_CRC8 = helpers.get_crc_8(
|
||||
static.DXCALLSIGN)
|
||||
|
||||
rawdata = {"datatype": "message","data": data, "checksum": checksum}
|
||||
static.DXCALLSIGN_CRC8 = helpers.get_crc_8(static.DXCALLSIGN)
|
||||
|
||||
# dt = datatype
|
||||
# --> f = file
|
||||
# --> m = message
|
||||
# fn = filename
|
||||
# ft = filetype
|
||||
# d = data
|
||||
# crc = checksum
|
||||
rawdata = {"dt": "m","d": data, "crc": checksum}
|
||||
dataframe = json.dumps(rawdata)
|
||||
data_out = bytes(dataframe, 'utf-8')
|
||||
|
||||
|
|
Loading…
Reference in a new issue