@capacitor-community/bluetooth-le 3.1.1 → 6.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/README.md +9 -5
- package/android/build.gradle +6 -6
- package/dist/esm/definitions.d.ts +3 -3
- package/dist/esm/definitions.js.map +1 -1
- package/package.json +10 -10
package/README.md
CHANGED
|
@@ -6,14 +6,14 @@
|
|
|
6
6
|
</p>
|
|
7
7
|
|
|
8
8
|
<p align="center">
|
|
9
|
-
<img src="https://img.shields.io/maintenance/yes/
|
|
9
|
+
<img src="https://img.shields.io/maintenance/yes/2024?style=flat-square" />
|
|
10
10
|
<a href="https://github.com/capacitor-community/bluetooth-le/actions?query=workflow%3A%22CI%22"><img src="https://img.shields.io/github/actions/workflow/status/capacitor-community/bluetooth-le/main.yml?branch=main&style=flat-square" /></a>
|
|
11
11
|
<a href="https://www.npmjs.com/package/@capacitor-community/bluetooth-le"><img src="https://img.shields.io/npm/l/@capacitor-community/bluetooth-le?style=flat-square" /></a>
|
|
12
12
|
<br>
|
|
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-15-orange?style=flat-square" /></a>
|
|
17
17
|
<!-- ALL-CONTRIBUTORS-BADGE:END -->
|
|
18
18
|
</p>
|
|
19
19
|
|
|
@@ -27,7 +27,8 @@
|
|
|
27
27
|
|
|
28
28
|
| Plugin | Capacitor | Documentation |
|
|
29
29
|
| ------ | --------- | --------------------------------------------------------------------------------- |
|
|
30
|
-
|
|
|
30
|
+
| 6.x | 6.x | [README](https://github.com/capacitor-community/bluetooth-le/blob/main/README.md) |
|
|
31
|
+
| 3.x | 5.x | [README](https://github.com/capacitor-community/bluetooth-le/blob/3.x/README.md) |
|
|
31
32
|
| 2.x | 4.x | [README](https://github.com/capacitor-community/bluetooth-le/blob/2.x/README.md) |
|
|
32
33
|
| 1.x | 3.x | [README](https://github.com/capacitor-community/bluetooth-le/blob/1.x/README.md) |
|
|
33
34
|
| 0.x | 2.x | [README](https://github.com/capacitor-community/bluetooth-le/blob/0.x/README.md) |
|
|
@@ -353,8 +354,8 @@ _Note_: web support depends on the browser, see [implementation status](https://
|
|
|
353
354
|
| [`readRssi(...)`](#readrssi) | ✅ | ✅ | ❌ |
|
|
354
355
|
| [`read(...)`](#read) | ✅ | ✅ | ✅ |
|
|
355
356
|
| [`write(...)`](#write) | ✅ | ✅ | ✅ |
|
|
356
|
-
| [`readDescriptor(...)`](#
|
|
357
|
-
| [`writeDescriptor(...)`](#
|
|
357
|
+
| [`readDescriptor(...)`](#readdescriptor) | ✅ | ✅ | ✅ |
|
|
358
|
+
| [`writeDescriptor(...)`](#writedescriptor) | ✅ | ✅ | ✅ |
|
|
358
359
|
| [`writeWithoutResponse(...)`](#writewithoutresponse) | ✅ | ✅ | ✅ |
|
|
359
360
|
| [`startNotifications(...)`](#startnotifications) | ✅ | ✅ | ✅ |
|
|
360
361
|
| [`stopNotifications(...)`](#stopnotifications) | ✅ | ✅ | ✅ |
|
|
@@ -1107,6 +1108,9 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
|
|
|
1107
1108
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/td-tomasz-joniec"><img src="https://avatars.githubusercontent.com/u/109506928?v=4?s=100" width="100px;" alt="td-tomasz-joniec"/><br /><sub><b>td-tomasz-joniec</b></sub></a><br /><a href="https://github.com/capacitor-community/bluetooth-le/commits?author=td-tomasz-joniec" title="Code">💻</a></td>
|
|
1108
1109
|
<td align="center" valign="top" width="14.28%"><a href="https://fanxj.com"><img src="https://avatars.githubusercontent.com/u/10436013?v=4?s=100" width="100px;" alt="Michele Ferrari"/><br /><sub><b>Michele Ferrari</b></sub></a><br /><a href="https://github.com/capacitor-community/bluetooth-le/commits?author=micheleypf" title="Code">💻</a></td>
|
|
1109
1110
|
</tr>
|
|
1111
|
+
<tr>
|
|
1112
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/mchl18"><img src="https://avatars.githubusercontent.com/u/6136970?v=4?s=100" width="100px;" alt="mchl18"/><br /><sub><b>mchl18</b></sub></a><br /><a href="https://github.com/capacitor-community/bluetooth-le/commits?author=mchl18" title="Documentation">📖</a></td>
|
|
1113
|
+
</tr>
|
|
1110
1114
|
</tbody>
|
|
1111
1115
|
</table>
|
|
1112
1116
|
|
package/android/build.gradle
CHANGED
|
@@ -6,7 +6,7 @@ ext {
|
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
buildscript {
|
|
9
|
-
ext.
|
|
9
|
+
ext.kotlin_version = project.hasProperty("kotlin_version") ? rootProject.ext.kotlin_version : '1.9.10'
|
|
10
10
|
ext.coreKtx = project.hasProperty('coreKtx') ? rootProject.ext.coreKtx : '1.9.0'
|
|
11
11
|
|
|
12
12
|
repositories {
|
|
@@ -14,8 +14,8 @@ buildscript {
|
|
|
14
14
|
mavenCentral()
|
|
15
15
|
}
|
|
16
16
|
dependencies {
|
|
17
|
-
classpath 'com.android.tools.build:gradle:8.
|
|
18
|
-
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$
|
|
17
|
+
classpath 'com.android.tools.build:gradle:8.2.1'
|
|
18
|
+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
|
|
@@ -24,10 +24,10 @@ apply plugin: 'kotlin-android'
|
|
|
24
24
|
|
|
25
25
|
android {
|
|
26
26
|
namespace "com.capacitorjs.community.plugins.bluetoothle"
|
|
27
|
-
compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion :
|
|
27
|
+
compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 34
|
|
28
28
|
defaultConfig {
|
|
29
29
|
minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 22
|
|
30
|
-
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion :
|
|
30
|
+
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 34
|
|
31
31
|
versionCode 1
|
|
32
32
|
versionName "1.0"
|
|
33
33
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
@@ -61,5 +61,5 @@ dependencies {
|
|
|
61
61
|
androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
|
|
62
62
|
androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
|
|
63
63
|
implementation "androidx.core:core-ktx:$coreKtx"
|
|
64
|
-
implementation "org.jetbrains.kotlin:kotlin-stdlib:$
|
|
64
|
+
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
65
65
|
}
|
|
@@ -269,9 +269,9 @@ export interface BluetoothLePlugin {
|
|
|
269
269
|
stopLEScan(): Promise<void>;
|
|
270
270
|
getDevices(options: GetDevicesOptions): Promise<GetDevicesResult>;
|
|
271
271
|
getConnectedDevices(options: GetConnectedDevicesOptions): Promise<GetDevicesResult>;
|
|
272
|
-
addListener(eventName: 'onEnabledChanged', listenerFunc: (result: BooleanResult) => void): PluginListenerHandle
|
|
273
|
-
addListener(eventName: string, listenerFunc: (event: ReadResult) => void): PluginListenerHandle
|
|
274
|
-
addListener(eventName: 'onScanResult', listenerFunc: (result: ScanResultInternal) => void): PluginListenerHandle
|
|
272
|
+
addListener(eventName: 'onEnabledChanged', listenerFunc: (result: BooleanResult) => void): Promise<PluginListenerHandle>;
|
|
273
|
+
addListener(eventName: string, listenerFunc: (event: ReadResult) => void): Promise<PluginListenerHandle>;
|
|
274
|
+
addListener(eventName: 'onScanResult', listenerFunc: (result: ScanResultInternal) => void): Promise<PluginListenerHandle>;
|
|
275
275
|
connect(options: DeviceIdOptions & TimeoutOptions): Promise<void>;
|
|
276
276
|
createBond(options: DeviceIdOptions & TimeoutOptions): Promise<void>;
|
|
277
277
|
isBonded(options: DeviceIdOptions): Promise<BooleanResult>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAkDA;;GAEG;AACH,MAAM,CAAN,IAAY,QAgBX;AAhBD,WAAY,QAAQ;IAClB;;;OAGG;IACH,qEAAuB,CAAA;IACvB;;;OAGG;IACH,mEAAsB,CAAA;IACtB;;;OAGG;IACH,yEAAyB,CAAA;AAC3B,CAAC,EAhBW,QAAQ,KAAR,QAAQ,QAgBnB;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,kBAgBX;AAhBD,WAAY,kBAAkB;IAC5B;;;OAGG;IACH,2GAAgC,CAAA;IAChC;;;OAGG;IACH,mGAA4B,CAAA;IAC5B;;;OAGG;IACH,6GAAiC,CAAA;AACnC,CAAC,EAhBW,kBAAkB,KAAlB,kBAAkB,QAgB7B","sourcesContent":["import type { PluginListenerHandle } from '@capacitor/core';\n\nimport type { DisplayStrings } from './config';\n\nexport interface InitializeOptions {\n /**\n * If your app doesn't use Bluetooth scan results to derive physical\n * location information, you can strongly assert that your app\n * doesn't derive physical location. (Android only)\n * Requires adding 'neverForLocation' to AndroidManifest.xml\n * https://developer.android.com/guide/topics/connectivity/bluetooth/permissions#assert-never-for-location\n * @default false\n */\n androidNeverForLocation?: boolean;\n}\n\nexport interface RequestBleDeviceOptions {\n /**\n * Filter devices by service UUIDs.\n * UUIDs have to be specified as 128 bit UUID strings,\n * e.g. ['0000180d-0000-1000-8000-00805f9b34fb']\n * There is a helper function to convert numbers to UUIDs.\n * e.g. [numberToUUID(0x180f)]. (see [UUID format](#uuid-format))\n */\n services?: string[];\n /**\n * Filter devices by name\n */\n name?: string;\n /**\n * Filter devices by name prefix\n */\n namePrefix?: string;\n /**\n * For **web**, all services that will be used have to be listed under services or optionalServices,\n * e.g. [numberToUUID(0x180f)] (see [UUID format](#uuid-format))\n */\n optionalServices?: string[];\n /**\n * Normally scans will discard the second and subsequent advertisements from a single device.\n * If you need to receive them, set allowDuplicates to true (only applicable in `requestLEScan`).\n * (default: false)\n */\n allowDuplicates?: boolean;\n /**\n * Android scan mode (default: ScanMode.SCAN_MODE_BALANCED)\n */\n scanMode?: ScanMode;\n}\n\n/**\n * Android scan mode\n */\nexport enum ScanMode {\n /**\n * Perform Bluetooth LE scan in low power mode. This mode is enforced if the scanning application is not in foreground.\n * https://developer.android.com/reference/android/bluetooth/le/ScanSettings#SCAN_MODE_LOW_POWER\n */\n SCAN_MODE_LOW_POWER = 0,\n /**\n * Perform Bluetooth LE scan in balanced power mode. (default) Scan results are returned at a rate that provides a good trade-off between scan frequency and power consumption.\n * https://developer.android.com/reference/android/bluetooth/le/ScanSettings#SCAN_MODE_BALANCED\n */\n SCAN_MODE_BALANCED = 1,\n /**\n * Scan using highest duty cycle. It's recommended to only use this mode when the application is running in the foreground.\n * https://developer.android.com/reference/android/bluetooth/le/ScanSettings#SCAN_MODE_LOW_LATENCY\n */\n SCAN_MODE_LOW_LATENCY = 2,\n}\n\n/**\n * Android connection priority used in `requestConnectionPriority`\n */\nexport enum ConnectionPriority {\n /**\n * Use the connection parameters recommended by the Bluetooth SIG. This is the default value if no connection parameter update is requested.\n * https://developer.android.com/reference/android/bluetooth/BluetoothGatt#CONNECTION_PRIORITY_BALANCED\n */\n CONNECTION_PRIORITY_BALANCED = 0,\n /**\n * Request a high priority, low latency connection. An application should only request high priority connection parameters to transfer large amounts of data over LE quickly. Once the transfer is complete, the application should request CONNECTION_PRIORITY_BALANCED connection parameters to reduce energy use.\n * https://developer.android.com/reference/android/bluetooth/BluetoothGatt#CONNECTION_PRIORITY_HIGH\n */\n CONNECTION_PRIORITY_HIGH = 1,\n /**\n * Request low power, reduced data rate connection parameters.\n * https://developer.android.com/reference/android/bluetooth/BluetoothGatt#CONNECTION_PRIORITY_LOW_POWER\n */\n CONNECTION_PRIORITY_LOW_POWER = 2,\n}\n\nexport interface BleDevice {\n /**\n * ID of the device, which will be needed for further calls.\n * On **Android** this is the BLE MAC address.\n * On **iOS** and **web** it is an identifier.\n */\n deviceId: string;\n /**\n * Name of the peripheral device.\n */\n name?: string;\n uuids?: string[];\n}\n\nexport interface DeviceIdOptions {\n deviceId: string;\n}\nexport interface TimeoutOptions {\n /**\n * Timeout in milliseconds for plugin call.\n * Default is 10000 for `connect` and 5000 for other plugin methods.\n */\n timeout?: number;\n}\n\nexport interface RequestConnectionPriorityOptions extends DeviceIdOptions {\n connectionPriority: ConnectionPriority;\n}\n\nexport interface GetDevicesOptions {\n deviceIds: string[];\n}\n\nexport interface GetConnectedDevicesOptions {\n services: string[];\n}\n\nexport interface BleService {\n readonly uuid: string;\n readonly characteristics: BleCharacteristic[];\n}\n\nexport interface BleDescriptor {\n readonly uuid: string;\n}\n\nexport interface BleCharacteristic {\n readonly uuid: string;\n readonly properties: BleCharacteristicProperties;\n readonly descriptors: BleDescriptor[];\n}\n\nexport interface BleCharacteristicProperties {\n readonly broadcast: boolean;\n readonly read: boolean;\n readonly writeWithoutResponse: boolean;\n readonly write: boolean;\n readonly notify: boolean;\n readonly indicate: boolean;\n readonly authenticatedSignedWrites: boolean;\n readonly reliableWrite?: boolean;\n readonly writableAuxiliaries?: boolean;\n readonly extendedProperties?: boolean;\n readonly notifyEncryptionRequired?: boolean;\n readonly indicateEncryptionRequired?: boolean;\n}\n\nexport interface BleServices {\n services: BleService[];\n}\n\nexport interface ReadOptions {\n deviceId: string;\n service: string;\n characteristic: string;\n}\n\nexport interface ReadDescriptorOptions {\n deviceId: string;\n service: string;\n characteristic: string;\n descriptor: string;\n}\n\nexport type Data = DataView | string;\n\nexport interface WriteOptions {\n deviceId: string;\n service: string;\n characteristic: string;\n /**\n * android, ios: string\n * web: DataView\n */\n value: Data;\n}\n\nexport interface WriteDescriptorOptions {\n deviceId: string;\n service: string;\n characteristic: string;\n descriptor: string;\n /**\n * android, ios: string\n * web: DataView\n */\n value: Data;\n}\n\nexport interface BooleanResult {\n value: boolean;\n}\n\nexport interface GetDevicesResult {\n devices: BleDevice[];\n}\n\nexport interface GetMtuResult {\n value: number;\n}\n\nexport interface ReadRssiResult {\n value: string;\n}\n\nexport interface ReadResult {\n /**\n * android, ios: string\n * web: DataView\n */\n value?: Data;\n}\n\nexport interface ScanResultInternal<T = Data> {\n device: BleDevice;\n localName?: string;\n rssi?: number;\n txPower?: number;\n manufacturerData?: { [key: string]: T };\n serviceData?: { [key: string]: T };\n uuids?: string[];\n rawAdvertisement?: T;\n}\n\nexport interface ScanResult {\n /**\n * The peripheral device that was found in the scan.\n * **Android** and **web**: `device.name` is always identical to `localName`.\n * **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.\n */\n device: BleDevice;\n /**\n * The name of the peripheral device from the advertisement data.\n */\n localName?: string;\n /**\n * Received Signal Strength Indication.\n */\n rssi?: number;\n /**\n * Transmit power in dBm. A value of 127 indicates that it is not available.\n */\n txPower?: number;\n /**\n * Manufacturer data, key is a company identifier and value is the data.\n */\n manufacturerData?: { [key: string]: DataView };\n /**\n * Service data, key is a service UUID and value is the data.\n */\n serviceData?: { [key: string]: DataView };\n /**\n * Advertised services.\n */\n uuids?: string[];\n /**\n * Raw advertisement data (**Android** only).\n */\n rawAdvertisement?: DataView;\n}\n\nexport interface BluetoothLePlugin {\n initialize(options?: InitializeOptions): Promise<void>;\n isEnabled(): Promise<BooleanResult>;\n requestEnable(): Promise<void>;\n enable(): Promise<void>;\n disable(): Promise<void>;\n startEnabledNotifications(): Promise<void>;\n stopEnabledNotifications(): Promise<void>;\n isLocationEnabled(): Promise<BooleanResult>;\n openLocationSettings(): Promise<void>;\n openBluetoothSettings(): Promise<void>;\n openAppSettings(): Promise<void>;\n setDisplayStrings(displayStrings: DisplayStrings): Promise<void>;\n requestDevice(options?: RequestBleDeviceOptions): Promise<BleDevice>;\n requestLEScan(options?: RequestBleDeviceOptions): Promise<void>;\n stopLEScan(): Promise<void>;\n getDevices(options: GetDevicesOptions): Promise<GetDevicesResult>;\n getConnectedDevices(options: GetConnectedDevicesOptions): Promise<GetDevicesResult>;\n addListener(eventName: 'onEnabledChanged', listenerFunc: (result: BooleanResult) => void): PluginListenerHandle;\n addListener(eventName: string, listenerFunc: (event: ReadResult) => void): PluginListenerHandle;\n addListener(eventName: 'onScanResult', listenerFunc: (result: ScanResultInternal) => void): PluginListenerHandle;\n connect(options: DeviceIdOptions & TimeoutOptions): Promise<void>;\n createBond(options: DeviceIdOptions & TimeoutOptions): Promise<void>;\n isBonded(options: DeviceIdOptions): Promise<BooleanResult>;\n disconnect(options: DeviceIdOptions): Promise<void>;\n getServices(options: DeviceIdOptions): Promise<BleServices>;\n discoverServices(options: DeviceIdOptions): Promise<void>;\n getMtu(options: DeviceIdOptions): Promise<GetMtuResult>;\n requestConnectionPriority(options: RequestConnectionPriorityOptions): Promise<void>;\n readRssi(options: DeviceIdOptions): Promise<ReadRssiResult>;\n read(options: ReadOptions & TimeoutOptions): Promise<ReadResult>;\n write(options: WriteOptions & TimeoutOptions): Promise<void>;\n writeWithoutResponse(options: WriteOptions & TimeoutOptions): Promise<void>;\n readDescriptor(options: ReadDescriptorOptions & TimeoutOptions): Promise<ReadResult>;\n writeDescriptor(options: WriteDescriptorOptions & TimeoutOptions): Promise<void>;\n startNotifications(options: ReadOptions): Promise<void>;\n stopNotifications(options: ReadOptions): Promise<void>;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAkDA;;GAEG;AACH,MAAM,CAAN,IAAY,QAgBX;AAhBD,WAAY,QAAQ;IAClB;;;OAGG;IACH,qEAAuB,CAAA;IACvB;;;OAGG;IACH,mEAAsB,CAAA;IACtB;;;OAGG;IACH,yEAAyB,CAAA;AAC3B,CAAC,EAhBW,QAAQ,KAAR,QAAQ,QAgBnB;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,kBAgBX;AAhBD,WAAY,kBAAkB;IAC5B;;;OAGG;IACH,2GAAgC,CAAA;IAChC;;;OAGG;IACH,mGAA4B,CAAA;IAC5B;;;OAGG;IACH,6GAAiC,CAAA;AACnC,CAAC,EAhBW,kBAAkB,KAAlB,kBAAkB,QAgB7B","sourcesContent":["import type { PluginListenerHandle } from '@capacitor/core';\n\nimport type { DisplayStrings } from './config';\n\nexport interface InitializeOptions {\n /**\n * If your app doesn't use Bluetooth scan results to derive physical\n * location information, you can strongly assert that your app\n * doesn't derive physical location. (Android only)\n * Requires adding 'neverForLocation' to AndroidManifest.xml\n * https://developer.android.com/guide/topics/connectivity/bluetooth/permissions#assert-never-for-location\n * @default false\n */\n androidNeverForLocation?: boolean;\n}\n\nexport interface RequestBleDeviceOptions {\n /**\n * Filter devices by service UUIDs.\n * UUIDs have to be specified as 128 bit UUID strings,\n * e.g. ['0000180d-0000-1000-8000-00805f9b34fb']\n * There is a helper function to convert numbers to UUIDs.\n * e.g. [numberToUUID(0x180f)]. (see [UUID format](#uuid-format))\n */\n services?: string[];\n /**\n * Filter devices by name\n */\n name?: string;\n /**\n * Filter devices by name prefix\n */\n namePrefix?: string;\n /**\n * For **web**, all services that will be used have to be listed under services or optionalServices,\n * e.g. [numberToUUID(0x180f)] (see [UUID format](#uuid-format))\n */\n optionalServices?: string[];\n /**\n * Normally scans will discard the second and subsequent advertisements from a single device.\n * If you need to receive them, set allowDuplicates to true (only applicable in `requestLEScan`).\n * (default: false)\n */\n allowDuplicates?: boolean;\n /**\n * Android scan mode (default: ScanMode.SCAN_MODE_BALANCED)\n */\n scanMode?: ScanMode;\n}\n\n/**\n * Android scan mode\n */\nexport enum ScanMode {\n /**\n * Perform Bluetooth LE scan in low power mode. This mode is enforced if the scanning application is not in foreground.\n * https://developer.android.com/reference/android/bluetooth/le/ScanSettings#SCAN_MODE_LOW_POWER\n */\n SCAN_MODE_LOW_POWER = 0,\n /**\n * Perform Bluetooth LE scan in balanced power mode. (default) Scan results are returned at a rate that provides a good trade-off between scan frequency and power consumption.\n * https://developer.android.com/reference/android/bluetooth/le/ScanSettings#SCAN_MODE_BALANCED\n */\n SCAN_MODE_BALANCED = 1,\n /**\n * Scan using highest duty cycle. It's recommended to only use this mode when the application is running in the foreground.\n * https://developer.android.com/reference/android/bluetooth/le/ScanSettings#SCAN_MODE_LOW_LATENCY\n */\n SCAN_MODE_LOW_LATENCY = 2,\n}\n\n/**\n * Android connection priority used in `requestConnectionPriority`\n */\nexport enum ConnectionPriority {\n /**\n * Use the connection parameters recommended by the Bluetooth SIG. This is the default value if no connection parameter update is requested.\n * https://developer.android.com/reference/android/bluetooth/BluetoothGatt#CONNECTION_PRIORITY_BALANCED\n */\n CONNECTION_PRIORITY_BALANCED = 0,\n /**\n * Request a high priority, low latency connection. An application should only request high priority connection parameters to transfer large amounts of data over LE quickly. Once the transfer is complete, the application should request CONNECTION_PRIORITY_BALANCED connection parameters to reduce energy use.\n * https://developer.android.com/reference/android/bluetooth/BluetoothGatt#CONNECTION_PRIORITY_HIGH\n */\n CONNECTION_PRIORITY_HIGH = 1,\n /**\n * Request low power, reduced data rate connection parameters.\n * https://developer.android.com/reference/android/bluetooth/BluetoothGatt#CONNECTION_PRIORITY_LOW_POWER\n */\n CONNECTION_PRIORITY_LOW_POWER = 2,\n}\n\nexport interface BleDevice {\n /**\n * ID of the device, which will be needed for further calls.\n * On **Android** this is the BLE MAC address.\n * On **iOS** and **web** it is an identifier.\n */\n deviceId: string;\n /**\n * Name of the peripheral device.\n */\n name?: string;\n uuids?: string[];\n}\n\nexport interface DeviceIdOptions {\n deviceId: string;\n}\nexport interface TimeoutOptions {\n /**\n * Timeout in milliseconds for plugin call.\n * Default is 10000 for `connect` and 5000 for other plugin methods.\n */\n timeout?: number;\n}\n\nexport interface RequestConnectionPriorityOptions extends DeviceIdOptions {\n connectionPriority: ConnectionPriority;\n}\n\nexport interface GetDevicesOptions {\n deviceIds: string[];\n}\n\nexport interface GetConnectedDevicesOptions {\n services: string[];\n}\n\nexport interface BleService {\n readonly uuid: string;\n readonly characteristics: BleCharacteristic[];\n}\n\nexport interface BleDescriptor {\n readonly uuid: string;\n}\n\nexport interface BleCharacteristic {\n readonly uuid: string;\n readonly properties: BleCharacteristicProperties;\n readonly descriptors: BleDescriptor[];\n}\n\nexport interface BleCharacteristicProperties {\n readonly broadcast: boolean;\n readonly read: boolean;\n readonly writeWithoutResponse: boolean;\n readonly write: boolean;\n readonly notify: boolean;\n readonly indicate: boolean;\n readonly authenticatedSignedWrites: boolean;\n readonly reliableWrite?: boolean;\n readonly writableAuxiliaries?: boolean;\n readonly extendedProperties?: boolean;\n readonly notifyEncryptionRequired?: boolean;\n readonly indicateEncryptionRequired?: boolean;\n}\n\nexport interface BleServices {\n services: BleService[];\n}\n\nexport interface ReadOptions {\n deviceId: string;\n service: string;\n characteristic: string;\n}\n\nexport interface ReadDescriptorOptions {\n deviceId: string;\n service: string;\n characteristic: string;\n descriptor: string;\n}\n\nexport type Data = DataView | string;\n\nexport interface WriteOptions {\n deviceId: string;\n service: string;\n characteristic: string;\n /**\n * android, ios: string\n * web: DataView\n */\n value: Data;\n}\n\nexport interface WriteDescriptorOptions {\n deviceId: string;\n service: string;\n characteristic: string;\n descriptor: string;\n /**\n * android, ios: string\n * web: DataView\n */\n value: Data;\n}\n\nexport interface BooleanResult {\n value: boolean;\n}\n\nexport interface GetDevicesResult {\n devices: BleDevice[];\n}\n\nexport interface GetMtuResult {\n value: number;\n}\n\nexport interface ReadRssiResult {\n value: string;\n}\n\nexport interface ReadResult {\n /**\n * android, ios: string\n * web: DataView\n */\n value?: Data;\n}\n\nexport interface ScanResultInternal<T = Data> {\n device: BleDevice;\n localName?: string;\n rssi?: number;\n txPower?: number;\n manufacturerData?: { [key: string]: T };\n serviceData?: { [key: string]: T };\n uuids?: string[];\n rawAdvertisement?: T;\n}\n\nexport interface ScanResult {\n /**\n * The peripheral device that was found in the scan.\n * **Android** and **web**: `device.name` is always identical to `localName`.\n * **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.\n */\n device: BleDevice;\n /**\n * The name of the peripheral device from the advertisement data.\n */\n localName?: string;\n /**\n * Received Signal Strength Indication.\n */\n rssi?: number;\n /**\n * Transmit power in dBm. A value of 127 indicates that it is not available.\n */\n txPower?: number;\n /**\n * Manufacturer data, key is a company identifier and value is the data.\n */\n manufacturerData?: { [key: string]: DataView };\n /**\n * Service data, key is a service UUID and value is the data.\n */\n serviceData?: { [key: string]: DataView };\n /**\n * Advertised services.\n */\n uuids?: string[];\n /**\n * Raw advertisement data (**Android** only).\n */\n rawAdvertisement?: DataView;\n}\n\nexport interface BluetoothLePlugin {\n initialize(options?: InitializeOptions): Promise<void>;\n isEnabled(): Promise<BooleanResult>;\n requestEnable(): Promise<void>;\n enable(): Promise<void>;\n disable(): Promise<void>;\n startEnabledNotifications(): Promise<void>;\n stopEnabledNotifications(): Promise<void>;\n isLocationEnabled(): Promise<BooleanResult>;\n openLocationSettings(): Promise<void>;\n openBluetoothSettings(): Promise<void>;\n openAppSettings(): Promise<void>;\n setDisplayStrings(displayStrings: DisplayStrings): Promise<void>;\n requestDevice(options?: RequestBleDeviceOptions): Promise<BleDevice>;\n requestLEScan(options?: RequestBleDeviceOptions): Promise<void>;\n stopLEScan(): Promise<void>;\n getDevices(options: GetDevicesOptions): Promise<GetDevicesResult>;\n getConnectedDevices(options: GetConnectedDevicesOptions): Promise<GetDevicesResult>;\n addListener(\n eventName: 'onEnabledChanged',\n listenerFunc: (result: BooleanResult) => void\n ): Promise<PluginListenerHandle>;\n addListener(eventName: string, listenerFunc: (event: ReadResult) => void): Promise<PluginListenerHandle>;\n addListener(\n eventName: 'onScanResult',\n listenerFunc: (result: ScanResultInternal) => void\n ): Promise<PluginListenerHandle>;\n connect(options: DeviceIdOptions & TimeoutOptions): Promise<void>;\n createBond(options: DeviceIdOptions & TimeoutOptions): Promise<void>;\n isBonded(options: DeviceIdOptions): Promise<BooleanResult>;\n disconnect(options: DeviceIdOptions): Promise<void>;\n getServices(options: DeviceIdOptions): Promise<BleServices>;\n discoverServices(options: DeviceIdOptions): Promise<void>;\n getMtu(options: DeviceIdOptions): Promise<GetMtuResult>;\n requestConnectionPriority(options: RequestConnectionPriorityOptions): Promise<void>;\n readRssi(options: DeviceIdOptions): Promise<ReadRssiResult>;\n read(options: ReadOptions & TimeoutOptions): Promise<ReadResult>;\n write(options: WriteOptions & TimeoutOptions): Promise<void>;\n writeWithoutResponse(options: WriteOptions & TimeoutOptions): Promise<void>;\n readDescriptor(options: ReadDescriptorOptions & TimeoutOptions): Promise<ReadResult>;\n writeDescriptor(options: WriteDescriptorOptions & TimeoutOptions): Promise<void>;\n startNotifications(options: ReadOptions): Promise<void>;\n stopNotifications(options: ReadOptions): Promise<void>;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capacitor-community/bluetooth-le",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.0-0",
|
|
4
4
|
"description": "Capacitor plugin for Bluetooth Low Energy ",
|
|
5
5
|
"main": "dist/plugin.cjs.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"unpkg": "dist/plugin.js",
|
|
9
9
|
"scripts": {
|
|
10
10
|
"verify": "npm run verify:ios && npm run verify:android && npm run verify:web",
|
|
11
|
-
"verify:ios": "set -o pipefail && cd ios && pod install && xcodebuild clean build test -workspace Plugin.xcworkspace -scheme Plugin -destination \"platform=iOS Simulator,name=iPhone
|
|
11
|
+
"verify:ios": "set -o pipefail && cd ios && pod install && xcodebuild clean build test -workspace Plugin.xcworkspace -scheme Plugin -destination \"platform=iOS Simulator,name=iPhone 15\" | xcpretty && cd ..",
|
|
12
12
|
"verify:android": "cd android && ./gradlew clean build test && cd ..",
|
|
13
13
|
"verify:web": "npm run test:coverage && npm run build",
|
|
14
14
|
"lint": "npm run eslint && npm run prettier -- --check && npm run lint:ios",
|
|
@@ -35,14 +35,14 @@
|
|
|
35
35
|
"author": "pwespi",
|
|
36
36
|
"license": "MIT",
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@types/web-bluetooth": "^0.0.
|
|
38
|
+
"@types/web-bluetooth": "^0.0.20"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@capacitor/android": "
|
|
42
|
-
"@capacitor/cli": "
|
|
43
|
-
"@capacitor/core": "
|
|
41
|
+
"@capacitor/android": "next",
|
|
42
|
+
"@capacitor/cli": "next",
|
|
43
|
+
"@capacitor/core": "next",
|
|
44
44
|
"@capacitor/docgen": "0.2.0",
|
|
45
|
-
"@capacitor/ios": "
|
|
45
|
+
"@capacitor/ios": "next",
|
|
46
46
|
"@ionic/eslint-config": "^0.3.0",
|
|
47
47
|
"@ionic/prettier-config": "^2.0.0",
|
|
48
48
|
"@ionic/swiftlint-config": "^1.1.2",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"typescript": "~4.9.4"
|
|
62
62
|
},
|
|
63
63
|
"peerDependencies": {
|
|
64
|
-
"@capacitor/core": "
|
|
64
|
+
"@capacitor/core": "next"
|
|
65
65
|
},
|
|
66
66
|
"files": [
|
|
67
67
|
"android/src/main/",
|
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
"url": "https://github.com/capacitor-community/bluetooth-le/issues"
|
|
98
98
|
},
|
|
99
99
|
"volta": {
|
|
100
|
-
"node": "
|
|
101
|
-
"npm": "
|
|
100
|
+
"node": "20.11.0",
|
|
101
|
+
"npm": "10.4.0"
|
|
102
102
|
}
|
|
103
103
|
}
|