OSDP.Net 5.2.1
A .NET library for implementing the Open Supervised Device Protocol (OSDP)
Loading...
Searching...
No Matches
ACUReceiveSize.cs
1using System;
2using System.Text;
5
7
12{
14 public ACUReceiveSize(ushort maximumReceiveSize)
15 {
16 MaximumReceiveSize = maximumReceiveSize;
17 }
18
22 public ushort MaximumReceiveSize { get; }
23
25 public override CommandType CommandType => CommandType.MaxReplySize;
26
28 public override byte Code => (byte)CommandType;
29
31 public override ReadOnlySpan<byte> SecurityControlBlock() => SecurityBlock.CommandMessageWithDataSecurity;
32
34 public override byte[] BuildData()
35 {
36 return Message.ConvertShortToBytes(MaximumReceiveSize);
37 }
38
42 public static ACUReceiveSize ParseData(ReadOnlySpan<byte> data)
43 {
44 return new ACUReceiveSize(Message.ConvertBytesToUnsignedShort(data));
45 }
46
48 public override string ToString()
49 {
50 var sb = new StringBuilder();
51 sb.AppendLine($"Max Receive Size: {MaximumReceiveSize} bytes");
52 return sb.ToString();
53 }
54}
A base message class for sending or replying.
Definition Message.cs:12
Contains standard Security Control Block data that can be used when building messages.
override ReadOnlySpan< byte > SecurityControlBlock()
ushort MaximumReceiveSize
Gets the maximum message size the ACU can receive.
static ACUReceiveSize ParseData(ReadOnlySpan< byte > data)
Parses the message payload bytes.
ACUReceiveSize(ushort maximumReceiveSize)
Base class representing a payload of a PD command message.