All Projects → labapart → Gattlib

labapart / Gattlib

Library to access GATT information from BLE (Bluetooth Low Energy) devices

Programming Languages

c
50402 projects - #5 most used programming language

Projects that are alternatives of or similar to Gattlib

python-sonicare
Python library to communicate with a Phillips Sonicare toothbrush via Bluetooth Low Energy
Stars: ✭ 46 (-83.63%)
Mutual labels:  ble, bluetooth-low-energy
android-ble-made-easy
An Android Library for handling Bluetooth Low Energy on Android Easy
Stars: ✭ 34 (-87.9%)
Mutual labels:  ble, bluetooth-low-energy
goble
Bluetooth Low Energy for Go
Stars: ✭ 43 (-84.7%)
Mutual labels:  ble, bluetooth-low-energy
blatann
Python BLE library for the Nordic nRF52 connectivity firmware
Stars: ✭ 44 (-84.34%)
Mutual labels:  ble, bluetooth-low-energy
ruuvitag-demo
Demo of reading Bluetooth Low Energy sensor measurements of RuuviTag environmental sensors and feeding them to MQTT, a database and dashboards
Stars: ✭ 14 (-95.02%)
Mutual labels:  ble, bluetooth-low-energy
Bluetooth-ble-beamer-and-scanner-for-tracing-corona-virus-infected-individual
Bluetooth ble beacon beamer and scanner for tracing corona virus infected person similar to Trace Together app
Stars: ✭ 26 (-90.75%)
Mutual labels:  ble, bluetooth-low-energy
Arduino-BLE-MIDI
MIDI over Bluetooth Low Energy (BLE-MIDI) 1.0 for Arduino
Stars: ✭ 133 (-52.67%)
Mutual labels:  ble, bluetooth-low-energy
ESP32BleAdvertise
Simple library for BLE advertise using ESP32 in Arduino
Stars: ✭ 39 (-86.12%)
Mutual labels:  ble, bluetooth-low-energy
JDY-08
JDY-08 Bluetooth transparent transmission module, with resource for KiCAD
Stars: ✭ 48 (-82.92%)
Mutual labels:  ble, bluetooth-low-energy
ESP32 BLE OTA Arduino
OTA update on ESP32 via BLE
Stars: ✭ 41 (-85.41%)
Mutual labels:  ble, bluetooth-low-energy
IOS-DFU-Library
OTA DFU Library for Mac and iOS, compatible with nRF5x SoCs
Stars: ✭ 400 (+42.35%)
Mutual labels:  ble, bluetooth-low-energy
IoT-iBeacon
An Ionic app for indoor localization and navigation using BLE iBeacons.
Stars: ✭ 39 (-86.12%)
Mutual labels:  ble, bluetooth-low-energy
H.E.L.P.
Home Environment Locating People 🍍
Stars: ✭ 19 (-93.24%)
Mutual labels:  ble, bluetooth-low-energy
awesome-bluetooth-security
List of Bluetooth BR/EDR/LE security resources
Stars: ✭ 220 (-21.71%)
Mutual labels:  ble, bluetooth-low-energy
BLELib
This library contains many of the features you need to interact with BLE peripherals
Stars: ✭ 21 (-92.53%)
Mutual labels:  ble, bluetooth-low-energy
bluetooth-manager
Java Bluetooth Manager. A library/framework for managing bluetooth adapters, bluetooth devices, GATT services and characteristics
Stars: ✭ 75 (-73.31%)
Mutual labels:  ble, bluetooth-low-energy
theheraldproject.github.io
Herald - Proximity Detection Protocol and research documentation, including the Fair Efficacy Formula
Stars: ✭ 17 (-93.95%)
Mutual labels:  ble, bluetooth-low-energy
IOS-CoreBluetooth-Mock
Mocking library for CoreBluetooth framework.
Stars: ✭ 142 (-49.47%)
Mutual labels:  ble, bluetooth-low-energy
ble-utilities-unreal
This is Unreal Engine plugin that allows to scan for BLE devices with Cycling Power service running, connect to one of them and subscribe for its notifications.
Stars: ✭ 48 (-82.92%)
Mutual labels:  ble, bluetooth-low-energy
stm32wb55
Implementation of bluetooth-hci for STM32WB5x wireless SoC
Stars: ✭ 18 (-93.59%)
Mutual labels:  ble, bluetooth-low-energy

