Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
72000f6
fix(udp): cap the payload at the server's advertised buffer
JPHutchins Sep 22, 2026
f4d5f08
Merge pull request #142 from intercreate/fix/udp-respect-server-buf-size
JPHutchins Sep 22, 2026
a231a36
Merge main into the #58 work (brings #142, the UDP buffer cap)
JPHutchins Sep 23, 2026
40c6d36
refactor(client): move the request/response exchange into smpclient._…
JPHutchins Sep 23, 2026
a353b5b
breaking(transport): transports own their address and lifecycle; SMPC…
JPHutchins Sep 23, 2026
78c58ee
breaking(transport): per-transport fragmentation strategies; negotiat…
JPHutchins Sep 23, 2026
9d00fd4
breaking(serial): pyserial settings move into SerialOptions
JPHutchins Sep 23, 2026
9a5eb94
fix(serial): open the port off the event loop; don't leak it when the…
JPHutchins Sep 23, 2026
c8ccc02
feat(serial): borrow a caller's open port; the harness borrows its so…
JPHutchins Sep 23, 2026
03306ea
feat(ble): borrow a caller's connected BleakClient
JPHutchins Sep 23, 2026
0ecf44c
feat(ble): pick the BlueZ adapter to scan and connect with
JPHutchins Sep 23, 2026
2bd7554
breaking(bumble): bond management moves to module functions
JPHutchins Sep 23, 2026
bdc979e
fix(bumble): release on cancel, return borrowed links whole, unsubscr…
JPHutchins Sep 23, 2026
d35531e
fix(ble): the link sum type carries the client; a closed transport ra…
JPHutchins Sep 23, 2026
5d58791
test(serial): lock SerialOptions to SerialBase, which declares pyseri…
JPHutchins Sep 23, 2026
a1c2b16
breaking(serial): drop the deprecated 7.1.0 sizing params
JPHutchins Sep 23, 2026
e4e8228
refactor(transport): Final config, a structural sequence default, and…
JPHutchins Sep 23, 2026
f6678a1
breaking(transport): the link target is an argument to connect(), not…
JPHutchins Sep 23, 2026
eab0363
breaking(ble): bleak backend options are one sum type, not two kwargs…
JPHutchins Sep 23, 2026
7bad118
feat(client): SMPClient is generic over its transport
JPHutchins Sep 23, 2026
7c91b0b
style: CLAUDE.md pass — cut restating docstrings, exhaustive matches,…
JPHutchins Sep 23, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion examples/ble/helloworld.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ async def main() -> None:
print(f"Found {len(smp_servers)} SMP servers: {smp_servers}")

print("Connecting to the first SMP server...", end="", flush=True)
async with SMPClient(SMPBLETransport(), smp_servers[0].address) as client:
async with SMPBLETransport().connected(smp_servers[0].address) as transport:
client = SMPClient(transport)
print("OK")

print("Sending request...", end="", flush=True)
Expand Down
3 changes: 2 additions & 1 deletion examples/ble/imagestate.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ async def main() -> None:
print(f"Found {len(smp_servers)} SMP servers: {smp_servers}")

print("Connecting to the first SMP server...", end="", flush=True)
async with SMPClient(SMPBLETransport(), smp_servers[0].address) as client:
async with SMPBLETransport().connected(smp_servers[0].address) as transport:
client = SMPClient(transport)
print("OK")

print("Sending request...", end="", flush=True)
Expand Down
3 changes: 2 additions & 1 deletion examples/ble/mcumgrparameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ async def main() -> None:
print(f"Found {len(smp_servers)} SMP servers: {smp_servers}")

print("Connecting to the first SMP server...", end="", flush=True)
async with SMPClient(SMPBLETransport(), smp_servers[0].address) as client:
async with SMPBLETransport().connected(smp_servers[0].address) as transport:
client = SMPClient(transport)
print("OK")
print(f"Client MTU is {client._transport.mtu}B")
print(f"Client max unencoded size is {client._transport.max_unencoded_size}B")
Expand Down
6 changes: 4 additions & 2 deletions examples/ble/upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ async def main() -> None:
print("OK")

print("Connecting to A SMP DUT...", end="", flush=True)
async with SMPClient(SMPBLETransport(), a_smp_dut.name or a_smp_dut.address) as client:
async with SMPBLETransport().connected(a_smp_dut.name or a_smp_dut.address) as transport:
client = SMPClient(transport)
print("OK")

