wifi-densepose-wasm
WebAssembly bindings for running WiFi-DensePose directly in the browser.
Overview
wifi-densepose-wasm compiles the WiFi-DensePose stack to wasm32-unknown-unknown and exposes a
JavaScript API via wasm-bindgen. The primary export is
MatDashboard -- a fully client-side disaster response dashboard that manages scan zones, tracks
survivors, generates triage alerts, and renders to an HTML Canvas element.
The crate also provides utility functions (init, getVersion, isMatEnabled, getTimestamp) and
a logging bridge that routes Rust log output to the browser console.
Features
- MatDashboard -- Create disaster events, add rectangular and circular scan zones, subscribe to survivor-detected and alert-generated callbacks, and render zone/survivor overlays on Canvas.
- Real-time callbacks -- Register JavaScript closures for
onSurvivorDetectedandonAlertGeneratedevents, called from the Rust event loop. - Canvas rendering -- Draw zone boundaries, survivor markers (colour-coded by triage status),
and alert indicators directly to a
CanvasRenderingContext2d. - WebSocket integration -- Connect to a sensing server for live CSI data via
web-sysWebSocket bindings. - Panic hook --
console_error_panic_hookprovides human-readable stack traces in the browser console on panic. - Optimised WASM -- Release profile uses
-O4wasm-opt with mutable globals for minimal binary size.
Feature flags
| Flag | Default | Description |
|---|---|---|
console_error_panic_hook |
yes | Better panic messages in the browser console |
mat |
no | Enable MAT disaster detection dashboard |
Quick Start
Build
# Build with wasm-pack (recommended)
# Or with cargo directly
JavaScript Usage
import init from './wifi_densepose_wasm.js';
;
Exported API
| Export | Kind | Description |
|---|---|---|
init() |
Function | Initialise the WASM module (called automatically via wasm_bindgen(start)) |
initLogging(level) |
Function | Set log level: trace, debug, info, warn, error |
getVersion() |
Function | Return the crate version string |
isMatEnabled() |
Function | Check whether the MAT feature is compiled in |
getTimestamp() |
Function | High-resolution timestamp via Performance.now() |
MatDashboard |
Class | Disaster response dashboard (zones, survivors, alerts, rendering) |
Related Crates
| Crate | Role |
|---|---|
wifi-densepose-mat |
MAT engine (linked when mat feature enabled) |
wifi-densepose-core |
Shared types and traits |
wifi-densepose-cli |
Terminal-based MAT interface |
wifi-densepose-sensing-server |
Backend sensing server for WebSocket data |
License
MIT OR Apache-2.0