Skip to content

bledev.webble: Web Bluetooth for PyScript and the WebAssembly build - #82

Merged
bdbarnett merged 6 commits into
mainfrom
bledev-web
Sep 25, 2026
Merged

bdbarnett merged 6 commits into
mainfrom
bledev-web

Conversation

@bdbarnett

@bdbarnett bdbarnett commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

bledev.webble, the Web Bluetooth backend (central only), stacked on #78. The same bledev code now runs in Chrome or Edge, on desktop or Android, under PyScript's Pyodide, PyScript's MicroPython, and the MicroPython WebAssembly build Workbench uses.

from bledev.webble import WebBLE
import bledev.nus as nus
link = await nus.connect(WebBLE(mtu=247), name="rack")   # from a click or tap

Proven on hardware, 2026-09-24, against the P4 panel (BLE through its C6) running tests/bledev_web/nus_gate_server.py: 16 KB up, down and echoed over nus, every byte checked.

  • Chrome on the Galaxy S21, all three runtimes: PASS. Echo runs at 8.6 to 10.4 KB/s each way at MTU 247.
  • Desktop Chrome on Windows, Pyodide, PyScript MicroPython and WebAssembly: PASS, with the chooser answered through CDP DeviceAccess, so no person is needed.
  • Planted bit flips (one each way, at offset 5000) fail every phase on the phone with exactly one mismatch at 5000.
  • tests/test_bledev_web.py runs the same gate headless against a mock device on all three runtimes, and it fails on two planted faults: a bit flip, and a page told a larger MTU than its link has. A fault planted in webble itself turns it red.

The numbers and the Web Bluetooth traps are in docs/bledev-internals.md#webble. Four of those traps shaped the code: Android's chooser can't match a name that's only in a scan response, the browser hides the MTU, first connects to the P4 fail about half the time, and Chrome allows one GATT operation at a time.

Two board-side findings are filed, not fixed here: #79 (the P4 sometimes loses writes without response while it's notifying) and #80 (the P4 reports MTU 23 to a Windows central).

Merge note: mip-split.toml's host-only now lists webble. #81 lists bleak on the same line, so whichever merges second has a one-line conflict.

# Conflicts:
#	docs/bledev-internals.md
#	docs/bledev.md
#	mip-split.toml
#	pydevices-desktop.toml
Base automatically changed from bledev-core to main September 25, 2026 05:37
@bdbarnett
bdbarnett merged commit 23fcc94 into main Sep 25, 2026
3 checks passed
@bdbarnett
bdbarnett deleted the bledev-web branch September 25, 2026 05:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant