import Foundation /** A result from sending a key to the device. */ enum KeyResult: UInt8 { /// No result from the device, or state not applicable case none = 0 /// Text content was received, although binary data was expected case textReceived = 1 /// A socket event on the device was unexpected (not binary data) case unexpectedSocketEvent = 2 /// The size of the payload (key id + key data) was invalid case invalidPayloadSize = 3 /// The index of the key was out of bounds case invalidKeyIndex = 4 /// The transmitted key data did not match the expected key case invalidKey = 5 /// The key has been previously used and is no longer valid case keyAlreadyUsed = 6 /// A later key has been used, invalidating this key (to prevent replay attacks after blocked communication) case keyWasSkipped = 7 /// The key was accepted by the device, and the door will be opened case keyAccepted = 8 /// The device produced an unknown error case uknownDeviceError = 9 /// The device is not connected through the socket case notConnected = 10 /// The request did not contain body data with the key case noBodyData = 11 /// The body data could not be read case corruptkeyData = 12 /// The device is not connected case deviceNotConnected = 13 /// The device did not respond within the timeout case deviceTimedOut = 14 /// The key was valid and the door will be opened case success = 15 }