bacure.read-properties

assemble-arrays

(assemble-arrays data)
Reassemble arrays from data returned from a
read-property-multiple.

assemble-results

(assemble-results results)
For each object-identifier, check if a property is present is
present more than once. If it is, we are most probably dealing with
a segmented array... just concat them together.

BACnet-array?

(BACnet-array? data)
Return true if the raw data returned by a read property is part of
an array.

compact-obj-prop-ref

(compact-obj-prop-ref obj-prop-refs)
Inverse of 'expand-obj-prop-ref'.

expand-array

(expand-array local-device-id device-id object-identifier property-reference)(expand-array local-device-id device-id object-identifier property-reference size)
Ask the remote device what is the length of the BACnet array and
return as many object-property-identifiers. If object is not an
array (or any other error), return nil.

An array length can be provided to avoid a request to a remote device.

expand-obj-prop-ref

(expand-obj-prop-ref obj-prop-refs)
Take a normal object-property-references, such as

[ [[:analog-input 0] :description :object-name] ...]

and separate the properties into individual references to obtain:
[ [[:analog-input 0] :description]
  [[:analog-input 0] :object-name] ...]

find-max-refs

(find-max-refs local-device-id device-id)

is-expanded-array?

(is-expanded-array? opr)
Return true if the object-property-references is an expanded array
Example :
[[[:device 123] [:object-list 1]]
 [[:device 123] [:object-list 2]]]

partition-object-property-references

(partition-object-property-references local-device-id device-id obj-prop-references)

read-array-in-chunks

(read-array-in-chunks local-device-id device-id partitioned-array)
Read the partitioned arrays in chunks and then assemble them back
together.

read-array-individually

(read-array-individually local-device-id device-id object-identifier property-reference)
Read a BACnet array one time at the time and re-assemble the result
afterward.

read-individually

(read-individually local-device-id device-id object-property-references)
Given a list of object-property-references, return a list of object properties maps.

[[[:analog-input 0] :description]
 [[:analog-input 1] :object-name]
 [[:device 1234] [:object-list 2]]] <---- with array index

---->

({:description "ANALOG INPUT 0", :object-identifier [:analog-input 0]}
 {:object-name "ANALOG INPUT 1", :object-identifier [:analog-input 1]}
 {[:object-list 2] [:analog-input 0], :object-identifier [:device 1234]})

read-properties

(read-properties device-id object-property-references)(read-properties local-device-id device-id object-property-references)
Retrieve the property values form a remote device.
 Format for object-property-references should be:

 [ [[:analog-input 0] :description :object-name]   <--- multiple properties
   [[:device 1234] [:object-list 0]]                <--- array access
   [[:analog-ouput 1] :present-value]  ...]

The result will be a collection of objects properties map.

Example:

({:object-identifier [analog-input 1], :present-value 12.23}
 {:object-identifier [analog-input 2], :present-value 24.53, object-name "Analog Input 2"})

read-properties-multiple-objects

(read-properties-multiple-objects device-id object-identifiers properties)(read-properties-multiple-objects local-device-id device-id object-identifiers properties)
A convenience function to retrieve properties for multiple
objects.

read-property-multiple

(read-property-multiple local-device-id device-id obj-prop-references)
read-access-specification should be of the form:
 [[object-identifier property-references]
  [object-identifier property-references]]

In case of an error (example :unknown-object), will fallback to
reading everything individually in order to be able to know which
property-reference is problematic.

read-property-multiple*

(read-property-multiple* local-device-id device-id obj-prop-references)
read-access-specification should be of the form:
[[object-identifier property-references]
 [object-identifier property-references]]

read-property-multiple-request

(read-property-multiple-request obj-prop-references)
Create a read-property-multiple request.
[[object-identifier property-references]
 [object-identifier property-references]]

read-property-request

(read-property-request object-identifier property-reference)
Create a read-property request.

[:analog-input 0] :description
[:analog-input 0] [:description 0] <--- with array index

read-range

(read-range local-device-id device-id object-identifier property-identifier array-index [reference range] & by-what?)
'by-what?' can be :sequence, :time, or position (the default if
none is provided).

read-range-request

(read-range-request object-identifier property-identifier array-index [reference range] & by-what?)
'by-what?' can be :sequence, :time, or :position (the default if none is provided).

read-range-request-by

(read-range-request-by reference range & by-what)

read-single-property

(read-single-property local-device-id device-id object-identifier property-reference)
Read a single property.

read-single-property-with-fallback

(read-single-property-with-fallback local-device-id device-id object-identifier property-reference)
Read a single property. If there's a size-related APDU error, will
try to read the BACnet arrays one item at the time.

replace-special-identifier

(replace-special-identifier object-property-references)
For devices that don't support the special identifiers
(i.e. :all, :required and :optional), return a list of properties.

The :all won't be as the one defined by the BACnet standard,
because we can't know for sure what are the properties. (Especially
in the case of proprietary objects.)

size-related?

(size-related? read-result)
True if the abort reason is size related.

split-opr

(split-opr obj-prop-references)

when-coll

(when-coll coll f)
Apply function 'f' to coll only if it really is a collection.
Return nil otherwise.