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

Copy Markdown View Source

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_identifier is present -> absolute reference (works across the BACnet internetwork).
  • When device_identifier is nil -> 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

Examples (Doc Test)

iex> ref = %DeviceObjectRef{
...>   device_identifier: nil,
...>   object_identifier: %ObjectIdentifier{type: :analog_input, instance: 1}
...> }
iex> ref.object_identifier.instance
1

Summary

Types

t()

References an object, optionally qualified by the device it resides in.

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

t()

@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

encode(ref, opts \\ [])

@spec encode(t(), Keyword.t()) ::
  {:ok, BACnet.Protocol.ApplicationTags.encoding_list()} | {:error, term()}

Encodes a BACnet device object reference into application tags encoding.

parse(tags)

Parses a BACnet device object reference into a struct.

valid?(t)

@spec valid?(t()) :: boolean()

Validates whether the given device object reference is in form valid.

It only validates the struct is valid as per type specification.