Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Receive disconnect event #15

Open
aviwad opened this issue Oct 16, 2024 · 3 comments
Open

Receive disconnect event #15

aviwad opened this issue Oct 16, 2024 · 3 comments

Comments

@aviwad
Copy link

aviwad commented Oct 16, 2024

Hi! Great project. Would appreciate a method to receive a change in the disconnect event without having to use regular Core-Bluetooth's Delegate functionality. Thanks a lot 😄

@pinefin
Copy link

pinefin commented Nov 4, 2024

This is possible.

var switchDisconnectSubscription : AsyncSubscription<PeripheralEvent> = peripheral.eventSubscriptions.queue { event, done in
    guard case .didDisconnect(let error) = event else { return }

    print("did disconnect: \(String(describing: error))")
}

As far as I know, it's not directly documented, it's more of a feature of this repository that I had to dig for.

@aviwad
Copy link
Author

aviwad commented Nov 11, 2024

Thank you very much <3

@aviwad
Copy link
Author

aviwad commented Nov 11, 2024

Sorry, how did you get this to work?
eventSubscription is marked internal. Did you fork the repo?

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

No branches or pull requests

2 participants