burst-link-protocol 0.1.1__cp312-abi3-win32.whl
Sign up to get free protection for your applications and to get access to all the features.
burst_interface_c.pyd
ADDED
Binary file
|
burst_interface_c.pyi
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
from cobs import cobs
|
2
|
+
from crc import Calculator,Crc16
|
3
|
+
|
4
|
+
crc = Calculator(Crc16.IBM_3740)
|
5
|
+
|
6
|
+
class BurstInterfacePy:
|
7
|
+
buffer = b""
|
8
|
+
|
9
|
+
def __init__(self):
|
10
|
+
pass
|
11
|
+
|
12
|
+
@staticmethod
|
13
|
+
def crc16( data: bytes) -> bytes:
|
14
|
+
return crc.checksum(data).to_bytes(2, "big")
|
15
|
+
|
16
|
+
|
17
|
+
@staticmethod
|
18
|
+
def encode_packet(packet: bytes) -> bytes:
|
19
|
+
packet_with_crc = packet + BurstInterfacePy.crc16(packet)
|
20
|
+
return cobs.encode(packet_with_crc) + b"\x00"
|
21
|
+
|
22
|
+
@staticmethod
|
23
|
+
def decode_packet(packet: bytes) -> bytes:
|
24
|
+
# decode and check crc
|
25
|
+
decoded = cobs.decode(packet)
|
26
|
+
|
27
|
+
if BurstInterfacePy.crc16(decoded[:-2]) != decoded[-2:]:
|
28
|
+
raise ValueError("CRC mismatch")
|
29
|
+
|
30
|
+
return decoded[:-2]
|
31
|
+
|
32
|
+
def encode(self, packets: list[bytes]) -> bytes:
|
33
|
+
return b"".join([self.encode_packet(packet) for packet in packets])
|
34
|
+
|
35
|
+
def decode(self, steam: bytes) -> list[bytes]:
|
36
|
+
self.buffer += steam
|
37
|
+
separated_packets = self.buffer.split(b"\x00")
|
38
|
+
# Add last packet to buffer
|
39
|
+
self.buffer = separated_packets.pop()
|
40
|
+
return [self.decode_packet(packet) for packet in separated_packets]
|
41
|
+
|
@@ -0,0 +1,89 @@
|
|
1
|
+
Metadata-Version: 2.1
|
2
|
+
Name: burst-link-protocol
|
3
|
+
Version: 0.1.1
|
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
|
+
Author-Email: Floris vernieuwe <floris@vernieuwe.eu>
|
6
|
+
Requires-Python: <4.0,>=3.10
|
7
|
+
Requires-Dist: cobs<2.0.0,>=1.2.1
|
8
|
+
Requires-Dist: numpy<3.0.0,>=2.2.3
|
9
|
+
Requires-Dist: crc<8.0.0,>=7.1.0
|
10
|
+
Requires-Dist: pytest<9.0.0,>=8.3.4
|
11
|
+
Requires-Dist: pytest-cov<7.0.0,>=6.0.0
|
12
|
+
Requires-Dist: pytest-benchmark<6.0.0,>=5.1.0
|
13
|
+
Requires-Dist: scikit-build-core[pyproject]<0.11.0,>=0.10.7; extra == "dev"
|
14
|
+
Requires-Dist: nanobind<3.0.0,>=2.5.0; extra == "dev"
|
15
|
+
Requires-Dist: pytest<9.0.0,>=8.3.4; extra == "dev"
|
16
|
+
Requires-Dist: pytest-cov<7.0.0,>=6.0.0; extra == "dev"
|
17
|
+
Requires-Dist: pytest-benchmark<6.0.0,>=5.1.0; extra == "dev"
|
18
|
+
Provides-Extra: dev
|
19
|
+
Description-Content-Type: text/markdown
|
20
|
+
|
21
|
+
# BURST interface
|
22
|
+
Binary Utility for Reliable Stream Transfer (BURST) is a library for encoding and decoding binary data streams, a packet format.
|
23
|
+
It combines a 16 bit checksum and cobs encoding to convert packets into a format that can be sent over a stream.
|
24
|
+
|
25
|
+
This projects is written so it can be used both in python, c and c++ based project
|
26
|
+
|
27
|
+
# Installation instuctions
|
28
|
+
|
29
|
+
## As an user
|
30
|
+
|
31
|
+
Simple installation
|
32
|
+
```sh
|
33
|
+
pip install -e .
|
34
|
+
```
|
35
|
+
|
36
|
+
## As a developer
|
37
|
+
|
38
|
+
Fast build
|
39
|
+
```sh
|
40
|
+
pip install --no-build-isolation -ve .
|
41
|
+
```
|
42
|
+
|
43
|
+
Auto rebuild on run
|
44
|
+
```sh
|
45
|
+
pip install --no-build-isolation -Ceditable.rebuild=true -ve .
|
46
|
+
```
|
47
|
+
|
48
|
+
|
49
|
+
### Python Stub files generation
|
50
|
+
|
51
|
+
They are generated automatically buy can also be generated
|
52
|
+
|
53
|
+
```
|
54
|
+
python -m nanobind.stubgen -m nanobind_example_ext
|
55
|
+
```
|
56
|
+
|
57
|
+
# Publishing instructions
|
58
|
+
|
59
|
+
```
|
60
|
+
|
61
|
+
```
|
62
|
+
|
63
|
+
# Test
|
64
|
+
|
65
|
+
```sh
|
66
|
+
pytest
|
67
|
+
```
|
68
|
+
|
69
|
+
# BURST protocol
|
70
|
+
TODO
|
71
|
+
* STAGE 1
|
72
|
+
* Convert cpp to c files [OK]
|
73
|
+
* Formalise naming [OK]
|
74
|
+
* Add c encode functions [OK]
|
75
|
+
* Test c encode functions [OK]
|
76
|
+
* Update README
|
77
|
+
* Improve poetry.toml [OK]
|
78
|
+
|
79
|
+
|
80
|
+
* STAGE 2
|
81
|
+
* Add CI/CD on github to compile x86
|
82
|
+
* Fix dependencies once compilation succeeds
|
83
|
+
* Publish on pypi
|
84
|
+
* STAGE 3
|
85
|
+
* Add a way to get C test coverage
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
|
@@ -0,0 +1,7 @@
|
|
1
|
+
burst_interface_c.pyd,sha256=XyoL6XO019bPpu62mS01OTE2cfGnBsd__Q_CHPzo-no,351232
|
2
|
+
burst_interface_c.pyi,sha256=XeNtZqvqT2bwCE7Le_DeKOiGPn83dw5WSZteHMzLo0A,201
|
3
|
+
burst_link_protocol/__init__.py,sha256=KISkm1e-VcDx29uyFp-4M76cox3LBfcPCOrrv9gv1QM,135
|
4
|
+
burst_link_protocol/main.py,sha256=Eicgf3yp8DxnI5SspCKD7jm5C4tNZWKKBoYdCfGrUis,1211
|
5
|
+
burst_link_protocol-0.1.1.dist-info/METADATA,sha256=2R1FyQ8xU5QFI6PDIHE9yu-JV-kkl8TaMf_4RMf7xpE,2106
|
6
|
+
burst_link_protocol-0.1.1.dist-info/WHEEL,sha256=PSf5v5Sqi9g580_jBIo7BVvLhbCJLtxUm2z36OA4YZQ,101
|
7
|
+
burst_link_protocol-0.1.1.dist-info/RECORD,,
|