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_completion | 0x0000 | The requested BVLC operation completed successfully |
:write_broadcast_distribution_table_nak | 0x0010 | Write-Broadcast-Distribution-Table failed |
:read_broadcast_distribution_table_nak | 0x0020 | Read-Broadcast-Distribution-Table failed |
:register_foreign_device_nak | 0x0030 | Register-Foreign-Device failed (e.g. no room) |
:read_foreign_device_table_nak | 0x0040 | Read-Foreign-Device-Table failed |
:delete_foreign_device_table_entry_nak | 0x0050 | Delete-Foreign-Device-Table-Entry failed |
:distribute_broadcast_to_network_nak | 0x0060 | Distribute-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_completionIn 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
BACnet.Protocol- thedecode_bvll/3entry point that materialisesBACnet.Protocol.BvlcResultvaluesBACnet.Protocol.BvlcFunction- the management requests that produce these resultsBACnet.Stack.BBMD- main consumer that acts on success/NAK codesBACnet.Stack.ForeignDevice- also receives results for its registration and table-read requests
Summary
Types
@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.