Add SendAndReceiveRaw

This commit is contained in:
2020-11-24 15:53:29 +01:00
parent 93dacbbaa6
commit 8b95d4b89d

View File

@@ -102,6 +102,13 @@ namespace WaveshareUARTFingerprintSensor
return (buffer[2], buffer[3], (ResponseType)buffer[4]);
}
private (byte first, byte second, byte third) SendAndReceiveRaw(CommandType commandType, byte first, byte second, byte third, int timeout = DefaultTimeout)
{
(byte f, byte s, ResponseType response) = SendAndReceive(commandType, first, second, third, timeout);
return (f, s, (byte)response);
}
private bool TrySendAndReceive(CommandType commandType, byte first, byte second, byte third, out (byte first, byte second, ResponseType responseType) response, int timeout = DefaultTimeout)
{
try
@@ -118,6 +125,21 @@ namespace WaveshareUARTFingerprintSensor
return true;
}
private bool TrySendAndReceiveRaw(CommandType commandType, byte first, byte second, byte third, out (byte first, byte second, byte third) response, int timeout = DefaultTimeout)
{
try
{
response = SendAndReceiveRaw(commandType, first, second, third, timeout);
}
catch (Exception)
{
response = default;
return false;
}
return true;
}
public bool TryGetUserCount(out ushort count)
{