Blue-Falcon

Kotlin Multiplatform BLE library for iOS, Android, macos, windows and javascript

View the Project on GitHub Reedyuk/blue-falcon

ADR 0001: Add Windows 10 Platform Support Using Native WinRT APIs

Status: Accepted

Date: 2026-04-10

Deciders: Blue Falcon maintainers

Technical Story: Windows desktop users requested native BLE support to enable cross-platform Kotlin applications spanning mobile, web, and desktop environments.

Context

Blue Falcon is a Kotlin Multiplatform BLE library supporting Android, iOS, macOS, JavaScript, and Raspberry Pi. Windows desktop was notably absent as a supported platform, limiting the library’s usefulness for developers building truly cross-platform applications.

The primary challenge was determining how to implement Windows BLE support while:

Windows 10 (version 1803+) provides built-in Bluetooth LE support through the Windows Runtime (WinRT) APIs in the Windows.Devices.Bluetooth namespace, but these are C++ APIs that require bridging to the JVM.

Decision

We will implement Windows platform support using a three-layer architecture:

  1. Kotlin/JVM Layer: Platform-specific implementation of the Blue Falcon API using Kotlin coroutines for async operations
  2. JNI Bridge Layer: Native interface layer for marshaling calls between Kotlin/Java and C++
  3. Native Windows Layer: Direct C++ implementation using Windows Runtime (WinRT) Bluetooth LE APIs

This implementation will:

Consequences

Positive

Negative

Neutral

Alternatives Considered

Alternative 1: Use blessed-bluez or TinyB Library

A third-party Bluetooth library wrapper that could potentially work on Windows.

Pros:

Cons:

Why not chosen: Explicitly rejected per project requirements to avoid third-party Bluetooth libraries.

Alternative 2: Pure JVM Implementation Using Java Bluetooth APIs

Attempt to use Java’s built-in Bluetooth APIs (JSR-82) or newer Java libraries.

Pros:

Cons:

Why not chosen: No viable pure-JVM BLE solution exists for Windows with required feature completeness.

Alternative 3: Kotlin/Native Windows Target

Use Kotlin/Native instead of Kotlin/JVM for Windows platform.

Pros:

Cons:

Why not chosen: JVM target is more practical for desktop Kotlin applications and aligns better with typical deployment scenarios.

Alternative 4: Wrapper Around Windows CLI Tools

Use Windows PowerShell or command-line Bluetooth utilities.

Pros:

Cons:

Why not chosen: Insufficient functionality and performance for a production BLE library.

Implementation Notes

Build Process

The native library must be built separately before the Kotlin library can be used:

  1. Navigate to library/src/windowsMain/cpp
  2. Use CMake to generate Visual Studio project
  3. Compile with Visual Studio C++ compiler
  4. Resulting DLL must be in Java library path or application working directory

Migration Path

This is a new platform addition, not a migration. Existing platforms are unaffected.

Files Created

Kotlin Layer:

Native Layer:

Documentation:

CI/CD Changes

Added Windows verification job to CI workflows:

References