Git Product home page Git Product logo

go-bluetooth's Introduction

go-bluetooth

Golang bluetooth client based on bluez DBus interfaces

See here for reference https://git.kernel.org/cgit/bluetooth/bluez.git/tree/doc

Status

The current API is unstable and may change in the future.

The features implemented are

  • Discovery
  • Adapter support
  • Device support (SensorTag example)
  • GATT Service and characteristics interface
  • Adapter on/off via rfkill
  • Handle systemd bluetooth.service unit
  • Expose hciconfig basic API
  • Expose bluetooth services via bluez GATT API

Examples

Check main.go or in examples/ for an initial overview of the API

Setup

The library has been tested with

  • golang 1.8 (minimum v1.6)
  • bluez bluetooth v5.46 (Note v5.43 is the minimum supported one)
  • ubuntu 16.10 kernel 4.8.0-27-generic
  • raspbian and hypirot (debian 8) armv7 4.4.x

bluez upgrade

Bluez, the linux bluetooth implementation, has introduced GATT support from v5.43

Ensure you are using an up to date version with bluetoothd -v

See in scripts/ how to upgrade bluez

Development notes

  • Give access to hciconfig to any user (may have security implications)

    sudo setcap 'cap_net_raw,cap_net_admin+eip' `which hciconfig`
    
  • Create a dbus profile

    ln -s `pwd`/scripts/dbus-dev.conf /etc/dbus1/system.d/go-bluetooth.config
  • Monitor activity

    sudo dbus-monitor --system "type=error"

  • View bluetoothd debug messages

    sudo bluetoothd -Edn

  • Enable LE advertisement

      sudo btmgmt -i 0 power off
      sudo btmgmt -i 0 le on
      sudo btmgmt -i 0 connectable on
      sudo btmgmt -i 0 advertising on
      sudo btmgmt -i 0 power on

TODO List / Help wanted

  • Add docs with examples
  • Add Device read / write and custom data converters
  • Unit tests coverage

References

License

MIT License

go-bluetooth's People

Contributors

muka avatar gbrayut avatar amenzhinsky avatar saurabh-zededa avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.