6.0.0 (#74)
* 调整接口 * 临时提交 * 重构 Android 平台代码 * 临时提交 * 临时提交 * Android 6.0.0-dev.0 * 临时提交 * 实现 Windows 接口 * windows-6.0.0-dev.0 * Darwin 6.0.0-dev.0 * 临时提交 * 1 * 临时提交 * 调整接口 * windows-6.0.0-dev.1 * 临时提交 * interface-6.0.0-dev.7 * interface-6.0.0-dev.8 * 临时提交 * windows-6.0.0-dev.2 * 删除多余脚本 * interface-6.0.0-dev.9 * 临时提交 * 临时提交 * interface-6.0.0-dev.10 * android-6.0.0-dev.1 * windows-6.0.0-dev.3 * 临时提交 * interface-6.0.0-dev.11 * windows-6.0.0-dev.4 * 更新 pubspec.lock * 1 * interface-6.0.0-dev.12 * interface-6.0.0-dev.13 * interface-6.0.0-dev.14 * 临时提交 * interface-6.0.0-dev.15 * 临时提交 * interface-6.0.0-dev.16 * android-6.0.0-dev.2 * 临时提交 * windows-6.0.0-dev.5 * 临时提交 * 临时提交 * windows-6.0.0-dev.6 * 优化注释和代码样式 * 优化代码 * 临时提交 * 实现 Dart 接口 * darwin-6.0.0-dev.0 * linux-6.0.0-dev.0 * 修复已知问题 * 修复问题 * 6.0.0-dev.0 * 修改包名 * 更新版本 * 移除原生部分 * 临时提交 * 修复问题 * 更新 pigeon 19.0.0 * 更新 README,添加迁移文档 * linux-6.0.0-dev.1 * 解析扫描回复和扩展广播 * 修复 googletest 版本警告问题 * Use centralArgs instead of addressArgs * interface-6.0.0-dev.18 * android-6.0.0-dev.4 * linux-6.0.0-dev.2 * windows-6.0.0-dev.8 * darwin-6.0.0-dev.2 * 6.0.0-dev.1 * Update LICENSE * clang-format * Combine ADV_IND and SCAN_RES * TEMP commit: update exampe * Adjust advertisement combine logic * Implement `MyPeripheralMananger` on Windows * Added NuGet auto download and scan for names on peripheral (#67) * fetch nuget using other technique * move FetchContent to right location in CMakeLists.txt * also added hash for googletest --------- Co-authored-by: Kevin De Keyser <kevin@dekeyser.ch> * Fix errors. * Check BluetoothAdapter role supported state and implement PeripheralManager on Flutter side. * Sort code * Fix known errors * interface-6.0.0-dev.19 * windows-6.0.0-dev.9 * Optimize example * android-6.0.0-dev.5 * Optimize the Adverrtisement BottomSheet. * linux-6.0.0-dev.3 * Update dependency * Fix example errors. * Temp commit. * darwin-6.0.0-dev.3 * 6.0.0-dev.2 * Update README.md * 6.0.0 * darwin-6.0.0-dev.4 * android-6.0.0-dev.6 * 6.0.0-dev.3 * Update docs. * interface-6.0.0 * android-6.0.0 * darwin-6.0.0 * linux-6.0.0 * windows-6.0.0 * 6.0.0 * Update dependency --------- Co-authored-by: Kevin De Keyser <dekeyser.kevin97@gmail.com> Co-authored-by: Kevin De Keyser <kevin@dekeyser.ch>
This commit is contained in:
@ -1,10 +1,13 @@
|
||||
// Run with `dart run pigeon --input my_api.dart`.
|
||||
import 'package:pigeon/pigeon.dart';
|
||||
|
||||
// TODO: Use `@ProxyApi` to manage instancs when this feature released:
|
||||
// https://github.com/flutter/flutter/issues/147486
|
||||
@ConfigurePigeon(
|
||||
PigeonOptions(
|
||||
dartOut: 'lib/src/my_api.g.dart',
|
||||
dartOptions: DartOptions(),
|
||||
swiftOut: 'darwin/Classes/MyApi.g.swift',
|
||||
swiftOut: 'darwin/Classes/MyAPI.g.swift',
|
||||
swiftOptions: SwiftOptions(),
|
||||
),
|
||||
)
|
||||
@ -17,7 +20,12 @@ enum MyBluetoothLowEnergyStateArgs {
|
||||
poweredOn,
|
||||
}
|
||||
|
||||
enum MyGattCharacteristicPropertyArgs {
|
||||
enum MyConnectionStateArgs {
|
||||
disconnected,
|
||||
connected,
|
||||
}
|
||||
|
||||
enum MyGATTCharacteristicPropertyArgs {
|
||||
read,
|
||||
write,
|
||||
writeWithoutResponse,
|
||||
@ -25,12 +33,19 @@ enum MyGattCharacteristicPropertyArgs {
|
||||
indicate,
|
||||
}
|
||||
|
||||
enum MyGattCharacteristicWriteTypeArgs {
|
||||
enum MyGATTCharacteristicPermissionArgs {
|
||||
read,
|
||||
readEncrypted,
|
||||
write,
|
||||
writeEncrypted,
|
||||
}
|
||||
|
||||
enum MyGATTCharacteristicWriteTypeArgs {
|
||||
withResponse,
|
||||
withoutResponse,
|
||||
}
|
||||
|
||||
enum MyGattErrorArgs {
|
||||
enum MyATTErrorArgs {
|
||||
success,
|
||||
invalidHandle,
|
||||
readNotPermitted,
|
||||
@ -62,7 +77,7 @@ class MyAdvertisementArgs {
|
||||
final String? nameArgs;
|
||||
final List<String?> serviceUUIDsArgs;
|
||||
final Map<String?, Uint8List?> serviceDataArgs;
|
||||
final MyManufacturerSpecificDataArgs? manufacturerSpecificDataArgs;
|
||||
final Uint8List? manufacturerSpecificDataArgs;
|
||||
|
||||
MyAdvertisementArgs(
|
||||
this.nameArgs,
|
||||
@ -84,25 +99,23 @@ class MyPeripheralArgs {
|
||||
MyPeripheralArgs(this.uuidArgs);
|
||||
}
|
||||
|
||||
class MyGattDescriptorArgs {
|
||||
class MyGATTDescriptorArgs {
|
||||
final int hashCodeArgs;
|
||||
final String uuidArgs;
|
||||
final Uint8List? valueArgs;
|
||||
|
||||
MyGattDescriptorArgs(
|
||||
MyGATTDescriptorArgs(
|
||||
this.hashCodeArgs,
|
||||
this.uuidArgs,
|
||||
this.valueArgs,
|
||||
);
|
||||
}
|
||||
|
||||
class MyGattCharacteristicArgs {
|
||||
class MyGATTCharacteristicArgs {
|
||||
final int hashCodeArgs;
|
||||
final String uuidArgs;
|
||||
final List<int?> propertyNumbersArgs;
|
||||
final List<MyGattDescriptorArgs?> descriptorsArgs;
|
||||
final List<MyGATTDescriptorArgs?> descriptorsArgs;
|
||||
|
||||
MyGattCharacteristicArgs(
|
||||
MyGATTCharacteristicArgs(
|
||||
this.hashCodeArgs,
|
||||
this.uuidArgs,
|
||||
this.propertyNumbersArgs,
|
||||
@ -110,39 +123,117 @@ class MyGattCharacteristicArgs {
|
||||
);
|
||||
}
|
||||
|
||||
class MyGattServiceArgs {
|
||||
class MyGATTServiceArgs {
|
||||
final int hashCodeArgs;
|
||||
final String uuidArgs;
|
||||
final List<MyGattCharacteristicArgs?> characteristicsArgs;
|
||||
final bool isPrimaryArgs;
|
||||
final List<MyGATTServiceArgs?> includedServicesArgs;
|
||||
final List<MyGATTCharacteristicArgs?> characteristicsArgs;
|
||||
|
||||
MyGattServiceArgs(
|
||||
MyGATTServiceArgs(
|
||||
this.hashCodeArgs,
|
||||
this.uuidArgs,
|
||||
this.isPrimaryArgs,
|
||||
this.includedServicesArgs,
|
||||
this.characteristicsArgs,
|
||||
);
|
||||
}
|
||||
|
||||
class MyMutableGATTDescriptorArgs {
|
||||
final int hashCodeArgs;
|
||||
final String uuidArgs;
|
||||
final Uint8List? valueArgs;
|
||||
|
||||
MyMutableGATTDescriptorArgs(
|
||||
this.hashCodeArgs,
|
||||
this.uuidArgs,
|
||||
this.valueArgs,
|
||||
);
|
||||
}
|
||||
|
||||
class MyMutableGATTCharacteristicArgs {
|
||||
final int hashCodeArgs;
|
||||
final String uuidArgs;
|
||||
final List<int?> propertyNumbersArgs;
|
||||
final List<int?> permissionNumbersArgs;
|
||||
final Uint8List? valueArgs;
|
||||
final List<MyMutableGATTDescriptorArgs?> descriptorsArgs;
|
||||
|
||||
MyMutableGATTCharacteristicArgs(
|
||||
this.hashCodeArgs,
|
||||
this.uuidArgs,
|
||||
this.propertyNumbersArgs,
|
||||
this.permissionNumbersArgs,
|
||||
this.valueArgs,
|
||||
this.descriptorsArgs,
|
||||
);
|
||||
}
|
||||
|
||||
class MyMutableGATTServiceArgs {
|
||||
final int hashCodeArgs;
|
||||
final String uuidArgs;
|
||||
final bool isPrimaryArgs;
|
||||
final List<MyMutableGATTServiceArgs?> includedServicesArgs;
|
||||
final List<MyMutableGATTCharacteristicArgs?> characteristicsArgs;
|
||||
|
||||
MyMutableGATTServiceArgs(
|
||||
this.hashCodeArgs,
|
||||
this.uuidArgs,
|
||||
this.isPrimaryArgs,
|
||||
this.includedServicesArgs,
|
||||
this.characteristicsArgs,
|
||||
);
|
||||
}
|
||||
|
||||
class MyATTRequestArgs {
|
||||
final int hashCodeArgs;
|
||||
final MyCentralArgs centralArgs;
|
||||
final int characteristicHashCodeArgs;
|
||||
final Uint8List? valueArgs;
|
||||
final int offsetArgs;
|
||||
|
||||
MyATTRequestArgs(
|
||||
this.hashCodeArgs,
|
||||
this.centralArgs,
|
||||
this.characteristicHashCodeArgs,
|
||||
this.valueArgs,
|
||||
this.offsetArgs,
|
||||
);
|
||||
}
|
||||
|
||||
@HostApi()
|
||||
abstract class MyCentralManagerHostApi {
|
||||
void setUp();
|
||||
void startDiscovery();
|
||||
abstract class MyCentralManagerHostAPI {
|
||||
void initialize();
|
||||
MyBluetoothLowEnergyStateArgs getState();
|
||||
@async
|
||||
void showAppSettings();
|
||||
void startDiscovery(List<String> serviceUUIDsArgs);
|
||||
void stopDiscovery();
|
||||
List<MyPeripheralArgs> retrieveConnectedPeripherals();
|
||||
@async
|
||||
void connect(String uuidArgs);
|
||||
@async
|
||||
void disconnect(String uuidArgs);
|
||||
int getMaximumWriteValueLength(String uuidArgs, int typeNumberArgs);
|
||||
int getMaximumWriteLength(
|
||||
String uuidArgs,
|
||||
MyGATTCharacteristicWriteTypeArgs typeArgs,
|
||||
);
|
||||
@async
|
||||
int readRSSI(String uuidArgs);
|
||||
@async
|
||||
List<MyGattServiceArgs> discoverServices(String uuidArgs);
|
||||
List<MyGATTServiceArgs> discoverServices(String uuidArgs);
|
||||
@async
|
||||
List<MyGattCharacteristicArgs> discoverCharacteristics(
|
||||
List<MyGATTServiceArgs> discoverIncludedServices(
|
||||
String uuidArgs,
|
||||
int hashCodeArgs,
|
||||
);
|
||||
@async
|
||||
List<MyGattDescriptorArgs> discoverDescriptors(
|
||||
List<MyGATTCharacteristicArgs> discoverCharacteristics(
|
||||
String uuidArgs,
|
||||
int hashCodeArgs,
|
||||
);
|
||||
@async
|
||||
List<MyGATTDescriptorArgs> discoverDescriptors(
|
||||
String uuidArgs,
|
||||
int hashCodeArgs,
|
||||
);
|
||||
@ -153,7 +244,7 @@ abstract class MyCentralManagerHostApi {
|
||||
String uuidArgs,
|
||||
int hashCodeArgs,
|
||||
Uint8List valueArgs,
|
||||
int typeNumberArgs,
|
||||
MyGATTCharacteristicWriteTypeArgs typeArgs,
|
||||
);
|
||||
@async
|
||||
void setCharacteristicNotifyState(
|
||||
@ -168,35 +259,44 @@ abstract class MyCentralManagerHostApi {
|
||||
}
|
||||
|
||||
@FlutterApi()
|
||||
abstract class MyCentralManagerFlutterApi {
|
||||
void onStateChanged(int stateNumberArgs);
|
||||
abstract class MyCentralManagerFlutterAPI {
|
||||
void onStateChanged(MyBluetoothLowEnergyStateArgs stateArgs);
|
||||
void onDiscovered(
|
||||
MyPeripheralArgs peripheralArgs,
|
||||
int rssiArgs,
|
||||
MyAdvertisementArgs advertisementArgs,
|
||||
);
|
||||
void onConnectionStateChanged(String uuidArgs, bool stateArgs);
|
||||
void onConnectionStateChanged(
|
||||
MyPeripheralArgs peripheralArgs,
|
||||
MyConnectionStateArgs stateArgs,
|
||||
);
|
||||
void onCharacteristicNotified(
|
||||
String uuidArgs,
|
||||
int hashCodeArgs,
|
||||
MyPeripheralArgs peripheralArgs,
|
||||
MyGATTCharacteristicArgs characteristicArgs,
|
||||
Uint8List valueArgs,
|
||||
);
|
||||
}
|
||||
|
||||
@HostApi()
|
||||
abstract class MyPeripheralManagerHostApi {
|
||||
void setUp();
|
||||
abstract class MyPeripheralManagerHostAPI {
|
||||
void initialize();
|
||||
MyBluetoothLowEnergyStateArgs getState();
|
||||
@async
|
||||
void addService(MyGattServiceArgs serviceArgs);
|
||||
void showAppSettings();
|
||||
@async
|
||||
void addService(MyMutableGATTServiceArgs serviceArgs);
|
||||
void removeService(int hashCodeArgs);
|
||||
void clearServices();
|
||||
void removeAllServices();
|
||||
@async
|
||||
void startAdvertising(MyAdvertisementArgs advertisementArgs);
|
||||
void stopAdvertising();
|
||||
int getMaximumUpdateValueLength(String uuidArgs);
|
||||
void respond(int idArgs, int errorNumberArgs, Uint8List? valueArgs);
|
||||
@async
|
||||
void updateCharacteristic(
|
||||
int getMaximumNotifyLength(String uuidArgs);
|
||||
void respond(
|
||||
int hashCodeArgs,
|
||||
Uint8List? valueArgs,
|
||||
MyATTErrorArgs errorArgs,
|
||||
);
|
||||
bool updateValue(
|
||||
int hashCodeArgs,
|
||||
Uint8List valueArgs,
|
||||
List<String>? uuidsArgs,
|
||||
@ -204,21 +304,11 @@ abstract class MyPeripheralManagerHostApi {
|
||||
}
|
||||
|
||||
@FlutterApi()
|
||||
abstract class MyPeripheralManagerFlutterApi {
|
||||
void onStateChanged(int stateNumberArgs);
|
||||
void onCharacteristicReadRequest(
|
||||
MyCentralArgs centralArgs,
|
||||
int hashCodeArgs,
|
||||
int idArgs,
|
||||
int offsetArgs,
|
||||
);
|
||||
void onCharacteristicWriteRequest(
|
||||
MyCentralArgs centralArgs,
|
||||
int hashCodeArgs,
|
||||
int idArgs,
|
||||
int offsetArgs,
|
||||
Uint8List valueArgs,
|
||||
);
|
||||
abstract class MyPeripheralManagerFlutterAPI {
|
||||
void onStateChanged(MyBluetoothLowEnergyStateArgs stateArgs);
|
||||
void didReceiveRead(MyATTRequestArgs requestArgs);
|
||||
void didReceiveWrite(List<MyATTRequestArgs> requestsArgs);
|
||||
void isReady();
|
||||
void onCharacteristicNotifyStateChanged(
|
||||
MyCentralArgs centralArgs,
|
||||
int hashCodeArgs,
|
||||
|
Reference in New Issue
Block a user