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

(Re-) discovered devices should reset peripheral status? #19

Open
Apollon77 opened this issue Jan 4, 2025 · 4 comments
Open

(Re-) discovered devices should reset peripheral status? #19

Apollon77 opened this issue Jan 4, 2025 · 4 comments

Comments

@Apollon77
Copy link

When I read corrrectly a peripheral which is connected can not send "connectable announcements". If this is true then a re-discovery of a device which is connectable should reset the peripheral state to "disconnected". Or!?
This could clean strange intermediate states like from #17

@stoprocent
Copy link
Owner

Please provide steps to reproduce this issues you have created are very lazy. Will re-open when proper steps to reproduce are provided

@Apollon77
Copy link
Author

Apollon77 commented Jan 5, 2025

Thats not that easy ...
In fact I tested a lot and had the effect that after doing connect/disconnect on a device and trying to do connect again this new connect call was not working and "hanging" (promise never got resolved). In this case the peripheral had the status "connecting". Even after cancelConnect() (see other issue) this state stayed "connecting".

I easiely could start a new scanning for device and such and when the device was then rediscovered the status stayed "connecting". But I was - after the rediscovery - able to connect to the device. After this the state was updated.

I mainly refer to

https://github.com/stoprocent/noble/blob/main/lib/noble.js#L227-L245

When the peripheral which is discovered is already known some values get updated, but the peripheral state stays untouched. So my main thing was if my assumptions above are correct (about the only connectable or discoverable) then also setting peripheral.status="disconnected" should be ok here in the case of existing peripherals

I mainly had this issue with the Shelly device where I did not correctly got the Matter handshake response (other issue) and so my retry mechanisms lead to this sometimes

@Apollon77
Copy link
Author

Ahh check the log in the main post at #13 ... there at the very end is such a "connect" that never resolved ... after this the peripheral has this "connecting" state and will also stay that ways when a new scan re-discovers the device because the state is not "re-set" on discovery and the peripheral is already known

@stoprocent
Copy link
Owner

Can you clean up issues because im lost a bit. You dropped suddenly 7 issues and somehow they are all related. Please clean it up

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants