Skip to content

Commit

Permalink
Merge branch 'dev' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
cwichel committed Dec 30, 2021
2 parents c881dca + 902be2e commit 188d86d
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 20 deletions.
2 changes: 1 addition & 1 deletion embutils/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.7.3'
__version__ = '0.7.4'
3 changes: 2 additions & 1 deletion embutils/utils/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ def join(self) -> None:
"""
Wait until service is fully terminated.
"""
self._ended.wait()
while not self._ended.is_set():
time.sleep(self.TASK_DELAY_S)

def _service(self) -> None:
"""
Expand Down
21 changes: 4 additions & 17 deletions examples/stream_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,25 +139,12 @@ def decode_stream(self, device: Device) -> Optional[AbstractSerialized]:
Defines how to the serial device will be read to decode the desired
serialized object.
"""
# Read a single byte and check...
recv = device.read(size=1)
# Read until COBS end (0x00)
recv = device.read_until(expected=b"\x00")
if recv is None:
raise ConnectionError(f"Connection error while reading from {device}")
if len(recv) == 0:
return None

# Are we reading contents?
byte = ord(recv)
if byte != 0x00:
# Yes -> Byte is not stuff... frame incoming
data = bytearray(recv)
recv = device.read_until(expected=b"\x00")
if recv is None:
raise ConnectionError(f"Connection error while reading from {device}")

# Process
data.extend(recv)
return SimplePacket.deserialize(data=COBS.decode(data=data))

# No -> Nothing to process
return None
# Process
return self._dtype.deserialize(data=COBS.decode(data=bytearray(recv)))
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tool.poetry]
version = "0.7.3"
version = "0.7.4"
name = "embutils"
license = "MIT"
readme = "README.md"
Expand Down

0 comments on commit 188d86d

Please sign in to comment.