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 remote-device-id)(find-remote-device remote-device-id {:keys [wait-seconds], :or {wait-seconds 1}, :as args})(find-remote-device local-device-id remote-device-id {:keys [wait-seconds], :or {wait-seconds 1}, :as args})
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 wait-seconds], :or {min-range 0, max-range 4194303, wait-seconds 1}, :as args})(find-remote-devices local-device-id {:keys [min-range max-range wait-seconds], :or {min-range 0, max-range 4194303, wait-seconds 1}, :as args})
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.

find-remote-devices-having-object

(find-remote-devices-having-object object-identifier-or-name)(find-remote-devices-having-object object-identifier-or-name {:keys [min-range max-range wait-seconds], :or {min-range 0, max-range 4194303, wait-seconds 1}, :as args})(find-remote-devices-having-object local-device-id object-identifier-or-name {:keys [min-range max-range wait-seconds], :or {min-range 0, max-range 4194303, wait-seconds 1}, :as args})
Do a Who-Has and return the remote-device-ids of any remote devices that
respond. The Who-Has updates a cache that can be accessed at
bacure.events/cached-remote-objects, and that is the same cache we query
here.

get-remote-devices-having-object

(get-remote-devices-having-object object-identifier-or-name)(get-remote-devices-having-object local-device-id object-identifier-or-name)
Query our cached remote-objects to see which remote-devices have the
specified object (if any). Use `find-remote-devices-having-object`
to update the cache.

IAm-received-auto-fetch-extended-information

(IAm-received-auto-fetch-extended-information local-device-id)
Listen to IAm and try to fetch extended-information.

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.

local-registered-test-devices!

(local-registered-test-devices! qty)
Boot up local devices and return their IDs.
The devices are registered as foreign devices to each other.

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 object 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-specifications)(set-remote-properties! local-device-id device-id write-access-specifications)
Set the given remote object properties.

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

'write-access-specifications' 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'

write-single-multiple-properties

(write-single-multiple-properties local-device-id device-id write-access-specifications)