burst-link-protocol 1.0.2__tar.gz → 1.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 (29) hide show
  1. {burst_link_protocol-1.0.2 → burst_link_protocol-1.0.3}/PKG-INFO +1 -1
  2. {burst_link_protocol-1.0.2 → burst_link_protocol-1.0.3}/ROADMAP.md +1 -1
  3. burst_link_protocol-1.0.3/platform/zephyr/CMakeLists.txt +9 -0
  4. {burst_link_protocol-1.0.2 → burst_link_protocol-1.0.3}/pyproject.toml +1 -1
  5. {burst_link_protocol-1.0.2 → burst_link_protocol-1.0.3}/src/decoder.c +1 -1
  6. burst_link_protocol-1.0.3/test/test_c.py +24 -0
  7. {burst_link_protocol-1.0.2 → burst_link_protocol-1.0.3}/test/test_c_validation.py +22 -16
  8. {burst_link_protocol-1.0.2 → burst_link_protocol-1.0.3}/.github/dependabot.yml +0 -0
  9. {burst_link_protocol-1.0.2 → burst_link_protocol-1.0.3}/.github/workflows/pip.yml +0 -0
  10. {burst_link_protocol-1.0.2 → burst_link_protocol-1.0.3}/.github/workflows/wheel.yml +0 -0
  11. {burst_link_protocol-1.0.2 → burst_link_protocol-1.0.3}/.gitignore +0 -0
  12. {burst_link_protocol-1.0.2 → burst_link_protocol-1.0.3}/.vscode/c_cpp_properties.json +0 -0
  13. {burst_link_protocol-1.0.2 → burst_link_protocol-1.0.3}/.vscode/launch.json +0 -0
  14. {burst_link_protocol-1.0.2 → burst_link_protocol-1.0.3}/.vscode/settings.json +0 -0
  15. {burst_link_protocol-1.0.2 → burst_link_protocol-1.0.3}/.vscode/tasks.json +0 -0
  16. {burst_link_protocol-1.0.2 → burst_link_protocol-1.0.3}/CMakeLists.txt +0 -0
  17. {burst_link_protocol-1.0.2 → burst_link_protocol-1.0.3}/LICENSE +0 -0
  18. {burst_link_protocol-1.0.2 → burst_link_protocol-1.0.3}/README.md +0 -0
  19. {burst_link_protocol-1.0.2 → burst_link_protocol-1.0.3}/docs/design.drawio +0 -0
  20. {burst_link_protocol-1.0.2 → burst_link_protocol-1.0.3}/docs/design.svg +0 -0
  21. {burst_link_protocol-1.0.2 → burst_link_protocol-1.0.3}/src/burst_interface.h +0 -0
  22. {burst_link_protocol-1.0.2 → burst_link_protocol-1.0.3}/src/burst_link_protocol/__init__.py +0 -0
  23. {burst_link_protocol-1.0.2 → burst_link_protocol-1.0.3}/src/burst_link_protocol/main.py +0 -0
  24. {burst_link_protocol-1.0.2 → burst_link_protocol-1.0.3}/src/crc.c +0 -0
  25. {burst_link_protocol-1.0.2 → burst_link_protocol-1.0.3}/src/crc.h +0 -0
  26. {burst_link_protocol-1.0.2 → burst_link_protocol-1.0.3}/src/encoder.c +0 -0
  27. {burst_link_protocol-1.0.2 → burst_link_protocol-1.0.3}/src/python_bindings.cpp +0 -0
  28. {burst_link_protocol-1.0.2 → burst_link_protocol-1.0.3}/test/test_python_validation.py +0 -0
  29. {burst_link_protocol-1.0.2 → burst_link_protocol-1.0.3}/test/test_speed.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: burst-link-protocol
3
- Version: 1.0.2
3
+ Version: 1.0.3
4
4
  Summary: Binary Utility for Reliable Stream Transfer (BURST) is a library for encoding and decoding binary data streams into and from a byte stream.
5
5
  Author-Email: Floris vernieuwe <floris@vernieuwe.eu>
6
6
  License-File: LICENSE
@@ -20,4 +20,4 @@
20
20
  - ⬜️ Add a way to get C test coverage
21
21
  - ⬜️ Add test report as a badge
22
22
  - ⬜️ Fix dependencies once compilation succeeds
23
-
23
+ - ⬜️ Fix packets that start with a 0x00 byte, they are currently not encoded correctly
@@ -0,0 +1,9 @@
1
+ zephyr_library_named(burst-link-protocol)
2
+ zephyr_library_sources(
3
+ "../../src/decoder.c"
4
+ "../../src/encoder.c"
5
+ "../../src/crc.c"
6
+ )
7
+
8
+ target_include_directories(burst-link-protocol PUBLIC ../../src)
9
+
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "burst-link-protocol"
3
- version = "1.0.2" # Choose one version reference here
3
+ version = "1.0.3" # Choose one version reference here
4
4
  description = "Binary Utility for Reliable Stream Transfer (BURST) is a library for encoding and decoding binary data streams into and from a byte stream."
