pyfastnet 2.0.14__tar.gz → 2.0.16__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.14/pyfastnet.egg-info → pyfastnet-2.0.16}/PKG-INFO +44 -16
- {pyfastnet-2.0.14 → pyfastnet-2.0.16}/README.md +2 -3
- {pyfastnet-2.0.14 → pyfastnet-2.0.16}/fastnet_decoder/__init__.py +2 -0
- {pyfastnet-2.0.14 → pyfastnet-2.0.16}/fastnet_decoder/decode_fastnet.py +2 -2
- {pyfastnet-2.0.14 → pyfastnet-2.0.16/pyfastnet.egg-info}/PKG-INFO +44 -16
- {pyfastnet-2.0.14 → pyfastnet-2.0.16}/pyfastnet.egg-info/SOURCES.txt +16 -9
- pyfastnet-2.0.16/pyfastnet.egg-info/requires.txt +3 -0
- pyfastnet-2.0.16/pyproject.toml +44 -0
- pyfastnet-2.0.16/tests/test_autopilot.py +74 -0
- pyfastnet-2.0.16/tests/test_awa.py +60 -0
- pyfastnet-2.0.16/tests/test_aws.py +36 -0
- pyfastnet-2.0.16/tests/test_battery.py +29 -0
- pyfastnet-2.0.16/tests/test_boatspeed.py +34 -0
- pyfastnet-2.0.16/tests/test_heading.py +80 -0
- pyfastnet-2.0.16/tests/test_heel_trim.py +100 -0
- pyfastnet-2.0.16/tests/test_sea_temp.py +64 -0
- pyfastnet-2.0.16/tests/test_sog.py +39 -0
- pyfastnet-2.0.16/tests/test_tidal.py +57 -0
- pyfastnet-2.0.16/tests/test_timer.py +30 -0
- pyfastnet-2.0.16/tests/test_twa.py +61 -0
- pyfastnet-2.0.16/tests/test_twd.py +60 -0
- pyfastnet-2.0.16/tests/test_tws.py +57 -0
- pyfastnet-2.0.14/MANIFEST.in +0 -17
- pyfastnet-2.0.14/setup.py +0 -20
- pyfastnet-2.0.14/tests/test_apparent_frame.py +0 -35
- pyfastnet-2.0.14/tests/test_autopilot_frame.py +0 -33
- pyfastnet-2.0.14/tests/test_channels.py +0 -406
- pyfastnet-2.0.14/tests/test_heel_frame.py +0 -35
- pyfastnet-2.0.14/tests/test_rudder_frame.py +0 -34
- pyfastnet-2.0.14/tests/test_tide_frame.py +0 -33
- pyfastnet-2.0.14/tests/test_true_frame.py +0 -33
- {pyfastnet-2.0.14 → pyfastnet-2.0.16}/LICENSE +0 -0
- {pyfastnet-2.0.14 → pyfastnet-2.0.16}/fastnet_decoder/frame_buffer.py +0 -0
- {pyfastnet-2.0.14 → pyfastnet-2.0.16}/fastnet_decoder/logger.py +0 -0
- {pyfastnet-2.0.14 → pyfastnet-2.0.16}/fastnet_decoder/mappings.py +0 -0
- {pyfastnet-2.0.14 → pyfastnet-2.0.16}/fastnet_decoder/utils.py +0 -0
- {pyfastnet-2.0.14 → pyfastnet-2.0.16}/pyfastnet.egg-info/dependency_links.txt +0 -0
- {pyfastnet-2.0.14 → pyfastnet-2.0.16}/pyfastnet.egg-info/top_level.txt +0 -0
- {pyfastnet-2.0.14 → pyfastnet-2.0.16}/setup.cfg +0 -0
- {pyfastnet-2.0.14 → pyfastnet-2.0.16}/tests/test_depth_frame.py +0 -0
- {pyfastnet-2.0.14 → pyfastnet-2.0.16}/tests/test_format07_msb_regression.py +0 -0
- {pyfastnet-2.0.14 → pyfastnet-2.0.16}/tests/test_format08_layout.py +0 -0
- {pyfastnet-2.0.14 → pyfastnet-2.0.16}/tests/test_latlon_frame.py +0 -0
|
@@ -1,25 +1,54 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pyfastnet
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.16
|
|
4
4
|
Summary: A Python library for decoding FastNet protocol data streams.
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
Author-email: Alex Salmon <alex@ivila.net>
|
|
6
|
+
License: MIT License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2025 ghotihook
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
SOFTWARE.
|
|
27
|
+
|
|
28
|
+
Project-URL: Homepage, https://github.com/ghotihook/pyfastnet
|
|
29
|
+
Project-URL: Repository, https://github.com/ghotihook/pyfastnet
|
|
30
|
+
Project-URL: Issues, https://github.com/ghotihook/pyfastnet/issues
|
|
31
|
+
Keywords: fastnet,bandg,hydra,h2000,marine,sailing,decoder
|
|
32
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
33
|
+
Classifier: Intended Audience :: Developers
|
|
9
34
|
Classifier: License :: OSI Approved :: MIT License
|
|
10
35
|
Classifier: Operating System :: OS Independent
|
|
36
|
+
Classifier: Programming Language :: Python :: 3
|
|
37
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
38
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
39
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
40
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
41
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
42
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
43
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
44
|
+
Classifier: Topic :: Communications
|
|
45
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
11
46
|
Requires-Python: >=3.7
|
|
12
47
|
Description-Content-Type: text/markdown
|
|
13
48
|
License-File: LICENSE
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
Dynamic: classifier
|
|
17
|
-
Dynamic: description
|
|
18
|
-
Dynamic: description-content-type
|
|
19
|
-
Dynamic: home-page
|
|
49
|
+
Provides-Extra: test
|
|
50
|
+
Requires-Dist: pytest>=7.0; extra == "test"
|
|
20
51
|
Dynamic: license-file
|
|
21
|
-
Dynamic: requires-python
|
|
22
|
-
Dynamic: summary
|
|
23
52
|
|
|
24
53
|
# pyfastnet
|
|
25
54
|
|
|
@@ -153,10 +182,9 @@ fb.get_buffer_contents() # hex string of buffer contents
|
|
|
153
182
|
|
|
154
183
|
## Companion apps
|
|
155
184
|
|
|
156
|
-
- [fastnet2ip](https://github.com/ghotihook/fastnet2ip) — reads FastNet from serial
|
|
157
|
-
- [fastnet2ip_n2k](https://github.com/ghotihook/fastnet2ip_n2k) — reads FastNet from serial, broadcasts NMEA 2000 via UDP
|
|
185
|
+
- [fastnet2ip](https://github.com/ghotihook/fastnet2ip) — reads FastNet from serial and broadcasts it over UDP as either NMEA 0183 or NMEA 2000 (selected with `--output`). Install with `pipx install fastnet2ip`.
|
|
158
186
|
|
|
159
|
-
|
|
187
|
+
Runs on Raspberry Pi, macOS, or Linux.
|
|
160
188
|
|
|
161
189
|
## Acknowledgments
|
|
162
190
|
|
|
@@ -130,10 +130,9 @@ fb.get_buffer_contents() # hex string of buffer contents
|
|
|
130
130
|
|
|
131
131
|
## Companion apps
|
|
132
132
|
|
|
133
|
-
- [fastnet2ip](https://github.com/ghotihook/fastnet2ip) — reads FastNet from serial
|
|
134
|
-
- [fastnet2ip_n2k](https://github.com/ghotihook/fastnet2ip_n2k) — reads FastNet from serial, broadcasts NMEA 2000 via UDP
|
|
133
|
+
- [fastnet2ip](https://github.com/ghotihook/fastnet2ip) — reads FastNet from serial and broadcasts it over UDP as either NMEA 0183 or NMEA 2000 (selected with `--output`). Install with `pipx install fastnet2ip`.
|
|
135
134
|
|
|
136
|
-
|
|
135
|
+
Runs on Raspberry Pi, macOS, or Linux.
|
|
137
136
|
|
|
138
137
|
## Acknowledgments
|
|
139
138
|
|
|
@@ -16,13 +16,13 @@ _DECIMAL_PLACES_MAP = {1: 0, 10: 1, 100: 2, 1000: 3}
|
|
|
16
16
|
# "°M" → magnetic bearing, suffix added after value
|
|
17
17
|
|
|
18
18
|
def _sign_from_layout(layout: str) -> int:
|
|
19
|
-
return -1 if layout in ("-[data]", "=[data]", "L[data]") else 1
|
|
19
|
+
return -1 if layout in ("-[data]", "=[data]", "L[data]", "H[data]") else 1
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
def _display_from_layout(layout: str, formatted: str) -> str:
|
|
23
23
|
if layout is None: return formatted
|
|
24
24
|
if layout == "°M": return f"{formatted}°M"
|
|
25
|
-
if layout == "H[data]": return f"H{formatted}"
|
|
25
|
+
if layout == "H[data]": return f"H{formatted.lstrip('-')}"
|
|
26
26
|
if layout == "[data]H": return f"{formatted}H"
|
|
27
27
|
if layout == "[data]=": return f"{formatted}="
|
|
28
28
|
if layout == "[data]-": return f"{formatted}-"
|
|
@@ -1,25 +1,54 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pyfastnet
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.16
|
|
4
4
|
Summary: A Python library for decoding FastNet protocol data streams.
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
Author-email: Alex Salmon <alex@ivila.net>
|
|
6
|
+
License: MIT License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2025 ghotihook
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
SOFTWARE.
|
|
27
|
+
|
|
28
|
+
Project-URL: Homepage, https://github.com/ghotihook/pyfastnet
|
|
29
|
+
Project-URL: Repository, https://github.com/ghotihook/pyfastnet
|
|
30
|
+
Project-URL: Issues, https://github.com/ghotihook/pyfastnet/issues
|
|
31
|
+
Keywords: fastnet,bandg,hydra,h2000,marine,sailing,decoder
|
|
32
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
33
|
+
Classifier: Intended Audience :: Developers
|
|
9
34
|
Classifier: License :: OSI Approved :: MIT License
|
|
10
35
|
Classifier: Operating System :: OS Independent
|
|
36
|
+
Classifier: Programming Language :: Python :: 3
|
|
37
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
38
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
39
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
40
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
41
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
42
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
43
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
44
|
+
Classifier: Topic :: Communications
|
|
45
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
11
46
|
Requires-Python: >=3.7
|
|
12
47
|
Description-Content-Type: text/markdown
|
|
13
48
|
License-File: LICENSE
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
Dynamic: classifier
|
|
17
|
-
Dynamic: description
|
|
18
|
-
Dynamic: description-content-type
|
|
19
|
-
Dynamic: home-page
|
|
49
|
+
Provides-Extra: test
|
|
50
|
+
Requires-Dist: pytest>=7.0; extra == "test"
|
|
20
51
|
Dynamic: license-file
|
|
21
|
-
Dynamic: requires-python
|
|
22
|
-
Dynamic: summary
|
|
23
52
|
|
|
24
53
|
# pyfastnet
|
|
25
54
|
|
|
@@ -153,10 +182,9 @@ fb.get_buffer_contents() # hex string of buffer contents
|
|
|
153
182
|
|
|
154
183
|
## Companion apps
|
|
155
184
|
|
|
156
|
-
- [fastnet2ip](https://github.com/ghotihook/fastnet2ip) — reads FastNet from serial
|
|
157
|
-
- [fastnet2ip_n2k](https://github.com/ghotihook/fastnet2ip_n2k) — reads FastNet from serial, broadcasts NMEA 2000 via UDP
|
|
185
|
+
- [fastnet2ip](https://github.com/ghotihook/fastnet2ip) — reads FastNet from serial and broadcasts it over UDP as either NMEA 0183 or NMEA 2000 (selected with `--output`). Install with `pipx install fastnet2ip`.
|
|
158
186
|
|
|
159
|
-
|
|
187
|
+
Runs on Raspberry Pi, macOS, or Linux.
|
|
160
188
|
|
|
161
189
|
## Acknowledgments
|
|
162
190
|
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
LICENSE
|
|
2
|
-
MANIFEST.in
|
|
3
2
|
README.md
|
|
4
|
-
|
|
3
|
+
pyproject.toml
|
|
5
4
|
fastnet_decoder/__init__.py
|
|
6
5
|
fastnet_decoder/decode_fastnet.py
|
|
7
6
|
fastnet_decoder/frame_buffer.py
|
|
@@ -11,15 +10,23 @@ fastnet_decoder/utils.py
|
|
|
11
10
|
pyfastnet.egg-info/PKG-INFO
|
|
12
11
|
pyfastnet.egg-info/SOURCES.txt
|
|
13
12
|
pyfastnet.egg-info/dependency_links.txt
|
|
13
|
+
pyfastnet.egg-info/requires.txt
|
|
14
14
|
pyfastnet.egg-info/top_level.txt
|
|
15
|
-
tests/
|
|
16
|
-
tests/
|
|
17
|
-
tests/
|
|
15
|
+
tests/test_autopilot.py
|
|
16
|
+
tests/test_awa.py
|
|
17
|
+
tests/test_aws.py
|
|
18
|
+
tests/test_battery.py
|
|
19
|
+
tests/test_boatspeed.py
|
|
18
20
|
tests/test_depth_frame.py
|
|
19
21
|
tests/test_format07_msb_regression.py
|
|
20
22
|
tests/test_format08_layout.py
|
|
21
|
-
tests/
|
|
23
|
+
tests/test_heading.py
|
|
24
|
+
tests/test_heel_trim.py
|
|
22
25
|
tests/test_latlon_frame.py
|
|
23
|
-
tests/
|
|
24
|
-
tests/
|
|
25
|
-
tests/
|
|
26
|
+
tests/test_sea_temp.py
|
|
27
|
+
tests/test_sog.py
|
|
28
|
+
tests/test_tidal.py
|
|
29
|
+
tests/test_timer.py
|
|
30
|
+
tests/test_twa.py
|
|
31
|
+
tests/test_twd.py
|
|
32
|
+
tests/test_tws.py
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "pyfastnet"
|
|
7
|
+
dynamic = ["version"]
|
|
8
|
+
description = "A Python library for decoding FastNet protocol data streams."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.7"
|
|
11
|
+
license = { file = "LICENSE" }
|
|
12
|
+
authors = [{ name = "Alex Salmon", email = "alex@ivila.net" }]
|
|
13
|
+
keywords = ["fastnet", "bandg", "hydra", "h2000", "marine", "sailing", "decoder"]
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Development Status :: 5 - Production/Stable",
|
|
16
|
+
"Intended Audience :: Developers",
|
|
17
|
+
"License :: OSI Approved :: MIT License",
|
|
18
|
+
"Operating System :: OS Independent",
|
|
19
|
+
"Programming Language :: Python :: 3",
|
|
20
|
+
"Programming Language :: Python :: 3.7",
|
|
21
|
+
"Programming Language :: Python :: 3.8",
|
|
22
|
+
"Programming Language :: Python :: 3.9",
|
|
23
|
+
"Programming Language :: Python :: 3.10",
|
|
24
|
+
"Programming Language :: Python :: 3.11",
|
|
25
|
+
"Programming Language :: Python :: 3.12",
|
|
26
|
+
"Programming Language :: Python :: 3.13",
|
|
27
|
+
"Topic :: Communications",
|
|
28
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
29
|
+
]
|
|
30
|
+
dependencies = []
|
|
31
|
+
|
|
32
|
+
[project.urls]
|
|
33
|
+
Homepage = "https://github.com/ghotihook/pyfastnet"
|
|
34
|
+
Repository = "https://github.com/ghotihook/pyfastnet"
|
|
35
|
+
Issues = "https://github.com/ghotihook/pyfastnet/issues"
|
|
36
|
+
|
|
37
|
+
[project.optional-dependencies]
|
|
38
|
+
test = ["pytest>=7.0"]
|
|
39
|
+
|
|
40
|
+
[tool.setuptools.packages.find]
|
|
41
|
+
include = ["fastnet_decoder*"]
|
|
42
|
+
|
|
43
|
+
[tool.setuptools.dynamic]
|
|
44
|
+
version = { attr = "fastnet_decoder.__version__" }
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import unittest
|
|
2
|
+
from fastnet_decoder.decode_fastnet import decode_frame
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
def _decode(hex_str):
|
|
6
|
+
result = decode_frame(bytes.fromhex(hex_str))
|
|
7
|
+
assert "error" not in result, f"Decode error: {result}"
|
|
8
|
+
return result["values"]
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class TestAutopilotStandby(unittest.TestCase):
|
|
12
|
+
"""
|
|
13
|
+
AP Mode = Standby: Autopilot Mode channel (0xB5), format 0x01,
|
|
14
|
+
raw int 20484 maps to display string "Standby".
|
|
15
|
+
In Standby the Compass Target channel carries an OFF segment display (value=None).
|
|
16
|
+
"""
|
|
17
|
+
FRAME = "ff121c01d2b5015004a606bee8e800af06bee8e8005306bee8e8007606bee8e80088"
|
|
18
|
+
|
|
19
|
+
def setUp(self):
|
|
20
|
+
self.v = _decode(self.FRAME)
|
|
21
|
+
|
|
22
|
+
def test_mode_display(self):
|
|
23
|
+
self.assertEqual(self.v["Autopilot Mode"]["display_text"], "Standby")
|
|
24
|
+
|
|
25
|
+
def test_target_is_off(self):
|
|
26
|
+
self.assertIsNone(self.v["Autopilot Compass Target"]["value"])
|
|
27
|
+
self.assertEqual(self.v["Autopilot Compass Target"]["display_text"], "OFF ")
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class TestAutopilotCompass(unittest.TestCase):
|
|
31
|
+
"""
|
|
32
|
+
AP Mode = Compass: target is a magnetic bearing (°M layout).
|
|
33
|
+
Target = 0°M in this frame (just engaged).
|
|
34
|
+
"""
|
|
35
|
+
FRAME = "ff120a01e4b5015101a60700660000e5"
|
|
36
|
+
|
|
37
|
+
def setUp(self):
|
|
38
|
+
self.v = _decode(self.FRAME)
|
|
39
|
+
|
|
40
|
+
def test_mode_display(self):
|
|
41
|
+
self.assertEqual(self.v["Autopilot Mode"]["display_text"], "Compass")
|
|
42
|
+
|
|
43
|
+
def test_target_value(self):
|
|
44
|
+
self.assertEqual(self.v["Autopilot Compass Target"]["value"], 0.0)
|
|
45
|
+
|
|
46
|
+
def test_target_layout(self):
|
|
47
|
+
self.assertEqual(self.v["Autopilot Compass Target"]["layout"], "°M")
|
|
48
|
+
|
|
49
|
+
def test_target_display(self):
|
|
50
|
+
self.assertEqual(self.v["Autopilot Compass Target"]["display_text"], "0°M")
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
class TestAutopilotWind(unittest.TestCase):
|
|
54
|
+
"""
|
|
55
|
+
AP Mode = Wind: target is a magnetic bearing representing a locked wind angle.
|
|
56
|
+
Target = 331°M in this frame.
|
|
57
|
+
"""
|
|
58
|
+
FRAME = "ff120a01e4b5015104a6070066014b96"
|
|
59
|
+
|
|
60
|
+
def setUp(self):
|
|
61
|
+
self.v = _decode(self.FRAME)
|
|
62
|
+
|
|
63
|
+
def test_mode_display(self):
|
|
64
|
+
self.assertEqual(self.v["Autopilot Mode"]["display_text"], "Wind")
|
|
65
|
+
|
|
66
|
+
def test_target_value(self):
|
|
67
|
+
self.assertEqual(self.v["Autopilot Compass Target"]["value"], 331.0)
|
|
68
|
+
|
|
69
|
+
def test_target_display(self):
|
|
70
|
+
self.assertEqual(self.v["Autopilot Compass Target"]["display_text"], "331°M")
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
if __name__ == "__main__":
|
|
74
|
+
unittest.main()
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import unittest
|
|
2
|
+
from fastnet_decoder.decode_fastnet import decode_frame
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
def _decode(hex_str):
|
|
6
|
+
result = decode_frame(bytes.fromhex(hex_str))
|
|
7
|
+
assert "error" not in result, f"Decode error: {result}"
|
|
8
|
+
return result["values"]
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
# Sign convention (format 0x03, segment byte drives layout):
|
|
12
|
+
# AWA port: seg 0xa0 → layout '-[data]' → value negative
|
|
13
|
+
# AWA stb: seg 0x20 → layout '[data]-' → value positive
|
|
14
|
+
#
|
|
15
|
+
# Dash before digits = port (negative); dash after digits = starboard (positive).
|
|
16
|
+
# The trailing dash on the B&G display is a direction marker, not a minus sign.
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class TestAWAPort(unittest.TestCase):
|
|
20
|
+
"""
|
|
21
|
+
AWA to port: segment byte 0xa0 → layout '-[data]'.
|
|
22
|
+
Leading dash drives sign negative; value is stored negative.
|
|
23
|
+
"""
|
|
24
|
+
FRAME = "ff051801e34e0a030a02bd4d61004a4f610026520ac4bbc4bb5113a0525e"
|
|
25
|
+
|
|
26
|
+
def setUp(self):
|
|
27
|
+
self.v = _decode(self.FRAME)["Apparent Wind Angle"]
|
|
28
|
+
|
|
29
|
+
def test_value(self):
|
|
30
|
+
self.assertAlmostEqual(self.v["value"], -82.0, places=0)
|
|
31
|
+
|
|
32
|
+
def test_layout(self):
|
|
33
|
+
self.assertEqual(self.v["layout"], "-[data]")
|
|
34
|
+
|
|
35
|
+
def test_display(self):
|
|
36
|
+
self.assertEqual(self.v["display_text"], "-82")
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
class TestAWAStarboard(unittest.TestCase):
|
|
40
|
+
"""
|
|
41
|
+
AWA to starboard: segment byte 0x20 → layout '[data]-'.
|
|
42
|
+
Trailing dash encodes starboard direction; value is positive.
|
|
43
|
+
"""
|
|
44
|
+
FRAME = "ff051801e34e0a02cf02804d61005a4f61002e520a128f128f5113201835"
|
|
45
|
+
|
|
46
|
+
def setUp(self):
|
|
47
|
+
self.v = _decode(self.FRAME)["Apparent Wind Angle"]
|
|
48
|
+
|
|
49
|
+
def test_value(self):
|
|
50
|
+
self.assertAlmostEqual(self.v["value"], 24.0, places=0)
|
|
51
|
+
|
|
52
|
+
def test_layout(self):
|
|
53
|
+
self.assertEqual(self.v["layout"], "[data]-")
|
|
54
|
+
|
|
55
|
+
def test_display(self):
|
|
56
|
+
self.assertEqual(self.v["display_text"], "24-")
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
if __name__ == "__main__":
|
|
60
|
+
unittest.main()
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import unittest
|
|
2
|
+
from fastnet_decoder.decode_fastnet import decode_frame
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
def _decode(hex_str):
|
|
6
|
+
result = decode_frame(bytes.fromhex(hex_str))
|
|
7
|
+
assert "error" not in result, f"Decode error: {result}"
|
|
8
|
+
return result["values"]
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class TestApparentWindSpeed(unittest.TestCase):
|
|
12
|
+
"""
|
|
13
|
+
18-channel broadcast containing apparent wind speed in both units.
|
|
14
|
+
Format 0x01, 16-bit signed, divisor 10.
|
|
15
|
+
AWA sign variants are in test_awa.py.
|
|
16
|
+
"""
|
|
17
|
+
FRAME = "ff051801e34e0a061c05fe4d51009c4f610050520a47f347f351032065a0"
|
|
18
|
+
|
|
19
|
+
def setUp(self):
|
|
20
|
+
self.v = _decode(self.FRAME)
|
|
21
|
+
|
|
22
|
+
def test_knots_value(self):
|
|
23
|
+
self.assertAlmostEqual(self.v["Apparent Wind Speed (Knots)"]["value"], 15.6, places=1)
|
|
24
|
+
|
|
25
|
+
def test_knots_display(self):
|
|
26
|
+
self.assertEqual(self.v["Apparent Wind Speed (Knots)"]["display_text"], "15.6")
|
|
27
|
+
|
|
28
|
+
def test_ms_value(self):
|
|
29
|
+
self.assertAlmostEqual(self.v["Apparent Wind Speed (m/s)"]["value"], 8.0, places=1)
|
|
30
|
+
|
|
31
|
+
def test_ms_display(self):
|
|
32
|
+
self.assertEqual(self.v["Apparent Wind Speed (m/s)"]["display_text"], "8.0")
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
if __name__ == "__main__":
|
|
36
|
+
unittest.main()
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import unittest
|
|
2
|
+
from fastnet_decoder.decode_fastnet import decode_frame
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
def _decode(hex_str):
|
|
6
|
+
result = decode_frame(bytes.fromhex(hex_str))
|
|
7
|
+
assert "error" not in result, f"Decode error: {result}"
|
|
8
|
+
return result["values"]
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class TestBatteryVolts(unittest.TestCase):
|
|
12
|
+
"""
|
|
13
|
+
Battery Volts: format 0x01, 16-bit signed, divisor 100.
|
|
14
|
+
Channel 0x8D; value 13.18 V.
|
|
15
|
+
"""
|
|
16
|
+
FRAME = "ff051401e78d8105263b3101fa344700f300cc9b4700a000099b"
|
|
17
|
+
|
|
18
|
+
def setUp(self):
|
|
19
|
+
self.v = _decode(self.FRAME)["Battery Volts"]
|
|
20
|
+
|
|
21
|
+
def test_value(self):
|
|
22
|
+
self.assertAlmostEqual(self.v["value"], 13.18, places=2)
|
|
23
|
+
|
|
24
|
+
def test_display(self):
|
|
25
|
+
self.assertEqual(self.v["display_text"], "13.18")
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
if __name__ == "__main__":
|
|
29
|
+
unittest.main()
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import unittest
|
|
2
|
+
from fastnet_decoder.decode_fastnet import decode_frame
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
def _decode(hex_str):
|
|
6
|
+
result = decode_frame(bytes.fromhex(hex_str))
|
|
7
|
+
assert "error" not in result, f"Decode error: {result}"
|
|
8
|
+
return result["values"]
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class TestBoatspeed(unittest.TestCase):
|
|
12
|
+
"""
|
|
13
|
+
Performance Processor broadcast containing Boatspeed (Knots) and
|
|
14
|
+
Boatspeed (Raw).
|
|
15
|
+
- Knots: format 0x01, 16-bit signed, divisor 100
|
|
16
|
+
- Raw: format 0x0A, two 16-bit signed integers rendered as "first / second"
|
|
17
|
+
"""
|
|
18
|
+
FRAME = "ff010a01f54192f9dd420a01ec082cea"
|
|
19
|
+
|
|
20
|
+
def setUp(self):
|
|
21
|
+
self.v = _decode(self.FRAME)
|
|
22
|
+
|
|
23
|
+
def test_knots_value(self):
|
|
24
|
+
self.assertAlmostEqual(self.v["Boatspeed (Knots)"]["value"], 4.77, places=2)
|
|
25
|
+
|
|
26
|
+
def test_knots_display(self):
|
|
27
|
+
self.assertEqual(self.v["Boatspeed (Knots)"]["display_text"], "4.77")
|
|
28
|
+
|
|
29
|
+
def test_raw_is_pair(self):
|
|
30
|
+
self.assertIn(" / ", self.v["Boatspeed (Raw)"]["display_text"])
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
if __name__ == "__main__":
|
|
34
|
+
unittest.main()
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import unittest
|
|
2
|
+
from fastnet_decoder.decode_fastnet import decode_frame
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
def _decode(hex_str):
|
|
6
|
+
result = decode_frame(bytes.fromhex(hex_str))
|
|
7
|
+
assert "error" not in result, f"Decode error: {result}"
|
|
8
|
+
return result["values"]
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class TestHeading(unittest.TestCase):
|
|
12
|
+
"""
|
|
13
|
+
Heading: format 0x08, segment code 0x66 → layout '°M'.
|
|
14
|
+
9-bit value; MSB=0 for values ≤ 255.
|
|
15
|
+
"""
|
|
16
|
+
FRAME = "ff120e01e00b038c024908cd634a0afbe13d492d"
|
|
17
|
+
|
|
18
|
+
def setUp(self):
|
|
19
|
+
self.v = _decode(self.FRAME)["Heading"]
|
|
20
|
+
|
|
21
|
+
def test_value(self):
|
|
22
|
+
self.assertEqual(self.v["value"], 355.0)
|
|
23
|
+
|
|
24
|
+
def test_layout(self):
|
|
25
|
+
self.assertEqual(self.v["layout"], "°M")
|
|
26
|
+
|
|
27
|
+
def test_display(self):
|
|
28
|
+
self.assertEqual(self.v["display_text"], "355°M")
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class TestRudder(unittest.TestCase):
|
|
32
|
+
"""
|
|
33
|
+
Rudder Angle: format 0x03, segment byte 0x8c → layout '=[data]'.
|
|
34
|
+
'=' is B&G's alternative minus symbol; value is stored negative.
|
|
35
|
+
Same frame as TestHeading.
|
|
36
|
+
"""
|
|
37
|
+
FRAME = "ff120e01e00b038c024908cd634a0afbe13d492d"
|
|
38
|
+
|
|
39
|
+
def setUp(self):
|
|
40
|
+
self.v = _decode(self.FRAME)["Rudder Angle"]
|
|
41
|
+
|
|
42
|
+
def test_value(self):
|
|
43
|
+
self.assertEqual(self.v["value"], -2.0)
|
|
44
|
+
|
|
45
|
+
def test_layout(self):
|
|
46
|
+
self.assertEqual(self.v["layout"], "=[data]")
|
|
47
|
+
|
|
48
|
+
def test_display(self):
|
|
49
|
+
self.assertEqual(self.v["display_text"], "-2")
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
class TestCourse(unittest.TestCase):
|
|
53
|
+
"""
|
|
54
|
+
Course (HDG + Leeway): format 0x08, layout '°M'.
|
|
55
|
+
Heading on Next Tack: format 0x08, layout '°M'.
|
|
56
|
+
Both from a 4-channel navigation broadcast.
|
|
57
|
+
"""
|
|
58
|
+
FRAME = "ff051401e74a0afbe1fbe1824700d800006908cd639a08cce65e"
|
|
59
|
+
|
|
60
|
+
def setUp(self):
|
|
61
|
+
self.v = _decode(self.FRAME)
|
|
62
|
+
|
|
63
|
+
def test_course_value(self):
|
|
64
|
+
self.assertEqual(self.v["Course (HDG + Leeway)"]["value"], 355.0)
|
|
65
|
+
|
|
66
|
+
def test_course_display(self):
|
|
67
|
+
self.assertEqual(self.v["Course (HDG + Leeway)"]["display_text"], "355°M")
|
|
68
|
+
|
|
69
|
+
def test_next_tack_value(self):
|
|
70
|
+
self.assertEqual(self.v["Heading on Next Tack"]["value"], 230.0)
|
|
71
|
+
|
|
72
|
+
def test_next_tack_display(self):
|
|
73
|
+
self.assertEqual(self.v["Heading on Next Tack"]["display_text"], "230°M")
|
|
74
|
+
|
|
75
|
+
def test_leeway_value(self):
|
|
76
|
+
self.assertEqual(self.v["Leeway"]["value"], 0.0)
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
if __name__ == "__main__":
|
|
80
|
+
unittest.main()
|