@capgo/capacitor-bluetooth-low-energy 8.0.5 → 8.1.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 +4 -3
- package/android/src/main/java/ee/forgr/plugin/bluetooth_low_energy/BluetoothLowEnergyPlugin.java +1 -1
- package/dist/docs.json +16 -0
- package/dist/esm/definitions.d.ts +7 -0
- package/dist/esm/definitions.js.map +1 -1
- package/ios/Sources/BluetoothLowEnergyPlugin/BluetoothLowEnergy.swift +9 -3
- package/ios/Sources/BluetoothLowEnergyPlugin/BluetoothLowEnergyPlugin.swift +3 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -782,9 +782,10 @@ Remove all listeners for this plugin.
|
|
|
782
782
|
|
|
783
783
|
Initialization options for the plugin.
|
|
784
784
|
|
|
785
|
-
| Prop
|
|
786
|
-
|
|
|
787
|
-
| **`mode`**
|
|
785
|
+
| Prop | Type | Description | Default | Since |
|
|
786
|
+
| -------------------- | -------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- | ---------------------- | ----- |
|
|
787
|
+
| **`mode`** | <code>'central' \| 'peripheral'</code> | The mode to initialize the plugin in. - 'central': Act as a BLE central (client) - 'peripheral': Act as a BLE peripheral (server) | <code>'central'</code> | 1.0.0 |
|
|
788
|
+
| **`showPowerAlert`** | <code>boolean</code> | Whether iOS should show the system Bluetooth power alert when Bluetooth is off (iOS only). | <code>true</code> | 8.0.7 |
|
|
788
789
|
|
|
789
790
|
|
|
790
791
|
#### IsAvailableResult
|
package/android/src/main/java/ee/forgr/plugin/bluetooth_low_energy/BluetoothLowEnergyPlugin.java
CHANGED
|
@@ -75,7 +75,7 @@ import java.util.UUID;
|
|
|
75
75
|
)
|
|
76
76
|
public class BluetoothLowEnergyPlugin extends Plugin {
|
|
77
77
|
|
|
78
|
-
private final String pluginVersion = "8.0
|
|
78
|
+
private final String pluginVersion = "8.1.0";
|
|
79
79
|
private BluetoothManager bluetoothManager;
|
|
80
80
|
private BluetoothAdapter bluetoothAdapter;
|
|
81
81
|
private BluetoothLeScanner bluetoothLeScanner;
|
package/dist/docs.json
CHANGED
|
@@ -1231,6 +1231,22 @@
|
|
|
1231
1231
|
"docs": "The mode to initialize the plugin in.\n- 'central': Act as a BLE central (client)\n- 'peripheral': Act as a BLE peripheral (server)",
|
|
1232
1232
|
"complexTypes": [],
|
|
1233
1233
|
"type": "'central' | 'peripheral' | undefined"
|
|
1234
|
+
},
|
|
1235
|
+
{
|
|
1236
|
+
"name": "showPowerAlert",
|
|
1237
|
+
"tags": [
|
|
1238
|
+
{
|
|
1239
|
+
"text": "true",
|
|
1240
|
+
"name": "default"
|
|
1241
|
+
},
|
|
1242
|
+
{
|
|
1243
|
+
"text": "8.0.7",
|
|
1244
|
+
"name": "since"
|
|
1245
|
+
}
|
|
1246
|
+
],
|
|
1247
|
+
"docs": "Whether iOS should show the system Bluetooth power alert when Bluetooth is off (iOS only).",
|
|
1248
|
+
"complexTypes": [],
|
|
1249
|
+
"type": "boolean | undefined"
|
|
1234
1250
|
}
|
|
1235
1251
|
]
|
|
1236
1252
|
},
|
|
@@ -491,6 +491,13 @@ export interface InitializeOptions {
|
|
|
491
491
|
* @since 1.0.0
|
|
492
492
|
*/
|
|
493
493
|
mode?: 'central' | 'peripheral';
|
|
494
|
+
/**
|
|
495
|
+
* Whether iOS should show the system Bluetooth power alert when Bluetooth is off (iOS only).
|
|
496
|
+
*
|
|
497
|
+
* @default true
|
|
498
|
+
* @since 8.0.7
|
|
499
|
+
*/
|
|
500
|
+
showPowerAlert?: boolean;
|
|
494
501
|
}
|
|
495
502
|
/**
|
|
496
503
|
* Result of the isAvailable method.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAs5CA;;;;GAIG;AACH,MAAM,OAAO,uBAAuB;IAClC;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,iBAAiB,CAAC,KAAe;QACtC,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACpE,CAAC;IAED;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,iBAAiB,CAAC,GAAW;QAClC,MAAM,KAAK,GAAa,EAAE,CAAC;QAC3B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;YACvC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;QAC7C,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,oBAAoB,CAAC,GAAW;QACrC,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;IACnD,CAAC;IAED;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,oBAAoB,CAAC,KAAe;QACzC,OAAO,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC;IACzD,CAAC;CACF"}
|
|
@@ -31,13 +31,19 @@ public class BluetoothLowEnergy: NSObject {
|
|
|
31
31
|
super.init()
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
func initialize(mode: String, completion: @escaping (Error?) -> Void) {
|
|
34
|
+
func initialize(mode: String, showPowerAlert: Bool, completion: @escaping (Error?) -> Void) {
|
|
35
35
|
self.mode = mode
|
|
36
36
|
|
|
37
37
|
if mode == "peripheral" {
|
|
38
|
-
|
|
38
|
+
let options: [String: Any] = [
|
|
39
|
+
CBPeripheralManagerOptionShowPowerAlertKey: showPowerAlert
|
|
40
|
+
]
|
|
41
|
+
peripheralManager = CBPeripheralManager(delegate: self, queue: nil, options: options)
|
|
39
42
|
} else {
|
|
40
|
-
|
|
43
|
+
let options: [String: Any] = [
|
|
44
|
+
CBCentralManagerOptionShowPowerAlertKey: showPowerAlert
|
|
45
|
+
]
|
|
46
|
+
centralManager = CBCentralManager(delegate: self, queue: nil, options: options)
|
|
41
47
|
}
|
|
42
48
|
|
|
43
49
|
// Wait for the manager to be ready
|
|
@@ -5,7 +5,7 @@ import CoreBluetooth
|
|
|
5
5
|
// swiftlint:disable type_body_length file_length
|
|
6
6
|
@objc(BluetoothLowEnergyPlugin)
|
|
7
7
|
public class BluetoothLowEnergyPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
8
|
-
private let pluginVersion: String = "8.0
|
|
8
|
+
private let pluginVersion: String = "8.1.0"
|
|
9
9
|
public let identifier = "BluetoothLowEnergyPlugin"
|
|
10
10
|
public let jsName = "BluetoothLowEnergy"
|
|
11
11
|
public let pluginMethods: [CAPPluginMethod] = [
|
|
@@ -51,7 +51,8 @@ public class BluetoothLowEnergyPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
51
51
|
|
|
52
52
|
@objc func initialize(_ call: CAPPluginCall) {
|
|
53
53
|
let mode = call.getString("mode") ?? "central"
|
|
54
|
-
|
|
54
|
+
let showPowerAlert = call.getBool("showPowerAlert") ?? true
|
|
55
|
+
implementation?.initialize(mode: mode, showPowerAlert: showPowerAlert) { error in
|
|
55
56
|
if let error = error {
|
|
56
57
|
call.reject(error.localizedDescription)
|
|
57
58
|
} else {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capgo/capacitor-bluetooth-low-energy",
|
|
3
|
-
"version": "8.0
|
|
3
|
+
"version": "8.1.0",
|
|
4
4
|
"description": "Bluetooth Low Energy (BLE) plugin for Capacitor with support for scanning, connecting, reading, writing, and notifications.",
|
|
5
5
|
"main": "dist/plugin.cjs.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|