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

Copy Markdown View Source

Property Value packages a property reference (identifier + optional array index) together with the value to be written (or that was read). It is the basic payload element inside WritePropertyMultiple, ReadPropertyMultiple results, and several action / event parameter structures.

The optional priority field is only meaningful when the target property is commandable. If omitted on a write, the device uses the default priority defined for that object type (usually 8 for many objects).

BACnet Specification References

Examples (Doc Test)

iex> pv = %PropertyValue{
...>   property_identifier: :present_value,
...>   property_array_index: nil,
...>   property_value: {:real, 42.5},
...>   priority: 8
...> }
iex> pv.priority
8

See Also

Summary

Types

t()

(property id + optional array index + value + optional priority) tuple used in WritePropertyMultiple and several action/event structures.

Functions

Encodes a BACnet property value into application tags encoding.

Encode a list of property values into application tag-encoded property values.

Parse application tag-encoded property value into a struct.

Parse application tag-encoded property values into a list of structs.

Validates whether the given property value is in form valid.

Types

t()

@type t() :: %BACnet.Protocol.PropertyValue{
  priority: 1..16 | nil,
  property_array_index: non_neg_integer() | nil,
  property_identifier:
    BACnet.Protocol.Constants.property_identifier() | non_neg_integer(),
  property_value:
    BACnet.Protocol.ApplicationTags.Encoding.t()
    | [BACnet.Protocol.ApplicationTags.Encoding.t()]
}

(property id + optional array index + value + optional priority) tuple used in WritePropertyMultiple and several action/event structures.

Functions

encode(property, opts \\ [])

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

Encodes a BACnet property value into application tags encoding.

encode_all(properties, opts \\ [])

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

Encode a list of property values into application tag-encoded property values.

parse(tags)

Parse application tag-encoded property value into a struct.

parse_all(tags)

@spec parse_all(BACnet.Protocol.ApplicationTags.encoding_list()) ::
  {:ok, [t()]} | {:error, term()}

Parse application tag-encoded property values into a list of structs.

valid?(t)

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

Validates whether the given property value is in form valid.

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