async def ensure_request(request: SMPRequest[TRep, TEr1, TEr2]) -> TRep:
Expand Down Expand Up @@ -119,7 +120,8 @@ async def ensure_request(request: SMPRequest[TRep, TEr1, TEr2]) -> TRep:
b_smp_dut = cast(BLEDevice, b_smp_dut)

print("Connecting to B SMP DUT...", end="", flush=True)
async with SMPClient(SMPBLETransport(), b_smp_dut.name or b_smp_dut.address) as client:
async with SMPBLETransport().connected(b_smp_dut.name or b_smp_dut.address) as transport:
client = SMPClient(transport)
print("OK")

print()
Expand Down
7 changes: 4 additions & 3 deletions examples/ble/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,10 @@ async def main() -> None:
print(f"Found {len(smp_servers)} SMP servers: {smp_servers}")

print("Connecting to the first SMP server...", end="", flush=True)
async with SMPClient(
SMPBLETransport(), smp_servers[0].name or smp_servers[0].address
) as client:
async with SMPBLETransport().connected(
smp_servers[0].name or smp_servers[0].address
) as transport:
client = SMPClient(transport)
print("OK")

print("Sending request...", end="", flush=True)
Expand Down
3 changes: 2 additions & 1 deletion examples/udp/helloworld.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ async def main() -> None:
parser.add_argument("address", help="The IP address to connect to")
address = parser.parse_args().address

async with SMPClient(SMPUDPTransport(), address) as client:
async with SMPUDPTransport().connected(address) as transport:
client = SMPClient(transport)
print("OK")

print("Sending request...", end="", flush=True)
Expand Down
3 changes: 2 additions & 1 deletion examples/usb/download_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ async def main() -> None:
port = args.port
file_location = args.file_location

async with SMPClient(SMPSerialTransport(), port) as client:
async with SMPSerialTransport().connected(port) as transport:
client = SMPClient(transport)
start_s = time.time()
file_data = await client.download_file(file_location)
end_s = time.time()
Expand Down
3 changes: 2 additions & 1 deletion examples/usb/helloworld.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ async def main() -> None:
parser.add_argument("port", help="The serial port to connect to")
port = parser.parse_args().port

async with SMPClient(SMPSerialTransport(), port) as client:
async with SMPSerialTransport().connected(port) as transport:
client = SMPClient(transport)
print("OK")

print("Sending request...", end="", flush=True)
Expand Down
26 changes: 8 additions & 18 deletions examples/usb/upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,10 @@ async def main() -> None:
await asyncio.sleep(1)

print("Connecting to SMP DUT...", end="", flush=True)
async with SMPClient(
SMPSerialTransport(
fragmentation_strategy=BufferParams(
line_length=line_length,
line_buffers=line_buffers,
)
),
port_a.device,
) as client:
async with SMPSerialTransport(
BufferParams(line_length=line_length, line_buffers=line_buffers)
).connected(port_a.device) as transport:
client = SMPClient(transport)
print("OK")

async def ensure_request(request: SMPRequest[TRep, TEr1, TEr2]) -> TRep:
Expand Down Expand Up @@ -185,15 +180,10 @@ async def ensure_request(request: SMPRequest[TRep, TEr1, TEr2]) -> TRep:
print(f"OK - found DUT B at {port_b.device}")

print("Connecting to B SMP DUT...", end="", flush=True)
async with SMPClient(
SMPSerialTransport(
fragmentation_strategy=BufferParams(
line_length=line_length,
line_buffers=line_buffers,
)
),
port_b.device,
) as client:
async with SMPSerialTransport(
BufferParams(line_length=line_length, line_buffers=line_buffers)
).connected(port_b.device) as transport:
client = SMPClient(transport)
print("OK")

print()
Expand Down
3 changes: 2 additions & 1 deletion examples/usb/upload_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ async def main() -> None:
Etiam elit velit, posuere ut pulvinar ac, condimentum eget justo. Fusce a erat velit. Vivamus
imperdiet ultrices orci in hendrerit.
"""
async with SMPClient(SMPSerialTransport(), port) as client:
async with SMPSerialTransport().connected(port) as transport:
client = SMPClient(transport)
start_s = time.time()
async for offset in client.upload_file(file_data=file_data, file_path=file_path):
print(
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ dependencies = [
"smp @ git+https://github.com/JPHutchins/smp@screaming-goblin",
"msgspec>=0.21.1",
"intelhex>=2.3.0",
# `TypeIs` landed in 4.10; `override`/`assert_never`/`deprecated` are older
# `TypeIs` landed in 4.10; `override`/`assert_never` are older
"typing-extensions>=4.10",
"async-timeout>=5.0.1; python_version < '3.11'",
]
Expand Down
Loading
Loading