Skip to content

Commit 6aee07b

Browse files
committed
Add canSendWriteWithoutResponse
1 parent db1abc3 commit 6aee07b

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/ios/BluetoothLePlugin.m

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2857,7 +2857,7 @@ - (void) peripheral:(CBPeripheral *)peripheral didReadRSSI:(NSNumber *)RSSI erro
28572857
[self.commandDelegate sendPluginResult:pluginResult callbackId:callback];
28582858
}
28592859

2860-
//Helpers for Callbacks
2860+
//This is called when peripheral is ready to accept more data when using write without response
28612861
- (void)peripheralIsReadyToSendWriteWithoutResponse:(CBPeripheral *)peripheral {
28622862
CBCharacteristic * const characteristic = currentWriteCharacteristic;
28632863
currentWriteCharacteristic = nil;
@@ -2894,6 +2894,7 @@ - (void)peripheralIsReadyToSendWriteWithoutResponse:(CBPeripheral *)peripheral {
28942894
}
28952895
}
28962896

2897+
//Helpers for Callbacks
28972898
- (NSMutableDictionary*) ensureCallback: (CBUUID *) characteristicUuid forConnection:(NSMutableDictionary*) connection {
28982899
//See if callback map exists for characteristic
28992900
NSMutableDictionary* characteristicCallbacks = [connection objectForKey:characteristicUuid];
@@ -3680,7 +3681,9 @@ - (void)writeDataToCharacteristic:(CBCharacteristic *)characteristic toPeriphera
36803681
self->currentWriteCharacteristic = characteristic;
36813682
}
36823683

3683-
[peripheral writeValue:data forCharacteristic:characteristic type:self->writeQtype];
3684+
if (peripheral.canSendWriteWithoutResponse) {
3685+
[peripheral writeValue:data forCharacteristic:characteristic type:self->writeQtype];
3686+
}
36843687
}
36853688

36863689
@end

0 commit comments

Comments
 (0)