BACnet.Protocol.Services.SubscribeCovProperty (bacstack v0.1.0-dev.1)

Copy Markdown View Source

This module represents the BACnet Subscribe COV Property service.

The Subscribe COV Property service is used to get subscribe to changes for a particular property of an object.

Service Description (ASHRAE 135)

The SubscribeCOVProperty service is used by a COV-client to subscribe for the receipt of notifications of changes that may occur to the properties of a particular object. Any object may optionally support COV reporting. If a standard object provides COV reporting, then changes of value of subscribed-to properties of the object, in some cases based on programmable increments, trigger COV notifications to be sent to one or more subscriber clients. Typically, COV notifications are sent to supervisory programs in BACnet client devices or to operators or logging devices. The subscription establishes a connection between the change of value detection and reporting mechanism within the COVserver device and a "process" within the COV-client device. Notifications of changes are issued by the COV-server device when changes occur after the subscription has been established. The ConfirmedCOVNotification and UnconfirmedCOVNotification services are used by the COV-server device to convey change notifications. The choice of confirmed or unconfirmed service is made at the time the subscription is established. Any object, proprietary or standard, may support COV reporting for any property at the implementor's option. The SubscribeCOVProperty service differs from the SubscribeCOV service in that it allows monitoring of properties other than those listed in Table 13-1.

Service Procedure (ASHRAE 135)

The absence of the 'Lifetime' and 'Issue Confirmed Notifications' indicates that the request is a cancellation. Any COV context that already exists for the same BACnet address contained in the PDU that carries the SubscribeCOVProperty request and has the same 'Subscriber Process Identifier', 'Monitored Object Identifier' and 'Monitored Property Identifier' shall be disabled and a 'Result(+)' returned. Cancellations that are issued for which no matching COV context can be found shall succeed as if a context had existed, returning 'Result(+)'. If an existing COV context is found, it shall be removed from the Active_COV_Subscriptions property in the Device object. If the 'Issue Confirmed Notifications' parameter is present but the property to be monitored does not support COV reporting, then a 'Result(-)' shall be returned. If the property to be monitored does support COV reporting, then a check shall be made to locate an existing COV context for the same BACnet address contained in the PDU that carries the SubscribeCOVProperty request and has the same 'Subscriber Process Identifier', 'Monitored Object Identifier' and 'Monitored Property Identifier'. If an existing COV context is found, then the request shall be considered a re-subscription and shall succeed as if the subscription had been newly created. If no COV context can be found that matches the request, then a new COV context shall be established that contains the BACnet address from the PDU that carries the SubscribeCOVProperty request and the same 'Subscriber Process Identifier', 'Monitored Object Identifier' and 'Monitored Property Identifier'. The new context shall be included in the Active_COV_Subscriptions property of the Device object. If no context can be created, then a 'Result(-)' shall be returned. If a new context is created, or a re-subscription is received, then the COV context shall be initialized and given a lifetime as specified by the 'Lifetime' parameter. The subscription shall be automatically cancelled after that many seconds have elapsed unless a re-subscription is received. A 'Result(+)' shall be returned and a ConfirmedCOVNotification or UnconfirmedCOVNotification shall be issued as soon as possible after the successful completion of a subscription or re-subscription request, as specified by the 'Issue Confirmed Notifications' parameter.

Result(+) Response (ASHRAE 135)

On success, a 'Result(+)' primitive is returned. Additionally, if this is a new subscription or re-subscription, a ConfirmedCOVNotification or UnconfirmedCOVNotification (as requested) is issued as soon as possible containing the current property value.

Result(-) Errors (ASHRAE 135)

The 'Result(-)' parameter shall indicate that the service request has failed. The reason for failure shall be specified by the 'Error Type' parameter.

The 'Error Class' and 'Error Code' to be returned for specific situations follow the same pattern as SubscribeCOV, with additional cases related to the 'Monitored Property Identifier' (standard property access errors per Clause 18).

Summary

Types

t()

Parameters for the Subscribe COV Property service.

Functions

Whether the service is of type confirmed or unconfirmed.

Converts the given Confirmed Service Request into a Subscribe COV Property Service.

Get the service name atom.

Get the Confirmed Service request for the given Subscribe COV Property Service.

Types

t()

@type t() :: %BACnet.Protocol.Services.SubscribeCovProperty{
  cov_increment: float() | nil,
  issue_confirmed_notifications: boolean() | nil,
  lifetime: non_neg_integer() | nil,
  monitored_object: BACnet.Protocol.ObjectIdentifier.t(),
  monitored_property: BACnet.Protocol.PropertyRef.t(),
  process_identifier: BACnet.Protocol.ApplicationTags.unsigned32()
}

Parameters for the Subscribe COV Property service.

Subscribes (or unsubscribes when lifetime and issue_confirmed_notifications are nil) for Change-Of-Value notifications on one specific property of an object, with optional COV increment for analog values and lifetime.

If issue_confirmed_notifications and lifetime are nil, then this is a cancellation of a COV subscription.

Functions

confirmed?()

@spec confirmed?() :: true

Whether the service is of type confirmed or unconfirmed.

from_apdu(request)

@spec from_apdu(BACnet.Protocol.APDU.ConfirmedServiceRequest.t()) ::
  {:ok, t()} | {:error, term()}

Converts the given Confirmed Service Request into a Subscribe COV Property Service.

get_name()

@spec get_name() :: atom()

Get the service name atom.

to_apdu(service, request_data)

@spec to_apdu(t(), Keyword.t()) ::
  {:ok, BACnet.Protocol.APDU.ConfirmedServiceRequest.t()} | {:error, term()}

Get the Confirmed Service request for the given Subscribe COV Property Service.

See the BACnet.Protocol.Services.Protocol function documentation for more information.