drewbaumann / onewheel-web

A Onewheel information interface for the web
15 stars 5 forks source link

Implement the unlock flow #1

Closed TomasHubelbauer closed 5 years ago

TomasHubelbauer commented 5 years ago

Hey, nice app! I am building something similar to what you're doing here, also using the Web Blueooth API. I think maybe the way the Web Bluetooth works in Chrome may have changed, but I am no longer able to locate my Onewheel using your app.

Here's what I am using to initiate successful pairing:

const bluetoothDevice = await navigator.bluetooth.requestDevice({
  filters: [ { namePrefix: 'ow' } ],
  optionalServices: [
    // See chrome://bluetooth-internals for the list of services broadcasted by the Onewheel
    'e659f300-ea98-11e3-ac10-0800200c9a66',
  ]
});

With the above code I can see the Onewheel in the list and pair with it.

Also, possibly since the Gemini firmware, the Onewheel now requires you to monkey dance for it some before it will give up its secrets. I have not implemented the unlock flow myself yet, but I am working on ripping off @kariudo's amazing research to be able to actually read the characteristics values.

I understand this was probably a PoC you did years ago and have little interest in updating, but just in case you care, here's the info I've been able to pull together so far and I will send you a PR with the unlock flow implemented once I have that working in my app if I get to it, if you want to merge that when it's ready.

drewbaumann commented 5 years ago

Hey thanks for touching base! I may handle that. I was considering updating this for the XR, but didn't even know about the hand shake that came with the Gemini firmware! I will need to take a look at the implementation and go from there.

Thank you for the heads up!

TomasHubelbauer commented 5 years ago

I've implemented the unlock flow using Web Bluetooth by porting @COM8's code. You can find the implementation here:

https://github.com/TomasHubelbauer/onewheel-web-bluetooth

This should also apply to the + after the firmware update that introduces the unlock for it. You just need to make sure the firmware revision is in the switch that checks for known firmware revisions.