Skip to main content

Crate ble_windows_server

Crate ble_windows_server 

Source
Expand description

§Windows BLE GATT Server

A simple, ergonomic BLE GATT server library for Windows using WinRT APIs.

§Features

  • Create BLE GATT services with multiple read/notify characteristics
  • Automatic adapter discovery and selection
  • Async/await support with Tokio
  • Simple data broadcast via notifications

§Example

use ble_windows_server::WindowsBLEGattServer;
use uuid::Uuid;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let service_uuid = Uuid::parse_str("12345678-1234-5678-1234-567812345678")?;
    let char_uuid = Uuid::from_u128(service_uuid.as_u128() + 1);
    let mut server = WindowsBLEGattServer::new("MyDevice".into(), service_uuid);
    server.add_characteristic("message", char_uuid, "A message");

    server.start().await?;
    server.notify("message", b"Hello BLE!").await?;

    Ok(())
}

Structs§

AdapterInfo
SRS-003: Bluetooth adapter information.
Uuid
A Universally Unique Identifier (UUID).
WindowsBLEGattServer
SRS-006: Windows BLE GATT Server.

Enums§

BleError
SRS-001: Unified error type for all BLE operations.

Functions§

list_adapters
SRS-004: Enumerate all Bluetooth adapters on the system.
list_radios
SRS-005: List all Bluetooth radios (debug utility).

Type Aliases§

Result
SRS-002: Standard Result type alias for the library.