bluetooth_identifiers 1.0.3 copy "bluetooth_identifiers: ^1.0.3" to clipboard
bluetooth_identifiers: ^1.0.3 copied to clipboard

outdated

Codification of Bluetooth specificiers for manufacturer & service data.

Pub License: MIT


Codification of some Assigned Numbers from Bluetooth.com which have been packaged neatly into a Flutter package for your convenience!

Learn more at Bluetooth.com!


Usage #

Usage of this package is dead simple as it is simply a neatly wrapped set of two maps with some convenience extensions.

16-Bit Hexadecimal #

Using hex strings.
final int key = int.parse('0x00E0', radix: 16); // Parse 16-bit hex in Dart using integer with radix 16

final UUIDAllocation uuidServiceId = BluetoothIdentifiers.uuidServiceIdentifiers[key];

print(uuidServiceId); // null


final String companyIdentifier = BluetoothIdentifiers.companyIdentifiers[key];

print(companyIdentifier); // 'Google'
copied to clipboard
Using convenience map extension function.
final UUIDAllocation uuidServiceID = BluetoothIdentifiers.uuidServiceIdentifiers
  .elementForHex('0xFCF1');

print(uuidServiceID); // UUIDAllocation(type: '16-bit UUID for Members', registrant: 'Google LLC')


final String companyIdentifier = BluetoothIdentifiers.companyIdentifiers
  .elementForHex('0x00E0'); 

print(companyIdentifier); // 'Google'
copied to clipboard
What if I also need calculated key?
final MapEntry<int, UUIDAllocation> uuidServiceIDEntry = BluetoothIdentifiers.uuidServiceIdentifiers
  .entryForHex('0x00E0');

print(uuidServiceIDEntry.key); // 224
print(uuidServiceIDEntry.value); // null


final MapEntry<int, String> companyIdentifierEntry = BluetoothIdentifiers.companyIdentifiers
  .entryForHex('0x00E0');

print(companyIdentifierEntry.key); // 224
print(companyIdentifierEntry.value); // 'Google'
copied to clipboard

Unsigned Decimal #

Unsigned decimals may also be used either in Dart hex notation or raw integer form for programmatic ease-of-use.
final UUIDAllocation uuidServiceId = BluetoothIdentifiers.uuidServiceIdentifiers[0x00E0];

print(uuidServiceID); // UUIDAllocation(type: '16-bit UUID for Members', registrant: 'Google LLC')


final String companyIdentifier = BluetoothIdentifiers.companyIdentifiers[0x00E0];

print(companyIdentifier); // 'Google'
copied to clipboard
which is exactly equivalent to
final UUIDAllocation uuidServiceId = BluetoothIdentifiers.uuidServiceIdentifiers[224];

print(uuidServiceID); // UUIDAllocation(type: '16-bit UUID for Members', registrant: 'Google LLC')

final String companyIdentifier = BluetoothIdentifiers.companyIdentifiers[224];

print(companyIdentifier); // 'Google'
copied to clipboard

Dart Versions #

  • Dart 2: >= 2.12

Maintainers #

Requests & Feedback #

  • Due to the fact that the sources of this package are living documents, if this package becomes outdated an issue may be raised on the Github page and I will do my best to update date it quickly. Any other feedback may be sent to my personal contact.
10
likes
0
points
51
downloads

Publisher

unverified uploader

Weekly Downloads

2024.05.28 - 2025.04.22

Codification of Bluetooth specificiers for manufacturer & service data.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on bluetooth_identifiers