OSDP.Net 5.2.1
A .NET library for implementing the Open Supervised Device Protocol (OSDP)
Loading...
Searching...
No Matches
ReaderStatus.cs
1using System;
2using System.Linq;
3using System.Text;
6
8{
13 {
19 {
20 ReaderTamperStatuses = statuses;
21 }
22
24 public override byte Code => (byte)ReplyType.ReaderStatusReport;
25
30
32 public override ReadOnlySpan<byte> SecurityControlBlock() => SecurityBlock.ReplyMessageWithDataSecurity;
33
37 internal static ReaderStatus ParseData(ReadOnlySpan<byte> data)
38 {
39 return new ReaderStatus(data.ToArray().Select(status => (ReaderTamperStatus) status).ToArray());
40 }
41
43 public override byte[] BuildData() => ReaderTamperStatuses.Select(x => (byte)x).ToArray();
44
46 public override string ToString()
47 {
48 byte readerNumber = 0;
49 var build = new StringBuilder();
50 foreach (var readerStatuses in ReaderTamperStatuses)
51 {
52 build.AppendLine($"Reader Number {readerNumber++:00}: {Helpers.SplitCamelCase(readerStatuses.ToString())}");
53 }
54
55 return build.ToString();
56 }
57 }
58}
Contains standard Security Control Block data that can be used when building messages.
Base class representing a payload an OSDP message.
Definition PayloadData.cs:9
override ReadOnlySpan< byte > SecurityControlBlock()
ReaderTamperStatus[] ReaderTamperStatuses
Gets the all the PDs reader statuses as an array ordered by reader number.
ReaderStatus(ReaderTamperStatus[] statuses)
Creates a new instance of ReaderStatus class.
ReplyType
Identifies the type of OSDP protocol reply (PD -> ACU) message.
Definition ReplyType.cs:7
ReaderTamperStatus
Possible states that the reader is currently reporting.