Obito1903 / sony-headphones-ctl

🎧 Control Sony headphones from cli
MIT License
9 stars 1 forks source link

Enhance service/device discovery #2

Open mphx12 opened 4 months ago

mphx12 commented 4 months ago

At the moment the rfcomm channel is hardcoded, which is not going to work with other devices. Instead of hardcoding the channel and address, a profile https://github.com/bluez/bluer/blob/1e5b4eced1811a3705d543dbd2cfe6cf885c39dc/bluer-tools/src/rfcat.rs#L105 with a suitable uuid https://codeberg.org/Freeyourgadget/Gadgetbridge/src/commit/310b95b551bb7fcd5e4a76c4fbcacfb78b6ab697/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/sony/headphones/SonyHeadphonesIoThread.java#L46-L47 can be registered. This works well when I just tested this, but it's a bit slow because often a connection from a previous run needs to be closed and opened again. Does this also happen with your SocketAddr-based implementation? I'm unsure whether there's a better way, or if the information can be cached or the connection outsourced to a daemon.