pebble-dev / RebbleOS

open source operating system for low-power smartwatches
Other
365 stars 38 forks source link

PPoGATT (BLE) support #73

Open jwise opened 5 years ago

jwise commented 5 years ago

BLE-only devices need PPoGATT support. Need to do:

jwise commented 5 years ago

Current status: MacOS refuses to speak to grab characteristics entirely, and something is still going wrong with handle identification for phone-as-GATT-server. Working on getting Gadgetbridge to talk to it in phone-as-GATT-client mode; ac9e91f took some steps in terms of pairing, but Gadgetbridge is still expecting something that isn't happening, as far as I can tell (looks like maybe we need to send it a PPoGATT packet first?).

jwise commented 5 years ago

Ok, here's some more updates. Gadgetbridge, apparently, can't be on the same phone as the Pebble app, so make sure the Pebble app is uninstalled, or the two of them will collide on using GATT. 43e78d76 got GadgetBridge a little further along in connecting, to the point where it sits and waits for RebbleOS to say something; GadgetBridge has to be run in client-only mode, because if it runs in server mode, it tries to send a NOTIFY event on a bad handle (which we can confirm in the btsnoop log). Not sure why it does that.

After sending GadgetBridge a PPoGATT reset event, it seems happier and no longer times out the PPoGATT init (and, in fact, responds with a reset ACK and a firmware version request!). We currently do not manage to elicit a response back from inside RebbleOS of the firmware version response, however, probably because of the return in the middle of the bluetooth_data_rx function. So I guess up next is to sync up with @ginge and figure out where the protocol branch is...

jwise commented 5 years ago

We can now talk to Gadgetbridge. The tx/rx state machine do not really support retransmitting or coalescing ACKs, though.