gatt.getPrimaryService Not Resolving

Hello,

I've been running into some connection issues with my parrot drone while
testing edge cases and I haven't been able to work this one out..

If I put the battery in the drone and refresh my page, the first connection
appears to always be successful.

I then refresh my browser and *immediately* reconnect (If I wait a few
seconds it isn't nearly as common).  I may have to repeat this several
times, but from anywhere between 1 and 5 iterations I run into the
following issue.


   - device.gatt.connect() is called and resolves successfully.
   - device.gatt.getPrimaryService() is called next and never resolves.
   - I can see at this point that the gatt server is disconnected.
   - I take the batter out of the drone and put it back in.
   - I go through the connection process again.

At this point, the original device.gatt.getPrimaryService() promise
resolves with the error "GATT Server is disconnected. Cannot retrieve
services. (Re)connect first with device.gatt.connect."  The
device.gatt.connect() promise from the latest connection also resolves with
the error "GATT Server disconnected while retrieving characteristics"

Now, I can try to connect and it appears to always be successful.

Is there no way to completely throw away the gatt server and try again?  It
seems like a bug that the promise doesn't resolve until I restart my device
and try again, but I'd be happy if I could just set a timeout and manually
throw the gatt server out and try again without the need for the user to
reset the device.

I hope that was clear, thanks for the help!

Nick

Received on Tuesday, 9 May 2017 11:49:06 UTC