pyfastnet 2.0.2__tar.gz → 2.0.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pyfastnet-2.0.2/pyfastnet.egg-info → pyfastnet-2.0.3}/PKG-INFO +1 -1
- {pyfastnet-2.0.2 → pyfastnet-2.0.3}/fastnet_decoder/decode_fastnet.py +10 -8
- {pyfastnet-2.0.2 → pyfastnet-2.0.3}/fastnet_decoder/frame_buffer.py +6 -6
- {pyfastnet-2.0.2 → pyfastnet-2.0.3/pyfastnet.egg-info}/PKG-INFO +1 -1
- {pyfastnet-2.0.2 → pyfastnet-2.0.3}/setup.py +1 -1
- {pyfastnet-2.0.2 → pyfastnet-2.0.3}/LICENSE +0 -0
- {pyfastnet-2.0.2 → pyfastnet-2.0.3}/MANIFEST.in +0 -0
- {pyfastnet-2.0.2 → pyfastnet-2.0.3}/README.md +0 -0
- {pyfastnet-2.0.2 → pyfastnet-2.0.3}/fastnet_decoder/__init__.py +0 -0
- {pyfastnet-2.0.2 → pyfastnet-2.0.3}/fastnet_decoder/logger.py +0 -0
- {pyfastnet-2.0.2 → pyfastnet-2.0.3}/fastnet_decoder/mappings.py +0 -0
- {pyfastnet-2.0.2 → pyfastnet-2.0.3}/fastnet_decoder/utils.py +0 -0
- {pyfastnet-2.0.2 → pyfastnet-2.0.3}/pyfastnet.egg-info/SOURCES.txt +0 -0
- {pyfastnet-2.0.2 → pyfastnet-2.0.3}/pyfastnet.egg-info/dependency_links.txt +0 -0
- {pyfastnet-2.0.2 → pyfastnet-2.0.3}/pyfastnet.egg-info/top_level.txt +0 -0
- {pyfastnet-2.0.2 → pyfastnet-2.0.3}/setup.cfg +0 -0
- {pyfastnet-2.0.2 → pyfastnet-2.0.3}/tests/test_apparent_frame.py +0 -0
- {pyfastnet-2.0.2 → pyfastnet-2.0.3}/tests/test_autopilot_frame.py +0 -0
- {pyfastnet-2.0.2 → pyfastnet-2.0.3}/tests/test_channels.py +0 -0
- {pyfastnet-2.0.2 → pyfastnet-2.0.3}/tests/test_depth_frame.py +0 -0
- {pyfastnet-2.0.2 → pyfastnet-2.0.3}/tests/test_format07_msb_regression.py +0 -0
- {pyfastnet-2.0.2 → pyfastnet-2.0.3}/tests/test_format08_layout.py +0 -0
- {pyfastnet-2.0.2 → pyfastnet-2.0.3}/tests/test_heel_frame.py +0 -0
- {pyfastnet-2.0.2 → pyfastnet-2.0.3}/tests/test_rudder_frame.py +0 -0
- {pyfastnet-2.0.2 → pyfastnet-2.0.3}/tests/test_tide_frame.py +0 -0
- {pyfastnet-2.0.2 → pyfastnet-2.0.3}/tests/test_true_frame.py +0 -0
|
@@ -33,11 +33,11 @@ def decode_frame(frame: bytes) -> dict:
|
|
|
33
33
|
body_checksum = frame[-1]
|
|
34
34
|
|
|
35
35
|
if calculate_checksum(frame[:4]) != header_checksum:
|
|
36
|
-
logger.debug(f"FRAME discard header-checksum [{frame.hex()
|
|
36
|
+
logger.debug(f"FRAME discard header-checksum [{frame.hex()}]")
|
|
37
37
|
return {"error": "Header checksum mismatch"}
|
|
38
38
|
|
|
39
39
|
if calculate_checksum(body) != body_checksum:
|
|
40
|
-
logger.debug(f"FRAME discard body-checksum [{frame.hex()
|
|
40
|
+
logger.debug(f"FRAME discard body-checksum [{frame.hex()}]")
|
|
41
41
|
return {"error": "Body checksum mismatch"}
|
|
42
42
|
|
|
43
43
|
if len(body) < 2 or len(body) != body_size:
|
|
@@ -73,20 +73,22 @@ def decode_frame(frame: bytes) -> dict:
|
|
|
73
73
|
data_bytes = body[index:index + data_length]
|
|
74
74
|
index += data_length
|
|
75
75
|
|
|
76
|
-
logger.debug(
|
|
77
|
-
f" CH 0x{channel_id:02X} {channel_name} "
|
|
78
|
-
f"fmt=0x{format_byte:02X} data=[{data_bytes.hex()}]"
|
|
79
|
-
)
|
|
80
|
-
|
|
81
76
|
decoded_value = decode_format_and_data(channel_id, format_byte, data_bytes)
|
|
82
77
|
decoded_data["values"][channel_name] = decoded_value
|
|
83
78
|
|
|
84
79
|
if decoded_value:
|
|
85
80
|
logger.debug(
|
|
86
|
-
f"
|
|
81
|
+
f" CH 0x{channel_id:02X} {channel_name} "
|
|
82
|
+
f"fmt=0x{format_byte:02X} data=[{data_bytes.hex()}] "
|
|
83
|
+
f"value={decoded_value['value']} "
|
|
87
84
|
f"display='{decoded_value['display_text']}' "
|
|
88
85
|
f"layout={decoded_value['layout']}"
|
|
89
86
|
)
|
|
87
|
+
else:
|
|
88
|
+
logger.debug(
|
|
89
|
+
f" CH 0x{channel_id:02X} {channel_name} "
|
|
90
|
+
f"fmt=0x{format_byte:02X} data=[{data_bytes.hex()}] (no decode)"
|
|
91
|
+
)
|
|
90
92
|
|
|
91
93
|
return decoded_data
|
|
92
94
|
|
|
@@ -52,15 +52,15 @@ class FrameBuffer:
|
|
|
52
52
|
frame = self.buffer[:full_frame_length]
|
|
53
53
|
body = self.buffer[5:full_frame_length - 1]
|
|
54
54
|
body_checksum = self.buffer[full_frame_length - 1]
|
|
55
|
-
frame_hex = bytes(frame
|
|
55
|
+
frame_hex = bytes(frame).hex()
|
|
56
56
|
|
|
57
57
|
if calculate_checksum(self.buffer[:4]) != header_checksum:
|
|
58
|
-
logger.debug(f"FRAME discard header-checksum [{frame_hex}
|
|
58
|
+
logger.debug(f"FRAME discard header-checksum [{frame_hex}]")
|
|
59
59
|
self.buffer = self.buffer[1:]
|
|
60
60
|
continue
|
|
61
61
|
|
|
62
62
|
if calculate_checksum(body) != body_checksum:
|
|
63
|
-
logger.debug(f"FRAME discard body-checksum [{frame_hex}
|
|
63
|
+
logger.debug(f"FRAME discard body-checksum [{frame_hex}]")
|
|
64
64
|
self.buffer = self.buffer[1:]
|
|
65
65
|
continue
|
|
66
66
|
|
|
@@ -73,7 +73,7 @@ class FrameBuffer:
|
|
|
73
73
|
logger.debug(
|
|
74
74
|
f"FRAME cmd={command_name} "
|
|
75
75
|
f"0x{to_address:02X}←0x{from_address:02X} "
|
|
76
|
-
f"body={body_size}B [{frame_hex}
|
|
76
|
+
f"body={body_size}B [{frame_hex}]"
|
|
77
77
|
)
|
|
78
78
|
self.decode_and_queue_frame(frame, command_name)
|
|
79
79
|
|
|
@@ -88,11 +88,11 @@ class FrameBuffer:
|
|
|
88
88
|
names_str += f", +{len(channel_names) - 4} more"
|
|
89
89
|
try:
|
|
90
90
|
self.frame_queue.put_nowait(decoded_frame)
|
|
91
|
-
logger.debug(f"QUEUE {len(channel_names)} channel(s) [{names_str}]")
|
|
91
|
+
logger.debug(f" QUEUE {len(channel_names)} channel(s) [{names_str}]")
|
|
92
92
|
except Full:
|
|
93
93
|
logger.warning("Frame queue full, dropping frame.")
|
|
94
94
|
else:
|
|
95
|
-
logger.debug(f"QUEUE fail decode error [{frame.hex()
|
|
95
|
+
logger.debug(f" QUEUE fail decode error [{frame.hex()}]")
|
|
96
96
|
|
|
97
97
|
def get_buffer_size(self):
|
|
98
98
|
return len(self.buffer)
|
|
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
|
|
|
2
2
|
|
|
3
3
|
setup(
|
|
4
4
|
name="pyfastnet",
|
|
5
|
-
version="2.0.
|
|
5
|
+
version="2.0.3", # Ensure this matches your intended version
|
|
6
6
|
author="Alex Salmon",
|
|
7
7
|
author_email="alex@ivila.net",
|
|
8
8
|
description="A Python library for decoding FastNet protocol data streams.",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|