Skip to content

3.2.0

Latest

Choose a tag to compare

@kylebrowning kylebrowning released this 15 Nov 23:07
3.2.0
a0c10ba

Peripheral-role L2CAP

PeripheralHost can now publish L2CAP channels and accept the channels that centrals open. This works on CoreBluetooth, on the in-process virtual radio, and over the simulator link. One simulator can open an L2CAP channel to another simulator.

let psm = try await host.publishL2CAPChannel()
for await channel in await host.incomingL2CAPChannels() {
    Task {
        for try await data in channel.incomingData {
            try await channel.write(data)
        }
    }
}

In-process virtual devices can publish channels too, with VirtualDeviceHandle.publishL2CAPChannel(psm:) and a handler that conforms to VirtualL2CAPAccepting.

New provider tools

  • bleswift-provider capture scans real devices with the Mac's radio and writes a fixture document.
  • bleswift-provider status shows the sessions of a running provider (--json for JSON).
  • bleswift-provider install-agent runs the provider at login. uninstall-agent removes it.
  • bleswift-provider --verbose logs each link message.

Fixed

  • A late result of a cancelled or timed-out openL2CAPChannel no longer goes to the next open.
  • A pending L2CAP open now fails when the peripheral disconnects. Before, it waited forever.
  • A client with a different protocol version now always receives the provider's refusal and its reason.

Upgrade notes

  • The link protocol is now version 2. Use the same BLESwift version for your app and for bleswift-provider.
  • New public enum cases: see "Changed" in the changelog.

Full changelog: 3.1.0...3.2.0