Update logic to async

This commit is contained in:
Christoph Hagen
2023-11-10 13:45:42 +01:00
parent b8c7256b9d
commit 9f20563877
4 changed files with 119 additions and 102 deletions

View File

@ -3,7 +3,7 @@ import Foundation
/**
A result from sending a key to the device.
*/
enum MessageResult: UInt8 {
enum MessageResult: UInt8, Error {
/// Text content was received, although binary data was expected
case textReceived = 1
@ -48,6 +48,8 @@ enum MessageResult: UInt8 {
case invalidUrlParameter = 20
case invalidResponseAuthentication = 21
case invalidDeviceResponse = 22
}
extension MessageResult: CustomStringConvertible {
@ -84,6 +86,8 @@ extension MessageResult: CustomStringConvertible {
return "The url parameter could not be found"
case .invalidResponseAuthentication:
return "The response could not be authenticated"
case .invalidDeviceResponse:
return "The device responded with invalid data"
}
}
}