OSDP.Net 5.2.1
A .NET library for implementing the Open Supervised Device Protocol (OSDP)
Loading...
Searching...
No Matches
BiometricReadResult.cs
1using System;
2using System.Linq;
3using System.Text;
6
8{
12 public class BiometricReadResult
13 {
17 private BiometricReadResult()
18 {
19 }
20
24 public byte ReaderNumber { get; private set; }
25
29 public BiometricStatus Status { get; private set; }
30
34 public BiometricType Type { get; private set; }
35
39 public byte Quality { get; private set; }
40
44 public short Length { get; private set; }
45
49 public byte[] TemplateData { get; private set; }
50
55 internal static BiometricReadResult ParseData(ReadOnlySpan<byte> data)
56 {
57 var dataArray = data.ToArray();
58
59 var biometricResult = new BiometricReadResult
60 {
61 ReaderNumber = dataArray[0],
62 Status = typeof(BiometricStatus).IsEnumDefined((int)data[1])
63 ? (BiometricStatus)data[1]
64 : BiometricStatus.UnknownError,
65 Type = (BiometricType)dataArray[2],
66 Quality = dataArray[3],
67 Length = Message.ConvertBytesToShort(dataArray.Skip(4).Take(2).ToArray(), true),
68 TemplateData = dataArray.Skip(6).ToArray()
69 };
70
71 return biometricResult;
72 }
73
75 public override string ToString()
76 {
77 var build = new StringBuilder();
78 build.AppendLine($"Reader Number: {ReaderNumber}");
79 build.AppendLine($" Status: {Status}");
80 build.AppendLine($" Type: {Type}");
81 build.AppendLine($" Quality: {Quality}");
82 build.AppendLine($" Length: {Length}");
83
84 return build.ToString();
85 }
86 }
87}
A base message class for sending or replying.
Definition Message.cs:12
BiometricStatus Status
Gets the results of the PD performing the biometric scan.
BiometricType Type
Gets the type/body part that was scanned.
byte Quality
The scan quality with 0x00 as worse and 0x99 as best.
byte ReaderNumber
Gets the reader number 0=First Reader 1=Second Reader.
BiometricType
The body part that is to be scanned.
BiometricStatus
Results of the biometric scanning.