nkaminski / csrmesh

Reverse engineered bridge implementation of the CSRMesh BTLE protocol
GNU Lesser General Public License v3.0
70 stars 20 forks source link

Handles need to be looked up by UUID rather than hardcoded #7

Open mjg59 opened 7 years ago

mjg59 commented 7 years ago

My CSRMesh device has the handles on 0x1c and 0x1f, but it looks like they have the same UUID as the handles used on your device. Unfortunately gatttool doesn't seem to have any good support for this. I'm using https://github.com/mikeryan/PyBT/tree/pybt2 in https://github.com/mjg59/python-avion to do this by hand rather than relying on gatttool, which also means I can keep a persistent connection rather than reconnecting on every command. There's no high-level API, but it seems to work well enough.

nkaminski commented 7 years ago

Will look into PyBT this weekend. Thanks for the suggestion!

t0mas commented 7 years ago

Hi @mjg59

Looking at your code it shows these UUIDs for low and high handle: c4edc000-9daf-11e3-8003-00025b000b00 and c4edc000-9daf-11e3-8004-00025b000b00. Interestingly my device uses the same UUIDs but writes to the high handle with the first bytes instead of the low one (so the 8004 UUID is the base handle format). I expect we'll need more data to understand how it selects the right handle.

Would you be able to share some bluetooth packet captures for your device talking to its original app? (e.g: http://stackoverflow.com/questions/23877761/sniffing-logging-your-own-android-bluetooth-traffic )

Tomas