bluetooth_identifiers

Creator: coderz1093

Last updated:

0 purchases

bluetooth_identifiers Image
bluetooth_identifiers Images

Languages

Categories

Add to Cart

Description:

bluetooth identifiers

Bluetooth Identifiers

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

Usage #
Usage of this package is dead simple as it is a neatly wrapped set of maps with int key type.
Direct Fetching #
Direct fetching may be done either via raw integer, or hex literal.
final UUIDAllocation uuidServiceId = BluetoothIdentifiers.uuidServiceIdentifiers[64753];

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


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

print(companyIdentifier); // 'Google'
copied to clipboard
Key Calculation #
Regular calculation of keys
Calculating key from hex string example
final int key = int.parse('0x00E0', radix: 16);
copied to clipboard
Calculating key from byte list example
final int start = 0;
final Uint8List bytes = Uint8List.fromList([0, 224]);

final int key = bytes.buffer.asByteData().getUint16(start);
copied to clipboard
Instead of grinding away at calculating your own keys for the maps in order to follow general usage, the package
exposes simple Map extension functions which may be used to reduce a lot of tedious boiler-plate.
Convenience extensions #
final UUIDAllocation uuidServiceId = BluetoothIdentifiers.uuidServiceIdentifiers.elementForHex('0x00E0');

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


final Uint8List bytes = Uint8List.fromList([0, 224]);
final String companyIdentifier = BluetoothIdentifiers.companyIdentifiers.elementForByteArray(bytes);

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

print(uuidServiceIDEntry.key); // 64753
print(uuidServiceIDEntry.value); // UUIDAllocation(type: '16-bit UUID for Members', registrant: 'Google LLC')

final Uint8List bytes = Uint8List.fromList([0, 224]);
final MapEntry<int, String> companyIdentifierEntry = BluetoothIdentifiers.companyIdentifiers
.entryForByteArray(bytes);

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

Dart 2: >= 2.12

Maintainers #

Adrian Lemus

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.

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.