Kotlin Multiplatform BLE library for iOS, Android, macos, windows and javascript
A minimal browser app that drives the Blue Falcon JsEngine compiled to the
wasmJs target. It scans for a device, connects, discovers services and
characteristics, and lets you read / write / subscribe — with every
characteristicvaluechanged notification printed to the on-page log.
It exists to exercise the wasmJs variant of blue-falcon-engine-js, including
the notification bridge.
https:// or http://localhost (Web
Bluetooth is blocked on file:// and plain remote HTTP).00002a37-...).This example resolves dev.bluefalcon:* from mavenLocal, so publish the core
and js/wasmJs engine first (run from this directory):
./gradlew -p ../../library :core:publishToMavenLocal :engines:js:publishToMavenLocal
If you don’t have the Android SDK installed, the core Android publication will
fail. Publish just the targets this example needs instead:
./gradlew -p ../../library \
:core:publishKotlinMultiplatformPublicationToMavenLocal \
:core:publishWasmJsPublicationToMavenLocal \
:engines:js:publishToMavenLocal
The version in
build.gradle.kts(falconVersion) must match the library’s version inlibrary/gradle.properties(currently 3.4.3).
./gradlew wasmJsBrowserDevelopmentRun --continuous
Gradle prints a local URL (typically http://localhost:8080/). Open it in Chrome or Edge.
To produce a static bundle instead (output in
build/dist/wasmJs/productionExecutable/), run:
./gradlew wasmJsBrowserDistribution
…then serve that folder over http://localhost with any static web server.
🔔 line — that is the
characteristicvaluechanged event flowing through the wasmJs engine.src/wasmJsMain/kotlin/Main.kt — creates
BlueFalcon(JsEngine()), drives the BLE flow, and renders a tiny DOM UI via
kotlinx.browser.src/wasmJsMain/resources/index.html —
the page; loads the webpack bundle blueFalconWasmExample.js.UNDISPATCHED so requestDevice() runs
inside the click’s user-gesture activation.blueFalcon.engine.characteristicNotifications.