diff --git a/ohos/CHANGELOG.md b/ohos/CHANGELOG.md index 33b9271b168e220ccd689882d889f6d79cd133f9..aa53e637af3412a72217cb9a9fb80db77bee2f23 100644 --- a/ohos/CHANGELOG.md +++ b/ohos/CHANGELOG.md @@ -1,10 +1,11 @@ -## 1.0.1 +## 1.0.2 +* 增加isSupport()接口 +## 1.0.1 * 修复无法获取ManufactureData问题 * 修复使用Worker使用不当问题 * 修改advName获取方式 * 增加扫描蓝牙过滤条件 ## 1.0.0 - * Support OpenHarmony \ No newline at end of file diff --git a/ohos/README.md b/ohos/README.md index aad230fa77ac327802c4b36f25bff5e1b1569fd4..dd17f36ab775493973753479eda30ef7d0eed332 100644 --- a/ohos/README.md +++ b/ohos/README.md @@ -188,6 +188,93 @@ for (var d in devs) { ``` +### FlutterBluePlus API + +| | Android | iOS | Ohos | Description | +| :--------------------- |:---------:| :----------------: | :----: | :----------------------------------------------------------| +| setLogLevel | :white_check_mark: | :white_check_mark: | :white_check_mark: | Configure plugin log level | +| setOptions | :white_check_mark: | :white_check_mark: | :white_check_mark: | Set configurable bluetooth options | +| isSupported | :white_check_mark: | :white_check_mark: | :white_check_mark: | Checks whether the device supports Bluetooth | +| turnOn | :white_check_mark: | | :white_check_mark: | Turns on the bluetooth adapter | +| adapterStateNow | :white_check_mark: | :white_check_mark: | | Current state of the bluetooth adapter | +| adapterState | :white_check_mark: | :white_check_mark: | :white_check_mark: | Stream of on & off states of the bluetooth adapter | +| startScan | :white_check_mark: | :white_check_mark: | :white_check_mark: | Starts a scan for Ble devices | +| stopScan | :white_check_mark: | :white_check_mark: | :white_check_mark: | Stop an existing scan for Ble devices | +| onScanResults | :white_check_mark: | :white_check_mark: | :white_check_mark: | Stream of live scan results | +| scanResults | :white_check_mark: | :white_check_mark: | :white_check_mark: | Stream of live scan results or previous results | +| lastScanResults | :white_check_mark: | :white_check_mark: | :white_check_mark: | The most recent scan results | +| isScanning | :white_check_mark: | :white_check_mark: | :white_check_mark: | Stream of current scanning state | +| isScanningNow | :white_check_mark: | :white_check_mark: | :white_check_mark: | Is a scan currently running? | +| connectedDevices | :white_check_mark: | :white_check_mark: | :white_check_mark: | List of devices connected to *your app* | +| systemDevices | :white_check_mark: | :white_check_mark: | :white_check_mark: | List of devices connected to the system, even by other apps| +| getPhySupport | :white_check_mark: | | | Get supported bluetooth phy codings | + +### FlutterBluePlus Events API + +| | Android | iOS | Ohos | Description | +| :-------------------------------- | :----------------: | :----------------: | :----------------: | :----------------------------------------------------- | +| events.onConnectionStateChanged 🌀 | :white_check_mark: | :white_check_mark: | :white_check_mark: | Stream of connection changes of *all devices* | +| events.onMtuChanged 🌀 | :white_check_mark: | :white_check_mark: | :white_check_mark: | Stream of mtu changes of *all devices* | +| events.onReadRssi 🌀 | :white_check_mark: | :white_check_mark: | :white_check_mark: | Stream of rssi reads of *all devices* | +| events.onServicesReset 🌀 | :white_check_mark: | :white_check_mark: | | Stream of services resets of *all devices* | +| events.onDiscoveredServices 🌀 | :white_check_mark: | :white_check_mark: | :white_check_mark: | Stream of services discovered of *all devices* | +| events.onCharacteristicReceived 🌀 | :white_check_mark: | :white_check_mark: | :white_check_mark: | Stream of characteristic value reads of *all devices* | +| events.onCharacteristicWritten 🌀 | :white_check_mark: | :white_check_mark: | :white_check_mark: | Stream of characteristic value writes of *all devices* | +| events.onDescriptorRead 🌀 | :white_check_mark: | :white_check_mark: | :white_check_mark: | Stream of descriptor value reads of *all devices* | +| events.onDescriptorWritten 🌀 | :white_check_mark: | :white_check_mark: | :white_check_mark: | Stream of descriptor value writes of *all devices* | +| events.onBondStateChanged 🌀 | :white_check_mark: | | | Stream of android bond state changes of *all devices* | +| events.onNameChanged 🌀 | | :white_check_mark: | | Stream of iOS name changes of *all devices* | + + +### BluetoothDevice API + +| | Android | iOS | Ohos | Description | +| :------------------------ | :----------------: | :----------------: | :----------------: | :--------------------------------------------------------- | +| platformName ⚡ | :white_check_mark: | :white_check_mark: | :white_check_mark: | The platform preferred name of the device | +| advName ⚡ | :white_check_mark: | :white_check_mark: | :white_check_mark: | The advertised name of the device found during scanning | +| connect | :white_check_mark: | :white_check_mark: | :white_check_mark: | Establishes a connection to the device | +| disconnect | :white_check_mark: | :white_check_mark: | :white_check_mark: | Cancels an active or pending connection to the device | +| isConnected ⚡ | :white_check_mark: | :white_check_mark: | :white_check_mark: | Is this device currently connected to *your app*? | +| isDisonnected ⚡ | :white_check_mark: | :white_check_mark: | :white_check_mark: | Is this device currently disconnected from *your app*? | +| connectionState 🌀 | :white_check_mark: | :white_check_mark: | :white_check_mark: | Stream of connection changes for the Bluetooth Device | +| discoverServices | :white_check_mark: | :white_check_mark: | :white_check_mark: | Discover services | +| servicesList ⚡ | :white_check_mark: | :white_check_mark: | :white_check_mark: | The current list of available services | +| onServicesReset 🌀 | :white_check_mark: | :white_check_mark: | | The services changed & must be rediscovered | +| mtu 🌀 | :white_check_mark: | :white_check_mark: | | Stream of current mtu value + changes | +| mtuNow ⚡ | :white_check_mark: | :white_check_mark: | | The current mtu value | +| readRssi | :white_check_mark: | :white_check_mark: | :white_check_mark: | Read RSSI from a connected device | +| requestMtu | :white_check_mark: | | :white_check_mark: | Request to change the MTU for the device | +| requestConnectionPriority | :white_check_mark: | | | Request to update a high priority, low latency connection | +| bondState 🌀 | :white_check_mark: | | | Stream of device bond state. Can be useful on Android | +| createBond | :white_check_mark: | | | Force a system pairing dialogue to show, if needed | +| removeBond | :white_check_mark: | | | Remove Bluetooth Bond of device | +| setPreferredPhy | :white_check_mark: | | | Set preferred RX and TX phy for connection and phy options | +| clearGattCache | :white_check_mark: | | | Clear android cache of service discovery results | + +### BluetoothCharacteristic API + +| | Android | iOS | Ohos | Description | +| :----------------- | :----------------: | :----------------: | :----------------: | :----------------------------------------------------------- | +| uuid ⚡ | :white_check_mark: | :white_check_mark: | :white_check_mark: | The uuid of characteristic | +| read | :white_check_mark: | :white_check_mark: | :white_check_mark: | Retrieves the value of the characteristic | +| write | :white_check_mark: | :white_check_mark: | :white_check_mark: | Writes the value of the characteristic | +| setNotifyValue | :white_check_mark: | :white_check_mark: | :white_check_mark: | Sets notifications or indications on the characteristic | +| isNotifying ⚡ | :white_check_mark: | :white_check_mark: | :white_check_mark: | Are notifications or indications currently enabled | +| onValueReceived 🌀 | :white_check_mark: | :white_check_mark: | :white_check_mark: | Stream of characteristic value updates received from the device | +| lastValue ⚡ | :white_check_mark: | :white_check_mark: | :white_check_mark: | The most recent value of the characteristic | +| lastValueStream 🌀 | :white_check_mark: | :white_check_mark: | :white_check_mark: | Stream of onValueReceived + writes | + +### BluetoothDescriptor API + +| | Android | iOS | Ohos | Description | +| :----------------- | :----------------: | :----------------: | :----------------: | :---------------------------------------- | +| uuid ⚡ | :white_check_mark: | :white_check_mark: | :white_check_mark: | The uuid of descriptor | +| read | :white_check_mark: | :white_check_mark: | :white_check_mark: | Retrieves the value of the descriptor | +| write | :white_check_mark: | :white_check_mark: | :white_check_mark: | Writes the value of the descriptor | +| onValueReceived 🌀 | :white_check_mark: | :white_check_mark: | :white_check_mark: | Stream of descriptor value reads & writes | +| lastValue ⚡ | :white_check_mark: | :white_check_mark: | :white_check_mark: | The most recent value of the descriptor | +| lastValueStream 🌀 | :white_check_mark: | :white_check_mark: | :white_check_mark: | Stream of onValueReceived + writes | + ## 约束与限制 @@ -195,4 +282,3 @@ for (var d in devs) { - sdk:API12 - diff --git a/ohos/example/ohos/oh-package.json5 b/ohos/example/ohos/oh-package.json5 index 4403745f9d2bf28856b96bfd3326aecf4e260e79..5a4a9794bfe91b92781ea974426a921ba6e0cbe4 100644 --- a/ohos/example/ohos/oh-package.json5 +++ b/ohos/example/ohos/oh-package.json5 @@ -1,7 +1,7 @@ { "modelVersion": "5.0.0", "name": "flutter_blue_plus_ohos_example", - "version": "1.0.1", + "version": "1.0.2", "description": "Please describe the basic information.", "main": "", "author": "", diff --git a/ohos/ohos/oh-package.json5 b/ohos/ohos/oh-package.json5 index 3fe407667fc1371d0c595a83bd1791b60ad85f0a..86ea54660d5ac0679e5e9638e1da8e82e6f70502 100644 --- a/ohos/ohos/oh-package.json5 +++ b/ohos/ohos/oh-package.json5 @@ -1,6 +1,6 @@ { "name": "flutter_blue_plus_ohos", - "version": "1.0.1", + "version": "1.0.2", "description": "Please describe the basic information.", "main": "index.ets", "author": "", diff --git a/ohos/ohos/src/main/ets/components/plugin/FlutterBluePlusOhosPlugin.ets b/ohos/ohos/src/main/ets/components/plugin/FlutterBluePlusOhosPlugin.ets index d68a483aa83d0b700ecab358e7a3082c984db287..95483b9a6b0ec6fecaa4d5b20611f4578b1bdf50 100644 --- a/ohos/ohos/src/main/ets/components/plugin/FlutterBluePlusOhosPlugin.ets +++ b/ohos/ohos/src/main/ets/components/plugin/FlutterBluePlusOhosPlugin.ets @@ -695,6 +695,15 @@ export default class FlutterBluePlusOhosPlugin implements FlutterPlugin, MethodC result.success(true); break; } + case "isSupported":{ + let gattServer: ble.GattServer = ble.createGattServer(); + result.success(gattServer!=null); + } + case "getAdapterName": + { + result.error("getAdapterName", "current ohos is not supported", null); + break; + } case "readDescriptor": { let data: Map = call.args; let remoteId: string = data.get("remote_id") as string; diff --git a/ohos/pubspec.yaml b/ohos/pubspec.yaml index 325806f39cb9380392fc6d4c20869ef85e5c93be..50651dbaa0e844b7be303571b47f880bf7c6c3ee 100644 --- a/ohos/pubspec.yaml +++ b/ohos/pubspec.yaml @@ -1,6 +1,6 @@ name: flutter_blue_plus_ohos description: flutter_blue_plus is an enhanced Flutter plugin for Bluetooth Low Energy (BLE) communication, providing a robust and feature-rich API to interact with BLE devices on OHOS platforms. -version: 1.0.1 +version: 1.0.2 repository: https://gitee.com/openharmony-sig/fluttertpc_flutter_blue_plus environment: