-
Notifications
You must be signed in to change notification settings - Fork 8
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
Bluetooth Devices disconnect upon bluetooth sensor switch #405
Closed
Closed
Changes from 6 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
14ba9c4
Adds Disconnected state due to no bluetooth, and ways to recover fro…
posytive aebfe21
Check redundant call on ios BT scanner to set device as Disconnected…
posytive 88b1ce7
Remove redundant call on ios, to notify peripherals of no bluetooth
posytive a748fa2
Revert " Remove redundant call on ios, to notify peripherals of no bl…
posytive 4be3b52
Removes verbose logging in bluetooth sensor management
posytive a2d6de3
Format sources
posytive e9d0229
Fixes existing tests
posytive 3a9557c
Merge branch 'develop' into device_disconnect_no_bt
posytive File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is something to discuss. This state represents
Device
when Bluetooth is turned off by the system. On iOS it means all services/characteristic objects are invalid (we can't read/write from them anymore). Also as far as I know Identifier for Bluetooth peripheral autogenerated by system at the time of discovery (compare to Android, where it's always MAC address of the device). We have to check if keepingIdentifier
somewhere and doing connection/reconnection/bluetooth/on/off after next scan we can access to the same device by thisIdentifier
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, I haven't thought of that cause I din't know about this requirement for ios.
Is true that I have been having re-connect issues on iOs for a project using this lib, at this specific branch, but I was blaming a different part of the code for it.
(we disabled automatic reconnection on that project, due to un-stable behaviour in general)
Interesting to know: I should now check this again, following on what you pointed out.
In my understanding, was enough to make sure Not to save services/characteristics the same way the original code was already doing upon other types of disconnection.
You can see in this file, at line 346, that
internal val noBluetooth = suspend {}
function passes a null for those.In my understanding, that should have been enough to guarantee that re-connecting would fetch services/characteristics again.
Long story short, I will check the feasibility/impact of keeping Identifier in the state.
Is a bit unfortunate that I don't have with me the device we use on the other project, but I will check what I can do using our own example.