Rust workspace + Web app for talking to DeTong / Detonger label printers over BLE.
- Tested: DeTong / Detonger P2 (德佟印立方 P2)
- Other models: not tested, may not work (protocol and GATT UUIDs may differ)
crates/detonger-protocol: protocol/encoding layer (transport agnostic)crates/detonger-printer: Rust library (BLE transport + printer operations)crates/detonger-cli: CLI binary (detonger)crates/detonger-wasm: Wasm bindings for protocol encodingdocs/specs/: work-item specs (new canonical path)docs/plan/: legacy planning docs (read-only compatibility)web/app: Vite + React + TypeScript Web Bluetooth apprefs/: local-only reverse engineering / legacy prototype (gitignored, never committed)
On macOS, the terminal running detonger must have Bluetooth permission.
System Settings -> Privacy & Security -> Bluetooth -> enable your terminal app.
docs/ble.md: BLE/GATT UUIDs + macOS setupdocs/protocol.md: protocol framing notes (header/bitmap/finalize)docs/runbook.md: manual validation steps (CLI + Web)
Scan for printers:
cargo run -q -p detonger -- scan --timeout-s 6Generate a PNG preview (no printer needed):
cargo run -q -p detonger -- preview width-test --out /tmp/detonger-width-test.pngPrint the width-test pattern:
cargo run -q -p detonger -- print width-test --device <device-id>Print a PNG:
cargo run -q -p detonger -- print png --device <device-id> --png /path/to/file.pngRequires Chrome desktop + secure context (https:// or http://localhost).
cd web/app
bun install
bun run devOpen http://localhost:5173/?mockBle=1 for a mock-BLE demo without hardware.
cd web/app
bun run lint
bun run test
bun run test:smoke
bun run buildbun run wasm:build compiles crates/detonger-wasm and regenerates web/app/src/wasm/pkg.