{"id":21658220,"url":"https://github.com/muka/go-bluetooth","last_synced_at":"2025-07-17T21:30:43.669Z","repository":{"id":38956559,"uuid":"70906260","full_name":"muka/go-bluetooth","owner":"muka","description":"Golang bluetooth client based on bluez DBus interfaces","archived":true,"fork":false,"pushed_at":"2024-07-01T04:45:17.000Z","size":1833,"stargazers_count":652,"open_issues_count":18,"forks_count":124,"subscribers_count":19,"default_branch":"master","last_synced_at":"2024-09-28T09:21:26.118Z","etag":null,"topics":["bluetooth","bluez","bluez-dbus-interfaces","golang","golang-bluetooth-client"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/muka.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"muka","patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2016-10-14T12:01:17.000Z","updated_at":"2024-09-27T11:30:42.000Z","dependencies_parsed_at":"2024-01-15T10:16:50.801Z","dependency_job_id":"75284522-00b8-42f3-bd0d-68dc5b8009a0","html_url":"https://github.com/muka/go-bluetooth","commit_stats":{"total_commits":419,"total_committers":45,"mean_commits":9.311111111111112,"dds":"0.26252983293556087","last_synced_commit":"dfdf79b8f61d90a3e7edafb89c1a37192f1faa94"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muka%2Fgo-bluetooth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muka%2Fgo-bluetooth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muka%2Fgo-bluetooth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muka%2Fgo-bluetooth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/muka","download_url":"https://codeload.github.com/muka/go-bluetooth/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226304487,"owners_count":17603603,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bluetooth","bluez","bluez-dbus-interfaces","golang","golang-bluetooth-client"],"created_at":"2024-11-25T09:28:54.790Z","updated_at":"2024-11-25T09:28:57.329Z","avatar_url":"https://github.com/muka.png","language":"Go","funding_links":["https://github.com/sponsors/muka"],"categories":["Go"],"sub_categories":[],"readme":"# go-bluetooth\n\n##  ARCHIVED REPOSITORY\n\nAfter some years, I am not maintaining nor using this repo anymore. If someone is interested maintaining or expanding it, let's talk. \n\n\n[![GoDoc](https://godoc.org/github.com/muka/go-bluetooth?status.svg)](https://godoc.org/github.com/muka/go-bluetooth)\n\n\n## Bluez API versioning\n\nThe version on master tracks Ubuntu bluetoothd version (v5.64). There are dedicated branches/tags with various version\n\n- [bluez 5.60](https://github.com/muka/go-bluetooth)\n- [bluez 5.62](https://github.com/muka/go-bluetooth/tree/bluez-5.62)\n- [bluez 5.63](https://github.com/muka/go-bluetooth/tree/bluez-5.63)\n- [bluez 5.64](https://github.com/muka/go-bluetooth/tree/bluez-5.64)\n- [bluez 5.65](https://github.com/muka/go-bluetooth/tree/bluez-5.65)\n\nSee branches for available versions.\n\n## Features\n\nThe library is a wrapper to the Bluez DBus API and some high level API to ease the interaction.\n\nHigh level features supported:\n\n- [x] Client code generation from bluez documentation\n- [x] Shell wrappers for `rfkill`, `btmgmt`, `hciconfig`, `hcitool`\n- [x] An `hci` socket basic API (inspired by [go-ble/ble](https://github.com/go-ble/ble))\n- [x] Expose bluetooth service from go code [*unstable*]\n- [x] Pairing and authentication support (via agent)\n- [x] Beaconing send \u0026 receive (iBeacon and Eddystone)\n- [x] Mesh API support (since v5.53)\n\n## Todo\n\n- [ ] Generate dbus-compatible XML from documentation\n- [ ] Generate mock service to test the library against\n\n## Using this library\n\n- [TinyGo bluetooth](https://github.com/tinygo-org/bluetooth)\n- [pi-wifi](https://github.com/muka/pi-wifi)\n\nWant to add your project? Please, add it to the [README.md](https://github.com/muka/go-bluetooth/edit/master/README.md) and open a PR!\n\n## Running examples\n\nExamples are available in `_examples` folder.\n\n```sh\ncd _examples\ngo run main.go\n# print available example commands\n# Example discovery\ngo run main.go discovery\n```\n\n## Development setup\n\n1. Clone the repository\n\n  `git clone https://github.com/muka/go-bluetooth.git`\n\n1. Retrieve the bluetooth API and generate GO code\n\n  ```sh\n  make bluez/init bluez/checkout gen/clean gen/run\n  ```\n\n## Code generation\n\nTo generate code for a new version of bluez use the command\n\n`BLUEZ_VERSION=5.65 make gen/clean gen`\n\nChange to a version available in bluez. Note that generated code may be broken or incomplete and the generation script may need fine tuning.\n\n### How generation works\n\nThe code structure follow this pattern:\n\n - `./api` contains wrappers for the DBus Api\n - `./bluez` contains the actual implementation, generated from the `bluez` documentation\n\nUse `make gen` to re-generate go sources. There is also a commodity bluez JSON file available in the root folder for reference.\n\nGenerated code has `gen_` prefix. If an API file exists with the same filename but _without_ the prefix, generation will be skipped for that API.\n\n## Requirements\n\nThe library is tested with\n\n- golang `1.17.5`\n- bluez bluetooth `v5.50`, `v5.54`, `v5.60`\n\n### Development notes\n\n- Inspect a service ObjectManager\n\n  ```shell\n  dbus-send --system --print-reply --dest=go.bluetooth /hci0/apps/0 org.freedesktop.DBus.ObjectManager.GetManagedObjects\n  ```\n\n- Retrieve char properties\n\n  ```\n  dbus-send --system --print-reply --dest=go.bluetooth /hci0/apps/0/service000003e8/char0  org.freedesktop.DBus.Properties.GetAll string:org.bluez.GattCharacteristic1\n  ```\n\n-   Give access to `hciconfig` to any user and avoid `sudo` (may have [security implications](https://www.insecure.ws/linux/getcap_setcap.html))\n\n    ```\n    sudo setcap 'cap_net_raw,cap_net_admin+eip' `which hciconfig`\n    ```\n- Monitor Bluetooth activity\n\n  `sudo btmon`\n\n- Monitor DBus activity\n\n    `sudo dbus-monitor --system \"type=error\"`\n\n- Start `bluetoothd` with experimental features and verbose debug messages `make bluetoothd`\n\n- Enable LE advertisement (on a single pc ensure to use at least 2x bluetooth adapter)\n\n  ```bash\n\n    sudo btmgmt -i 0 power off\n    sudo btmgmt -i 0 name \"my go app\"\n    sudo btmgmt -i 0 le on    \n    sudo btmgmt -i 0 connectable on\n    sudo btmgmt -i 0 advertising on\n    sudo btmgmt -i 0 power on\n\n  ```\n\n## References\n\n- [Standard GATT characteristics descriptions](https://www.bluetooth.com/specifications/gatt/)\n- [bluez git](https://git.kernel.org/cgit/bluetooth/bluez.git/tree/doc)\n- [GATT services specs](https://www.bluetooth.com/specifications/gatt/services)\n- [A C++ implementation](https://github.com/nettlep/gobbledegook)\n- [DBus specifications](https://dbus.freedesktop.org/doc/dbus-specification.html#type-system)\n- [SensorTag specs](http://processors.wiki.ti.com/images/a/a8/BLE_SensorTag_GATT_Server.pdf)\n\n## License\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n   http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmuka%2Fgo-bluetooth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmuka%2Fgo-bluetooth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmuka%2Fgo-bluetooth/lists"}