A COV Subscription records that a particular client (identified by its Process Identifier and Recipient address) has asked to be notified whenever a specific property (or the entire object) changes value beyond a configured increment.
The structure stores the subscription parameters that the server must remember: the recipient address (which may be a local process or a remote device), the monitored property reference, the COV increment, the issue confirmed flag, and the lifetime of the subscription.
When the monitored value changes sufficiently, the server walks its subscription table and sends ConfirmedCOVNotification or UnconfirmedCOVNotification messages to every active subscriber. Proper management of these records (including automatic removal when the lifetime expires) is one of the more complex pieces of state that a BACnet server must maintain.
Examples (Doc Test)
iex> sub = %CovSubscription{
...> recipient: %Recipient{type: :device, device: %ObjectIdentifier{type: :device, instance: 100}, address: nil},
...> recipient_process: 1,
...> monitored_object_property: %ObjectPropertyRef{
...> object_identifier: %ObjectIdentifier{type: :analog_input, instance: 1},
...> property_identifier: :present_value,
...> property_array_index: nil
...> },
...> issue_confirmed_notifications: true,
...> time_remaining: 3600,
...> cov_increment: 0.5
...> }
iex> sub.time_remaining
3600
Summary
Functions
Encodes a COV subscription struct into BACnet application tags encoding.
Parses a BACnet COV subscription application tags encoding into a struct.
Validates whether the given COV subscription is in form valid.
Types
@type t() :: %BACnet.Protocol.CovSubscription{ cov_increment: float() | nil, issue_confirmed_notifications: boolean(), monitored_object_property: BACnet.Protocol.ObjectPropertyRef.t(), recipient: BACnet.Protocol.Recipient.t(), recipient_process: non_neg_integer(), time_remaining: non_neg_integer() }
Represents a Change of Value (COV) subscription.
Functions
@spec encode(t(), Keyword.t()) :: {:ok, BACnet.Protocol.ApplicationTags.encoding_list()} | {:error, term()}
Encodes a COV subscription struct into BACnet application tags encoding.
@spec parse(BACnet.Protocol.ApplicationTags.encoding_list()) :: {:ok, {t(), rest :: BACnet.Protocol.ApplicationTags.encoding_list()}} | {:error, term()}
Parses a BACnet COV subscription application tags encoding into a struct.
Validates whether the given COV subscription is in form valid.
It only validates the struct is valid as per type specification.