Build Status

GattLib is a library used to access Generic Attribute Profile (GATT) protocol of BLE (Bluetooth Low Energy) devices. It has been introduced to allow to build applications that could easily communicate with BLE devices.

It supports Bluez v4 and v5.

Latest GattLib Release packages

Build GattLib

  • Gattlib requires the following packages: libbluetooth-dev, libreadline-dev.
    On Debian based system (such as Ubuntu), you can installed these packages with the following command: sudo apt install libbluetooth-dev libreadline-dev
cd <gattlib-src-root>
mkdir build && cd build
cmake ..
make
  • Gattlib can also be built for a specific version of Bluez by specifying its version at build time:
mkdir build && cd build
cmake -DBLUEZ_VERSION=5.50 ..
make
  • On Bluez versions prior to v5.42, gattlib used Bluez source code while it uses D-Bus API from v5.42. D-Bus API can be used on version prior to Bluez v5.42 by using the CMake flag -DGATTLIB_FORCE_DBUS=TRUE:
mkdir build && cd build
cmake -DGATTLIB_FORCE_DBUS=TRUE ..
make

Cross-Compilation

To cross-compile GattLib, you must provide the following environment variables:

  • CROSS_COMPILE: prefix of your cross-compile toolchain
  • SYSROOT: an existing system root that contains the libraries and include files required by your application

Example:

cd <gattlib-src-root>
mkdir build && cd build
export CROSS_COMPILE=~/Toolchains/gcc-linaro-4.9-2015.05-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-
export SYSROOT=~/Distributions/debian-wheezy
cmake ..
make

Package GattLib

From the build directory: cpack ..

Note: It generates DEB, RPM and ZIP packages. Ensure you have the expected dependencies installed on your system (eg: to generate RPM package on Debian-based Linux distribution you must have rpm package installed).

Default install directory is defined as /usr by CPack variable CPACK_PACKAGE_INSTALL_DIRECTORY.
To change the install directory to /usr/local run: cpack -DCPACK_PACKAGE_INSTALL_DIRECTORY=/usr/local ..

Examples

Note 1: The example 'read/write mem' is similar to the example 'read/write' except a GLib loop is used to allows the memory to be freed by Glib. Without this loop, some memory could be locked.

Note 2: examples/gatttool has been partially ported to gattlib. There are two reasons: the laziness (some of the GATT functions could be replaced by their gattlib equivalent) and the completeness (there are still some missing functions in gattlib).

  • Notification is also supported. Example:
void notification_cb(uint16_t handle, const uint8_t* data, size_t data_length, void* user_data) {
	printf("Notification on handle 0x%02x\n", handle);
}

main() {
	uint16_t status_handle; // Handle of the 'status' characteristic
	uint16_t enable_notification = 0x0001;

	// Enable Status Notification
	gattlib_write_char_by_handle(connection, status_handle + 1, &enable_notification, sizeof(enable_notification));
	// Register notification handler
	gattlib_register_notification(connection, notification_cb, NULL);
}

Known limitations

  • gattlib and BLE: gattlib requires at least Bluez v4.100 to work with Bluetooth Low Energy (BLE) devices. Bluez does not allow to connect to BLE device prior to this version. But gattlib can still work with Bluetooth Classic (BR/EDR) prior to Bluez v4.100.
    Debian 7 "Wheezy" (supported until 31st of May 2018) relies on Bluez v4.99 while Debian 8 "Jessie" (supported until April/May 2020) uses Bluez v5.23.

TODO List

  • Complete examples/gatttool port to GattLib to demonstrate the completeness of GattLib.
  • Remove GLib dependencies to GattLib (mainly replacing GLib IO Channels by Unix Domain Socket).

Support

Commercial Support can be obtained through Lab A Part. Please contact us: https://labapart.com/about/.

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].