feat: 支持外围设备接口,优化中心设备接口 (#18)

* 临时提交

* 临时提交

* 临时提交

* fix: 调整接口

* fix: 修复问题

* fix: 调整 iOS 实现

* fix: 添加注释

* fix: 修改预览版本号

* fix: 修复已知问题

* fix: 优化接口

* fix: 解决 32 位 UUID 报错问题

* fix: 修复问题

* fix: 修复依赖项

* fix: 移除多余代码

* fix: 修复已知问题

* fix: 修复问题

* fix: 修改版本号

* fix: 修复问题

* fix: 发布正式版本
This commit is contained in:
Mr剑侠客
2023-10-10 05:01:25 -05:00
committed by GitHub
parent 073c2b9a2e
commit 79c50d638d
113 changed files with 9125 additions and 4560 deletions

View File

@ -1,3 +1,45 @@
## 3.0.0
* Add `PeripheralManager` api.
* Add `CentralManager#readRSSI` method.
* Add `CentralManager.instance` api.
* Add `PeripheralManager.instance` api.
* Move `CentralController` to `CentralManager`.
* Move `CentralState` to `BluetoothLowEnergyState`.
* Move `CentralDiscoveredEventArgs` to `DiscoveredEventArgs`.
* Move `Advertisement` class to `AdvertiseData` class.
* Move `setUp` method from `BluetoothLowEnergy` class to `BluetoothLowEnergyManger` class.
* Change the type of `manufacturerSpecificData` from `Map<int, Uint8List>` to `ManufacturerSpecificData`.
* [Fix the issue that `UUID.fromString()` throw FormatException with 32 bits UUID string.](https://github.com/yanshouwang/bluetooth_low_energy/issues/13)
* Fix known issues.
## 3.0.0-dev.5
* Move `Advertisement` class to `AdvertiseData` class.
## 3.0.0-dev.4
* Fix issues.
## 3.0.0-dev.3
* [Fix the issue that `UUID.fromString()` throw FormatException with 32 bits UUID string.](https://github.com/yanshouwang/bluetooth_low_energy/issues/13)
* Change the type of `manufacturerSpecificData` from `Map<int, Uint8List>` to `ManufacturerSpecificData`.
## 3.0.0-dev.2
* Move `setUp` method from `BluetoothLowEnergy` class to `BluetoothLowEnergyManger` class.
* Add `CentralManager.instance` api.
* Add `PeripheralManager.instance` api.
## 3.0.0-dev.1
* Add `PeripheralManager` api.
* Add `CentralManager#readRSSI` method.
* Move `CentralController` to `CentralManager`.
* Move `CentralState` to `BluetoothLowEnergyState`.
* Move `CentralDiscoveredEventArgs` to `DiscoveredEventArgs`.
## 2.2.0
* Add `GattCharacteristicWriteType` argument to `CentralController#getMaximumWriteLength` method.

View File

@ -1,12 +1,24 @@
export 'src/errors.dart';
export 'src/event_args.dart';
export 'src/central_controller.dart';
export 'src/central_state.dart';
export 'src/bluetooth_low_energy.dart';
export 'src/bluetooth_low_energy_manager.dart';
export 'src/bluetooth_low_energy_state.dart';
export 'src/central_manager.dart';
export 'src/peripheral_manager.dart';
export 'src/bluetooth_low_energy_peer.dart';
export 'src/central.dart';
export 'src/peripheral.dart';
export 'src/uuid.dart';
export 'src/advertisement.dart';
export 'src/advertise_data.dart';
export 'src/manufacturer_specific_data.dart';
export 'src/gatt_service.dart';
export 'src/gatt_characteristic.dart';
export 'src/gatt_characteristic_property.dart';
export 'src/gatt_characteristic_write_type.dart';
export 'src/gatt_descriptor.dart';
export 'src/my_object.dart';
export 'src/my_peripheral.dart';
export 'src/my_gatt_service.dart';
export 'src/my_gatt_characteristic.dart';
export 'src/my_gatt_descriptor.dart';
export 'src/my_central.dart';

View File

@ -1,26 +1,27 @@
import 'dart:typed_data';
import 'manufacturer_specific_data.dart';
import 'uuid.dart';
/// The advertisement discovered from a peripheral.
class Advertisement {
/// The advertise data discovered from a peripheral.
class AdvertiseData {
/// The name of the peripheral.
final String? name;
/// The manufacturer specific data of the peripheral.
final Map<int, Uint8List> manufacturerSpecificData;
/// The GATT service uuids of the peripheral.
final List<UUID> serviceUUIDs;
/// The GATT service data of the peripheral.
final Map<UUID, Uint8List> serviceData;
/// Constructs an [Advertisement].
Advertisement({
/// The manufacturer specific data of the peripheral.
final ManufacturerSpecificData? manufacturerSpecificData;
/// Constructs an [AdvertiseData].
AdvertiseData({
this.name,
this.manufacturerSpecificData = const {},
this.serviceUUIDs = const [],
this.serviceData = const {},
this.manufacturerSpecificData,
});
}

View File

@ -0,0 +1,41 @@
import 'package:plugin_platform_interface/plugin_platform_interface.dart';
import 'central_manager.dart';
import 'peripheral_manager.dart';
/// The bluetooth low energy interface.
///
/// Call `setUp` before use any api.
abstract class BluetoothLowEnergy extends PlatformInterface {
/// Constructs a [BluetoothLowEnergy].
BluetoothLowEnergy() : super(token: _token);
static final Object _token = Object();
static BluetoothLowEnergy? _instance;
/// The default instance of [BluetoothLowEnergy] to use.
static BluetoothLowEnergy get instance {
final instance = _instance;
if (instance == null) {
throw UnimplementedError(
'`BluetoothLowEnergy` is not implemented on this platform.',
);
}
return instance;
}
/// Platform-specific implementations should set this with their own
/// platform-specific class that extends [BluetoothLowEnergy] when
/// they register themselves.
static set instance(BluetoothLowEnergy instance) {
PlatformInterface.verifyToken(instance, _token);
_instance = instance;
}
/// Gets the instance of central manager.
CentralManager get centralManager;
/// Gets the instance of peripheral manager.
PeripheralManager get peripheralManager;
}

View File

@ -0,0 +1,14 @@
import 'bluetooth_low_energy_state.dart';
import 'event_args.dart';
/// The abstract base class that manages central and peripheral objects.
abstract class BluetoothLowEnergyManager {
/// The current state of the manager.
BluetoothLowEnergyState get state;
/// Tells the managers state updated.
Stream<BluetoothLowEnergyStateChangedEventArgs> get stateChanged;
/// Sets up this bluetooth low energy manager.
Future<void> setUp();
}

View File

@ -0,0 +1,7 @@
import 'uuid.dart';
/// An object that represents a remote device.
abstract class BluetoothLowEnergyPeer {
/// The UUID associated with the peer.
UUID get uuid;
}

View File

@ -0,0 +1,17 @@
/// The state of the bluetooth low energy.
enum BluetoothLowEnergyState {
/// The bluetooth low energy is unknown.
unknown,
/// The bluetooth low energy is unsupported.
unsupported,
/// The bluetooth low energy is unauthorized.
unauthorized,
/// The bluetooth low energy is powered off.
poweredOff,
/// The bluetooth low energy is powered on.
poweredOn,
}

View File

@ -0,0 +1,4 @@
import 'bluetooth_low_energy_peer.dart';
/// A remote device connected to a local app, which is acting as a peripheral.
abstract class Central extends BluetoothLowEnergyPeer {}

View File

@ -1,120 +0,0 @@
import 'dart:typed_data';
import 'package:plugin_platform_interface/plugin_platform_interface.dart';
import 'central_state.dart';
import 'event_args.dart';
import 'gatt_characteristic.dart';
import 'gatt_characteristic_write_type.dart';
import 'gatt_descriptor.dart';
import 'gatt_service.dart';
import 'peripheral.dart';
/// The central controller used to communicate with peripherals.
/// Call `setUp` before use any api, and call `tearDown` when it is no longer needed.
abstract class CentralController extends PlatformInterface {
/// Constructs a [CentralController].
CentralController() : super(token: _token);
static final Object _token = Object();
static CentralController? _instance;
/// The default instance of [CentralController] to use.
static CentralController get instance {
final instance = _instance;
if (instance == null) {
const message =
'`BluetoothLowEnergy` is not implemented on this platform.';
throw UnimplementedError(message);
}
return instance;
}
/// Platform-specific implementations should set this with their own
/// platform-specific class that extends [CentralController] when
/// they register themselves.
static set instance(CentralController instance) {
PlatformInterface.verifyToken(instance, _token);
_instance = instance;
}
/// Gets the state of the central.
CentralState get state;
/// Used to listen the central state changed event.
Stream<CentralStateChangedEventArgs> get stateChanged;
/// Used to listen the central discovered event.
Stream<CentralDiscoveredEventArgs> get discovered;
/// Used to listen peripherals state changed event.
Stream<PeripheralStateChangedEventArgs> get peripheralStateChanged;
/// Used to listen GATT characteristics value changed event.
Stream<GattCharacteristicValueChangedEventArgs>
get characteristicValueChanged;
/// Sets up the central controller.
Future<void> setUp();
/// Tears down the central controller.
Future<void> tearDown();
/// Starts to discover peripherals.
Future<void> startDiscovery();
/// Stops to discover peripherals.
Future<void> stopDiscovery();
/// Connects to the peripheral.
Future<void> connect(Peripheral peripheral);
/// Disconnects form the peripheral.
Future<void> disconnect(Peripheral peripheral);
/// Gets the max length in bytes for a single write type of the peripheral.
Future<int> getMaximumWriteLength(
Peripheral peripheral, {
required GattCharacteristicWriteType type,
});
/// Discovers GATT of the peripheral.
Future<void> discoverGATT(Peripheral peripheral);
/// Gets GATT services of the peripheral.
Future<List<GattService>> getServices(Peripheral peripheral);
/// Gets GATT characteristics of the GATT service.
Future<List<GattCharacteristic>> getCharacteristics(GattService service);
/// Gets GATT descriptors of the GATT characteristic.
Future<List<GattDescriptor>> getDescriptors(
GattCharacteristic characteristic,
);
/// Reads value of the GATT characteristic.
Future<Uint8List> readCharacteristic(GattCharacteristic characteristic);
/// Writes value of the GATT characteristic.
Future<void> writeCharacteristic(
GattCharacteristic characteristic, {
required Uint8List value,
required GattCharacteristicWriteType type,
});
/// Notifies value of the GATT characteristic.
Future<void> notifyCharacteristic(
GattCharacteristic characteristic, {
required bool state,
});
/// Reads value of the GATT descriptor.
Future<Uint8List> readDescriptor(GattDescriptor descriptor);
/// Writes value of the GATT descriptor.
Future<void> writeDescriptor(
GattDescriptor descriptor, {
required Uint8List value,
});
}

View File

@ -0,0 +1,76 @@
import 'dart:typed_data';
import 'bluetooth_low_energy.dart';
import 'bluetooth_low_energy_manager.dart';
import 'event_args.dart';
import 'gatt_characteristic.dart';
import 'gatt_characteristic_write_type.dart';
import 'gatt_descriptor.dart';
import 'gatt_service.dart';
import 'peripheral.dart';
/// An object that scans for, discovers, connects to, and manages peripherals.
abstract class CentralManager extends BluetoothLowEnergyManager {
/// Gets the instance of [CentralManager].
static CentralManager get instance =>
BluetoothLowEnergy.instance.centralManager;
/// Tells the central manager discovered a peripheral while scanning for devices.
Stream<DiscoveredEventArgs> get discovered;
/// Tells that retrieving the specified peripheral's state changed.
Stream<PeripheralStateChangedEventArgs> get peripheralStateChanged;
/// Tells that retrieving the specified characteristics value changed.
Stream<GattCharacteristicValueChangedEventArgs>
get characteristicValueChanged;
/// Scans for peripherals that are advertising services.
Future<void> startDiscovery();
/// Asks the central manager to stop scanning for peripherals.
Future<void> stopDiscovery();
/// Establishes a local connection to a peripheral.
Future<void> connect(Peripheral peripheral);
/// Cancels an active or pending local connection to a peripheral.
Future<void> disconnect(Peripheral peripheral);
/// Gets the maximum amount of data, in bytes, you can send to a characteristic in a single write type.
Future<int> getMaximumWriteLength(
Peripheral peripheral, {
required GattCharacteristicWriteType type,
});
/// Retrieves the current RSSI value for the peripheral while connected to the central manager.
Future<int> readRSSI(Peripheral peripheral);
/// Discovers the GATT services, characteristics and descriptors of the peripheral.
Future<List<GattService>> discoverGATT(Peripheral peripheral);
/// Retrieves the value of a specified characteristic.
Future<Uint8List> readCharacteristic(GattCharacteristic characteristic);
/// Writes the value of a characteristic.
Future<void> writeCharacteristic(
GattCharacteristic characteristic, {
required Uint8List value,
required GattCharacteristicWriteType type,
});
/// Sets notifications or indications for the value of a specified characteristic.
Future<void> notifyCharacteristic(
GattCharacteristic characteristic, {
required bool state,
});
/// Retrieves the value of a specified characteristic descriptor.
Future<Uint8List> readDescriptor(GattDescriptor descriptor);
/// Writes the value of a characteristic descriptor.
Future<void> writeDescriptor(
GattDescriptor descriptor, {
required Uint8List value,
});
}

View File

@ -1,17 +0,0 @@
/// The state of the central.
enum CentralState {
/// The central is unknown.
unknown,
/// The central is unsupported.
unsupported,
/// The central is unauthorized.
unauthorized,
/// The central is powered off.
poweredOff,
/// The central is powered on.
poweredOn,
}

View File

@ -1,35 +1,36 @@
import 'dart:typed_data';
import 'advertisement.dart';
import 'central_state.dart';
import 'advertise_data.dart';
import 'bluetooth_low_energy_state.dart';
import 'central.dart';
import 'gatt_characteristic.dart';
import 'peripheral.dart';
/// The base event arguments.
abstract class EventArgs {}
/// The central state changed event arguments.
class CentralStateChangedEventArgs extends EventArgs {
/// The new state of the central.
final CentralState state;
/// The bluetooth low energy state changed event arguments.
class BluetoothLowEnergyStateChangedEventArgs extends EventArgs {
/// The new state of the bluetooth low energy.
final BluetoothLowEnergyState state;
/// Constructs a [CentralStateChangedEventArgs].
CentralStateChangedEventArgs(this.state);
/// Constructs a [BluetoothLowEnergyStateChangedEventArgs].
BluetoothLowEnergyStateChangedEventArgs(this.state);
}
/// The central discovered event arguments.
class CentralDiscoveredEventArgs extends EventArgs {
/// The discovered event arguments.
class DiscoveredEventArgs extends EventArgs {
/// The disvered peripheral.
final Peripheral peripheral;
/// The rssi of the peripheral.
final int rssi;
/// The advertisement of the peripheral.
final Advertisement advertisement;
/// The advertise data of the peripheral.
final AdvertiseData advertiseData;
/// Constructs a [CentralDiscoveredEventArgs].
CentralDiscoveredEventArgs(this.peripheral, this.rssi, this.advertisement);
/// Constructs a [DiscoveredEventArgs].
DiscoveredEventArgs(this.peripheral, this.rssi, this.advertiseData);
}
/// The peripheral state changed event arguments.
@ -55,3 +56,45 @@ class GattCharacteristicValueChangedEventArgs extends EventArgs {
/// Constructs a [GattCharacteristicValueChangedEventArgs].
GattCharacteristicValueChangedEventArgs(this.characteristic, this.value);
}
class ReadGattCharacteristicCommandEventArgs {
final Central central;
final GattCharacteristic characteristic;
final int id;
final int offset;
ReadGattCharacteristicCommandEventArgs(
this.central,
this.characteristic,
this.id,
this.offset,
);
}
class WriteGattCharacteristicCommandEventArgs {
final Central central;
final GattCharacteristic characteristic;
final int id;
final int offset;
final Uint8List value;
WriteGattCharacteristicCommandEventArgs(
this.central,
this.characteristic,
this.id,
this.offset,
this.value,
);
}
class NotifyGattCharacteristicCommandEventArgs {
final Central central;
final GattCharacteristic characteristic;
final bool state;
NotifyGattCharacteristicCommandEventArgs(
this.central,
this.characteristic,
this.state,
);
}

View File

@ -0,0 +1,7 @@
import 'uuid.dart';
/// A representation of common aspects of services offered by a peripheral.
abstract class GattAttribute {
/// The Bluetooth-specific UUID of the attribute.
UUID get uuid;
}

View File

@ -1,17 +1,27 @@
import 'gatt_attribute.dart';
import 'gatt_characteristic_property.dart';
import 'gatt_descriptor.dart';
import 'my_gatt_characteristic.dart';
import 'my_gatt_descriptor.dart';
import 'uuid.dart';
/// The GATT characteristic.
class GattCharacteristic {
/// The [UUID] of this GATT characteristic.
final UUID uuid;
/// A characteristic of a remote peripherals service.
abstract class GattCharacteristic extends GattAttribute {
/// The properties of the characteristic.
List<GattCharacteristicProperty> get properties;
/// The properties of this GATT characteristic.
final List<GattCharacteristicProperty> properties;
/// A list of the descriptors discovered in this characteristic.
List<GattDescriptor> get descriptors;
/// Constructs a [GattCharacteristic].
GattCharacteristic({
required this.uuid,
required this.properties,
});
factory GattCharacteristic({
required UUID uuid,
required List<GattCharacteristicProperty> properties,
required List<GattDescriptor> descriptors,
}) =>
MyGattCharacteristic(
uuid: uuid,
properties: properties,
descriptors: descriptors.cast<MyGattDescriptor>(),
);
}

View File

@ -1,12 +1,18 @@
import 'dart:typed_data';
import 'gatt_attribute.dart';
import 'my_gatt_descriptor.dart';
import 'uuid.dart';
/// The GATT characteristic.
class GattDescriptor {
/// The [UUID] of this GATT descriptor.
final UUID uuid;
/// An object that provides further information about a remote peripherals characteristic.
abstract class GattDescriptor extends GattAttribute {
/// Constructs a [GattDescriptor].
GattDescriptor({
required this.uuid,
});
factory GattDescriptor({
required UUID uuid,
required Uint8List value,
}) =>
MyGattDescriptor(
uuid: uuid,
value: value,
);
}

View File

@ -1,12 +1,21 @@
import 'gatt_attribute.dart';
import 'gatt_characteristic.dart';
import 'my_gatt_characteristic.dart';
import 'my_gatt_service.dart';
import 'uuid.dart';
/// The GATT service.
class GattService {
/// The [UUID] of this GATT service.
final UUID uuid;
/// A collection of data and associated behaviors that accomplish a function or feature of a device.
abstract class GattService extends GattAttribute {
/// A list of characteristics discovered in this service.
List<GattCharacteristic> get characteristics;
/// Constructs a [GattService].
GattService({
required this.uuid,
});
factory GattService({
required UUID uuid,
required List<GattCharacteristic> characteristics,
}) =>
MyGattService(
uuid: uuid,
characteristics: characteristics.cast<MyGattCharacteristic>(),
);
}

View File

@ -0,0 +1,16 @@
import 'dart:typed_data';
/// The manufacturer specific data of the peripheral
class ManufacturerSpecificData {
/// The manufacturer id.
final int id;
/// The manufacturer data.
final Uint8List data;
/// Constructs an [ManufacturerSpecificData].
ManufacturerSpecificData({
required this.id,
required this.data,
});
}

View File

@ -0,0 +1,13 @@
import 'central.dart';
import 'my_object.dart';
import 'uuid.dart';
class MyCentral extends MyObject implements Central {
@override
final UUID uuid;
MyCentral({
required super.hashCode,
required this.uuid,
});
}

View File

@ -0,0 +1,21 @@
import 'gatt_characteristic.dart';
import 'gatt_characteristic_property.dart';
import 'my_gatt_descriptor.dart';
import 'my_object.dart';
import 'uuid.dart';
class MyGattCharacteristic extends MyObject implements GattCharacteristic {
@override
final UUID uuid;
@override
final List<GattCharacteristicProperty> properties;
@override
final List<MyGattDescriptor> descriptors;
MyGattCharacteristic({
super.hashCode,
required this.uuid,
required this.properties,
required this.descriptors,
});
}

View File

@ -0,0 +1,17 @@
import 'dart:typed_data';
import 'gatt_descriptor.dart';
import 'my_object.dart';
import 'uuid.dart';
class MyGattDescriptor extends MyObject implements GattDescriptor {
@override
final UUID uuid;
final Uint8List? value;
MyGattDescriptor({
super.hashCode,
required this.uuid,
this.value,
});
}

View File

@ -0,0 +1,17 @@
import 'gatt_service.dart';
import 'my_gatt_characteristic.dart';
import 'my_object.dart';
import 'uuid.dart';
class MyGattService extends MyObject implements GattService {
@override
final UUID uuid;
@override
final List<MyGattCharacteristic> characteristics;
MyGattService({
super.hashCode,
required this.uuid,
required this.characteristics,
});
}

View File

@ -0,0 +1,13 @@
abstract class MyObject {
final int? _hashCode;
MyObject({int? hashCode}) : _hashCode = hashCode;
@override
int get hashCode => _hashCode ?? super.hashCode;
@override
bool operator ==(Object other) {
return other is MyObject && other.hashCode == hashCode;
}
}

View File

@ -0,0 +1,13 @@
import 'my_object.dart';
import 'peripheral.dart';
import 'uuid.dart';
class MyPeripheral extends MyObject implements Peripheral {
@override
final UUID uuid;
MyPeripheral({
required super.hashCode,
required this.uuid,
});
}

View File

@ -1,7 +1,4 @@
import 'uuid.dart';
import 'bluetooth_low_energy_peer.dart';
/// The peripheral.
abstract class Peripheral {
/// The [UUID] of this peripheral.
UUID get uuid;
}
/// A remote peripheral device.
abstract class Peripheral extends BluetoothLowEnergyPeer {}

View File

@ -0,0 +1,73 @@
import 'dart:typed_data';
import 'advertise_data.dart';
import 'bluetooth_low_energy.dart';
import 'bluetooth_low_energy_manager.dart';
import 'central.dart';
import 'event_args.dart';
import 'gatt_characteristic.dart';
import 'gatt_service.dart';
/// An object that manages and advertises peripheral services exposed by this app.
abstract class PeripheralManager extends BluetoothLowEnergyManager {
/// Gets the instance of [PeripheralManager].
static PeripheralManager get instance =>
BluetoothLowEnergy.instance.peripheralManager;
/// Tells that the local peripheral received an Attribute Protocol (ATT) read request for a characteristic with a dynamic value.
Stream<ReadGattCharacteristicCommandEventArgs>
get readCharacteristicCommandReceived;
/// Tells that the local peripheral device received an Attribute Protocol (ATT) write request for a characteristic with a dynamic value.
Stream<WriteGattCharacteristicCommandEventArgs>
get writeCharacteristicCommandReceived;
/// Tells that the peripheral manager received a characteristics notify changed.
Stream<NotifyGattCharacteristicCommandEventArgs>
get notifyCharacteristicCommandReceived;
/// Publishes a service and any of its associated characteristics and characteristic descriptors to the local GATT database.
Future<void> addService(GattService service);
/// Removes a specified published service from the local GATT database.
Future<void> removeService(GattService service);
/// Removes all published services from the local GATT database.
Future<void> clearServices();
/// Advertises peripheral manager data.
Future<void> startAdvertising(AdvertiseData advertiseData);
/// Stops advertising peripheral manager data.
Future<void> stopAdvertising();
/// Gets the maximum amount of data, in bytes, that the central can receive in a
/// single notification or indication.
Future<int> getMaximumWriteLength(Central central);
/// Responds to a read request from a connected central.
Future<void> sendReadCharacteristicReply(
Central central,
GattCharacteristic characteristic,
int id,
int offset,
bool status,
Uint8List value,
);
/// Responds to a write request from a connected central.
Future<void> sendWriteCharacteristicReply(
Central central,
GattCharacteristic characteristic,
int id,
int offset,
bool status,
);
/// Send an updated characteristic value to one or more subscribed centrals, using a notification or indication.
Future<void> notifyCharacteristicValueChanged(
Central central,
GattCharacteristic characteristic,
Uint8List value,
);
}

View File

@ -48,13 +48,13 @@ class UUID {
/// Creates a new UUID from the string format encoding (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx where xx is a hexadecimal number).
factory UUID.fromString(String value) {
if (value.length == 4) {
try {
final shortValue = int.parse(value, radix: 16);
return UUID.short(shortValue);
} catch (e) {
// 16 or 32 bits UUID.
if (value.length == 4 || value.length == 8) {
final shortValue = int.tryParse(value, radix: 16);
if (shortValue == null) {
throw const FormatException('Invalid UUID string');
}
return UUID.short(shortValue);
}
var groups = value.split('-');
if (groups.length != 5 ||
@ -91,7 +91,7 @@ class UUID {
(group4 >> 24) & 0xff,
(group4 >> 16) & 0xff,
(group4 >> 8) & 0xff,
(group4 >> 0) & 0xff
(group4 >> 0) & 0xff,
]);
}

View File

@ -1,6 +1,6 @@
name: bluetooth_low_energy_platform_interface
description: A common platform interface for the bluetooth_low_energy plugin.
version: 2.2.0
version: 3.0.0
homepage: https://github.com/yanshouwang/bluetooth_low_energy
environment: