gatt 0.0.1 copy "gatt: ^0.0.1" to clipboard
gatt: ^0.0.1 copied to clipboard

GATT (Generic ATTribute profile) structured data for BLE communication.

GATT (Generic ATTribute profile) #

GATT (Generic ATTribute profile) is the information protocol at the heart of Bluetooth Low Energy communication. This package provides structured representations for GATT IDs, which identify services, characteristics, and descriptors. This package also includes many SIG GATT IDs for easy reference in your BLE code.

Usage #

Reference existing SIG GATT IDs, or define your own.

import 'package:gatt/gatt.dart';

// Reference official SIG IDs:
print(batteryLevelCharacteristicId);

// Construct a SIG ID with the leading 16-bit or 32-bit UUID:
print(const SigGattId(0x1234));

// Construct a custom GATT ID:
print(const GattId(0x1234, '-0000-1111-2222-3456789ABCDE'));

// Access the leading 32-bits as an integer:
print(const GattId(0x1234, '-0000-1111-2222-3456789ABCDE').leadingHexInt);
// prints the integer form of 0x1234

// Access the leading 32-bits as a hex string:
print(const GattId(0x1234, '-0000-1111-2222-3456789ABCDE').asUuid4Bytes);
// prints "0001234"

// Access the lower 16-bits of the leading 32-bits as a hex string:
print(const GattId(0x1234, '-0000-1111-2222-3456789ABCDE').asUuid2Bytes);
// prints "1234"

Contributing #

Please follow the standard Flutter Bounty Hunter contribution guidelines

Learn more #

Adafruit introduction to GATT

Bluetooth SIG assigned numbers

Bluetooth SIG UUIDs

4
likes
110
pub points
44%
popularity

Publisher

verified publisherflutterbountyhunters.com

GATT (Generic ATTribute profile) structured data for BLE communication.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

More

Packages that depend on gatt