5
5
  requires-python = ">=3.10,<4.0"
6
6
  authors = [
@@ -145,6 +145,6 @@ burst_packet_t burst_decoder_get_packet(burst_decoder_t *ctx)
145
145
 
146
146
  burst_packet_t packet;
147
147
  packet.data = ctx->buffer;
148
- packet.size = ctx->out_head-1;
148
+ packet.size = ctx->out_head;
149
149
  return packet;
150
150
  }
@@ -0,0 +1,24 @@
1
+ from burst_link_protocol import BurstInterfaceC
2
+
3
+
4
+ def test_c_encoding_decoding():
5
+ c_interface = BurstInterfaceC()
6
+
7
+ packets = [b"Hello, world!", b"Goodbye, world!"]
8
+
9
+ decoded = c_interface.decode(c_interface.encode(packets))
10
+ print(decoded)
11
+ assert packets == decoded, f"Expected {packets}, got {decoded}"
12
+
13
+
14
+ def test_c_encoding_decoding_fail():
15
+ c_interface = BurstInterfaceC()
16
+
17
+ packets = [b"\0Hello, world!"]
18
+
19
+ decoded = c_interface.decode(c_interface.encode(packets))
20
+ print(decoded)
21
+ assert packets == decoded, f"Expected {packets}, got {decoded}"
22
+
23
+ if __name__ == "__main__":
24
+ test_c_encoding_decoding()
@@ -1,11 +1,11 @@
1
-
2
- from burst_link_protocol import BurstInterfacePy,BurstInterfaceC
1
+ from burst_link_protocol import BurstInterfacePy, BurstInterfaceC
3
2
  import pytest
4
3
  import numpy as np
5
4
 
5
+
6
6
  def test_c_decoder_python():
7
- python_interface = BurstInterfacePy()
8
- c_interface = BurstInterfaceC()
7
+ python_interface = BurstInterfacePy()
8
+ c_interface = BurstInterfaceC()
9
9
 
10
10
  packets = [b"Hello, world!", b"Goodbye, world!"]
11
11
 
@@ -14,39 +14,45 @@ def test_c_decoder_python():
14
14
  print(decoded)
15
15
  assert packets == decoded
16
16
 
17
+
17
18
  def test_python_crc_validation():
18
- interface = BurstInterfacePy()
19
+ interface = BurstInterfacePy()
19
20
  packets = [b"Hello, world!", b"Goodbye, world!"]
20
21
 
21
22
  data = bytearray(interface.encode(packets))
22
23
 
23
- for i in range( len(data)):
24
- c_interface = BurstInterfaceC()
24
+ for i in range(len(data)):
25
+ c_interface = BurstInterfaceC()
25
26
 
26
27
  data_copy = data.copy()
27
28
 
28
29
  # modify byte x
29
30
  data_copy[i] = (data_copy[i] + 1) % 256
30
31
  with pytest.raises(Exception):
31
- decoded = c_interface.decode(bytes(data_copy),fail_on_crc_error=True)
32
+ decoded = c_interface.decode(bytes(data_copy), fail_on_crc_error=True)
32
33
  print(decoded)
33
- assert len(decoded) == len(packets), f"Expected {len(packets)} packets, got {len(decoded)}"
34
+ assert len(decoded) == len(packets), (
35
+ f"Expected {len(packets)} packets, got {len(decoded)}"
36
+ )
37
+
34
38
 
35
39
  def test_max_size_error():
36
- interface = BurstInterfacePy()
37
- c_interface = BurstInterfaceC()
40
+ interface = BurstInterfacePy()
41
+ c_interface = BurstInterfaceC()
38
42
  packets = np.random.bytes(1500)
39
43
  with pytest.raises(Exception):
40
- data = c_interface.decode(interface.encode([packets]),fail_on_crc_error=True)
41
-
44
+ data = c_interface.decode(interface.encode([packets]), fail_on_crc_error=True)
45
+
46
+
42
47
  def test_encoding():
43
- interface = BurstInterfacePy()
44
- c_interface = BurstInterfaceC()
48
+ interface = BurstInterfacePy()
49
+ c_interface = BurstInterfaceC()
45
50
  packets = [b"Hello, world!", b"Goodbye, world!"]
46
51
 
47
52
  assert interface.encode(packets) == c_interface.encode(packets)
48
53
 
54
+
49
55
  # if __name__ == "__main__":
50
56
  # # test_c_decoder_python()
51
57
  # # test_python_crc_validation()
52
- # # max_size_error()
58
+ # # max_size_error()