OSDP.Net 5.2.1
A .NET library for implementing the Open Supervised Device Protocol (OSDP)
Loading...
Searching...
No Matches
CommandData.cs
1using System;
2using System.Collections.Generic;
4
6{
10 public abstract class CommandData : PayloadData
11 {
15 public abstract CommandType CommandType { get; }
16
25 protected static T[] SplitData<T>(int size, Func<byte[], T> parseDataFunction, ReadOnlySpan<byte> payloadData)
26 {
27 var data = new List<T>();
28 for (int index = 0; index + size <= payloadData.Length; index += size)
29 {
30 data.Add(parseDataFunction(payloadData.Slice(index, size).ToArray()));
31 }
32
33 return data.ToArray();
34 }
35 }
36}
Base class representing a payload of a PD command message.
CommandType CommandType
Message command code.
static T[] SplitData< T >(int size, Func< byte[], T > parseDataFunction, ReadOnlySpan< byte > payloadData)
Splits data into multiple elements of type T based on a specified size.
Base class representing a payload an OSDP message.
Definition PayloadData.cs:9