BACnet.Protocol.AccessSpecification.Property (bacstack v0.1.0-dev.1)

Copy Markdown View Source

Represents one property entry inside an Access Specification.

When used for reading (Read Property Multiple), the property_value field is nil and the structure simply names which property (and optional array index) should be returned. When used for writing (Write Property Multiple), the property_value field carries the new value to be written.

The Property submodule is deliberately kept small and reusable so that the same type can serve both the read and write paths of the multiple-property services without duplication.

Summary

Types

t()

A single property reference (with optional value for writes) inside an Access Specification.

Functions

Encodes a BACnet Read/Write Access Specification Property into BACnet application tags encoding.

Parses a BACnet Read/Write Access Specification Property from BACnet application tags encoding.

Validates whether the given access specification property is in form valid.

Types

t()

@type t() :: %BACnet.Protocol.AccessSpecification.Property{
  property_array_index: non_neg_integer() | nil,
  property_identifier:
    BACnet.Protocol.Constants.property_identifier() | non_neg_integer(),
  property_value: BACnet.Protocol.ApplicationTags.Encoding.t() | nil
}

A single property reference (with optional value for writes) inside an Access Specification.

Functions

encode(property, opts \\ [])

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

Encodes a BACnet Read/Write Access Specification Property into BACnet application tags encoding.

parse(tags)

@spec parse(BACnet.Protocol.ApplicationTags.encoding_list()) ::
  {:ok,
   {t() | :all | :required | :optional,
    rest :: BACnet.Protocol.ApplicationTags.encoding_list()}}
  | {:error, term()}

Parses a BACnet Read/Write Access Specification Property from BACnet application tags encoding.

valid?(t)

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

Validates whether the given access specification property is in form valid.

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

Be aware, this function does not know whether it is a read or write access specification, thus it can't verify if the special property identifiers (atoms) are as per BACnet specification. Only read supports the special property identifiers.