bacure.remote-device

advanced-property

(advanced-property property-value priority property-array-index)
Take a property and wrap it inside a map with the priority and
property-array-index.

all-extended-information

(all-extended-information)(all-extended-information local-device-id)
Make sure we have the extended information of every known
remote devices.

Can be used some time after the network discovery mechanism, as
some devices might take a while to answer the WhoIs.

Remote devices are queried in parallel.

cached-extended-information

(cached-extended-information device-id)(cached-extended-information local-device-id device-id)
Return the cached remote device extended information. Nil if we have nothing.

create-remote-object!

(create-remote-object! device-id object-map)(create-remote-object! local-device-id device-id object-map)
Send a 'create object request' to the remote device. Must be given
at least an :object-identifier OR an :object-type. If
an :object-identifier isn't given, the numbering of the new object
will be choosen by the remote device.

Will block until we receive a response back, success or failure.
If the request times out, an exception is thrown.

delete-remote-object!

(delete-remote-object! device-id object-identifier)(delete-remote-object! local-device-id device-id object-identifier)
Send a 'delete object' request to a remote device.

 Will block until we receive a response back, success or failure.
If the request times out, an exception is thrown.

discover-network

(discover-network)(discover-network local-device-id)(discover-network local-device-id tries)
Find remote devices and their extended info. By default, will try
up to 5 time if not a single device answer. Return the list of
remote-devices.

Should be called in a future call to avoid `hanging' the program
while waiting for the remote devices to answer.

extended-information

(extended-information device-id)(extended-information local-device-id device-id)
Return the device extended information that we have cached locally,
or request it directly to the remote device.

find-remote-device

(find-remote-device id)(find-remote-device local-device-id remote-device-id)
Send a WhoIs for a single device-id, effectively finding a single
device. Some devices seem to ignore a general WhoIs broadcast, but
will answer a WhoIs request specifically for their ID.

find-remote-devices

(find-remote-devices)(find-remote-devices {:keys [min-range max-range], :as args})(find-remote-devices local-device-id {:keys [min-range max-range]})
We find remote devices by sending a 'WhoIs' broadcast. Every device
that responds is added to the remote-devices field in the
local-device. WARNING: This won't ask the device if it supports
read-property-multiple. Thus, any property read based solely on this
remote device discovery might fail. The use of `discover-network' is
highly recommended, even if it might take a little longer to
execute.

is-alive?

(is-alive? device-id)(is-alive? local-device-id device-id)
Check if the remote device is still alive. This is the closest
thing to a 'ping' in the BACnet world.

networking-info

(networking-info device-id)(networking-info local-device-id device-id)
Return a map with the networking info of the remote device. (The
network number, the IP address, the port...)

rd

(rd device-id)(rd local-device-id device-id)
Get the remote device by its device-id

remote-devices

(remote-devices)(remote-devices local-device-id)
Return the list of the current remote devices. These devices must
be in the local table. To scan a network, use `discover-network'.

remote-devices-and-names

(remote-devices-and-names)(remote-devices-and-names local-device-id)
Return a list of vector pair with the device-id and its name.
-->  ([1234 "SimpleServer"])

retrieve-extended-information!

(retrieve-extended-information! device-id)(retrieve-extended-information! local-device-id device-id)
Retrieve the remote device extended information (name, segmentation,
property multiple, etc..) and update it locally.

Return the cached extended information.

segmentation-supported

(segmentation-supported device-id)(segmentation-supported local-device-id device-id)
Return the type of segmentatin supported.

services-supported

(services-supported device-id)(services-supported local-device-id device-id)
Return a map of the services supported by the remote device.

set-remote-properties!

(set-remote-properties! device-id write-access-specificiations)(set-remote-properties! local-device-id device-id write-access-specificiations)
Set the given remote object properties.

Will block until we receive a response back, success or failure.

'write-access-specificiations' is a map of the form:
{[:analog-input 1] [[:present-value 10.0][:description "short description"]]}

If the remote device doesn't support 'write-property-multiple',
fallback to writing all properties individually.

set-remote-property!

(set-remote-property! device-id object-identifier property-identifier property-value)(set-remote-property! local-device-id device-id object-identifier property-identifier property-value)
Set the given remote object property.

 Will block until we receive a response back, success or failure.

Property-value can be the value directly OR a map resulting from
`advanced-property'