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

Copy Markdown View Source

A Time Value is the atomic (time, value) pair used inside BACnet.Protocol.DailySchedule entries. It says: "at (or after) this time, the scheduled property should take on this value".

The value is stored as a raw ApplicationTags.Encoding so it can carry any datatype the target property accepts (real, enumerated, boolean, etc.).

BACnet Specification References

  • ASN.1 (Clause 21): BACnetTimeValue ::= SEQUENCE { time Time, value ABSTRACT-SYNTAX.&Type }
  • Used in BACnet.Protocol.DailySchedule.daySchedule and therefore in both normal weekly schedules and special-event overrides (Schedule object, Clause 12.24).

Examples (Doc Test)

iex> tv = %TimeValue{time: %BACnetTime{hour: 8, minute: 0, second: 0, hundredth: 0}, value: {:real, 22.5}}
iex> tv.value
{:real, 22.5}

See Also

Summary

Types

t()

(time, value) pair for schedules. value is generic ApplicationTags encoding.

Functions

Encodes a BACnet time value into BACnet application tags encoding.

Parses a BACnet time value from BACnet application tags encoding.

Validates whether the given time value is in form valid.

Types

t()

@type t() :: %BACnet.Protocol.TimeValue{
  time: BACnet.Protocol.BACnetTime.t(),
  value: BACnet.Protocol.ApplicationTags.Encoding.t()
}

(time, value) pair for schedules. value is generic ApplicationTags encoding.

Functions

encode(time_value, opts \\ [])

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

Encodes a BACnet time value into BACnet application tags encoding.

parse(tags)

Parses a BACnet time value from BACnet application tags encoding.

valid?(t)

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

Validates whether the given time value is in form valid.

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