react-native-ble-manager 8.4.1 → 8.4.4
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
CHANGED
|
@@ -359,7 +359,7 @@ Returns a `Promise` object.
|
|
|
359
359
|
- `serviceUUID` - `String` - the UUID of the service.
|
|
360
360
|
- `characteristicUUID` - `String` - the UUID of the characteristic.
|
|
361
361
|
- `data` - `Byte array` - the data to write.
|
|
362
|
-
- `maxByteSize` - `Integer` - specify the max byte size before splitting message
|
|
362
|
+
- `maxByteSize` - `Integer` - specify the max byte size before splitting message, defaults to 20 bytes if not specified
|
|
363
363
|
|
|
364
364
|
**Data preparation**
|
|
365
365
|
|
package/android/build.gradle
CHANGED
|
@@ -21,6 +21,11 @@ def safeExtGet(prop, fallback) {
|
|
|
21
21
|
|
|
22
22
|
android {
|
|
23
23
|
compileSdkVersion safeExtGet("compileSdkVersion", 30)
|
|
24
|
+
|
|
25
|
+
compileOptions {
|
|
26
|
+
sourceCompatibility JavaVersion.VERSION_1_8
|
|
27
|
+
targetCompatibility JavaVersion.VERSION_1_8
|
|
28
|
+
}
|
|
24
29
|
|
|
25
30
|
defaultConfig {
|
|
26
31
|
minSdkVersion safeExtGet("minSdkVersion", 21)
|
|
@@ -331,8 +331,11 @@ public class Peripheral extends BluetoothGattCallback {
|
|
|
331
331
|
readCallback, registerNotifyCallback, requestMTUCallback);
|
|
332
332
|
for (Callback currentCallback : callbacks) {
|
|
333
333
|
if (currentCallback != null) {
|
|
334
|
-
|
|
335
|
-
|
|
334
|
+
try {
|
|
335
|
+
currentCallback.invoke("Device disconnected");
|
|
336
|
+
} catch (Exception e) {
|
|
337
|
+
e.printStackTrace();
|
|
338
|
+
} }
|
|
336
339
|
}
|
|
337
340
|
if (connectCallback != null) {
|
|
338
341
|
connectCallback.invoke("Connection error");
|
|
@@ -416,6 +419,7 @@ public class Peripheral extends BluetoothGattCallback {
|
|
|
416
419
|
return;
|
|
417
420
|
}
|
|
418
421
|
sendBackrError(readCallback, "Error reading " + characteristic.getUuid() + " status=" + status);
|
|
422
|
+
readCallback = null;
|
|
419
423
|
} else if (readCallback != null) {
|
|
420
424
|
final byte[] dataValue = copyOf(characteristic.getValue());
|
|
421
425
|
final Callback callback = readCallback;
|
|
@@ -446,6 +450,7 @@ public class Peripheral extends BluetoothGattCallback {
|
|
|
446
450
|
return;
|
|
447
451
|
}
|
|
448
452
|
sendBackrError(writeCallback, "Error writing " + characteristic.getUuid() + " status=" + status);
|
|
453
|
+
writeCallback = null;
|
|
449
454
|
} else if (writeCallback != null) {
|
|
450
455
|
final Callback callback = writeCallback;
|
|
451
456
|
mainHandler.post(new Runnable() {
|
|
@@ -467,8 +472,8 @@ public class Peripheral extends BluetoothGattCallback {
|
|
|
467
472
|
registerNotifyCallback.invoke();
|
|
468
473
|
Log.d(BleManager.LOG_TAG, "onDescriptorWrite success");
|
|
469
474
|
} else {
|
|
470
|
-
registerNotifyCallback.invoke("Error writing descriptor
|
|
471
|
-
Log.e(BleManager.LOG_TAG, "Error writing descriptor
|
|
475
|
+
registerNotifyCallback.invoke("Error writing descriptor status=" + status, null);
|
|
476
|
+
Log.e(BleManager.LOG_TAG, "Error writing descriptor status=" + status);
|
|
472
477
|
}
|
|
473
478
|
|
|
474
479
|
registerNotifyCallback = null;
|