Git Product home page Git Product logo

blzlib's Introduction

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.

blzlib's People

Contributors

panta avatar anthonybrandon avatar gb88 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.