Skip to content

Commit

Permalink
Update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
fotiDim committed Jul 14, 2024
1 parent 3fceeae commit 20909a7
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Universal BLE
# UniversalBLE

[![universal_ble version](https://img.shields.io/pub/v/universal_ble?label=universal_ble)](https://pub.dev/packages/universal_ble)

Expand All @@ -16,6 +16,9 @@ A cross-platform (Android/iOS/macOS/Windows/Linux/Web) Bluetooth Low Energy (BLE
- [Bluetooth Availability](#bluetooth-availability)
- [Command Queue](#command-queue)
- [Timeout](#timeout)
- [UUID Format Agnostic](#uuid-format-agnostic)

## Usage

### API Support Matrix

Expand Down Expand Up @@ -260,36 +263,37 @@ UniversalBle.timeout = const Duration(seconds: 10);
UniversalBle.timeout = null;
```

## UUID format
## UUID Format Agnostic

UniversalBLE is agnostic to the UUID format of services and characteristics regardless of the platform the app runs on. When passing a UUID, you can pass it in any format (long/short) or character case (upper/lower case) you want. UniversalBLE will take care of necessary conversions, across all platforms, so that you don't need to worry about underlying platform differences.

All characteristic and service UUIDs will be returned in lowercase and in 128 bit format, across all platforms.
e.g. `0000180a-0000-1000-8000-00805f9b34fb`
For consistency, all characteristic and service UUIDs will be returned in **lowercase 128-bit format**, across all platforms, e.g. `0000180a-0000-1000-8000-00805f9b34fb`.

When passing a UUID you can pass it in any character case or format (long/short) you want. The plugin will take care of conversions across all platforms so that you don't need to worry about platform differences.
### Utility Methods

### Utility methods
If you need to convert any UUIDs in your app you can use the following methods.

`BleUuidParser.string()` converts a string to a 128-bit UUID format string:
- `BleUuidParser.string()` converts a string to a 128-bit UUID formatted string:

```dart
BleUuidParser.string("180A"); // "0000180a-0000-1000-8000-00805f9b34fb"
BleUuidParser.string("0000180A-0000-1000-8000-00805F9B34FB"); // "0000180a-0000-1000-8000-00805f9b34fb"
```

`BleUuidParser.number()` converts a number to a 128-bit UUID format string:
- `BleUuidParser.number()` converts a number to a 128-bit UUID formatted string:

```dart
BleUuidParser.number(0x180A); // "0000180a-0000-1000-8000-00805f9b34fb"
```

`BleUuidParser.compare()` compares two differently formatted UUIDs:
- `BleUuidParser.compare()` compares two differently formatted UUIDs:

```dart
BleUuidParser.compare("180a","0000180A-0000-1000-8000-00805F9B34FB"); // true
```

## Platform-Specific Setup
## Platform-specific Setup

### Android

Expand Down

0 comments on commit 20909a7

Please sign in to comment.