diff --git a/PayfritBeacon/Provisioners/DXSmartProvisioner.swift b/PayfritBeacon/Provisioners/DXSmartProvisioner.swift index b6aa21b..02a5d95 100644 --- a/PayfritBeacon/Provisioners/DXSmartProvisioner.swift +++ b/PayfritBeacon/Provisioners/DXSmartProvisioner.swift @@ -448,10 +448,18 @@ extension DXSmartProvisioner: CBPeripheralDelegate { return } - // Handle write errors for command writes - if let error, let cont = responseContinuation { + // For command writes (FFE1/FFE2): the .withResponse write confirmation + // IS the ACK. Some commands (e.g. 0x61 Frame1_DevInfo) don't send a + // separate FFE1 notification, so we must resolve here on success too. + // If a notification also arrives later, responseContinuation will already + // be nil — harmless. + if let cont = responseContinuation { responseContinuation = nil - cont.resume(throwing: error) + if let error { + cont.resume(throwing: error) + } else { + cont.resume(returning: Data()) + } } } }