BACnet.Protocol.WeekNDay (bacstack v0.0.1)

View Source

Summary

Types

t()

Represents a BACnet Week And Day, which can have unspecified (= any) or even/odd values.

Functions

Encodes a BACnet week and day into application tags encoding.

Parses a BACnet week and day from application tags encoding.

Validates whether the given BACnet week and day is in form valid.

Types

t()

@type t() :: %BACnet.Protocol.WeekNDay{
  month: 1..12 | :even | :odd | :unspecified,
  week_of_month: 1..6 | :unspecified,
  weekday: 1..7 | :unspecified
}

Represents a BACnet Week And Day, which can have unspecified (= any) or even/odd values.

Week of month specifies which week of the month:

  • 1 - Days numbered 1-7
  • 2 - Days numbered 8-14
  • 3 - Days numbered 15-21
  • 4 - Days numbered 22-28
  • 5 - Days numbered 29-31
  • 6 - Last 7 days of this month

Weekday specifies the day of the week, starting with monday to sunday (1-7).

Functions

encode(week, opts \\ [])

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

Encodes a BACnet week and day into application tags encoding.

parse(tags)

Parses a BACnet week and day from application tags encoding.

valid?(t)

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

Validates whether the given BACnet week and day is in form valid.

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