@capacitor-community/bluetooth-le 7.2.0 → 8.0.0-0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CapacitorCommunityBluetoothLe.podspec +17 -17
- package/LICENSE +21 -21
- package/Package.swift +28 -0
- package/README.md +68 -161
- package/android/build.gradle +71 -68
- package/android/src/main/AndroidManifest.xml +22 -22
- package/android/src/main/java/com/capacitorjs/community/plugins/bluetoothle/BluetoothLe.kt +1094 -1070
- package/android/src/main/java/com/capacitorjs/community/plugins/bluetoothle/Conversion.kt +51 -51
- package/android/src/main/java/com/capacitorjs/community/plugins/bluetoothle/Device.kt +771 -767
- package/android/src/main/java/com/capacitorjs/community/plugins/bluetoothle/DeviceList.kt +28 -28
- package/android/src/main/java/com/capacitorjs/community/plugins/bluetoothle/DeviceScanner.kt +189 -189
- package/dist/docs.json +906 -849
- package/dist/esm/bleClient.d.ts +278 -278
- package/dist/esm/bleClient.js +361 -347
- package/dist/esm/bleClient.js.map +1 -1
- package/dist/esm/config.d.ts +53 -53
- package/dist/esm/config.js +2 -2
- package/dist/esm/conversion.d.ts +56 -34
- package/dist/esm/conversion.js +134 -84
- package/dist/esm/conversion.js.map +1 -1
- package/dist/esm/definitions.d.ts +352 -313
- package/dist/esm/definitions.js +42 -42
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/index.d.ts +5 -5
- package/dist/esm/index.js +5 -5
- package/dist/esm/plugin.d.ts +2 -2
- package/dist/esm/plugin.js +4 -4
- package/dist/esm/queue.d.ts +3 -3
- package/dist/esm/queue.js +17 -17
- package/dist/esm/queue.js.map +1 -1
- package/dist/esm/timeout.d.ts +1 -1
- package/dist/esm/timeout.js +9 -9
- package/dist/esm/validators.d.ts +1 -1
- package/dist/esm/validators.js +11 -11
- package/dist/esm/validators.js.map +1 -1
- package/dist/esm/web.d.ts +57 -56
- package/dist/esm/web.js +403 -340
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +967 -837
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +967 -837
- package/dist/plugin.js.map +1 -1
- package/ios/{Plugin → Sources/BluetoothLe}/Conversion.swift +83 -83
- package/ios/{Plugin → Sources/BluetoothLe}/Device.swift +423 -423
- package/ios/Sources/BluetoothLe/DeviceListView.swift +121 -0
- package/ios/{Plugin → Sources/BluetoothLe}/DeviceManager.swift +503 -401
- package/ios/{Plugin → Sources/BluetoothLe}/Logging.swift +8 -8
- package/ios/{Plugin → Sources/BluetoothLe}/Plugin.swift +775 -682
- package/ios/{Plugin → Sources/BluetoothLe}/ThreadSafeDictionary.swift +15 -13
- package/ios/Tests/BluetoothLeTests/ConversionTests.swift +55 -0
- package/ios/Tests/BluetoothLeTests/PluginTests.swift +27 -0
- package/package.json +115 -101
- package/ios/Plugin/Info.plist +0 -24
- package/ios/Plugin/Plugin.h +0 -10
- package/ios/Plugin/Plugin.m +0 -41
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
require 'json'
|
|
2
|
-
|
|
3
|
-
package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
|
|
4
|
-
|
|
5
|
-
Pod::Spec.new do |s|
|
|
6
|
-
s.name = 'CapacitorCommunityBluetoothLe'
|
|
7
|
-
s.version = package['version']
|
|
8
|
-
s.summary = package['description']
|
|
9
|
-
s.license = package['license']
|
|
10
|
-
s.homepage = package['repository']['url']
|
|
11
|
-
s.author = package['author']
|
|
12
|
-
s.source = { :git => package['repository']['url'], :tag => s.version.to_s }
|
|
13
|
-
s.source_files = 'ios/
|
|
14
|
-
s.ios.deployment_target = '
|
|
15
|
-
s.dependency 'Capacitor'
|
|
16
|
-
s.swift_version = '5.1'
|
|
17
|
-
end
|
|
1
|
+
require 'json'
|
|
2
|
+
|
|
3
|
+
package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
|
|
4
|
+
|
|
5
|
+
Pod::Spec.new do |s|
|
|
6
|
+
s.name = 'CapacitorCommunityBluetoothLe'
|
|
7
|
+
s.version = package['version']
|
|
8
|
+
s.summary = package['description']
|
|
9
|
+
s.license = package['license']
|
|
10
|
+
s.homepage = package['repository']['url']
|
|
11
|
+
s.author = package['author']
|
|
12
|
+
s.source = { :git => package['repository']['url'], :tag => s.version.to_s }
|
|
13
|
+
s.source_files = 'ios/Sources/**/*.{swift,h,m,c,cc,mm,cpp}'
|
|
14
|
+
s.ios.deployment_target = '15.0'
|
|
15
|
+
s.dependency 'Capacitor'
|
|
16
|
+
s.swift_version = '5.1'
|
|
17
|
+
end
|
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2021 Capacitor plugin for Bluetooth Low Energy
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021 Capacitor plugin for Bluetooth Low Energy
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/Package.swift
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// swift-tools-version: 5.9
|
|
2
|
+
import PackageDescription
|
|
3
|
+
|
|
4
|
+
let package = Package(
|
|
5
|
+
name: "CapacitorCommunityBluetoothLe",
|
|
6
|
+
platforms: [.iOS(.v15)],
|
|
7
|
+
products: [
|
|
8
|
+
.library(
|
|
9
|
+
name: "CapacitorCommunityBluetoothLe",
|
|
10
|
+
targets: ["BluetoothLe"])
|
|
11
|
+
],
|
|
12
|
+
dependencies: [
|
|
13
|
+
.package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "8.0.0")
|
|
14
|
+
],
|
|
15
|
+
targets: [
|
|
16
|
+
.target(
|
|
17
|
+
name: "BluetoothLe",
|
|
18
|
+
dependencies: [
|
|
19
|
+
.product(name: "Capacitor", package: "capacitor-swift-pm"),
|
|
20
|
+
.product(name: "Cordova", package: "capacitor-swift-pm")
|
|
21
|
+
],
|
|
22
|
+
path: "ios/Sources/BluetoothLe"),
|
|
23
|
+
.testTarget(
|
|
24
|
+
name: "BluetoothLeTests",
|
|
25
|
+
dependencies: ["BluetoothLe"],
|
|
26
|
+
path: "ios/Tests/BluetoothLeTests")
|
|
27
|
+
]
|
|
28
|
+
)
|
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
<a href="https://www.npmjs.com/package/@capacitor-community/bluetooth-le"><img src="https://img.shields.io/npm/dw/@capacitor-community/bluetooth-le?style=flat-square" /></a>
|
|
14
14
|
<a href="https://www.npmjs.com/package/@capacitor-community/bluetooth-le"><img src="https://img.shields.io/npm/v/@capacitor-community/bluetooth-le?style=flat-square" /></a>
|
|
15
15
|
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
|
|
16
|
-
<a href="#contributors-"><img src="https://img.shields.io/badge/all%20contributors-
|
|
16
|
+
<a href="#contributors-"><img src="https://img.shields.io/badge/all%20contributors-25-orange?style=flat-square" /></a>
|
|
17
17
|
<!-- ALL-CONTRIBUTORS-BADGE:END -->
|
|
18
18
|
</p>
|
|
19
19
|
|
|
@@ -89,7 +89,6 @@ Below is an index of all the methods available.
|
|
|
89
89
|
- [`startNotifications(...)`](#startnotifications)
|
|
90
90
|
- [`stopNotifications(...)`](#stopnotifications)
|
|
91
91
|
- [Interfaces](#interfaces)
|
|
92
|
-
- [Type Aliases](#type-aliases)
|
|
93
92
|
- [Enums](#enums)
|
|
94
93
|
|
|
95
94
|
</docgen-index>
|
|
@@ -786,7 +785,7 @@ Read the value of a characteristic. For an example, see [usage](#usage).
|
|
|
786
785
|
| **`characteristic`** | <code>string</code> | UUID of the characteristic (see [UUID format](#uuid-format)) |
|
|
787
786
|
| **`options`** | <code><a href="#timeoutoptions">TimeoutOptions</a></code> | Options for plugin call |
|
|
788
787
|
|
|
789
|
-
**Returns:** <code>Promise<
|
|
788
|
+
**Returns:** <code>Promise<[DataView](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/DataView)></code>
|
|
790
789
|
|
|
791
790
|
---
|
|
792
791
|
|
|
@@ -798,13 +797,13 @@ write(deviceId: string, service: string, characteristic: string, value: DataView
|
|
|
798
797
|
|
|
799
798
|
Write a value to a characteristic. For an example, see [usage](#usage).
|
|
800
799
|
|
|
801
|
-
| Param | Type
|
|
802
|
-
| -------------------- |
|
|
803
|
-
| **`deviceId`** | <code>string</code>
|
|
804
|
-
| **`service`** | <code>string</code>
|
|
805
|
-
| **`characteristic`** | <code>string</code>
|
|
806
|
-
| **`value`** | <code
|
|
807
|
-
| **`options`** | <code><a href="#timeoutoptions">TimeoutOptions</a></code>
|
|
800
|
+
| Param | Type | Description |
|
|
801
|
+
| -------------------- | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
802
|
+
| **`deviceId`** | <code>string</code> | The ID of the device to use (obtained from [requestDevice](#requestDevice) or [requestLEScan](#requestLEScan)) |
|
|
803
|
+
| **`service`** | <code>string</code> | UUID of the service (see [UUID format](#uuid-format)) |
|
|
804
|
+
| **`characteristic`** | <code>string</code> | UUID of the characteristic (see [UUID format](#uuid-format)) |
|
|
805
|
+
| **`value`** | <code>[DataView](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/DataView)</code> | The value to write as a [DataView](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/DataView). To create a [DataView](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/DataView) from an array of numbers, there is a helper function, e.g. numbersToDataView([1, 0]) |
|
|
806
|
+
| **`options`** | <code><a href="#timeoutoptions">TimeoutOptions</a></code> | Options for plugin call |
|
|
808
807
|
|
|
809
808
|
---
|
|
810
809
|
|
|
@@ -816,13 +815,13 @@ writeWithoutResponse(deviceId: string, service: string, characteristic: string,
|
|
|
816
815
|
|
|
817
816
|
Write a value to a characteristic without waiting for a response.
|
|
818
817
|
|
|
819
|
-
| Param | Type
|
|
820
|
-
| -------------------- |
|
|
821
|
-
| **`deviceId`** | <code>string</code>
|
|
822
|
-
| **`service`** | <code>string</code>
|
|
823
|
-
| **`characteristic`** | <code>string</code>
|
|
824
|
-
| **`value`** | <code
|
|
825
|
-
| **`options`** | <code><a href="#timeoutoptions">TimeoutOptions</a></code>
|
|
818
|
+
| Param | Type | Description |
|
|
819
|
+
| -------------------- | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
820
|
+
| **`deviceId`** | <code>string</code> | The ID of the device to use (obtained from [requestDevice](#requestDevice) or [requestLEScan](#requestLEScan)) |
|
|
821
|
+
| **`service`** | <code>string</code> | UUID of the service (see [UUID format](#uuid-format)) |
|
|
822
|
+
| **`characteristic`** | <code>string</code> | UUID of the characteristic (see [UUID format](#uuid-format)) |
|
|
823
|
+
| **`value`** | <code>[DataView](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/DataView)</code> | The value to write as a [DataView](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/DataView). To create a [DataView](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/DataView) from an array of numbers, there is a helper function, e.g. numbersToDataView([1, 0]) |
|
|
824
|
+
| **`options`** | <code><a href="#timeoutoptions">TimeoutOptions</a></code> | Options for plugin call |
|
|
826
825
|
|
|
827
826
|
---
|
|
828
827
|
|
|
@@ -842,7 +841,7 @@ Read the value of a descriptor.
|
|
|
842
841
|
| **`descriptor`** | <code>string</code> | UUID of the descriptor (see [UUID format](#uuid-format)) |
|
|
843
842
|
| **`options`** | <code><a href="#timeoutoptions">TimeoutOptions</a></code> | Options for plugin call |
|
|
844
843
|
|
|
845
|
-
**Returns:** <code>Promise<
|
|
844
|
+
**Returns:** <code>Promise<[DataView](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/DataView)></code>
|
|
846
845
|
|
|
847
846
|
---
|
|
848
847
|
|
|
@@ -854,14 +853,14 @@ writeDescriptor(deviceId: string, service: string, characteristic: string, descr
|
|
|
854
853
|
|
|
855
854
|
Write a value to a descriptor.
|
|
856
855
|
|
|
857
|
-
| Param | Type
|
|
858
|
-
| -------------------- |
|
|
859
|
-
| **`deviceId`** | <code>string</code>
|
|
860
|
-
| **`service`** | <code>string</code>
|
|
861
|
-
| **`characteristic`** | <code>string</code>
|
|
862
|
-
| **`descriptor`** | <code>string</code>
|
|
863
|
-
| **`value`** | <code
|
|
864
|
-
| **`options`** | <code><a href="#timeoutoptions">TimeoutOptions</a></code>
|
|
856
|
+
| Param | Type | Description |
|
|
857
|
+
| -------------------- | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
858
|
+
| **`deviceId`** | <code>string</code> | The ID of the device to use (obtained from [requestDevice](#requestDevice) or [requestLEScan](#requestLEScan)) |
|
|
859
|
+
| **`service`** | <code>string</code> | UUID of the service (see [UUID format](#uuid-format)) |
|
|
860
|
+
| **`characteristic`** | <code>string</code> | UUID of the characteristic (see [UUID format](#uuid-format)) |
|
|
861
|
+
| **`descriptor`** | <code>string</code> | UUID of the descriptor (see [UUID format](#uuid-format)) |
|
|
862
|
+
| **`value`** | <code>[DataView](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/DataView)</code> | The value to write as a [DataView](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/DataView). To create a [DataView](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/DataView) from an array of numbers, there is a helper function, e.g. numbersToDataView([1, 0]) |
|
|
863
|
+
| **`options`** | <code><a href="#timeoutoptions">TimeoutOptions</a></code> | Options for plugin call |
|
|
865
864
|
|
|
866
865
|
---
|
|
867
866
|
|
|
@@ -876,13 +875,13 @@ Note that you should only start the notifications once per characteristic in you
|
|
|
876
875
|
not call `startNotifications` in every component that needs the data.
|
|
877
876
|
For an example, see [usage](#usage).
|
|
878
877
|
|
|
879
|
-
| Param | Type
|
|
880
|
-
| -------------------- |
|
|
881
|
-
| **`deviceId`** | <code>string</code>
|
|
882
|
-
| **`service`** | <code>string</code>
|
|
883
|
-
| **`characteristic`** | <code>string</code>
|
|
884
|
-
| **`callback`** | <code>(value:
|
|
885
|
-
| **`options`** | <code><a href="#timeoutoptions">TimeoutOptions</a></code>
|
|
878
|
+
| Param | Type | Description |
|
|
879
|
+
| -------------------- | -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- |
|
|
880
|
+
| **`deviceId`** | <code>string</code> | The ID of the device to use (obtained from [requestDevice](#requestDevice) or [requestLEScan](#requestLEScan)) |
|
|
881
|
+
| **`service`** | <code>string</code> | UUID of the service (see [UUID format](#uuid-format)) |
|
|
882
|
+
| **`characteristic`** | <code>string</code> | UUID of the characteristic (see [UUID format](#uuid-format)) |
|
|
883
|
+
| **`callback`** | <code>(value: [DataView](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/DataView)) => void</code> | Callback function to use when the value of the characteristic changes |
|
|
884
|
+
| **`options`** | <code><a href="#timeoutoptions">TimeoutOptions</a></code> | Options for plugin call. Timeout not supported on **web**. |
|
|
886
885
|
|
|
887
886
|
---
|
|
888
887
|
|
|
@@ -929,134 +928,46 @@ Stop listening to the changes of the value of a characteristic. For an example,
|
|
|
929
928
|
|
|
930
929
|
#### RequestBleDeviceOptions
|
|
931
930
|
|
|
932
|
-
| Prop | Type | Description |
|
|
933
|
-
| ---------------------- | --------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
934
|
-
| **`services`** | <code>string[]</code> | Filter devices by service UUIDs. UUIDs have to be specified as 128 bit UUID strings, e.g. ['0000180d-0000-1000-8000-00805f9b34fb'] There is a helper function to convert numbers to UUIDs. e.g. [numberToUUID(0x180f)]. (see [UUID format](#uuid-format)) |
|
|
935
|
-
| **`name`** | <code>string</code> | Filter devices by name |
|
|
936
|
-
| **`namePrefix`** | <code>string</code> | Filter devices by name prefix |
|
|
937
|
-
| **`optionalServices`** | <code>string[]</code> | For **web**, all services that will be used have to be listed under services or optionalServices, e.g. [numberToUUID(0x180f)] (see [UUID format](#uuid-format)) |
|
|
938
|
-
| **`allowDuplicates`** | <code>boolean</code> | Normally scans will discard the second and subsequent advertisements from a single device. If you need to receive them, set allowDuplicates to true (only applicable in `requestLEScan`). (default: false) |
|
|
939
|
-
| **`scanMode`** | <code><a href="#scanmode">ScanMode</a></code> | Android scan mode (default: <a href="#scanmode">ScanMode.SCAN_MODE_BALANCED</a>) |
|
|
940
|
-
| **`manufacturerData`** | <code>ManufacturerDataFilter[]</code> | Allow scanning for devices with a specific manufacturer data https://developer.mozilla.org/en-US/docs/Web/API/Bluetooth/requestDevice#manufacturerdata |
|
|
931
|
+
| Prop | Type | Description | Default |
|
|
932
|
+
| ---------------------- | --------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------- |
|
|
933
|
+
| **`services`** | <code>string[]</code> | Filter devices by service UUIDs. UUIDs have to be specified as 128 bit UUID strings, e.g. ['0000180d-0000-1000-8000-00805f9b34fb'] There is a helper function to convert numbers to UUIDs. e.g. [numberToUUID(0x180f)]. (see [UUID format](#uuid-format)) | |
|
|
934
|
+
| **`name`** | <code>string</code> | Filter devices by name | |
|
|
935
|
+
| **`namePrefix`** | <code>string</code> | Filter devices by name prefix | |
|
|
936
|
+
| **`optionalServices`** | <code>string[]</code> | For **web**, all services that will be used have to be listed under services or optionalServices, e.g. [numberToUUID(0x180f)] (see [UUID format](#uuid-format)) | |
|
|
937
|
+
| **`allowDuplicates`** | <code>boolean</code> | Normally scans will discard the second and subsequent advertisements from a single device. If you need to receive them, set allowDuplicates to true (only applicable in `requestLEScan`). (default: false) | |
|
|
938
|
+
| **`scanMode`** | <code><a href="#scanmode">ScanMode</a></code> | Android scan mode (default: <a href="#scanmode">ScanMode.SCAN_MODE_BALANCED</a>) | |
|
|
939
|
+
| **`manufacturerData`** | <code>ManufacturerDataFilter[]</code> | Allow scanning for devices with a specific manufacturer data https://developer.mozilla.org/en-US/docs/Web/API/Bluetooth/requestDevice#manufacturerdata | |
|
|
940
|
+
| **`displayMode`** | <code>'alert' \| 'list'</code> | Display mode for the device list in `requestDevice` (**iOS** only). - `"alert"`: Classic alert dialog (default) - `"list"`: Scrollable list view | <code>"alert"</code> |
|
|
941
|
+
| **`serviceData`** | <code>ServiceDataFilter[]</code> | Allow scanning for devices with specific service data. Service data is data associated with a specific service UUID in the advertisement packet. Useful for protocols like OpenDroneID, EddyStone, and Open Beacon. | |
|
|
941
942
|
|
|
942
943
|
#### ManufacturerDataFilter
|
|
943
944
|
|
|
944
|
-
| Prop | Type
|
|
945
|
-
| ----------------------- |
|
|
946
|
-
| **`companyIdentifier`** | <code>number</code>
|
|
947
|
-
| **`dataPrefix`** | <code
|
|
948
|
-
| **`mask`** | <code
|
|
949
|
-
|
|
950
|
-
####
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
|
956
|
-
|
|
|
957
|
-
| **`BYTES_PER_ELEMENT`** | <code>number</code> | The size in bytes of each element in the array. |
|
|
958
|
-
| **`buffer`** | <code><a href="#arraybufferlike">ArrayBufferLike</a></code> | The <a href="#arraybuffer">ArrayBuffer</a> instance referenced by the array. |
|
|
959
|
-
| **`byteLength`** | <code>number</code> | The length in bytes of the array. |
|
|
960
|
-
| **`byteOffset`** | <code>number</code> | The offset in bytes of the array. |
|
|
961
|
-
| **`length`** | <code>number</code> | The length of the array. |
|
|
962
|
-
|
|
963
|
-
| Method | Signature | Description |
|
|
964
|
-
| ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
965
|
-
| **copyWithin** | (target: number, start: number, end?: number \| undefined) => this | Returns the this object after copying a section of the array identified by start and end to the same array starting at position target |
|
|
966
|
-
| **every** | (predicate: (value: number, index: number, array: <a href="#uint8array">Uint8Array</a>) => unknown, thisArg?: any) => boolean | Determines whether all the members of an array satisfy the specified test. |
|
|
967
|
-
| **fill** | (value: number, start?: number \| undefined, end?: number \| undefined) => this | Returns the this object after filling the section identified by start and end with value |
|
|
968
|
-
| **filter** | (predicate: (value: number, index: number, array: <a href="#uint8array">Uint8Array</a>) => any, thisArg?: any) => <a href="#uint8array">Uint8Array</a> | Returns the elements of an array that meet the condition specified in a callback function. |
|
|
969
|
-
| **find** | (predicate: (value: number, index: number, obj: <a href="#uint8array">Uint8Array</a>) => boolean, thisArg?: any) => number \| undefined | Returns the value of the first element in the array where predicate is true, and undefined otherwise. |
|
|
970
|
-
| **findIndex** | (predicate: (value: number, index: number, obj: <a href="#uint8array">Uint8Array</a>) => boolean, thisArg?: any) => number | Returns the index of the first element in the array where predicate is true, and -1 otherwise. |
|
|
971
|
-
| **forEach** | (callbackfn: (value: number, index: number, array: <a href="#uint8array">Uint8Array</a>) => void, thisArg?: any) => void | Performs the specified action for each element in an array. |
|
|
972
|
-
| **indexOf** | (searchElement: number, fromIndex?: number \| undefined) => number | Returns the index of the first occurrence of a value in an array. |
|
|
973
|
-
| **join** | (separator?: string \| undefined) => string | Adds all the elements of an array separated by the specified separator string. |
|
|
974
|
-
| **lastIndexOf** | (searchElement: number, fromIndex?: number \| undefined) => number | Returns the index of the last occurrence of a value in an array. |
|
|
975
|
-
| **map** | (callbackfn: (value: number, index: number, array: <a href="#uint8array">Uint8Array</a>) => number, thisArg?: any) => <a href="#uint8array">Uint8Array</a> | Calls a defined callback function on each element of an array, and returns an array that contains the results. |
|
|
976
|
-
| **reduce** | (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: <a href="#uint8array">Uint8Array</a>) => number) => number | Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. |
|
|
977
|
-
| **reduce** | (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: <a href="#uint8array">Uint8Array</a>) => number, initialValue: number) => number | |
|
|
978
|
-
| **reduce** | <U>(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: <a href="#uint8array">Uint8Array</a>) => U, initialValue: U) => U | Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. |
|
|
979
|
-
| **reduceRight** | (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: <a href="#uint8array">Uint8Array</a>) => number) => number | Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. |
|
|
980
|
-
| **reduceRight** | (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: <a href="#uint8array">Uint8Array</a>) => number, initialValue: number) => number | |
|
|
981
|
-
| **reduceRight** | <U>(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: <a href="#uint8array">Uint8Array</a>) => U, initialValue: U) => U | Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. |
|
|
982
|
-
| **reverse** | () => <a href="#uint8array">Uint8Array</a> | Reverses the elements in an Array. |
|
|
983
|
-
| **set** | (array: <a href="#arraylike">ArrayLike</a><number>, offset?: number \| undefined) => void | Sets a value or an array of values. |
|
|
984
|
-
| **slice** | (start?: number \| undefined, end?: number \| undefined) => <a href="#uint8array">Uint8Array</a> | Returns a section of an array. |
|
|
985
|
-
| **some** | (predicate: (value: number, index: number, array: <a href="#uint8array">Uint8Array</a>) => unknown, thisArg?: any) => boolean | Determines whether the specified callback function returns true for any element of an array. |
|
|
986
|
-
| **sort** | (compareFn?: ((a: number, b: number) => number) \| undefined) => this | Sorts an array. |
|
|
987
|
-
| **subarray** | (begin?: number \| undefined, end?: number \| undefined) => <a href="#uint8array">Uint8Array</a> | Gets a new <a href="#uint8array">Uint8Array</a> view of the <a href="#arraybuffer">ArrayBuffer</a> store for this array, referencing the elements at begin, inclusive, up to end, exclusive. |
|
|
988
|
-
| **toLocaleString** | () => string | Converts a number to a string by using the current locale. |
|
|
989
|
-
| **toString** | () => string | Returns a string representation of an array. |
|
|
990
|
-
| **valueOf** | () => <a href="#uint8array">Uint8Array</a> | Returns the primitive value of the specified object. |
|
|
991
|
-
|
|
992
|
-
#### ArrayLike
|
|
993
|
-
|
|
994
|
-
| Prop | Type |
|
|
995
|
-
| ------------ | ------------------- |
|
|
996
|
-
| **`length`** | <code>number</code> |
|
|
997
|
-
|
|
998
|
-
#### ArrayBufferTypes
|
|
999
|
-
|
|
1000
|
-
Allowed <a href="#arraybuffer">ArrayBuffer</a> types for the buffer of an ArrayBufferView and related Typed Arrays.
|
|
1001
|
-
|
|
1002
|
-
| Prop | Type |
|
|
1003
|
-
| ----------------- | --------------------------------------------------- |
|
|
1004
|
-
| **`ArrayBuffer`** | <code><a href="#arraybuffer">ArrayBuffer</a></code> |
|
|
1005
|
-
|
|
1006
|
-
#### ArrayBuffer
|
|
1007
|
-
|
|
1008
|
-
Represents a raw buffer of binary data, which is used to store data for the
|
|
1009
|
-
different typed arrays. ArrayBuffers cannot be read from or written to directly,
|
|
1010
|
-
but can be passed to a typed array or <a href="#dataview">DataView</a> Object to interpret the raw
|
|
1011
|
-
buffer as needed.
|
|
1012
|
-
|
|
1013
|
-
| Prop | Type | Description |
|
|
1014
|
-
| ---------------- | ------------------- | ------------------------------------------------------------------------------- |
|
|
1015
|
-
| **`byteLength`** | <code>number</code> | Read-only. The length of the <a href="#arraybuffer">ArrayBuffer</a> (in bytes). |
|
|
1016
|
-
|
|
1017
|
-
| Method | Signature | Description |
|
|
1018
|
-
| --------- | --------------------------------------------------------------------------------------- | --------------------------------------------------------------- |
|
|
1019
|
-
| **slice** | (begin: number, end?: number \| undefined) => <a href="#arraybuffer">ArrayBuffer</a> | Returns a section of an <a href="#arraybuffer">ArrayBuffer</a>. |
|
|
945
|
+
| Prop | Type | Description |
|
|
946
|
+
| ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
947
|
+
| **`companyIdentifier`** | <code>number</code> | Company ID (sometimes called the manufacturer ID) to search for in the manufacturer data field. |
|
|
948
|
+
| **`dataPrefix`** | <code>[DataView](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/DataView) \| [Uint8Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array)</code> | Prefix to match in the manufacturer data field. On **Android** this field is mandatory. android, ios: DataView web: [Uint8Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) |
|
|
949
|
+
| **`mask`** | <code>[DataView](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/DataView) \| [Uint8Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array)</code> | Set filter on partial manufacture data. For any bit in the mask, set it the 1 if it needs to match the one in manufacturer data, otherwise set it to 0. The `mask` must have the same length of dataPrefix. android, ios: DataView web: [Uint8Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) |
|
|
950
|
+
|
|
951
|
+
#### ServiceDataFilter
|
|
952
|
+
|
|
953
|
+
| Prop | Type | Description |
|
|
954
|
+
| ----------------- | ------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
955
|
+
| **`serviceUuid`** | <code>string</code> | Service UUID to filter by. The service data must be associated with this UUID. UUIDs have to be specified as 128 bit UUID strings, e.g. '0000fffa-0000-1000-8000-00805f9b34fb' |
|
|
956
|
+
| **`dataPrefix`** | <code>[DataView](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/DataView)</code> | Prefix to match in the service data field. For example, OpenDroneID uses [0x0D] as the advertisement code. android, ios: string web: [DataView](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/DataView) |
|
|
957
|
+
| **`mask`** | <code>[DataView](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/DataView)</code> | Set filter on partial service data. For any bit in the mask, set it to 1 if it needs to match the one in service data, otherwise set it to 0. The `mask` must have the same length as dataPrefix. android, ios: string web: [DataView](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/DataView) |
|
|
1020
958
|
|
|
1021
959
|
#### ScanResult
|
|
1022
960
|
|
|
1023
|
-
| Prop | Type
|
|
1024
|
-
| ---------------------- |
|
|
1025
|
-
| **`device`** | <code><a href="#bledevice">BleDevice</a></code>
|
|
1026
|
-
| **`localName`** | <code>string</code>
|
|
1027
|
-
| **`rssi`** | <code>number</code>
|
|
1028
|
-
| **`txPower`** | <code>number</code>
|
|
1029
|
-
| **`manufacturerData`** | <code>{ [key: string]:
|
|
1030
|
-
| **`serviceData`** | <code>{ [key: string]:
|
|
1031
|
-
| **`uuids`** | <code>string[]</code>
|
|
1032
|
-
| **`rawAdvertisement`** | <code
|
|
1033
|
-
|
|
1034
|
-
#### DataView
|
|
1035
|
-
|
|
1036
|
-
| Prop | Type |
|
|
1037
|
-
| ---------------- | --------------------------------------------------- |
|
|
1038
|
-
| **`buffer`** | <code><a href="#arraybuffer">ArrayBuffer</a></code> |
|
|
1039
|
-
| **`byteLength`** | <code>number</code> |
|
|
1040
|
-
| **`byteOffset`** | <code>number</code> |
|
|
1041
|
-
|
|
1042
|
-
| Method | Signature | Description |
|
|
1043
|
-
| -------------- | ----------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
1044
|
-
| **getFloat32** | (byteOffset: number, littleEndian?: boolean \| undefined) => number | Gets the Float32 value at the specified byte offset from the start of the view. There is no alignment constraint; multi-byte values may be fetched from any offset. |
|
|
1045
|
-
| **getFloat64** | (byteOffset: number, littleEndian?: boolean \| undefined) => number | Gets the Float64 value at the specified byte offset from the start of the view. There is no alignment constraint; multi-byte values may be fetched from any offset. |
|
|
1046
|
-
| **getInt8** | (byteOffset: number) => number | Gets the Int8 value at the specified byte offset from the start of the view. There is no alignment constraint; multi-byte values may be fetched from any offset. |
|
|
1047
|
-
| **getInt16** | (byteOffset: number, littleEndian?: boolean \| undefined) => number | Gets the Int16 value at the specified byte offset from the start of the view. There is no alignment constraint; multi-byte values may be fetched from any offset. |
|
|
1048
|
-
| **getInt32** | (byteOffset: number, littleEndian?: boolean \| undefined) => number | Gets the Int32 value at the specified byte offset from the start of the view. There is no alignment constraint; multi-byte values may be fetched from any offset. |
|
|
1049
|
-
| **getUint8** | (byteOffset: number) => number | Gets the Uint8 value at the specified byte offset from the start of the view. There is no alignment constraint; multi-byte values may be fetched from any offset. |
|
|
1050
|
-
| **getUint16** | (byteOffset: number, littleEndian?: boolean \| undefined) => number | Gets the Uint16 value at the specified byte offset from the start of the view. There is no alignment constraint; multi-byte values may be fetched from any offset. |
|
|
1051
|
-
| **getUint32** | (byteOffset: number, littleEndian?: boolean \| undefined) => number | Gets the Uint32 value at the specified byte offset from the start of the view. There is no alignment constraint; multi-byte values may be fetched from any offset. |
|
|
1052
|
-
| **setFloat32** | (byteOffset: number, value: number, littleEndian?: boolean \| undefined) => void | Stores an Float32 value at the specified byte offset from the start of the view. |
|
|
1053
|
-
| **setFloat64** | (byteOffset: number, value: number, littleEndian?: boolean \| undefined) => void | Stores an Float64 value at the specified byte offset from the start of the view. |
|
|
1054
|
-
| **setInt8** | (byteOffset: number, value: number) => void | Stores an Int8 value at the specified byte offset from the start of the view. |
|
|
1055
|
-
| **setInt16** | (byteOffset: number, value: number, littleEndian?: boolean \| undefined) => void | Stores an Int16 value at the specified byte offset from the start of the view. |
|
|
1056
|
-
| **setInt32** | (byteOffset: number, value: number, littleEndian?: boolean \| undefined) => void | Stores an Int32 value at the specified byte offset from the start of the view. |
|
|
1057
|
-
| **setUint8** | (byteOffset: number, value: number) => void | Stores an Uint8 value at the specified byte offset from the start of the view. |
|
|
1058
|
-
| **setUint16** | (byteOffset: number, value: number, littleEndian?: boolean \| undefined) => void | Stores an Uint16 value at the specified byte offset from the start of the view. |
|
|
1059
|
-
| **setUint32** | (byteOffset: number, value: number, littleEndian?: boolean \| undefined) => void | Stores an Uint32 value at the specified byte offset from the start of the view. |
|
|
961
|
+
| Prop | Type | Description |
|
|
962
|
+
| ---------------------- | -------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
963
|
+
| **`device`** | <code><a href="#bledevice">BleDevice</a></code> | The peripheral device that was found in the scan. **Android** and **web**: `device.name` is always identical to `localName`. **iOS**: `device.name` is identical to `localName` the first time a device is discovered, but after connecting `device.name` is the cached GAP name in subsequent scans. |
|
|
964
|
+
| **`localName`** | <code>string</code> | The name of the peripheral device from the advertisement data. |
|
|
965
|
+
| **`rssi`** | <code>number</code> | Received Signal Strength Indication. |
|
|
966
|
+
| **`txPower`** | <code>number</code> | Transmit power in dBm. A value of 127 indicates that it is not available. |
|
|
967
|
+
| **`manufacturerData`** | <code>{ [key: string]: [DataView](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/DataView); }</code> | Manufacturer data, key is a company identifier and value is the data. |
|
|
968
|
+
| **`serviceData`** | <code>{ [key: string]: [DataView](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/DataView); }</code> | Service data, key is a service UUID and value is the data. |
|
|
969
|
+
| **`uuids`** | <code>string[]</code> | Advertised services. |
|
|
970
|
+
| **`rawAdvertisement`** | <code>[DataView](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/DataView)</code> | Raw advertisement data (**Android** only). |
|
|
1060
971
|
|
|
1061
972
|
#### TimeoutOptions
|
|
1062
973
|
|
|
@@ -1102,12 +1013,6 @@ buffer as needed.
|
|
|
1102
1013
|
| ---------- | ------------------- |
|
|
1103
1014
|
| **`uuid`** | <code>string</code> |
|
|
1104
1015
|
|
|
1105
|
-
### Type Aliases
|
|
1106
|
-
|
|
1107
|
-
#### ArrayBufferLike
|
|
1108
|
-
|
|
1109
|
-
<code>ArrayBufferTypes[keyof ArrayBufferTypes]</code>
|
|
1110
|
-
|
|
1111
1016
|
### Enums
|
|
1112
1017
|
|
|
1113
1018
|
#### ScanMode
|
|
@@ -1211,6 +1116,8 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
|
|
|
1211
1116
|
<tr>
|
|
1212
1117
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/gion-andri"><img src="https://avatars.githubusercontent.com/u/540998?v=4?s=100" width="100px;" alt="Gion-Andri Cantieni"/><br /><sub><b>Gion-Andri Cantieni</b></sub></a><br /><a href="https://github.com/capacitor-community/bluetooth-le/commits?author=gion-andri" title="Code">💻</a></td>
|
|
1213
1118
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/JasonAsmk"><img src="https://avatars.githubusercontent.com/u/994111?v=4?s=100" width="100px;" alt="Iason Asimakopoulos"/><br /><sub><b>Iason Asimakopoulos</b></sub></a><br /><a href="https://github.com/capacitor-community/bluetooth-le/commits?author=JasonAsmk" title="Code">💻</a></td>
|
|
1119
|
+
<td align="center" valign="top" width="14.28%"><a href="https://www.talaviram.com"><img src="https://avatars.githubusercontent.com/u/6911158?v=4?s=100" width="100px;" alt="Tal Aviram"/><br /><sub><b>Tal Aviram</b></sub></a><br /><a href="https://github.com/capacitor-community/bluetooth-le/commits?author=talaviram" title="Code">💻</a></td>
|
|
1120
|
+
<td align="center" valign="top" width="14.28%"><a href="https://emmanuelrobinson.dev/"><img src="https://avatars.githubusercontent.com/u/52470812?v=4?s=100" width="100px;" alt="Emmanuel Robinson Ejakpomewhe"/><br /><sub><b>Emmanuel Robinson Ejakpomewhe</b></sub></a><br /><a href="https://github.com/capacitor-community/bluetooth-le/commits?author=emmanuelorobinson" title="Code">💻</a></td>
|
|
1214
1121
|
</tr>
|
|
1215
1122
|
</tbody>
|
|
1216
1123
|
</table>
|