Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github.com/niziak/go-bluetooth

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/niziak/go-bluetooth

  • v0.0.0-20181026125232-cce1b8e209f0
  • Source
  • Go
  • Socket score

Version published
Created
Source

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
  • HCI protocol communication
  • Pairing support

Examples

Check examples/ folder for an overview of the API

Setup

The library has been tested with

  • golang 1.9 (minimum v1.6)
  • bluez bluetooth v5.48 (minimum supported v5.43)

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 P hostname

  • Enable LE advertisement (to use a single pc, you will need 2 bluetooth adapter)

      sudo btmgmt -i 0 power off
      sudo btmgmt -i 0 name "my go app"
      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
  • Integrate hci communication from github.com/[currentlabs|go-ble]/ble

References

License

MIT License

FAQs

Package last updated on 26 Oct 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc