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

GATT not working #5

Open
mayardamaury opened this issue Jan 19, 2022 · 4 comments
Open

GATT not working #5

mayardamaury opened this issue Jan 19, 2022 · 4 comments

Comments

@mayardamaury
Copy link

mayardamaury commented Jan 19, 2022

Hi !

I've encoutered an issue trying to run your script, when I try to connect Vernie, the GATT throws a generic error.
I've not been able to get where this is coming from, although I'm not very skilled regarding bluetooth connectivity (which is why I was delighted to run into this, thank you for making it opensource !)

Here's what's going on in the console

hub.ts:455 
Writing to device {data: Uint8Array(8), secondArg: true, callback: ƒ}

hub.ts:465 
Error while writing: ��2�Q	 - Error NotSupportedError: GATT Error Unknown.

/local_url/#:1 
Uncaught (in promise) DOMException: GATT operation failed for unknown reason.

legoBoost.ts:91
handleGattDisconnect

legoBoost.ts:98
 Disconnected
2
legoBoost.ts:91 handleGattDisconnect

Here are the bluetooth log associated with the connection attempt :

[21:24:18] OnConnectionStatusChanged() status=0

[21:24:09] Unexpected GattCommunicationStatus: 1

[21:24:08] OnConnectionStatusChanged() status=1

[21:24:08] OnGattDiscoveryComplete() success=1

[21:24:08] StartGattDiscovery()

[21:24:08] No advertisement flags found.

[21:24:04] Web Bluetooth Device Chooser initiating Bluetooth discovery session

Do you have any idea of how this bug may be fixed ?

@mayardamaury
Copy link
Author

update : exact same bug is encoutered on https://legoboost.azurewebsites.net/

Navigator is last version of google chrome on windows 11 so it should be bluetooth compatible. Maybe something is wrong with my configuration ?

@ttu
Copy link
Owner

ttu commented Jan 20, 2022

Hi! Thanks for the issue and logs.

Unfortunately I couldn't reproduce the issue.

Tested with
Google Chrome: Version 97.0.4692.71 (Language: English)
OS: Windows 11 (Language: English)

What language you are using in your OS and with browser?

@mayardamaury
Copy link
Author

mayardamaury commented Jan 20, 2022

I've noticed serious improvement, let me answer to yoru question first :
The browser is just running your JS with the connect() function called from index.html and I'm running on windows 11

So, the GATT error seems to be a sync issue on attempts to write on the device. BUT, I'm not quite sure about this since simple restarting the browser a number of times allows me to connect almost without issue.

I'd say almost because once connected, I have to follow a precise step-by-step in order to be able to reconnect. The sequence is :

  • use the disconnect function
  • wait for vernie to turn off completely
  • refresh page & clear navigator caches
  • reconnect

Reconnecting before the device turning off or without emptying caches or losing connection by any other means wil lresult in systematically getting the error above. Only solution then is to restart the navigator

So it's working but not quite stable

@ttu
Copy link
Owner

ttu commented Jan 28, 2022

Thanks for the description! It seems that this is related to already known issue with disconnects. Issue: #2

Unfortunately I haven't had time to dig into it, but thanks for the detailed steps how to reproduce the problem.

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