bacure.local-device

clear-all!

(clear-all!)
Destroy all traces of a local-device.

default-configs

Some default configurations for device creation.

default-transport

(default-transport network)

get-configs

(get-configs local-device-id)
Return a map of the local-device configurations

get-local-device

(get-local-device device-id)
Return the local-device associated with the device-id. If device-id
is nil, simply return the first found.

get-local-device-id

(get-local-device-id device-object)
Given a local device object, return the device ID.

i-am-broadcast!

(i-am-broadcast!)(i-am-broadcast! local-device-id)
Send an 'I am' broadcast on the network.

initialize!

(initialize!)(initialize! local-device-id)
Initialize the local device. This will bind it to it's port (most
likely 47808) and load any programs available for the local-device.
The port will remain unavailable until the device is terminated.
Once terminated, you should discard the device and create a new one
if needed.

For more information on the local-device 'programs' operations, see
the bacure.local-save namespace.

Return true if initializing (binding to port) is successful.

list-local-devices

(list-local-devices)

load-local-device-backup!

(load-local-device-backup! local-device-id)(load-local-device-backup! local-device-id new-configs)
Load the local-device backup file and reset it with this new
configuration.

local-device-backup

(local-device-backup)(local-device-backup local-device-id)
Get the necessary information to create a local device backup.

local-device-object

(local-device-object device-id)
Return the local-device bacnet4j object associated with the
device-id. If device-id is nil, simply return the first found.

local-devices

mapify

macro

(mapify & symbols)
Given some symbols, construct a map with the symbols as keys, and
 the value of the symbols as the map values. For example:
(Let [aa 12]
    (mapify aa))
=> {:aa 12}

new-local-device!

(new-local-device!)(new-local-device! configs-map)
Return a new configured BACnet local device . (A device is required
to communicate over the BACnet network.). Use the function
'initialize' and 'terminate' to bind and unbind the device to the
BACnet port. If needed, the initial configurations are available in
the atom 'local-device-configs.

The optional config map can contain the following:
:device-id <number>
:broadcast-address <string>
:port <number>
:local-address <string> <----- You probably don't want to use it.
:'other-configs' <string> OR <number> OR other

The device ID is the device identifier on the network. It should be
unique.

The broadcast-address is the address on which we send 'WhoIs'. You
should not have to provide anything for this, unless you have
multiple interfaces or want to trick your machine into sending to a
'fake' broadcast address.

Port and destination port are the BACnet port, usually 47808.

The local-address will default to "0.0.0.0", also known as the
'anylocal'. (Default by the underlying BACnet4J library.) This is
required on Linux, Solaris and some Windows machines in order to
catch packet sent as a broadcast. You can manually change it, but
unless you know exactly what you are doing, bad things will happen.

The 'other-configs' is any configuration returned when using the
function 'get-configs'. These configuation can be set when the
device is created simply by providing them in the arguments. For
example, to change the vendor name, simply add '{:vendor-name "some
vendor name"}'.

reset-local-device!

(reset-local-device!)(reset-local-device! config-or-id)(reset-local-device! local-device-id new-config)
Terminate the local device and discard it. Replace it with a new
local device, and apply the same configurations as the previous one.
If a map with new configurations is provided, it will be merged with
the old config.

(reset-local-device {:device-id 1112})
---> reset the device and change the device id.

save-local-device-backup!

(save-local-device-backup!)
Save the device backup on a local file and return the config map.

terminate!

(terminate!)(terminate! local-device-id)
Terminate the local device, freeing any bound port in the process.

terminate-all!

(terminate-all!)
Terminate all local devices.

update-configs!

(update-configs! local-device-id properties-smap)
Given a map of properties, will update the local-device. Return the
device configs. Please note that many properties CANNOT be changed
while the device is initialized (:object-identifier for example) and
will simply be discarded.

with-temp-devices

macro

(with-temp-devices & body)
Execute body with a temporary set of local-devices. Any existing
devices will be terminated before the body executes and re-initiated
after. Useful for tests.