-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 调整接口 * 临时提交 * 重构 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>
- Loading branch information
1 parent
71de531
commit 108b6a8
Showing
380 changed files
with
23,109 additions
and
13,454 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
.vscode/ | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"configurations": [ | ||
{ | ||
"name": "Win32", | ||
"includePath": [ | ||
"${workspaceFolder}/**" | ||
], | ||
"defines": [ | ||
"_DEBUG", | ||
"UNICODE", | ||
"_UNICODE" | ||
], | ||
"windowsSdkVersion": "10.0.22621.0", | ||
"compilerPath": "cl.exe", | ||
"cStandard": "c17", | ||
"cppStandard": "c++20", | ||
"intelliSenseMode": "windows-msvc-arm64" | ||
} | ||
], | ||
"version": 4 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,5 +26,4 @@ migrate_working_dir/ | |
/pubspec.lock | ||
**/doc/api/ | ||
.dart_tool/ | ||
.packages | ||
build/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,61 +1,103 @@ | ||
# bluetooth_low_energy | ||
|
||
A Flutter plugin for controlling the bluetooth low energy. | ||
|
||
## Features | ||
|
||
### CentralManager | ||
|
||
- [x] Get/Listen the state of the central manager. | ||
- [x] Listen connection state cahgned. | ||
- [x] Listen GATT characteristic notified. | ||
- [x] Start/Stop discovery. | ||
- [x] Connect/Disconnect peripherals. | ||
- [x] Read RSSI of peripherals. | ||
- [x] Discover GATT. | ||
- [x] Read/Write GATT characteristics. | ||
- [x] Set GATT characteristics notify state. | ||
- [x] Read/Write GATT descriptors. | ||
|
||
### PeripheralManager | ||
|
||
- [x] Get/Listen the state of the peripheral manager. | ||
- [x] Listen GATT characteristic read/written/notifyStateChanged. | ||
- [x] Add/Remove/Clear service(s). | ||
- [x] Start/Stop advertising. | ||
- [x] Read/Write(Notify) GATT characteristics. | ||
A Flutter plugin for controlling the bluetooth low energy, supports central and peripheral roles. | ||
|
||
## CentralManager | ||
|
||
|API|Android|iOS|macOS|Windows|Linux| | ||
|:-|:-:|:-:|:-:|:-:|:-:| | ||
|logLevel|✅|✅|✅|✅|✅| | ||
|state|✅|✅|✅|✅|✅| | ||
|stateChanged|✅|✅|✅|✅|✅| | ||
|authorize|✅||||| | ||
|showAppSettings|✅|✅|||| | ||
|discovered|✅|✅|✅|✅|✅| | ||
|connectionStateChanged|✅|✅|✅|✅|✅| | ||
|mtuChanged|✅|||✅|| | ||
|characteristicNotified|✅|✅|✅|✅|✅| | ||
|startDiscovery|✅|✅|✅|✅|✅| | ||
|stopDiscovery|✅|✅|✅|✅|✅| | ||
|retrieveConnectedPeripherals|✅|✅|✅||✅| | ||
|connect|✅|✅|✅|✅|✅| | ||
|disconnect|✅|✅|✅|✅|✅| | ||
|requestMTU|✅||||| | ||
|getMaximumWriteLength|✅|✅|✅|✅|✅| | ||
|readRSSI|✅|✅|✅||✅| | ||
|readCharacteristic|✅|✅|✅|✅|✅| | ||
|writeCharacteristic|✅|✅|✅|✅|✅| | ||
|setCharacteristicNotifyState|✅|✅|✅|✅|✅| | ||
|readDescriptor|✅|✅|✅|✅|✅| | ||
|writeDescriptor|✅|✅|✅|✅|✅| | ||
|
||
## PeripheralManager | ||
|
||
|API|Android|iOS|macOS|Windows|Linux| | ||
|:-|:-:|:-:|:-:|:-:|:-:| | ||
|logLevel|✅|✅|✅|✅|| | ||
|state|✅|✅|✅|✅|| | ||
|stateChanged|✅|✅|✅|✅|| | ||
|authorize|✅||||| | ||
|showAppSettings|✅|✅|||| | ||
|connectionStateChanged|✅||||| | ||
|mtuChanged|✅|||✅|| | ||
|characteristicReadRequested|✅|✅|✅|✅|| | ||
|characteristicWriteRequested|✅|✅|✅|✅|| | ||
|characteristicNotifyStateChanged|✅|✅|✅|✅|| | ||
|descriptorReadRequested|✅|||✅|| | ||
|descriptorWriteRequested|✅|||✅|| | ||
|addService|✅|✅|✅|✅|| | ||
|removeService|✅|✅|✅|✅|| | ||
|removeAllServices|✅|✅|✅|✅|| | ||
|startAdvertising|✅|✅|✅|✅|| | ||
|stopAdvertising|✅|✅|✅|✅|| | ||
|getMaximumNotifyLength|✅|✅|✅|✅|| | ||
|respondReadRequestWithValue|✅|✅|✅|✅|| | ||
|respondReadRequestWithError|✅|✅|✅|✅|| | ||
|respondWriteRequest|✅|✅|✅|✅|| | ||
|respondWriteRequestWithError|✅|✅|✅|✅|| | ||
|notifyCharacteristic|✅|✅|✅|✅|| | ||
|
||
## Getting Started | ||
|
||
Add `bluetooth_low_energy` as a [dependency in your pubspec.yaml file](https://flutter.dev/using-packages/). | ||
Add `bluetooth_low_energy` as a [dependency][1] in your pubspec.yaml file. | ||
|
||
``` Yaml | ||
``` YAML | ||
dependencies: | ||
bluetooth_low_energy: ^<latest-version> | ||
``` | ||
Remember to call `await CentralManager.setUp()` and `await PeripheralManager.setUp()` before use any apis of this plugin. | ||
|
||
*Note:* Bluetooth Low Energy doesn't work on emulators, so use physical devices which has bluetooth features for development. | ||
### Android | ||
Make sure you have a `miniSdkVersion` with 21 or higher in your `android/app/build.gradle` file. | ||
Make sure you have a `minSdk` with 21 or higher in your `android/app/build.gradle` file. | ||
|
||
### iOS and macOS | ||
|
||
According to Apple's [documents](https://developer.apple.com/documentation/corebluetooth/), you must include the [`NSBluetoothAlwaysUsageDescription`](https://developer.apple.com/documentation/bundleresources/information_property_list/nsbluetoothalwaysusagedescription) on or after iOS 13, and include the [`NSBluetoothPeripheralUsageDescription`](https://developer.apple.com/documentation/bundleresources/information_property_list/nsbluetoothperipheralusagedescription) key before iOS 13. | ||
According to the [Apple's documents][2], you must include the [`NSBluetoothAlwaysUsageDescription`][3] on or after iOS 13, and include the [`NSBluetoothPeripheralUsageDescription`][4] key before iOS 13. | ||
|
||
When use bluetooth or other hardwares on macOS, developers need to [configure the app sandbox][5]. | ||
|
||
*Note:* The `PeripheralManager#startAdvertising` only support `name` and `serviceUUIDs`, see the [Apple's document][6]. | ||
|
||
*Note:* The `PeripheralManager#startAdvertising` only support `name` and `serviceUUIDs`, see [the startAdvertising document](https://developer.apple.com/documentation/corebluetooth/cbperipheralmanager/1393252-startadvertising). | ||
### Winodows | ||
|
||
*Note:* When use bluetooth or other hardwares on macOS, developers need to [configure the app sandbox](https://developer.apple.com/documentation/xcode/configuring-the-macos-app-sandbox#Enable-access-to-restricted-resources). | ||
*Note:* The `PeripheralManager#startAdvertising` not support `name`, see the [Microsoft's document][7]. | ||
|
||
### Linux | ||
|
||
PeripheralManager is not implemented because the `bluez` plugin doesn't support this yet, see [How to use bluez to act as bluetooth peripheral](https://github.com/canonical/bluez.dart/issues/85). | ||
The `PeripheralManager` API is not implemented since the [`bluez`][8] didn't support this feature yet. | ||
|
||
### Windows | ||
## Migrations | ||
|
||
PeripheralManager is not implemented, it will be implemented in the future. | ||
* [Migrate from 5.x to 6.x][9] | ||
|
||
*Note:* The `CentralManager#readRSSI` method is not implemented on windows(windows doesn't support read RSSI after connected), avoid call this when running on windows devices. | ||
[1]: https://docs.flutter.dev/packages-and-plugins/using-packages | ||
[2]: https://developer.apple.com/documentation/corebluetooth | ||
[3]: https://developer.apple.com/documentation/bundleresources/information_property_list/nsbluetoothalwaysusagedescription | ||
[4]: https://developer.apple.com/documentation/bundleresources/information_property_list/nsbluetoothperipheralusagedescription | ||
[5]: https://developer.apple.com/documentation/xcode/configuring-the-macos-app-sandbox#Enable-access-to-restricted-resources | ||
[6]: https://developer.apple.com/documentation/corebluetooth/cbperipheralmanager/1393252-startadvertising | ||
[7]: https://learn.microsoft.com/en-us/uwp/api/windows.devices.bluetooth.advertisement.bluetoothleadvertisementpublisher.advertisement?view=winrt-22621 | ||
[8]: https://github.com/canonical/bluez.dart | ||
[9]: doc/migrations/migration-v6.md |
Oops, something went wrong.