react-native-ble-manager 11.0.5 → 11.0.6
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.
|
@@ -419,8 +419,10 @@ public class Peripheral extends BluetoothGattCallback {
|
|
|
419
419
|
|
|
420
420
|
@Override
|
|
421
421
|
public void onCharacteristicChanged(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic) {
|
|
422
|
-
|
|
423
|
-
|
|
422
|
+
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU) {
|
|
423
|
+
super.onCharacteristicChanged(gatt, characteristic);
|
|
424
|
+
onCharacteristicChanged(gatt, characteristic, characteristic.getValue());
|
|
425
|
+
}
|
|
424
426
|
}
|
|
425
427
|
|
|
426
428
|
@Override
|
|
@@ -468,8 +470,10 @@ public class Peripheral extends BluetoothGattCallback {
|
|
|
468
470
|
|
|
469
471
|
@Override
|
|
470
472
|
public void onCharacteristicRead(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, int status) {
|
|
471
|
-
|
|
472
|
-
|
|
473
|
+
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU) {
|
|
474
|
+
super.onCharacteristicRead(gatt, characteristic, status);
|
|
475
|
+
onCharacteristicRead(gatt, characteristic, characteristic.getValue(), status);
|
|
476
|
+
}
|
|
473
477
|
}
|
|
474
478
|
@Override
|
|
475
479
|
public void onCharacteristicRead(@NonNull final BluetoothGatt gatt,
|
package/ios/BleManager.swift
CHANGED
|
@@ -686,7 +686,7 @@ class BleManager: RCTEventEmitter, CBCentralManagerDelegate, CBPeripheralDelegat
|
|
|
686
686
|
}
|
|
687
687
|
|
|
688
688
|
@objc func getMaximumWriteValueLengthForWithResponse(_ peripheralUUID: String,
|
|
689
|
-
|
|
689
|
+
callback: @escaping RCTResponseSenderBlock) {
|
|
690
690
|
NSLog("getMaximumWriteValueLengthForWithResponse")
|
|
691
691
|
|
|
692
692
|
guard let peripheral = peripherals[peripheralUUID] else {
|
|
@@ -717,7 +717,7 @@ class BleManager: RCTEventEmitter, CBCentralManagerDelegate, CBPeripheralDelegat
|
|
|
717
717
|
}
|
|
718
718
|
}
|
|
719
719
|
}
|
|
720
|
-
|
|
720
|
+
|
|
721
721
|
|
|
722
722
|
func centralManager(_ central: CBCentralManager,
|
|
723
723
|
didConnect peripheral: CBPeripheral) {
|
|
@@ -1072,41 +1072,43 @@ class BleManager: RCTEventEmitter, CBCentralManagerDelegate, CBPeripheralDelegat
|
|
|
1072
1072
|
"code": error._code
|
|
1073
1073
|
])
|
|
1074
1074
|
}
|
|
1075
|
+
} else {
|
|
1076
|
+
if hasListeners {
|
|
1077
|
+
sendEvent(withName: "BleManagerDidUpdateNotificationStateFor", body: [
|
|
1078
|
+
"peripheral": peripheral.uuidAsString(),
|
|
1079
|
+
"characteristic": characteristic.uuid.uuidString.lowercased(),
|
|
1080
|
+
"isNotifying": characteristic.isNotifying
|
|
1081
|
+
])
|
|
1082
|
+
}
|
|
1075
1083
|
}
|
|
1076
1084
|
|
|
1077
1085
|
let key = Helper.key(forPeripheral: peripheral, andCharacteristic: characteristic)
|
|
1078
1086
|
|
|
1079
|
-
if
|
|
1087
|
+
if let error = error {
|
|
1080
1088
|
if notificationCallbacks[key] != nil {
|
|
1081
|
-
|
|
1082
|
-
invokeAndClearDictionary(¬ificationCallbacks, withKey: key, usingParameters: [error])
|
|
1083
|
-
} else {
|
|
1084
|
-
if BleManager.verboseLogging {
|
|
1085
|
-
NSLog("Notification began on \(characteristic.uuid)")
|
|
1086
|
-
}
|
|
1087
|
-
invokeAndClearDictionary(¬ificationCallbacks, withKey: key, usingParameters: [])
|
|
1088
|
-
}
|
|
1089
|
+
invokeAndClearDictionary(¬ificationCallbacks, withKey: key, usingParameters: [error])
|
|
1089
1090
|
}
|
|
1090
|
-
} else {
|
|
1091
|
-
// Notification has stopped
|
|
1092
1091
|
if stopNotificationCallbacks[key] != nil {
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1092
|
+
invokeAndClearDictionary(&stopNotificationCallbacks, withKey: key, usingParameters: [error])
|
|
1093
|
+
}
|
|
1094
|
+
} else {
|
|
1095
|
+
if characteristic.isNotifying {
|
|
1096
|
+
if BleManager.verboseLogging {
|
|
1097
|
+
NSLog("Notification began on \(characteristic.uuid)")
|
|
1098
|
+
}
|
|
1099
|
+
if notificationCallbacks[key] != nil {
|
|
1100
|
+
invokeAndClearDictionary(¬ificationCallbacks, withKey: key, usingParameters: [])
|
|
1101
|
+
}
|
|
1102
|
+
} else {
|
|
1103
|
+
// Notification has stopped
|
|
1104
|
+
if BleManager.verboseLogging {
|
|
1105
|
+
NSLog("Notification ended on \(characteristic.uuid)")
|
|
1106
|
+
}
|
|
1107
|
+
if stopNotificationCallbacks[key] != nil {
|
|
1099
1108
|
invokeAndClearDictionary(&stopNotificationCallbacks, withKey: key, usingParameters: [])
|
|
1100
1109
|
}
|
|
1101
1110
|
}
|
|
1102
1111
|
}
|
|
1103
|
-
if hasListeners {
|
|
1104
|
-
sendEvent(withName: "BleManagerDidUpdateNotificationStateFor", body: [
|
|
1105
|
-
"peripheral": peripheral.uuidAsString(),
|
|
1106
|
-
"characteristic": characteristic.uuid.uuidString.lowercased(),
|
|
1107
|
-
"isNotifying": characteristic.isNotifying
|
|
1108
|
-
])
|
|
1109
|
-
}
|
|
1110
1112
|
}
|
|
1111
1113
|
|
|
1112
1114
|
func peripheral(_ peripheral: CBPeripheral,
|