Blzlib
Bluetooth GATT Library for Linux / Bluez
Install / Use
/learn @infsoft-locaware/BlzlibREADME
blzlib - Bluetooth GATT Library for Linux / Bluez
blzlib is a C library providing an easy interface to acess Bluetooth Low Energy (BLE) Generic Attribute Profile (GATT) Services and Characteristics on Linux. It interfaces with the Bluez Bluetooth daemon on Linux via its D-Bus API. It depends on libsystemd (sd-bus) and is licensed under the LGPLv3.
Currently the following features are supported:
- Discovery / Scanning of nearby BLE devices
- Discovery of services and characteristics
- Read GATT characteristics
- Notify of GATT characteristics (value change notifications)
- Write GATT characteristics
- Efficient write of GATT characteristics by file descriptor (write-without-respose)
Dependencies
-
Bluez version 5.49 and higher
-
libsystemd: blzlib uses systemds sd-bus library to access the D-Bus API of Bluez.
sudo apt install libsystemd-dev
Building
Currently building with meson as well as cmake is supported.
Meson:
meson build
cd build/
ninja
CMake:
mkdir build
cd build
cmake ..
make
Examples
Here is a simple example how to write a characteristic:
blz* blz = blz_init("hci0");
blz_dev* dev = blz_connect(blz, "00:11:22:33:44:55", NULL);
blz_serv* srv = blz_get_serv_from_uuid(dev, "6e400001-b5a3-f393-e0a9-e50e24dcca9e");
blz_char* ch = blz_get_char_from_uuid(srv, "6e400002-b5a3-f393-e0a9-e50e24dcca9e");
blz_char_write(ch, "test", 4);
More real-life examples can be found in the examples/ directory.
Related Skills
node-connect
349.2kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
109.5kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
349.2kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
349.2kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
