A Recipient identifies the target of an event notification or a COV notification. It is a CHOICE between either a specific device (identified by its Device object identifier) or a network address (which may be a unicast address, a broadcast address, or a remote network broadcast).
The distinction is important for event distribution. When a Notification Class object is configured with a device identifier as the recipient, it will automatically resolve the current network address of that device before sending the notification. When an address is configured directly, the notification is sent to that exact address without any resolution step. This gives system designers flexibility between robust "follow the device" addressing and lightweight "send to this fixed location" addressing.
BACnet Specification References
- ASN.1 (Clause 21):
BACnetRecipient ::= CHOICE { device [0] BACnetObjectIdentifier, address [1] BACnetAddress } - Combined with
BACnet.Protocol.Destination(valid days, time window, transitions, etc.) inside Notification Classrecipient_list.
Examples (Doc Test)
iex> recipient = %Recipient{type: :device, device: %ObjectIdentifier{type: :device, instance: 123}, address: nil}
iex> recipient.type
:device
Summary
Types
Represents a BACnet notification recipient, which can be either a specific device (identified by its Device object identifier) or a raw network address.
Functions
Encodes a BACnet recipient into application tags encoding.
Decodes the given application tags encoding into a BACnet recipient.
Validates whether the given BACnet recipient is in form valid.
Types
@type t() :: %BACnet.Protocol.Recipient{ address: BACnet.Protocol.RecipientAddress.t() | nil, device: BACnet.Protocol.ObjectIdentifier.t() | nil, type: :address | :device }
Represents a BACnet notification recipient, which can be either a specific device (identified by its Device object identifier) or a raw network address.
Functions
@spec encode(t(), Keyword.t()) :: {:ok, BACnet.Protocol.ApplicationTags.encoding_list()} | {:error, term()}
Encodes a BACnet recipient into application tags encoding.
@spec parse(BACnet.Protocol.ApplicationTags.encoding_list()) :: {:ok, {t(), rest :: BACnet.Protocol.ApplicationTags.encoding_list()}} | {:error, term()}
Decodes the given application tags encoding into a BACnet recipient.
Validates whether the given BACnet recipient is in form valid.
It only validates the struct is valid as per type specification.