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.
Files changed (26) hide show
  1. {pyfastnet-2.0.2/pyfastnet.egg-info → pyfastnet-2.0.3}/PKG-INFO +1 -1
  2. {pyfastnet-2.0.2 → pyfastnet-2.0.3}/fastnet_decoder/decode_fastnet.py +10 -8
  3. {pyfastnet-2.0.2 → pyfastnet-2.0.3}/fastnet_decoder/frame_buffer.py +6 -6
  4. {pyfastnet-2.0.2 → pyfastnet-2.0.3/pyfastnet.egg-info}/PKG-INFO +1 -1
  5. {pyfastnet-2.0.2 → pyfastnet-2.0.3}/setup.py +1 -1
  6. {pyfastnet-2.0.2 → pyfastnet-2.0.3}/LICENSE +0 -0
  7. {pyfastnet-2.0.2 → pyfastnet-2.0.3}/MANIFEST.in +0 -0
  8. {pyfastnet-2.0.2 → pyfastnet-2.0.3}/README.md +0 -0
  9. {pyfastnet-2.0.2 → pyfastnet-2.0.3}/fastnet_decoder/__init__.py +0 -0
  10. {pyfastnet-2.0.2 → pyfastnet-2.0.3}/fastnet_decoder/logger.py +0 -0
  11. {pyfastnet-2.0.2 → pyfastnet-2.0.3}/fastnet_decoder/mappings.py +0 -0
  12. {pyfastnet-2.0.2 → pyfastnet-2.0.3}/fastnet_decoder/utils.py +0 -0
  13. {pyfastnet-2.0.2 → pyfastnet-2.0.3}/pyfastnet.egg-info/SOURCES.txt +0 -0
  14. {pyfastnet-2.0.2 → pyfastnet-2.0.3}/pyfastnet.egg-info/dependency_links.txt +0 -0
  15. {pyfastnet-2.0.2 → pyfastnet-2.0.3}/pyfastnet.egg-info/top_level.txt +0 -0
  16. {pyfastnet-2.0.2 → pyfastnet-2.0.3}/setup.cfg +0 -0
  17. {pyfastnet-2.0.2 → pyfastnet-2.0.3}/tests/test_apparent_frame.py +0 -0
  18. {pyfastnet-2.0.2 → pyfastnet-2.0.3}/tests/test_autopilot_frame.py +0 -0
  19. {pyfastnet-2.0.2 → pyfastnet-2.0.3}/tests/test_channels.py +0 -0
  20. {pyfastnet-2.0.2 → pyfastnet-2.0.3}/tests/test_depth_frame.py +0 -0
  21. {pyfastnet-2.0.2 → pyfastnet-2.0.3}/tests/test_format07_msb_regression.py +0 -0
  22. {pyfastnet-2.0.2 → pyfastnet-2.0.3}/tests/test_format08_layout.py +0 -0
  23. {pyfastnet-2.0.2 → pyfastnet-2.0.3}/tests/test_heel_frame.py +0 -0
  24. {pyfastnet-2.0.2 → pyfastnet-2.0.3}/tests/test_rudder_frame.py +0 -0
  25. {pyfastnet-2.0.2 → pyfastnet-2.0.3}/tests/test_tide_frame.py +0 -0
  26. {pyfastnet-2.0.2 → pyfastnet-2.0.3}/tests/test_true_frame.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyfastnet
3
- Version: 2.0.2
3
+ Version: 2.0.3
4
4
  Summary: A Python library for decoding FastNet protocol data streams.
5
5
  Home-page: https://github.com/ghotihook/pyfastnet
6
6
  Author: Alex Salmon
@@ -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()[:16]}...]")
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()[:16]}...]")
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" value={decoded_value['value']} "
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[:8]).hex()
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()[:16]}...]")
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)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyfastnet
3
- Version: 2.0.2
3
+ Version: 2.0.3
4
4
  Summary: A Python library for decoding FastNet protocol data streams.
5
5
  Home-page: https://github.com/ghotihook/pyfastnet
6
6
  Author: Alex Salmon
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name="pyfastnet",
5
- version="2.0.2", # Ensure this matches your intended version
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