All Projects → sputnikdev → bluetooth-gatt-parser

sputnikdev / bluetooth-gatt-parser

Licence: Apache-2.0 license
Bluetooth GATT service and characteristic parser

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to bluetooth-gatt-parser

bluetooth-manager
Java Bluetooth Manager. A library/framework for managing bluetooth adapters, bluetooth devices, GATT services and characteristics
Stars: ✭ 75 (+22.95%)
Mutual labels:  bluetooth, ble, gatt, characteristics
ble2mqtt
A BLE to MQTT bridge
Stars: ✭ 60 (-1.64%)
Mutual labels:  bluetooth, ble, gatt
IOS-DFU-Library
OTA DFU Library for Mac and iOS, compatible with nRF5x SoCs
Stars: ✭ 400 (+555.74%)
Mutual labels:  bluetooth, ble, bluetoothsmart
coBlue
Use Bluetooth Low Energy for remote commands, file transfer, Based on bluez Bluetooth protocol stack (BLE Terminal)
Stars: ✭ 41 (-32.79%)
Mutual labels:  bluetooth, ble, gatt
GoFIT SDK Android
GoFIT SDK for Android — GOLiFE 手環 App 介接 SDK
Stars: ✭ 32 (-47.54%)
Mutual labels:  bluetooth, ble
mi-lamp-re
💡 Reverse Engineering Notes for the Yeelight Bedside Lamp (BLE)
Stars: ✭ 35 (-42.62%)
Mutual labels:  bluetooth, ble
IOsonata
IOsonata multi-platform multi-architecture power & performance optimized software library for fast and easy IoT MCU firmware development. Object Oriented design, no board package to define, just pure plug & play any boards
Stars: ✭ 40 (-34.43%)
Mutual labels:  bluetooth, ble
pymetawear
Community developed SDK around the Python bindings for the C++ SDK
Stars: ✭ 42 (-31.15%)
Mutual labels:  bluetooth, ble
theheraldproject.github.io
Herald - Proximity Detection Protocol and research documentation, including the Fair Efficacy Formula
Stars: ✭ 17 (-72.13%)
Mutual labels:  bluetooth, ble
bluetooth-iot-service-python
This application connects two devices over Bluetooth and allows one to send messages to the other using json. Raspberry Pi Bluetooth interfacing with Linux via RFCOMM BT network
Stars: ✭ 23 (-62.3%)
Mutual labels:  bluetooth, ble
GATT
Bluetooth Generic Attribute Profile (GATT) for Swift (Supports Linux)
Stars: ✭ 48 (-21.31%)
Mutual labels:  bluetooth, gatt
ESP32BleAdvertise
Simple library for BLE advertise using ESP32 in Arduino
Stars: ✭ 39 (-36.07%)
Mutual labels:  bluetooth, ble
ChromeBluetooth
Demo of a "Stress Display" using Chrome Bluetooth. Reads Heart-rate data, and displays "stress" colors to a smart bulb. (Uses a SBT5007 smart bulb)
Stars: ✭ 14 (-77.05%)
Mutual labels:  bluetooth, ble
easyble
A simple framework for Android Bluetooth Low Energy (BLE)
Stars: ✭ 43 (-29.51%)
Mutual labels:  bluetooth, ble
H.E.L.P.
Home Environment Locating People 🍍
Stars: ✭ 19 (-68.85%)
Mutual labels:  bluetooth, ble
react-native-google-nearby-messages
📲 Communicate with nearby devices using Bluetooth, BLE, WiFi and near-ultrasonic audio. Broadcast and receive small payloads (like strings) using the easy-to-use React Native API!
Stars: ✭ 143 (+134.43%)
Mutual labels:  bluetooth, ble
BLELib
This library contains many of the features you need to interact with BLE peripherals
Stars: ✭ 21 (-65.57%)
Mutual labels:  bluetooth, ble
python-sonicare
Python library to communicate with a Phillips Sonicare toothbrush via Bluetooth Low Energy
Stars: ✭ 46 (-24.59%)
Mutual labels:  bluetooth, ble
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 (-57.38%)
Mutual labels:  bluetooth, ble
daydream-node
Quick Node.js module to connect to the Daydream controller and receive all the data
Stars: ✭ 17 (-72.13%)
Mutual labels:  bluetooth, ble

