All Projects → muka → Go Bluetooth

muka / Go Bluetooth

Licence: apache-2.0
Golang bluetooth client based on bluez DBus interfaces

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects

Labels

Projects that are alternatives of or similar to Go Bluetooth

Bluetoothchat
基于Android Classic Bluetooth的蓝牙聊天软件,目前仅支持一对一实时通信、文件传输、好友添加、好友分组、好友在线状态更新等功能,其中消息发送支持文本、表情等方式。
Stars: ✭ 296 (-30.02%)
Mutual labels:  bluetooth
Python Keyboard
A hand-wired USB & Bluetooth keyboard powered by Python and more
Stars: ✭ 360 (-14.89%)
Mutual labels:  bluetooth
Rxbluetooth
Android reactive bluetooth
Stars: ✭ 405 (-4.26%)
Mutual labels:  bluetooth
React Native System Setting
A library to access system setting, and change it easily. eg: volume, brightness, wifi
Stars: ✭ 319 (-24.59%)
Mutual labels:  bluetooth
Coderyi.github.io
Don't fork! coderyi's blog,about iOS ,CS and my code life.
Stars: ✭ 349 (-17.49%)
Mutual labels:  bluetooth
Stats
macOS system monitor in your menu bar
Stars: ✭ 7,134 (+1586.52%)
Mutual labels:  bluetooth
Rubble
(going to be a) BLE stack for embedded Rust
Stars: ✭ 292 (-30.97%)
Mutual labels:  bluetooth
Bleak
Bluetooth Low Energy platform Agnostic Klient for Python
Stars: ✭ 415 (-1.89%)
Mutual labels:  bluetooth
Bluetooth headset battery level
A python script to get battery level from Bluetooth headsets
Stars: ✭ 351 (-17.02%)
Mutual labels:  bluetooth
32feet
Personal Area Networking for .NET
Stars: ✭ 395 (-6.62%)
Mutual labels:  bluetooth
Sweetblue
BLE on Android, the easy way. THIS IS NOW DEPRECATED. Please visit website for info on new versions.
Stars: ✭ 339 (-19.86%)
Mutual labels:  bluetooth
Ios Pods Dfu Library
OTA DFU Library for Mac and iOS, compatible with nRF5x SoCs
Stars: ✭ 349 (-17.49%)
Mutual labels:  bluetooth
Mac Precision Touchpad
Windows Precision Touchpad Driver Implementation for Apple MacBook / Magic Trackpad
Stars: ✭ 5,107 (+1107.33%)
Mutual labels:  bluetooth
Esp32 Ble2mqtt
A BLE to MQTT bridge running on an ESP32
Stars: ✭ 301 (-28.84%)
Mutual labels:  bluetooth
Xamarin Bluetooth Le
Bluetooth LE plugin for Xamarin
Stars: ✭ 419 (-0.95%)
Mutual labels:  bluetooth
Blynk Library
Blynk library for embedded hardware. Works with Arduino, ESP8266, Raspberry Pi, Intel Edison/Galileo, LinkIt ONE, Particle Core/Photon, Energia, ARM mbed, etc.
Stars: ✭ 3,305 (+681.32%)
Mutual labels:  bluetooth
Internalblue
Bluetooth experimentation framework for Broadcom and Cypress chips.
Stars: ✭ 373 (-11.82%)
Mutual labels:  bluetooth
Mobly
E2E test framework for tests with complex environment requirements.
Stars: ✭ 424 (+0.24%)
Mutual labels:  bluetooth
Gimx
The GIMX software.
Stars: ✭ 421 (-0.47%)
Mutual labels:  bluetooth
Bluetoothconnector
Simple macOS CLI to connect/disconnect a Bluetooth device. Useful for AirPods or other Bluetooth headphones.
Stars: ✭ 388 (-8.27%)
Mutual labels:  bluetooth

go-bluetooth

Go bluetooth API for Linux-based Bluez DBus interface.

GoDoc

Features

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

High level features supported:

  • [x] Client code generation from bluez documentation
  • [x] Shell wrappers for rfkill, btmgmt, hciconfig, hcitool
  • [x] An hci socket basic API (inspired by go-ble/ble)
  • [x] Expose bluetooth service from go code [unstable]
  • [x] Pairing and authentication support (via agent)
  • [x] Beaconing send & receive (iBeacon and Eddystone)
  • [x] Mesh API support (since v5.53)

Todo

  • [ ] Generate dbus-compatible XML from documentation
  • [ ] Generate mock service to test the library against

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

The code structure follow this pattern:

  • ./api contains wrappers for the DBus Api
  • ./bluez contains the actual implementation, generated from the bluez documentation

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

  • golang 1.14.1
  • bluez bluetooth v5.50, v5.54

Development notes

  • Inspect a service ObjectManager

    dbus-send --system --print-reply --dest=go.bluetooth /hci0/apps/0 org.freedesktop.DBus.ObjectManager.GetManagedObjects
    
  • Retrieve char properties

    dbus-send --system --print-reply --dest=go.bluetooth /hci0/apps/0/service000003e8/char0  org.freedesktop.DBus.Properties.GetAll string:org.bluez.GattCharacteristic1
    
  • Give access to hciconfig to any user and avoid sudo (may have security implications)

    sudo setcap 'cap_net_raw,cap_net_admin+eip' `which hciconfig`
    
  • Monitor Bluetooth activity

    sudo btmon

  • Monitor DBus activity

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

  • Start bluetoothd with experimental features and verbose debug messages make bluetoothd

  • Enable LE advertisement (on a single pc ensure to use at least 2x 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
    
    

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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].