serial-toolkit 0.2.0__tar.gz → 0.3.0__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.
- {serial_toolkit-0.2.0 → serial_toolkit-0.3.0}/PKG-INFO +1 -1
- {serial_toolkit-0.2.0 → serial_toolkit-0.3.0}/pyproject.toml +1 -1
- {serial_toolkit-0.2.0 → serial_toolkit-0.3.0}/src/serialkit/errors.py +6 -1
- {serial_toolkit-0.2.0 → serial_toolkit-0.3.0}/src/serialkit/link.py +12 -4
- {serial_toolkit-0.2.0 → serial_toolkit-0.3.0}/README.md +0 -0
- {serial_toolkit-0.2.0 → serial_toolkit-0.3.0}/src/serialkit/__init__.py +0 -0
- {serial_toolkit-0.2.0 → serial_toolkit-0.3.0}/src/serialkit/framing.py +0 -0
- {serial_toolkit-0.2.0 → serial_toolkit-0.3.0}/src/serialkit/pacing.py +0 -0
- {serial_toolkit-0.2.0 → serial_toolkit-0.3.0}/src/serialkit/py.typed +0 -0
- {serial_toolkit-0.2.0 → serial_toolkit-0.3.0}/src/serialkit/testing.py +0 -0
- {serial_toolkit-0.2.0 → serial_toolkit-0.3.0}/src/serialkit/waiting.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: serial-toolkit
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.0
|
|
4
4
|
Summary: Wire mechanics for RS232 device drivers: framing, pacing, exclusivity, sequence anchoring, dispatch, reconnect, and liveness behind a callback API
|
|
5
5
|
Author: Ben Bangert
|
|
6
6
|
Author-email: Ben Bangert <ben.bangert@nabucasa.com>
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# Distributed as "serial-toolkit" on PyPI ("serialkit" is blocked by PyPI's
|
|
3
3
|
# name policy); the import package stays `serialkit` (see tool.uv.build-backend).
|
|
4
4
|
name = "serial-toolkit"
|
|
5
|
-
version = "v0.
|
|
5
|
+
version = "v0.3.0"
|
|
6
6
|
description = "Wire mechanics for RS232 device drivers: framing, pacing, exclusivity, sequence anchoring, dispatch, reconnect, and liveness behind a callback API"
|
|
7
7
|
readme = "README.md"
|
|
8
8
|
license = "MIT"
|
|
@@ -15,7 +15,12 @@ class SerialKitError(Exception):
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
class ConnectionLostError(SerialKitError):
|
|
18
|
-
"""The serial connection
|
|
18
|
+
"""The serial connection could not be opened, or dropped.
|
|
19
|
+
|
|
20
|
+
Raised by ``start()`` when the transport cannot be opened (the transport's
|
|
21
|
+
exception is the ``__cause__``), and by in-flight waits when the session
|
|
22
|
+
is lost (EOF, write failure, probe timeout).
|
|
23
|
+
"""
|
|
19
24
|
|
|
20
25
|
|
|
21
26
|
class CommandTimeoutError(SerialKitError):
|
|
@@ -221,14 +221,22 @@ class SerialLink:
|
|
|
221
221
|
async def start(self) -> None:
|
|
222
222
|
"""Connect, start dispatch, run ``on_connect``, then supervise.
|
|
223
223
|
|
|
224
|
-
A failure
|
|
225
|
-
|
|
226
|
-
|
|
224
|
+
A failure to open the transport is raised as
|
|
225
|
+
:class:`~serialkit.ConnectionLostError` with the transport's own
|
|
226
|
+
exception as its ``__cause__``: transports raise their own types for
|
|
227
|
+
an unreachable port (not all of them ``OSError``), and a caller that
|
|
228
|
+
retries on the kit's error must not have to know every one of them. A
|
|
229
|
+
failure in the first ``on_connect()`` propagates as raised, after
|
|
230
|
+
symmetric teardown. Either way the reconnect loop only supervises a
|
|
231
|
+
session that started successfully.
|
|
227
232
|
"""
|
|
228
233
|
if self._monitor_task is not None:
|
|
229
234
|
raise RuntimeError("already started")
|
|
230
235
|
self._stopped = False
|
|
231
|
-
|
|
236
|
+
try:
|
|
237
|
+
await self._open_session()
|
|
238
|
+
except Exception as exc:
|
|
239
|
+
raise ConnectionLostError(f"could not open connection: {exc!r}") from exc
|
|
232
240
|
try:
|
|
233
241
|
await self._handler.on_connect()
|
|
234
242
|
except BaseException:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|