diff --git a/Source/GridSolutionsFramework.sln.DotSettings b/Source/GridSolutionsFramework.sln.DotSettings index c24071f8a6..a1392a4175 100644 --- a/Source/GridSolutionsFramework.sln.DotSettings +++ b/Source/GridSolutionsFramework.sln.DotSettings @@ -524,6 +524,7 @@ True True True + True True True True diff --git a/Source/Libraries/GSF.TimeSeries/BufferBlockMeasurement.cs b/Source/Libraries/GSF.TimeSeries/BufferBlockMeasurement.cs index 86f925314e..c6fd930bf6 100755 --- a/Source/Libraries/GSF.TimeSeries/BufferBlockMeasurement.cs +++ b/Source/Libraries/GSF.TimeSeries/BufferBlockMeasurement.cs @@ -23,57 +23,91 @@ using System; -namespace GSF.TimeSeries +namespace GSF.TimeSeries; + +/// +/// Represents a byte buffer that can be transported through the system as a . +/// +public class BufferBlockMeasurement : Measurement { + #region [ Constructors ] + /// - /// Represents a byte buffer that can be transported through the system as a . + /// Creates a new . /// - public class BufferBlockMeasurement : Measurement + public BufferBlockMeasurement() { - #region [ Constructors ] + Value = double.NaN; // Value of measurement should be indeterminate since this a buffer + } - /// - /// Creates a new . - /// - public BufferBlockMeasurement() => - Value = double.NaN; // Value of measurement should be indeterminate since this a buffer + /// + /// Creates a new from an existing buffer. + /// + /// Source buffer. + /// Start index of valid data in source buffer. + /// Valid length of source buffer. + /// is null. + /// + /// or is less than 0 -or- + /// and will exceed length. + /// + public BufferBlockMeasurement(byte[] buffer, int startIndex, int length) : this() + { + // Validate buffer parameters + buffer.ValidateParameters(startIndex, length); - /// - /// Creates a new from an existing buffer. - /// - /// is null. - /// - /// or is less than 0 -or- - /// and will exceed length. - /// - public BufferBlockMeasurement(byte[] buffer, int startIndex, int length) - : this() - { - // Validate buffer parameters - buffer.ValidateParameters(startIndex, length); + // We don't hold on to source buffer (we don't own it), so we instantiate a new one + Buffer = new byte[length]; - // We don't hold on to source buffer (we don't own it), so we instantiate a new one - Buffer = new byte[length]; + // Copy buffer contents onto our local buffer + System.Buffer.BlockCopy(buffer, startIndex, Buffer, 0, length); + Length = length; + } - // Copy buffer contents onto our local buffer - System.Buffer.BlockCopy(buffer, startIndex, Buffer, 0, length); - Length = length; - } + #endregion - #endregion + #region [ Properties ] - #region [ Properties ] + /// + /// Cached buffer image. + /// + public byte[] Buffer { get; } - /// - /// Cached buffer image. - /// - public byte[] Buffer { get; } + /// + /// Valid length of cached buffer image. + /// + public int Length { get; } + + /// + /// Gets or sets a value indicating whether reception of this buffer block must be acknowledged + /// by the subscriber with a ConfirmBufferBlock command. + /// + /// + /// + /// Maps to IEEE Std 2664-2024 Table 8 bit 0x01 (REQUIRE CONFIRMATION) on the wire. + /// Default value is true, preserving STTP's traditional retransmission semantics where + /// the publisher caches each buffer block until acknowledged and retransmits on timeout. + /// + /// + /// When set to false, the buffer block is fire-and-forget: no retransmission cache entry + /// is added, the retransmission timer is not (re)started, and the subscriber does not emit a + /// confirmation. Useful for high-rate buffer-block streams over reliable transports (TCP) + /// where the round-trip acknowledgement overhead is unnecessary. + /// + /// + public bool RequireConfirmation { get; set; } = true; - /// - /// Valid length of cached buffer image. - /// - public int Length { get; } + /// + /// Gets or sets the raw buffer-block flag byte as it appeared on the wire (IEEE Std 2664-2024 + /// Table 8). On receive, this carries the publisher's full intent (REQUIRE CONFIRMATION, + /// COMPRESSED, CACHE INDEX, etc.); on send, this field is unused by the wire codec - the codec + /// constructs the byte from and other per-block state. + /// + /// + /// Stored as a raw so this assembly need not take a dependency on the STTP + /// flag enum. Cast to BufferBlockFlags at the call site if structured inspection is needed. + /// + public byte Flags { get; set; } - #endregion - } + #endregion } \ No newline at end of file