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

Copy Markdown View Source

This module represents the BACnet Who-Is service.

The Who-Is service is the primary discovery mechanism in BACnet. It allows a device or operator workstation to locate other devices on the local network or across a routed internetwork by asking devices to identify themselves.

Service Description (ASHRAE 135)

The Who-Is service is used by a sending BACnet-user to determine the device object identifier, the network address, or both, of other BACnet devices that share the same internetwork. The Who-Is service is an unconfirmed service. The Who-Is service may be used to determine the device object identifier and network addresses of all devices on the network, or to determine the network address of a specific device whose device object identifier is known, but whose address is not. The IAm service is also an unconfirmed service. The I-Am service is used to respond to Who-Is service requests. However, the IAm service request may be issued at any time. It does not need to be preceded by the receipt of a Who-Is service request. In particular, a device may wish to broadcast an I-Am service request when it powers up. The network address is derived either from the MAC address associated with the I-Am service request, if the device issuing the request is on the local network, or from the NPCI if the device is on a remote network.

A Who-Is can be broadcast with no parameters to discover every device, or it can be restricted by device instance range to locate a specific device when only its object identifier is known. Every responding device answers with an I-Am.

Service Procedure (ASHRAE 135)

The sending BACnet-user shall transmit the Who-Is unconfirmed request, normally using a broadcast address. If the 'Device Instance Range Low Limit' and 'Device Instance Range High Limit' parameters are omitted, then all receiving BACnet-users shall return their Device Object_Identifier in individual responses using the I-Am service. If the 'Device Instance Range Low Limit' and 'Device Instance Range High Limit' parameters are present, then only those receiving BACnet-users whose Device Object_Identifier instance number falls within the range 'Device Instance Range Low Limit' ≤ Device Object_Identifier Instance Number ≤ 'Device Instance Range High Limit' shall return their Device Object_Identifier using the I-Am service. If the receiving BACnet-user has a Slave_Proxy_Enable property and the Slave_Proxy_Enable for the receiving port is TRUE, then the BACnet-user shall respond with an I-Am unconfirmed request for each of the slave devices on the MS/TP network that are present in the Slave_Address_Binding property and that match the device range parameters.

Summary

Types

t()

Parameters for the Who-Is service (optional device instance range filters).

Functions

Whether the service is of type confirmed or unconfirmed.

Converts the given Unconfirmed Service Request into a Who-Is Service.

Get the service name atom.

Get the Unconfirmed Service request for the given Who-Is Service.

Types

t()

@type t() :: %BACnet.Protocol.Services.WhoIs{
  device_id_high_limit: non_neg_integer() | nil,
  device_id_low_limit: non_neg_integer() | nil
}

Parameters for the Who-Is service (optional device instance range filters).

Functions

confirmed?()

@spec confirmed?() :: false

Whether the service is of type confirmed or unconfirmed.

from_apdu(request)

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

Converts the given Unconfirmed Service Request into a Who-Is 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.UnconfirmedServiceRequest.t()} | {:error, term()}

Get the Unconfirmed Service request for the given Who-Is Service.

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