From b706a5af4ba5e8e44f11c8be6430defc4badc88a Mon Sep 17 00:00:00 2001 From: Alsey Coleman Miller Date: Wed, 18 Nov 2026 00:55:10 -0500 Subject: [PATCH 1/7] Used the new Bluetooth contract names in LinuxAttributes --- Sources/LinuxBluetooth/LinuxAttributes.swift | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Sources/LinuxBluetooth/LinuxAttributes.swift b/Sources/LinuxBluetooth/LinuxAttributes.swift index 324760c..2a6916d 100644 --- a/Sources/LinuxBluetooth/LinuxAttributes.swift +++ b/Sources/LinuxBluetooth/LinuxAttributes.swift @@ -4,7 +4,7 @@ import DynamicBluetooth import DynamicRuntime /// A `GattService1` object. -public final class LinuxService: Service { +public final class LinuxService: BluetoothService { let path: String @@ -31,11 +31,11 @@ public final class LinuxService: Service { object["Primary"]?.boolValue ?? true } - public func characteristics() -> [any Characteristic] { + public func characteristics() -> [any BluetoothCharacteristic] { discovered } - public func peripheral() -> any Peripheral { + public func peripheral() -> any BluetoothPeripheral { hub.peripheral(object["Device"]?.stringValue ?? Self.parent(of: path)) } @@ -45,7 +45,7 @@ public final class LinuxService: Service { } /// A `GattCharacteristic1` object. -public final class LinuxCharacteristic: Characteristic { +public final class LinuxCharacteristic: BluetoothCharacteristic { let path: String @@ -89,11 +89,11 @@ public final class LinuxCharacteristic: Characteristic { notifying ?? object["Notifying"]?.boolValue ?? false } - public func descriptors() -> [any Descriptor] { + public func descriptors() -> [any BluetoothDescriptor] { discovered } - public func service() -> any Service { + public func service() -> any BluetoothService { hub.service(object["Service"]?.stringValue ?? LinuxService.parent(of: path)) } @@ -107,7 +107,7 @@ public final class LinuxCharacteristic: Characteristic { } /// A `GattDescriptor1` object. -public final class LinuxDescriptor: Descriptor { +public final class LinuxDescriptor: BluetoothDescriptor { let path: String @@ -134,13 +134,13 @@ public final class LinuxDescriptor: Descriptor { lastValue ?? object["Value"]?.bytes } - public func characteristic() -> any Characteristic { + public func characteristic() -> any BluetoothCharacteristic { hub.characteristic(object["Characteristic"]?.stringValue ?? LinuxService.parent(of: path)) } } /// What a device advertised, as BlueZ has it when it's reported. -public final class LinuxAdvertisement: Advertisement { +public final class LinuxAdvertisement: BluetoothAdvertisement { let device: [String: DBusValue] From 281d071fbeff2f5b6fce5ecc0f8dccc3906ef386 Mon Sep 17 00:00:00 2001 From: Alsey Coleman Miller Date: Wed, 18 Nov 2026 00:55:10 -0500 Subject: [PATCH 2/7] Used the new Bluetooth contract names in LinuxBluetooth --- Sources/LinuxBluetooth/LinuxBluetooth.swift | 32 ++++++++++----------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/Sources/LinuxBluetooth/LinuxBluetooth.swift b/Sources/LinuxBluetooth/LinuxBluetooth.swift index db4be74..38141c5 100644 --- a/Sources/LinuxBluetooth/LinuxBluetooth.swift +++ b/Sources/LinuxBluetooth/LinuxBluetooth.swift @@ -10,26 +10,26 @@ public enum LinuxBluetooth: HostModule { public static var contracts: [ContractDescriptor] { [ - CentralProxy.descriptor, - CentralDelegateProxy.descriptor, - PeripheralProxy.descriptor, - PeripheralDelegateProxy.descriptor, - ServiceProxy.descriptor, - CharacteristicProxy.descriptor, - DescriptorProxy.descriptor, - AdvertisementProxy.descriptor, + BluetoothCentralProxy.descriptor, + BluetoothCentralDelegateProxy.descriptor, + BluetoothPeripheralProxy.descriptor, + BluetoothPeripheralDelegateProxy.descriptor, + BluetoothServiceProxy.descriptor, + BluetoothCharacteristicProxy.descriptor, + BluetoothDescriptorProxy.descriptor, + BluetoothAdvertisementProxy.descriptor, ] } public static func register(in registrar: some ContractRegistrar) { - CentralProxy.register(LinuxCentral.self, in: registrar) - PeripheralProxy.register(LinuxPeripheral.self, in: registrar) - ServiceProxy.register(LinuxService.self, in: registrar) - CharacteristicProxy.register(LinuxCharacteristic.self, in: registrar) - DescriptorProxy.register(LinuxDescriptor.self, in: registrar) - AdvertisementProxy.register(LinuxAdvertisement.self, in: registrar) - CentralDelegateProxy.registerInterface(in: registrar) - PeripheralDelegateProxy.registerInterface(in: registrar) + BluetoothCentralProxy.register(LinuxCentral.self, in: registrar) + BluetoothPeripheralProxy.register(LinuxPeripheral.self, in: registrar) + BluetoothServiceProxy.register(LinuxService.self, in: registrar) + BluetoothCharacteristicProxy.register(LinuxCharacteristic.self, in: registrar) + BluetoothDescriptorProxy.register(LinuxDescriptor.self, in: registrar) + BluetoothAdvertisementProxy.register(LinuxAdvertisement.self, in: registrar) + BluetoothCentralDelegateProxy.registerInterface(in: registrar) + BluetoothPeripheralDelegateProxy.registerInterface(in: registrar) } /// Desktop Linux has no Bluetooth prompt: a declared `bluetooth` From 28c4fd7813fff36ca647f03cba43678ea3453358 Mon Sep 17 00:00:00 2001 From: Alsey Coleman Miller Date: Wed, 18 Nov 2026 00:55:10 -0500 Subject: [PATCH 3/7] Used the new Bluetooth contract names in LinuxCentral --- Sources/LinuxBluetooth/LinuxCentral.swift | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Sources/LinuxBluetooth/LinuxCentral.swift b/Sources/LinuxBluetooth/LinuxCentral.swift index f03c8c6..79403ef 100644 --- a/Sources/LinuxBluetooth/LinuxCentral.swift +++ b/Sources/LinuxBluetooth/LinuxCentral.swift @@ -3,7 +3,7 @@ import DBUS import DynamicBluetooth import LinuxHost -/// The `Central` contract over BlueZ (`Plan.md` §6). +/// The `BluetoothCentral` contract over BlueZ (`Plan.md` §6). /// /// - Authorization is always `allowed`: desktop Linux has no prompt, and /// the sandbox's `bluetooth` capability gates the contract itself. @@ -14,14 +14,14 @@ import LinuxHost /// - Connection timeouts are main-loop timers; BlueZ's own is long. /// /// Every call that reports through the delegate reports exactly once. -public final class LinuxCentral: Central { +public final class LinuxCentral: BluetoothCentral { struct ScanRequest { var services: [BluetoothUUID] var allowDuplicates: Bool } - let delegate: any CentralDelegate + let delegate: any BluetoothCentralDelegate let hub: BlueZHub @@ -39,7 +39,7 @@ public final class LinuxCentral: Central { private var reportedState: CentralState? - init(delegate: any CentralDelegate, hub: BlueZHub) { + init(delegate: any BluetoothCentralDelegate, hub: BlueZHub) { self.delegate = delegate self.hub = hub } @@ -59,11 +59,11 @@ public final class LinuxCentral: Central { BluetoothAuthorization.allowed.rawValue } - public static func make(_ delegate: any CentralDelegate) -> LinuxCentral { + public static func make(_ delegate: any BluetoothCentralDelegate) -> LinuxCentral { make(delegate, hub: .shared) } - static func make(_ delegate: any CentralDelegate, hub: BlueZHub) -> LinuxCentral { + static func make(_ delegate: any BluetoothCentralDelegate, hub: BlueZHub) -> LinuxCentral { let central = LinuxCentral(delegate: delegate, hub: hub) hub.add(central) LinuxBluetooth.post { [weak central] in @@ -145,7 +145,7 @@ public final class LinuxCentral: Central { // MARK: Connections - public func connect(_ peripheral: any Peripheral, timeout: Int32) { + public func connect(_ peripheral: any BluetoothPeripheral, timeout: Int32) { guard let peripheral = LinuxBluetooth.resolve(peripheral, as: LinuxPeripheral.self) else { HostLog.warning("connect: not a peripheral of this host") return @@ -188,7 +188,7 @@ public final class LinuxCentral: Central { } } - public func cancelConnection(_ peripheral: any Peripheral) { + public func cancelConnection(_ peripheral: any BluetoothPeripheral) { guard let peripheral = LinuxBluetooth.resolve(peripheral, as: LinuxPeripheral.self) else { return } let path = peripheral.path if let attempt = connecting.removeValue(forKey: path) { @@ -217,11 +217,11 @@ public final class LinuxCentral: Central { } } - public func retrievePeripherals(_ identifiers: [String]) -> [any Peripheral] { + public func retrievePeripherals(_ identifiers: [String]) -> [any BluetoothPeripheral] { identifiers.compactMap { hub.devicePath(address: $0).map(hub.peripheral) } } - public func retrieveConnectedPeripherals(_ services: [BluetoothUUID]) -> [any Peripheral] { + public func retrieveConnectedPeripherals(_ services: [BluetoothUUID]) -> [any BluetoothPeripheral] { let wanted = Set(services.map(BlueZMapping.bluezUUID)) return hub.devicePaths.filter { path in guard let device = hub.properties(path, BlueZInterface.device), device["Connected"]?.boolValue == true else { From fcda5804de4c792ab7726fce7d6e733c7c0f15b7 Mon Sep 17 00:00:00 2001 From: Alsey Coleman Miller Date: Wed, 18 Nov 2026 00:55:10 -0500 Subject: [PATCH 4/7] Used the new Bluetooth contract names in LinuxPeripheral --- Sources/LinuxBluetooth/LinuxPeripheral.swift | 24 ++++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/Sources/LinuxBluetooth/LinuxPeripheral.swift b/Sources/LinuxBluetooth/LinuxPeripheral.swift index 5ce7f9f..a45a93f 100644 --- a/Sources/LinuxBluetooth/LinuxPeripheral.swift +++ b/Sources/LinuxBluetooth/LinuxPeripheral.swift @@ -3,14 +3,14 @@ import DBUS import DynamicBluetooth import LinuxHost -/// The `Peripheral` contract over a BlueZ device (`Plan.md` §6). +/// The `BluetoothPeripheral` contract over a BlueZ device (`Plan.md` §6). /// /// BlueZ resolves the whole GATT database when it connects, so discovery /// reads `GattService1`, `GattCharacteristic1` and `GattDescriptor1` /// objects under the device. Operations are queued and run one at a time; /// each reports exactly once, and a disconnect fails what's queued with /// `notConnected`. -public final class LinuxPeripheral: Peripheral { +public final class LinuxPeripheral: BluetoothPeripheral { let path: String @@ -18,7 +18,7 @@ public final class LinuxPeripheral: Peripheral { /// outlive it. let hub: BlueZHub - private(set) var delegate: (any PeripheralDelegate)? + private(set) var delegate: (any BluetoothPeripheralDelegate)? /// Services discovered so far. private var discovered: [LinuxService] = [] @@ -81,7 +81,7 @@ public final class LinuxPeripheral: Peripheral { return state.rawValue } - public func setDelegate(_ delegate: (any PeripheralDelegate)?) { + public func setDelegate(_ delegate: (any BluetoothPeripheralDelegate)?) { self.delegate = delegate } @@ -106,11 +106,11 @@ public final class LinuxPeripheral: Peripheral { } } - public func services() -> [any Service] { + public func services() -> [any BluetoothService] { discovered } - public func discoverCharacteristics(_ uuids: [BluetoothUUID], for service: any Service) { + public func discoverCharacteristics(_ uuids: [BluetoothUUID], for service: any BluetoothService) { guard let service = LinuxBluetooth.resolve(service, as: LinuxService.self) else { return } let wanted = Set(uuids.map(BlueZMapping.bluezUUID)) enqueue { [self] done in @@ -124,7 +124,7 @@ public final class LinuxPeripheral: Peripheral { } } - public func discoverDescriptors(for characteristic: any Characteristic) { + public func discoverDescriptors(for characteristic: any BluetoothCharacteristic) { guard let characteristic = LinuxBluetooth.resolve(characteristic, as: LinuxCharacteristic.self) else { return } enqueue { [self] done in characteristic.discovered = hub.children(of: characteristic.path, interface: BlueZInterface.descriptor, parentKey: "Characteristic") @@ -136,7 +136,7 @@ public final class LinuxPeripheral: Peripheral { } } - public func readValue(_ characteristic: any Characteristic) { + public func readValue(_ characteristic: any BluetoothCharacteristic) { guard let characteristic = LinuxBluetooth.resolve(characteristic, as: LinuxCharacteristic.self) else { return } enqueue { [self] done in characteristic.reading = true @@ -157,7 +157,7 @@ public final class LinuxPeripheral: Peripheral { } } - public func writeValue(_ value: [UInt8], for characteristic: any Characteristic, type: Int32) { + public func writeValue(_ value: [UInt8], for characteristic: any BluetoothCharacteristic, type: Int32) { guard let characteristic = LinuxBluetooth.resolve(characteristic, as: LinuxCharacteristic.self) else { return } let withResponse = type != WriteType.withoutResponse.rawValue enqueue { [self] done in @@ -178,7 +178,7 @@ public final class LinuxPeripheral: Peripheral { } } - public func setNotifyValue(_ enabled: Bool, for characteristic: any Characteristic) { + public func setNotifyValue(_ enabled: Bool, for characteristic: any BluetoothCharacteristic) { guard let characteristic = LinuxBluetooth.resolve(characteristic, as: LinuxCharacteristic.self) else { return } enqueue { [self] done in gatt(characteristic.path, BlueZInterface.characteristic, enabled ? "StartNotify" : "StopNotify", [], nil) { [self] result in @@ -200,7 +200,7 @@ public final class LinuxPeripheral: Peripheral { } } - public func readDescriptor(_ descriptor: any Descriptor) { + public func readDescriptor(_ descriptor: any BluetoothDescriptor) { guard let descriptor = LinuxBluetooth.resolve(descriptor, as: LinuxDescriptor.self) else { return } enqueue { [self] done in gatt(descriptor.path, BlueZInterface.descriptor, "ReadValue", [.options([:])], "a{sv}") { [self] result in @@ -219,7 +219,7 @@ public final class LinuxPeripheral: Peripheral { } } - public func writeDescriptor(_ value: [UInt8], for descriptor: any Descriptor) { + public func writeDescriptor(_ value: [UInt8], for descriptor: any BluetoothDescriptor) { guard let descriptor = LinuxBluetooth.resolve(descriptor, as: LinuxDescriptor.self) else { return } enqueue { [self] done in gatt(descriptor.path, BlueZInterface.descriptor, "WriteValue", [.byteArray(value), .options([:])], "aya{sv}") { [self] result in From 97fe9bc0a800d0d6000a20d3436451760a80bbb2 Mon Sep 17 00:00:00 2001 From: Alsey Coleman Miller Date: Wed, 18 Nov 2026 00:55:11 -0500 Subject: [PATCH 5/7] Used the new Bluetooth contract names in FakeBlueZ --- Tests/LinuxBluetoothTests/FakeBlueZ.swift | 44 +++++++++++------------ 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/Tests/LinuxBluetoothTests/FakeBlueZ.swift b/Tests/LinuxBluetoothTests/FakeBlueZ.swift index 40de911..c7e057d 100644 --- a/Tests/LinuxBluetoothTests/FakeBlueZ.swift +++ b/Tests/LinuxBluetoothTests/FakeBlueZ.swift @@ -90,92 +90,92 @@ final class FakeBus: BlueZBus { } /// Records what a central reports. -final class CentralLog: CentralDelegate { +final class CentralLog: BluetoothCentralDelegate { var events: [String] = [] - var discovered: [(peripheral: any Peripheral, advertisement: any Advertisement, rssi: Int32)] = [] + var discovered: [(peripheral: any BluetoothPeripheral, advertisement: any BluetoothAdvertisement, rssi: Int32)] = [] - func didChangeAuthorization(_ central: any Central, status: Int32) { + func didChangeAuthorization(_ central: any BluetoothCentral, status: Int32) { events.append("authorization \(status)") } - func didUpdateState(_ central: any Central, state: Int32) { + func didUpdateState(_ central: any BluetoothCentral, state: Int32) { events.append("state \(CentralState(rawValue: state)!)") } - func didDiscover(_ central: any Central, peripheral: any Peripheral, advertisement: any Advertisement, rssi: Int32) { + func didDiscover(_ central: any BluetoothCentral, peripheral: any BluetoothPeripheral, advertisement: any BluetoothAdvertisement, rssi: Int32) { events.append("discover \(peripheral.identifier()) \(rssi)") discovered.append((peripheral, advertisement, rssi)) } - func didStopScanning(_ central: any Central, error: Int32) { + func didStopScanning(_ central: any BluetoothCentral, error: Int32) { events.append("stopScanning \(error)") } - func didConnect(_ central: any Central, peripheral: any Peripheral) { + func didConnect(_ central: any BluetoothCentral, peripheral: any BluetoothPeripheral) { events.append("connect") } - func didFailToConnect(_ central: any Central, peripheral: any Peripheral, error: Int32) { + func didFailToConnect(_ central: any BluetoothCentral, peripheral: any BluetoothPeripheral, error: Int32) { events.append("failToConnect \(BluetoothError(rawValue: error)!)") } - func didDisconnect(_ central: any Central, peripheral: any Peripheral, error: Int32) { + func didDisconnect(_ central: any BluetoothCentral, peripheral: any BluetoothPeripheral, error: Int32) { events.append("disconnect \(error)") } } /// Records what a peripheral reports. -final class PeripheralLog: PeripheralDelegate { +final class PeripheralLog: BluetoothPeripheralDelegate { var events: [String] = [] - func didDiscoverServices(_ peripheral: any Peripheral, error: Int32) { + func didDiscoverServices(_ peripheral: any BluetoothPeripheral, error: Int32) { events.append("services \(error)") } - func didDiscoverCharacteristics(_ peripheral: any Peripheral, service: any Service, error: Int32) { + func didDiscoverCharacteristics(_ peripheral: any BluetoothPeripheral, service: any BluetoothService, error: Int32) { events.append("characteristics \(error)") } - func didDiscoverDescriptors(_ peripheral: any Peripheral, characteristic: any Characteristic, error: Int32) { + func didDiscoverDescriptors(_ peripheral: any BluetoothPeripheral, characteristic: any BluetoothCharacteristic, error: Int32) { events.append("descriptors \(error)") } - func didUpdateValue(_ peripheral: any Peripheral, characteristic: any Characteristic, value: [UInt8], error: Int32) { + func didUpdateValue(_ peripheral: any BluetoothPeripheral, characteristic: any BluetoothCharacteristic, value: [UInt8], error: Int32) { events.append("value \(value) \(error)") } - func didWriteValue(_ peripheral: any Peripheral, characteristic: any Characteristic, error: Int32) { + func didWriteValue(_ peripheral: any BluetoothPeripheral, characteristic: any BluetoothCharacteristic, error: Int32) { events.append("write \(error)") } - func didUpdateNotificationState(_ peripheral: any Peripheral, characteristic: any Characteristic, error: Int32) { + func didUpdateNotificationState(_ peripheral: any BluetoothPeripheral, characteristic: any BluetoothCharacteristic, error: Int32) { events.append("notifying \(characteristic.isNotifying()) \(error)") } - func didUpdateDescriptorValue(_ peripheral: any Peripheral, descriptor: any Descriptor, value: [UInt8], error: Int32) { + func didUpdateDescriptorValue(_ peripheral: any BluetoothPeripheral, descriptor: any BluetoothDescriptor, value: [UInt8], error: Int32) { events.append("descriptor \(value) \(error)") } - func didWriteDescriptorValue(_ peripheral: any Peripheral, descriptor: any Descriptor, error: Int32) { + func didWriteDescriptorValue(_ peripheral: any BluetoothPeripheral, descriptor: any BluetoothDescriptor, error: Int32) { events.append("descriptorWrite \(error)") } - func didReadRSSI(_ peripheral: any Peripheral, rssi: Int32, error: Int32) { + func didReadRSSI(_ peripheral: any BluetoothPeripheral, rssi: Int32, error: Int32) { events.append("rssi \(rssi) \(error)") } - func isReadyToSendWriteWithoutResponse(_ peripheral: any Peripheral) { + func isReadyToSendWriteWithoutResponse(_ peripheral: any BluetoothPeripheral) { events.append("ready") } - func didModifyServices(_ peripheral: any Peripheral) { + func didModifyServices(_ peripheral: any BluetoothPeripheral) { events.append("modified") } - func didUpdateName(_ peripheral: any Peripheral) { + func didUpdateName(_ peripheral: any BluetoothPeripheral) { events.append("name") } } From 774aa07aedabd3fa91ac6ac36e0165ff9d153a14 Mon Sep 17 00:00:00 2001 From: Alsey Coleman Miller Date: Wed, 18 Nov 2026 00:55:11 -0500 Subject: [PATCH 6/7] Updated Documentation/Plan.md for the new Bluetooth contract names --- Documentation/Plan.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Documentation/Plan.md b/Documentation/Plan.md index 13c2f32..8d2ae19 100644 --- a/Documentation/Plan.md +++ b/Documentation/Plan.md @@ -46,7 +46,7 @@ AppRuntime's contracts. | arm64 and x86_64 Linux with glibc (Debian 13, Ubuntu 24.04+) | armv7, musl | | Native slices linked into the host | wasm2c (AppRuntime's shim, as on Darwin); WasmKit for development | | Wayland and X11 through SDL3; a headless driver for tests | Multiple windows | -| `Renderer`, Bluetooth `Central` and friends, GL surfaces, web views, files, settings, the built-ins | Location (GeoClue), Device (UPower, sysfs), Networking (libcurl), Formatting (ICU), Motion (iio-sensor-proxy), NFC (neard) | +| `Renderer`, `BluetoothCentral` and friends, GL surfaces, web views, files, settings, the built-ins | Location (GeoClue), Device (UPower, sysfs), Networking (libcurl), Formatting (ICU), Motion (iio-sensor-proxy), NFC (neard) | ## 2. Process model @@ -89,7 +89,7 @@ timers for `schedule`. |---|---| | `LinuxHost` | `AppHost` (built-ins, modules, `rt_main`), `MainLoop`, `MainLoopClock`, the `Bundle` built-in, and `LinuxFiles` and `LinuxDefaults` (§9); over AppRuntime's `RuntimeHost`, which every host shares: `AppInfo` (the bundle's `Info.plist` keys), the compatibility checks, `HostModule`, the `Permissions` and `Application` built-ins, `HostFiles` and `HostDefaults` | | `LinuxUI` | The SwiftUI player: DarwinAppRuntime's `DarwinUI`, copied by `Scripts/sync-darwinui.sh`, over Cacao's `SwiftUI` and `Combine` modules; `Host.swift` gives it the logger and bundle it takes from its host | -| `LinuxBluetooth` | `Central`, `Peripheral`, `Service`, `Characteristic`, `Descriptor`, `Advertisement` over BlueZ | +| `LinuxBluetooth` | `BluetoothCentral`, `BluetoothPeripheral`, `BluetoothService`, `BluetoothCharacteristic`, `BluetoothDescriptor`, `BluetoothAdvertisement` over BlueZ | | `LinuxGraphics` | `Surface` over EGL and GLES 2.0, loaded at run time; the player's `GLSurface` view shows it (§7) | | `LinuxWebKit` | `WebContent` over WPE WebKit, loaded at run time; the player's `WebView` view shows it (§8) | | `LinuxCoreModel` | `LinuxModelStore`: the model store over CoreModel-SQLite, through AppRuntime's `HostModelStore` (§9) | @@ -159,14 +159,14 @@ contract logic is tested with a fake bus. | `scan` | `SetDiscoveryFilter({Transport: le, UUIDs, DuplicateData})`, `StartDiscovery`; a device is reported when it appears or its `RSSI`, `ManufacturerData` or `ServiceData` changes, once per scan unless duplicates are allowed; services filtered on the host too, since cached devices skip BlueZ's filter | | `connect` | `Device1.Connect`; `didConnect` once `Connected` and `ServicesResolved`; the timeout is a main-loop timer that disconnects | | `cancelConnection` | `Device1.Disconnect`, `didDisconnect` with `0` | -| `retrievePeripherals` | Devices by address (`Peripheral.identifier`) | +| `retrievePeripherals` | Devices by address (`BluetoothPeripheral.identifier`) | | `retrieveConnectedPeripherals` | Connected devices with any of the services in `UUIDs` | | `discoverServices`, `discoverCharacteristics`, `discoverDescriptors` | BlueZ resolves the database on connection: the `GattService1`, `GattCharacteristic1` and `GattDescriptor1` objects under the device | | `readValue`, `writeValue` | `ReadValue({})`, `WriteValue(value, {type: request / command})` | | `setNotifyValue` | `StartNotify` / `StopNotify`; values arrive as `PropertiesChanged` of `Value` | | `readRSSI` | `Device1.RSSI` (BlueZ reports it while discovering) | | `maximumWriteLength` | `GattCharacteristic1.MTU` − 3 without response, 512 with | -| `Advertisement` | `Name`, `ManufacturerData` (company ID first, little-endian), `UUIDs`, `ServiceData`, `TxPower` | +| `BluetoothAdvertisement` | `Name`, `ManufacturerData` (company ID first, little-endian), `UUIDs`, `ServiceData`, `TxPower` | GATT operations are queued per peripheral, and every call gets exactly one callback; a disconnect fails what's queued with `notConnected`. BlueZ From 058899d79c8b7d76e1f6324e3cb6c49d003025bd Mon Sep 17 00:00:00 2001 From: Alsey Coleman Miller Date: Wed, 18 Nov 2026 00:55:11 -0500 Subject: [PATCH 7/7] Updated README.md for the new Bluetooth contract names --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 44a7574..7920db1 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ added to its database between launches: |---|---| | `LinuxHost` | `AppHost` (built-ins, modules, `rt_main`), `MainLoop` and its clock, the `Bundle` built-in, `LinuxFiles` and `LinuxDefaults`, the app's files and settings in XDG's directories or a container ([plan](Documentation/Plan.md) §9), over AppRuntime's shared `RuntimeHost` (`AppInfo`, compatibility checks, `HostModule`, `Permissions`, `Application`, `HostFiles`, `HostDefaults`) | | `LinuxUI` | The SwiftUI player: DarwinAppRuntime's `DarwinUI`, copied by `Scripts/sync-darwinui.sh`, over Cacao's `SwiftUI` | -| `LinuxBluetooth` | `Central`, `Peripheral`, `Service`, `Characteristic`, `Descriptor` and `Advertisement` over BlueZ, through `wendylabsinc/dbus` | +| `LinuxBluetooth` | `BluetoothCentral`, `BluetoothPeripheral`, `BluetoothService`, `BluetoothCharacteristic`, `BluetoothDescriptor` and `BluetoothAdvertisement` over BlueZ, through `wendylabsinc/dbus` | | `LinuxGraphics` | `Surface`: GLES 2.0 drawn in EGL pbuffers, loaded at run time, and read back into the player's `GLSurface` view ([plan](Documentation/Plan.md) §7) | | `LinuxWebKit` | `WebContent`: WPE WebKit pages, loaded at run time, drawn into shared memory and shown by the player's `WebView` view ([plan](Documentation/Plan.md) §8) | | `LinuxCoreModel` | `LinuxModelStore`: the app's CoreModel stores in SQLite, through AppRuntime's `HostModelStore` and CoreModel-SQLite ([plan](Documentation/Plan.md) §9) |