Add logging

This commit is contained in:
Christoph Hagen 2023-08-08 16:06:41 +02:00
parent aad6e32082
commit a53c12b02c

View File

@ -65,10 +65,16 @@ struct DeviceResponse {
}
self.event = event
guard let data = buffer.getSlice(at: 1, length: Message.length) else {
log("\(request): Insufficient data received from device (expected \(Message.length + 1), got \(buffer.readableBytes))")
self.response = nil
return
}
self.response = Message(decodeFrom: data)
guard let message = Message(decodeFrom: data) else {
log("\(request): Failed to decode message received from device")
self.response = nil
return
}
self.response = message
}
/**