|
OSDP.Net 5.2.1
A .NET library for implementing the Open Supervised Device Protocol (OSDP)
|
Buffers incoming OSDP data from a stream and extracts complete packets. More...
Public Member Functions | |
| PacketBuffer () | |
| Creates a new PacketBuffer with the default buffer size (4096 bytes). | |
| PacketBuffer (int bufferSize) | |
| Creates a new PacketBuffer with a specified buffer size. | |
| bool | TryExtractPacket (out byte[]? packet) |
| Attempts to extract a complete OSDP packet from the buffer. | |
| void | Append (byte[] data, int count) |
| Appends data to the buffer. | |
| void | Clear () |
| Clears all data from the buffer. | |
Properties | |
| int | Length [get] |
| Gets the number of bytes currently in the buffer. | |
Buffers incoming OSDP data from a stream and extracts complete packets.
Use this for passive monitoring or any scenario where serial/TCP data arrives in fragments that need to be reassembled into complete OSDP packets.
Definition at line 13 of file PacketBuffer.cs.
|
inline |
Creates a new PacketBuffer with the default buffer size (4096 bytes).
Definition at line 25 of file PacketBuffer.cs.
|
inline |
Creates a new PacketBuffer with a specified buffer size.
| bufferSize | The size of the internal buffer in bytes. |
Definition at line 33 of file PacketBuffer.cs.
|
inline |
Appends data to the buffer.
| data | The data to append. |
| count | The number of bytes to append from the data array. |
Definition at line 95 of file PacketBuffer.cs.
References OSDP.Net.Messages.Message.StartOfMessage.
|
inline |
Clears all data from the buffer.
Definition at line 119 of file PacketBuffer.cs.
|
inline |
Attempts to extract a complete OSDP packet from the buffer.
| packet | When successful, contains the extracted packet bytes. |
Definition at line 43 of file PacketBuffer.cs.
References OSDP.Net.Messages.Message.StartOfMessage.
|
get |
Gets the number of bytes currently in the buffer.
Definition at line 127 of file PacketBuffer.cs.