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

Copy Markdown View Source

Represents the result of a BVLC operation (BVLC function 0x00, BVLC-Result) in BACnet/IP (ASHRAE 135 Annex J.2.1). The single-byte result code indicates success or the reason for failure.

A BACnet.Protocol.BvlcResult is returned by a BBMD (or other BVLC responder) to acknowledge management requests that require a reply: Write-Broadcast-Distribution-Table, Register-Foreign-Device, Delete-Foreign-Device-Table-Entry, and the various Read-*-Table operations (the Read operations return an Ack PDU on success and a Result/NAK on failure).

BACnet Specification References

  • Annex J.2.1 defines the purpose of BVLC-Result.
  • J.2.1.1 gives the exact format (BVLC Type 0x81, Function 0x00, Length 0x0006, 2-octet Result Code) and the normative list of result codes.

Result Codes

Atom (in :bvlc_result_format)Value (hex)Meaning (from J.2.1.1)
:successful_completion0x0000The requested BVLC operation completed successfully
:write_broadcast_distribution_table_nak0x0010Write-Broadcast-Distribution-Table failed
:read_broadcast_distribution_table_nak0x0020Read-Broadcast-Distribution-Table failed
:register_foreign_device_nak0x0030Register-Foreign-Device failed (e.g. no room)
:read_foreign_device_table_nak0x0040Read-Foreign-Device-Table failed
:delete_foreign_device_table_entry_nak0x0050Delete-Foreign-Device-Table-Entry failed
:distribute_broadcast_to_network_nak0x0060Distribute-Broadcast-To-Network failed

Only the codes above are modelled. Unknown codes received on the wire produce {:error, {:unknown_result_code, value}} in BACnet.Protocol.decode_bvll/3.

Construction & Usage

The struct is deliberately minimal (one field) because the wire representation is only two octets. Typical construction for tests or when generating a response:

iex> alias BACnet.Protocol.{BvlcResult, Constants}
iex> require Constants
iex> res = %BvlcResult{
...>   result_code: Constants.macro_assert_name(:bvlc_result_format, :successful_completion)
...> }
iex> res.result_code
:successful_completion

In normal operation you rarely construct BACnet.Protocol.BvlcResult values yourself; they arrive via BACnet.Protocol.decode_bvll/3 when a remote device replies to a management request you (or the BBMD) sent. BACnet.Stack.BBMD interprets the code to decide whether a BDT/FDT update or foreign registration succeeded.

See Also

Summary

Types

t()

Represents the result of a BVLC operation (function code 0x00).

Types

t()

@type t() :: %BACnet.Protocol.BvlcResult{
  result_code: BACnet.Protocol.Constants.bvlc_result_format()
}

Represents the result of a BVLC operation (function code 0x00).

The result_code is taken from the :bvlc_result_format constants and directly mirrors the values defined in ASHRAE 135 Annex J.2.1.1.