linux: rewrite everything to use DBus directly #216
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a big rewrite to use DBus calls directly instead of going through go-bluetooth first.
This is a big change, but I believe it is an improvement. While the go-bluetooth works for many cases, it's a layer in between that I believe hurts more than it helps. Without it, we can just program directly against the BlueZ D-Bus API. The end result is about 20% more code, so not even that much more verbose (makes me think why we needed the go-bluetooth package in the first place).
With this rewrite, I fixed the following issues:
WriteEvent
callback in a characteristic now also gets the 'offset' parameter which wasn't provided by go-bluetooth.This rewrite also avoids go-bluetooth specific workarounds like #74 and #121.
I have tested all six examples in the smoketest-linux Makefile target. They all still work with this rewrite on BlueZ 5.71 (Fedora 39) and BlueZ 5.66 (Raspberry Pi OS 64-bit running on a Raspberry Pi 3).