-
Notifications
You must be signed in to change notification settings - Fork 70
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
HAP: wait for pairing event #551
base: main
Are you sure you want to change the base?
Conversation
await self._preset_changed_operation(connection) | ||
# Update the active preset index if needed | ||
await self.notify_active_preset_for_connection(connection) | ||
@connection.on('pairing') # type: ignore |
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.
One issue here is that this only remembers paired connections when the pairing happens while the service is running. But what about connections from devices that were previously paired and bonded?
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.
I assume that setting up HAS is done before we connect to a remote device.
If an already paired device reconnect, it should go in this if:
if connection.peer_resolvable_address:
self.on_incoming_paired_connection(connection)
directly
My opinion is that Bumble is not designed for persistent usage, so it's better to do this kind of operations at the caller side, which has more (well-controlled) context of persistent states. |
@zxzxwu, the service need to notify every currently connected devices. The only persistent code in has is to update the device after re connection. I haven't implemented any persistent storage that would works between multiples bumble restart. They are only lasting as long as the current bumble is running. |
HAP is supposed to work only when device are bonded.
By listening to the
on_pairing
event of the connection, we can start add the remote device to thepreset_changed_operations_history_per_device
only after the bonding (and thus the public address) has been done.This missing logic was found thanks to https://r.android.com/3236429, an avatar test that try to delete a preset and then wait for the notification / indication to be sent to the device