A DeviceObjectRef points to an object, optionally qualified by the device that contains it. It is one of the most common reference types in the entire BACnet object model.
- When
device_identifieris present -> absolute reference (works across the BACnet internetwork). - When
device_identifierisnil-> the reference is local to the device holding the referring object.
This distinction matters for Schedule, Trend Log, Event Enrollment, Structured View, and many other objects that can reference data in remote devices.
BACnet Specification References
- ASN.1 (Clause 21):
BACnetDeviceObjectReference ::= SEQUENCE { deviceIdentifier [0] BACnetObjectIdentifier OPTIONAL, objectIdentifier [1] BACnetObjectIdentifier } - Used inside
BACnet.Protocol.ObjectPropertyRef,BACnet.Protocol.RecipientAddress, many event and fault parameters, Structured View, etc.
Examples (Doc Test)
iex> ref = %DeviceObjectRef{
...> device_identifier: nil,
...> object_identifier: %ObjectIdentifier{type: :analog_input, instance: 1}
...> }
iex> ref.object_identifier.instance
1
Summary
Functions
Encodes a BACnet device object reference into application tags encoding.
Parses a BACnet device object reference into a struct.
Validates whether the given device object reference is in form valid.
Types
@type t() :: %BACnet.Protocol.DeviceObjectRef{ device_identifier: BACnet.Protocol.ObjectIdentifier.t() | nil, object_identifier: BACnet.Protocol.ObjectIdentifier.t() }
References an object, optionally qualified by the device it resides in.
Functions
@spec encode(t(), Keyword.t()) :: {:ok, BACnet.Protocol.ApplicationTags.encoding_list()} | {:error, term()}
Encodes a BACnet device object reference into application tags encoding.
@spec parse(BACnet.Protocol.ApplicationTags.encoding_list()) :: {:ok, {t(), rest :: BACnet.Protocol.ApplicationTags.encoding_list()}} | {:error, term()}
Parses a BACnet device object reference into a struct.
Validates whether the given device object reference is in form valid.
It only validates the struct is valid as per type specification.