@@ -184,7 +184,7 @@ class BluetoothManager: NSObject, CBPeripheralDelegate, CBCentralManagerDelegate
184184
185185 // Check what kind of Write Type is supported. By default it will try Without Response.
186186 // 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
188188 let mtu = bluetoothPeripheral? . maximumWriteValueLength ( for: type) ?? 20
189189
190190 // The following code will split the text into packets
@@ -231,16 +231,16 @@ class BluetoothManager: NSObject, CBPeripheralDelegate, CBCentralManagerDelegate
231231
232232 // Check what kind of Write Type is supported. By default it will try Without Response.
233233 // 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
235235 let mtu = bluetoothPeripheral? . maximumWriteValueLength ( for: type) ?? 20
236236
237237 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 "
238240 data. forEach {
239241 self . bluetoothPeripheral!. writeValue ( $0, for: uartRXCharacteristic, type: type)
242+ log ( withLevel: . debug, andMessage: " peripheral.writeValue(0x \( $0. hexString) , for: \( uartRXCharacteristic. uuid. uuidString) , type: \( typeAsString) ) " )
240243 }
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) ) " )
244244 log ( withLevel: . application, andMessage: " Sent command: \( aCommand. title) " )
245245
246246 }
0 commit comments