BACnet.Protocol.ResultFlags (bacstack v0.1.0-dev.1)

Copy Markdown View Source

BACnet Result Flags is a three-bit bit string returned by range-reading services (ReadRange, GetEventInformation, etc.) to describe the window of data that was actually returned.

Bit meanings (MSB first):

BitNameMeaning when TRUE
0FIRST_ITEMResponse contains the first (oldest) item of the requested range
1LAST_ITEMResponse contains the last (newest) item of the requested range
2MORE_ITEMSMore items matched but could not fit in this PDU / segment

The flags allow a client to know whether it has the beginning, the end, or is looking at a slice in the middle of a potentially large collection (trend-log buffer, alarm summary, event log, etc.).

BACnet Specification References

  • ASN.1 (Clause 21): BACnetResultFlags ::= BIT STRING { first-item (0), last-item (1), more-items (2) }
  • Primary services: ReadRange-ACK (15.8), GetEventInformation-ACK (13.11), and several alarm/event summary acknowledgments.

Examples (Doc Test)

iex> flags = %ResultFlags{first_item: true, last_item: false, more_items: true}
iex> flags.more_items
true

See Also

  • BACnet.Protocol.ReadRange

Summary

Types

t()

Three Boolean flags describing a partial result set (see module docs for bit positions).

Functions

Encodes a BACnet result flags into application tags encoding.

Creates from an application tag bitstring a result flags.

Parses a BACnet result flags from application tags encoding.

Creates an application tag bitstring from a result flags.

Validates whether the given result flags is in form valid.

Types

t()

@type t() :: %BACnet.Protocol.ResultFlags{
  first_item: boolean(),
  last_item: boolean(),
  more_items: boolean()
}

Three Boolean flags describing a partial result set (see module docs for bit positions).

Functions

encode(flags, opts \\ [])

@spec encode(t(), Keyword.t()) ::
  {:ok, BACnet.Protocol.ApplicationTags.encoding_list()} | {:error, term()}

Encodes a BACnet result flags into application tags encoding.

from_bitstring(bitstring)

@spec from_bitstring(tuple()) :: t()

Creates from an application tag bitstring a result flags.

parse(tags)

Parses a BACnet result flags from application tags encoding.

to_bitstring(t)

Creates an application tag bitstring from a result flags.

valid?(t)

@spec valid?(t()) :: boolean()

Validates whether the given result flags is in form valid.

It only validates the struct is valid as per type specification.