react-native-ble-manager 12.0.0 → 12.1.1
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 +5 -5
- package/android/src/main/java/it/innove/BleManager.java +66 -34
- package/android/src/main/java/it/innove/Peripheral.java +1 -1
- package/dist/cjs/NativeBleManager.d.ts +1 -0
- package/dist/cjs/NativeBleManager.js.map +1 -1
- package/dist/esm/NativeBleManager.d.ts +1 -0
- package/dist/esm/NativeBleManager.js.map +1 -1
- package/ios/BleManager.mm +12 -0
- package/ios/SwiftBleManager.swift +304 -294
- package/package.json +1 -1
- package/plugin/build/withBLE.d.ts +1 -0
- package/plugin/build/withBLE.js +2 -2
- package/plugin/build/withBLEAndroidManifest.d.ts +1 -1
- package/plugin/build/withBLEAndroidManifest.js +3 -3
- package/src/NativeBleManager.ts +8 -0
package/package.json
CHANGED
package/plugin/build/withBLE.js
CHANGED
|
@@ -8,7 +8,7 @@ const withBluetoothPermissions_1 = require("./withBluetoothPermissions");
|
|
|
8
8
|
*/
|
|
9
9
|
const withBLE = (config, props = {}) => {
|
|
10
10
|
const _props = props || {};
|
|
11
|
-
const
|
|
11
|
+
const isBleRequired = _props.isBleRequired ?? false;
|
|
12
12
|
const neverForLocation = _props.neverForLocation ?? false;
|
|
13
13
|
const companionDeviceEnabled = _props.companionDeviceEnabled ?? false;
|
|
14
14
|
// iOS
|
|
@@ -20,7 +20,7 @@ const withBLE = (config, props = {}) => {
|
|
|
20
20
|
'android.permission.BLUETOOTH_CONNECT', // since Android SDK 31
|
|
21
21
|
]);
|
|
22
22
|
config = (0, withBLEAndroidManifest_1.withBLEAndroidManifest)(config, {
|
|
23
|
-
|
|
23
|
+
isBleRequired,
|
|
24
24
|
neverForLocation,
|
|
25
25
|
companionDeviceEnabled,
|
|
26
26
|
});
|
|
@@ -7,7 +7,7 @@ exports.addConnectPermissionToManifest = addConnectPermissionToManifest;
|
|
|
7
7
|
exports.addCompanionPermissionToManifest = addCompanionPermissionToManifest;
|
|
8
8
|
exports.addBLEHardwareFeatureToManifest = addBLEHardwareFeatureToManifest;
|
|
9
9
|
const config_plugins_1 = require("expo/config-plugins");
|
|
10
|
-
const withBLEAndroidManifest = (config, {
|
|
10
|
+
const withBLEAndroidManifest = (config, { isBleRequired, neverForLocation, companionDeviceEnabled }) => {
|
|
11
11
|
return (0, config_plugins_1.withAndroidManifest)(config, config => {
|
|
12
12
|
config.modResults = addLocationPermissionToManifest(config.modResults, neverForLocation);
|
|
13
13
|
config.modResults = addScanPermissionToManifest(config.modResults, neverForLocation);
|
|
@@ -15,7 +15,7 @@ const withBLEAndroidManifest = (config, { isBackgroundEnabled, neverForLocation,
|
|
|
15
15
|
if (companionDeviceEnabled) {
|
|
16
16
|
config.modResults = addCompanionPermissionToManifest(config.modResults);
|
|
17
17
|
}
|
|
18
|
-
if (
|
|
18
|
+
if (isBleRequired) {
|
|
19
19
|
config.modResults = addBLEHardwareFeatureToManifest(config.modResults);
|
|
20
20
|
}
|
|
21
21
|
return config;
|
|
@@ -107,7 +107,7 @@ function addCompanionPermissionToManifest(androidManifest) {
|
|
|
107
107
|
}
|
|
108
108
|
return androidManifest;
|
|
109
109
|
}
|
|
110
|
-
// Add this line if your application always requires BLE. More info can be found on: https://developer.android.com/
|
|
110
|
+
// Add this line if your application always requires BLE. More info can be found on: https://developer.android.com/develop/connectivity/bluetooth/bt-permissions
|
|
111
111
|
function addBLEHardwareFeatureToManifest(androidManifest) {
|
|
112
112
|
// Add `<uses-feature android:name="android.hardware.bluetooth_le" android:required="true"/>` to the AndroidManifest.xml
|
|
113
113
|
if (!Array.isArray(androidManifest.manifest['uses-feature'])) {
|
package/src/NativeBleManager.ts
CHANGED
|
@@ -94,6 +94,14 @@ export interface Spec extends TurboModule {
|
|
|
94
94
|
callback: (error: string | null, data: number[]) => void
|
|
95
95
|
): void;
|
|
96
96
|
|
|
97
|
+
startNotificationWithBuffer(
|
|
98
|
+
peripheralUUID: string,
|
|
99
|
+
serviceUUID: string,
|
|
100
|
+
characteristicUUID: string,
|
|
101
|
+
bufferLength: number,
|
|
102
|
+
callback: (error: string | null) => void
|
|
103
|
+
): void;
|
|
104
|
+
|
|
97
105
|
startNotification(
|
|
98
106
|
peripheralUUID: string,
|
|
99
107
|
serviceUUID: string,
|