Home

Awesome

go-bluetooth

ARCHIVED REPOSITORY

After some years, I am not maintaining nor using this repo anymore. If someone is interested maintaining or expanding it, let's talk.

GoDoc

Bluez API versioning

The version on master tracks Ubuntu bluetoothd version (v5.64). There are dedicated branches/tags with various version

See branches for available versions.

Features

The library is a wrapper to the Bluez DBus API and some high level API to ease the interaction.

High level features supported:

Todo

Using this library

Want to add your project? Please, add it to the README.md and open a PR!

Running examples

Examples are available in _examples folder.

cd _examples
go run main.go
# print available example commands
# Example discovery
go run main.go discovery

Development setup

  1. Clone the repository

git clone https://github.com/muka/go-bluetooth.git

  1. Retrieve the bluetooth API and generate GO code
make bluez/init bluez/checkout gen/clean gen/run

Code generation

To generate code for a new version of bluez use the command

BLUEZ_VERSION=5.65 make gen/clean gen

Change to a version available in bluez. Note that generated code may be broken or incomplete and the generation script may need fine tuning.

How generation works

The code structure follow this pattern:

Use make gen to re-generate go sources. There is also a commodity bluez JSON file available in the root folder for reference.

Generated code has gen_ prefix. If an API file exists with the same filename but without the prefix, generation will be skipped for that API.

Requirements

The library is tested with

Development notes

References

License

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.