@@ -184,7 +184,7 @@ class BluetoothManager: NSObject, CBPeripheralDelegate, CBCentralManagerDelegate
184
184
185
185
// Check what kind of Write Type is supported. By default it will try Without Response.
186
186
// If the RX charactereisrtic have Write property the Write Request type will be used.
187
- let type : CBCharacteristicWriteType = uartRXCharacteristic. properties. contains ( . write ) ? . withResponse : . withoutResponse
187
+ let type : CBCharacteristicWriteType = uartRXCharacteristic. properties. contains ( . writeWithoutResponse ) ? . withoutResponse : . withResponse
188
188
let mtu = bluetoothPeripheral? . maximumWriteValueLength ( for: type) ?? 20
189
189
190
190
// The following code will split the text into packets
@@ -231,16 +231,16 @@ class BluetoothManager: NSObject, CBPeripheralDelegate, CBCentralManagerDelegate
231
231
232
232
// Check what kind of Write Type is supported. By default it will try Without Response.
233
233
// If the RX characteristic have Write property the Write Request type will be used.
234
- let type : CBCharacteristicWriteType = uartRXCharacteristic. properties. contains ( . write ) ? . withResponse : . withoutResponse
234
+ let type : CBCharacteristicWriteType = uartRXCharacteristic. properties. contains ( . writeWithoutResponse ) ? . withoutResponse : . withResponse
235
235
let mtu = bluetoothPeripheral? . maximumWriteValueLength ( for: type) ?? 20
236
236
237
237
let data = aCommand. data. split ( by: mtu)
238
+ log ( withLevel: . verbose, andMessage: " Writing to characteristic: \( uartRXCharacteristic. uuid. uuidString) " )
239
+ let typeAsString = type == . withoutResponse ? " .withoutResponse " : " .withResponse "
238
240
data. forEach {
239
241
self . bluetoothPeripheral!. writeValue ( $0, for: uartRXCharacteristic, type: type)
242
+ log ( withLevel: . debug, andMessage: " peripheral.writeValue(0x \( $0. hexString) , for: \( uartRXCharacteristic. uuid. uuidString) , type: \( typeAsString) ) " )
240
243
}
241
- log ( withLevel: . verbose, andMessage: " Writing to characteristic: \( uartRXCharacteristic. uuid. uuidString) " )
242
- let typeAsString = type == . withoutResponse ? " .withoutResponse " : " .withResponse "
243
- log ( withLevel: . debug, andMessage: " peripheral.writeValue(0x \( aCommand. data. hexString) , for: \( uartRXCharacteristic. uuid. uuidString) , type: \( typeAsString) ) " )
244
244
log ( withLevel: . application, andMessage: " Sent command: \( aCommand. title) " )
245
245
246
246
}
0 commit comments