BACnet.Protocol.APDU.SimpleACK (bacstack v0.1.0-dev.1)

Copy Markdown View Source

Simple ACK APDUs are the minimal successful reply to a confirmed service.

APDU Description (ASHRAE 135)

The BACnet-SimpleACK-PDU is used to convey the information contained in a positive service response primitive that contains no other information except that the service request was successfully carried out. (Clause 21)

They are sent when the requested operation completed successfully and the service definition does not require any data to be returned to the client. Typical examples:

  • WriteProperty
  • SubscribeCOV
  • AcknowledgeAlarm
  • DeviceCommunicationControl
  • ReinitializeDevice

A SimpleACK only carries the original invoke ID and the service choice. It has no payload.

This module implements the BACnet.Stack.EncoderProtocol.

Decoding is performed by BACnet.Protocol.APDU.decode/1 (and BACnet.Protocol.APDU.decode_simple_ack/1).

Examples

iex> ack = %SimpleACK{invoke_id: 70, service: :write_property}
iex> SimpleACK.encode(ack)
{:ok, <<32, 70, 15>>}

Decoding a SimpleACK from the wire:

iex> raw = <<0x20, 0x46, 0x0F>>
iex> BACnet.Protocol.APDU.decode(raw)
{:ok, %SimpleACK{invoke_id: 70, service: :write_property}}

Summary

Types

t()

Represents the Application Data Unit (APDU) Simple ACK.

Functions

Encodes the Simple ACK APDU into binary data.

Types

t()

@type t() :: %BACnet.Protocol.APDU.SimpleACK{
  invoke_id: 0..255,
  service:
    BACnet.Protocol.Constants.confirmed_service_choice() | non_neg_integer()
}

Represents the Application Data Unit (APDU) Simple ACK.

To allow forward compatibility, service is allowed to be an integer.

Functions

encode(apdu)

@spec encode(t()) :: {:ok, iodata()} | {:error, Exception.t()}

Encodes the Simple ACK APDU into binary data.