Maven Central Build Status Coverage Status Codacy Badge Join the chat at https://gitter.im/sputnikdev/bluetooth-gatt-parser

bluetooth-gatt-parser

A simple library/framework to work with Bluetooth Smart (BLE) GATT services and characteristics.

Have a look at an example of parsing a standard characteristic (Battery Level 0x2A19) value:

BluetoothGattParserFactory.getDefault().parse("2A19", new byte[] {51}).get("Level").getInteger(null);

This would print 51.

Features:

  1. Supports 99% of the existing/standard GATT services and characteristics specifications.
  2. Parse/read single and multi field characteristics into a user-friendly data format.
  3. Writing single and multi field characteristics.
  4. Validating input data whether it conforms to GATT specifications (format types and mandatory fields).
  5. Extensibility. User defined services and characteristics.
  6. Support for all defined format types.

Start using the library by including a maven dependency in your project:

<dependency>
  <groupId>org.sputnikdev</groupId>
  <artifactId>bluetooth-gatt-parser</artifactId>
  <version>X.Y.Z</version>
</dependency>

A more complex example of parsing multi-field characteristics (Heart Rate service):

// Getting a default implementation which is capable of reading/writing the standard GATT services and characteristics
BluetoothGattParser parser = BluetoothGattParserFactory.getDefault();

// Reading Body Sensor Location (0x2A38) characteristic (sigle field)
byte[] data = new byte[] {1}; // 1 == Chest
GattResponse response = parser.parse("2A38", data);
String sensorLocation = response.get("Body Sensor Location").getInteger(null); // prints 1 (Chest)

// Reading Heart Rate Measurement (0x2A37) characteristic (multi field)
byte[] data = new byte[] {20, 74, 13, 3};
GattResponse response = parser.parse("2A37", data);
String heartRateValue = response.get("Heart Rate Measurement Value (uint8)").getInteger(null); // prints 74
String rrIntervalValue = response.get("RR-Interval").getInteger(null); // prints 781

// Writing Heart Rate Control Point (0x2A39) characteristic
GattRequest request = parser.prepare("2A39");
request.setField("Heart Rate Control Point", 1); // control value to be sent to a bluetooth device
byte[] data = parser.serialize(request);

See more examples in the integration tests: GenericCharacteristicParserIntegrationTest


Extending the library with user defined services and characteristics

The gatt-parser library is designed to be able to add support for some new custom services/characteristics or to override an existing ("approved") service and characteristic. This can be done by just providing a new GATT XML file which specifies your service and characteristic (have a look at the standard definition for the Battery Level characteristic). The library will read your custom files and build internal rules/conditions for parsing and serialization of your custom characteristics. This means you don't have to write any code to parse/serialize simple or complex custom characteristics.

Loading XML GATT specification files (GATT-like specifications) from a folder:

BluetoothGattParser parser = BluetoothGattParserFactory.getDefault();
File extensionsFolderFile = new File(..);
gattParser.loadExtensionsFromFolder(extensions);

A custom parser can be added for a characteristic if you are not satisfied with the default one

See the default one for a hint and a reference: GenericCharacteristicParser

BluetoothGattParser parser = BluetoothGattParserFactory.getDefault();
CharacteristicParser customParser = new ...; // your own implementation
parser.registerParser(CHARACTERISTIC_UUID, customParser);

Contribution

You are welcome to contribute to the project, the project environment is designed to make it easy by using:

  • Travis CI to release artifacts directly to the Maven Central repository.
  • Code style rules to support clarity and supportability. The results can be seen in the Codacy.
  • Code coverage reports in the Coveralls to maintain sustainability. 100% of code coverage with unittests is the target.

The build process is streamlined by using standard maven tools.

To build the project with maven:

mvn clean install

To cut a new release and upload it to the Maven Central Repository:

mvn release:prepare -B
mvn release:perform

Travis CI process will take care of everything, you will find a new artifact in the Maven Central repository when the release process finishes successfully.

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