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

Copy Markdown View Source

A Daily Schedule is a list of BACnet.Protocol.TimeValue pairs that define the desired behavior of a scheduled property for one 24-hour period. It is the fundamental building block of both the normal weekly_schedule (7 entries, one per BACnet.Protocol.DaysOfWeek) and the exception_schedule in Schedule objects.

Each TimeValue specifies the time at which the scheduled property should take on the given value (and keep it until the next entry or the end of the day).

BACnet Specification References

  • ASN.1 (Clause 21): BACnetDailySchedule ::= SEQUENCE { daySchedule SEQUENCE OF BACnetTimeValue }
  • Schedule object (12.24): weekly_schedule is a BACnetARRAY[7] of BACnet.Protocol.DailySchedule; exception_schedule is a list of BACnet.Protocol.SpecialEvent each containing a BACnet.Protocol.DailySchedule (in the list field).
  • Time values may be unspecified patterns in some contexts, but for normal schedule operation concrete times are expected.

Examples (Doc Test)

iex> schedule = %DailySchedule{
...>   schedule: [
...>     %TimeValue{time: %BACnetTime{hour: 8, minute: 0, second: 0, hundredth: 0}, value: {:real, 22.0}},
...>     %TimeValue{time: %BACnetTime{hour: 18, minute: 0, second: 0, hundredth: 0}, value: {:real, 18.0}}
...>   ]
...> }
iex> length(schedule.schedule)
2

See Also

Summary

Types

t()

One day's schedule: list of BACnet.Protocol.TimeValue (see BACnet.Protocol.DailySchedule module docs and Schedule object Clause 12.24).

Functions

Encode a BACnet daily schedule into application tag-encoded.

Parse a BACnet daily schedule from application tags encoding.

Validates whether the given daily schedule is in form valid.

Types

t()

@type t() :: %BACnet.Protocol.DailySchedule{schedule: [BACnet.Protocol.TimeValue.t()]}

One day's schedule: list of BACnet.Protocol.TimeValue (see BACnet.Protocol.DailySchedule module docs and Schedule object Clause 12.24).

Functions

encode(schedule, opts \\ [])

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

Encode a BACnet daily schedule into application tag-encoded.

parse(tags)

Parse a BACnet daily schedule from application tags encoding.

valid?(t)

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

Validates whether the given daily schedule is in form valid.

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