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,9 +1,9 @@
import 'package:bluetooth_low_energy_platform_interface/bluetooth_low_energy_platform_interface.dart';
import 'src/my_central_controller.dart';
import 'src/my_bluetooth_low_energy.dart';
abstract class BluetoothLowEnergyWindows {
static void registerWith() {
CentralController.instance = MyCentralController();
BluetoothLowEnergy.instance = MyBluetoothLowEnergy();
}
}

View File

@ -0,0 +1,11 @@
import 'package:bluetooth_low_energy_platform_interface/bluetooth_low_energy_platform_interface.dart';
class MyBluetoothLowEnergy extends BluetoothLowEnergy {
@override
// TODO: implement centralManager
CentralManager get centralManager => throw UnimplementedError();
@override
// TODO: implement peripheralManager
PeripheralManager get peripheralManager => throw UnimplementedError();
}

View File

@ -1,128 +0,0 @@
import 'dart:typed_data';
import 'package:bluetooth_low_energy_platform_interface/bluetooth_low_energy_platform_interface.dart';
class MyCentralController extends CentralController {
@override
// TODO: implement state
CentralState get state => throw UnimplementedError();
@override
// TODO: implement stateChanged
Stream<CentralStateChangedEventArgs> get stateChanged =>
throw UnimplementedError();
@override
// TODO: implement discovered
Stream<CentralDiscoveredEventArgs> get discovered =>
throw UnimplementedError();
@override
// TODO: implement peripheralStateChanged
Stream<PeripheralStateChangedEventArgs> get peripheralStateChanged =>
throw UnimplementedError();
@override
// TODO: implement characteristicValueChanged
Stream<GattCharacteristicValueChangedEventArgs>
get characteristicValueChanged => throw UnimplementedError();
@override
Future<void> setUp() {
// TODO: implement setUp
throw UnimplementedError();
}
@override
Future<void> tearDown() {
// TODO: implement tearDown
throw UnimplementedError();
}
@override
Future<void> startDiscovery() {
// TODO: implement startDiscovery
throw UnimplementedError();
}
@override
Future<void> stopDiscovery() {
// TODO: implement stopDiscovery
throw UnimplementedError();
}
@override
Future<void> connect(Peripheral peripheral) {
// TODO: implement connect
throw UnimplementedError();
}
@override
Future<void> disconnect(Peripheral peripheral) {
// TODO: implement disconnect
throw UnimplementedError();
}
@override
Future<int> getMaximumWriteLength(
Peripheral peripheral, {
required GattCharacteristicWriteType type,
}) {
// TODO: implement getMaximumWriteLength
throw UnimplementedError();
}
@override
Future<void> discoverGATT(Peripheral peripheral) {
// TODO: implement discoverGATT
throw UnimplementedError();
}
@override
Future<List<GattService>> getServices(Peripheral peripheral) {
// TODO: implement getServices
throw UnimplementedError();
}
@override
Future<List<GattCharacteristic>> getCharacteristics(GattService service) {
// TODO: implement getCharacteristics
throw UnimplementedError();
}
@override
Future<List<GattDescriptor>> getDescriptors(
GattCharacteristic characteristic) {
// TODO: implement getDescriptors
throw UnimplementedError();
}
@override
Future<Uint8List> readCharacteristic(GattCharacteristic characteristic) {
// TODO: implement readCharacteristic
throw UnimplementedError();
}
@override
Future<void> writeCharacteristic(GattCharacteristic characteristic,
{required Uint8List value, required GattCharacteristicWriteType type}) {
// TODO: implement writeCharacteristic
throw UnimplementedError();
}
@override
Future<void> notifyCharacteristic(GattCharacteristic characteristic,
{required bool state}) {
// TODO: implement notifyCharacteristic
throw UnimplementedError();
}
@override
Future<Uint8List> readDescriptor(GattDescriptor descriptor) {
// TODO: implement readDescriptor
throw UnimplementedError();
}
@override
Future<void> writeDescriptor(GattDescriptor descriptor,
{required Uint8List value}) {
// TODO: implement writeDescriptor
throw UnimplementedError();
}
}

View File

@ -1,6 +1,6 @@
name: bluetooth_low_energy_windows
description: Windows implementation of the bluetooth_low_energy plugin.
version: 2.2.0
version: 3.0.0
homepage: https://github.com/yanshouwang/bluetooth_low_energy
environment:
@ -10,7 +10,7 @@ environment:
dependencies:
flutter:
sdk: flutter
bluetooth_low_energy_platform_interface: ^2.2.0
bluetooth_low_energy_platform_interface: ^3.0.0
win32: ^5.0.6
dev_dependencies: