Skip to content

Connection lifecycle#39

Merged
itsniper merged 4 commits into
masterfrom
36-connection-lifecycle
Jul 5, 2026
Merged

Connection lifecycle#39
itsniper merged 4 commits into
masterfrom
36-connection-lifecycle

Conversation

@itsniper

@itsniper itsniper commented Jul 5, 2026

Copy link
Copy Markdown
Member

Plan: docs/plans/connection-lifecycle-stream-2026-06-30.md

Closes #36

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Implements the peripheral connection lifecycle in the ReliaBLE library by wiring CoreBluetooth connect/disconnect/fail delegate paths into BluetoothActor, exposing per-peripheral connection-state transitions as a multi-subscriber AsyncStream, and updating the demo + docs + tests to exercise and consume the new stream.

Changes:

  • Add public connection-state models (ConnectionState, ConnectionStateChange) and a new ReliaBLEManager.connectionStateChanges stream plus disconnect(from:).
  • Implement connection registry + broadcasting in BluetoothActor, including optimistic .connecting / .disconnecting transitions and delegate-driven .connected / .disconnected / .failed.
  • Add mock-driven lifecycle tests and update DocC + Demo app to consume and display connection state.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
Tests/ReliaBLETests/ReliaBLEManagerTests.swift Adds connection lifecycle tests and mock-spec support for connect/disconnect/failure flows.
Sources/ReliaBLE/ReliaBLEManager.swift Exposes connectionStateChanges, currentConnectionStates, and a new disconnect(from:) API.
Sources/ReliaBLE/Models/PeripheralError.swift Extends public error surface with connection-related cases and a CBError mapper.
Sources/ReliaBLE/Models/ConnectionState.swift Introduces public connection-state types used by the stream and snapshot.
Sources/ReliaBLE/Documentation.docc/GettingStarted.md Documents connection lifecycle and adds a connection-state stream example.
Sources/ReliaBLE/BluetoothActor.swift Implements connection state registry, stream broadcaster, connect/disconnect, and delegate event handling.
docs/reviews/connection-lifecycle-stream-plan-critique-2026-06-30.md Adds a critique document for the connection-lifecycle plan.
docs/plans/connection-lifecycle-stream-2026-06-30.md Adds the implementation plan referenced by the PR.
Demo/ReliaBLE Demo/ReliaBLE Demo/Central/CentralViewModel.swift Stores transient per-device connection state and updates it on the main actor.
Demo/ReliaBLE Demo/ReliaBLE Demo/Central/CentralView.swift Subscribes to connection-state stream and adds connect/disconnect UI in the detail view.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Sources/ReliaBLE/BluetoothActor.swift Outdated
Comment thread Sources/ReliaBLE/BluetoothActor.swift Outdated
Comment thread Sources/ReliaBLE/BluetoothActor.swift Outdated
Comment thread Sources/ReliaBLE/Documentation.docc/GettingStarted.md
Comment thread Tests/ReliaBLETests/ReliaBLEManagerTests.swift Outdated
Comment thread Demo/ReliaBLE Demo/ReliaBLE Demo/Central/CentralView.swift Outdated
@itsniper itsniper force-pushed the 36-connection-lifecycle branch from 10a56c0 to 14c9443 Compare July 5, 2026 21:49
@itsniper itsniper merged commit 0842b48 into master Jul 5, 2026
1 check passed
@itsniper itsniper deleted the 36-connection-lifecycle branch July 5, 2026 22:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FR-2.3.1 / FR-1.3.1: Peripheral connection lifecycle + connection-state stream

2 participants