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

Copy Markdown View Source

BACnet fault parameters configure the conditions under which an object should report a FAULT event state (as opposed to NORMAL or OFFNORMAL).

Fault algorithms are separate from event algorithms. While event algorithms detect alarm conditions, fault algorithms detect problems with the reliability of the input data or the object itself (e.g. sensor failure, out-of-range values that indicate hardware problems, etc.).

This module provides encoding and parsing for all supported fault parameter types. The individual modules under this namespace contain the fields for each specific fault detection algorithm.

Examples

# Fault out of range (common)
iex> %FaultParameters.FaultCharacterString{
...>   fault_values: ["hello"]
...> }

# Fault extended (vendor specific)
iex> %FaultParameters.FaultExtended{
...>   vendor_id: 42,
...>   extended_fault_type: 1,
...>   parameters: []
...> }

Summary

Types

Possible BACnet fault parameters.

Functions

Encodes a fault parameter variant into BACnet application tag encoding.

Parses a constructed application tag into the corresponding fault parameter struct. The inverse of encode/2.

Validates whether the given fault parameter is in form valid.

Types

Functions

encode(fault_params, opts \\ [])

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

Encodes a fault parameter variant into BACnet application tag encoding.

Used when configuring objects that support fault detection or when building event enrollment records that include fault parameters.

parse(fault_values_tag)

@spec parse(binary()) :: {:ok, fault_parameter()} | {:error, term()}

Parses a constructed application tag into the corresponding fault parameter struct. The inverse of encode/2.

valid?(t)

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

Validates whether the given fault parameter is in form valid.

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