A great fellow sent me a quick draft.
It didn't fully fulfill my desires, but I still sent him 5 BTC. The bounty is now [15 BTC]!
1. Install leiningen. That is, download the script from https://github.com/technomancy/leiningen
and run 'lein self-install'
2. Create a project, for example:
lein new clj-bacnet
to create a project skeleton in clj-bacnet directory
3. Add bacnet4j as dependency.
Leiningen prefers to obtain its dependencies from a maven repository.
Since I didn't find any, I took the liberty of adding a copy of bacnet4j
to the clojars.org repository.
After adding the bacnet dependency your project.clj should look like this:
(defproject clj-bacnet "1.0.0-SNAPSHOT"
:description "FIXME: write description"
:dependencies [[org.clojure/clojure "1.2.1"]
4. Run 'lein deps' to download the bacnet jars (and a copy of clojure)
to your project directory
Now you can run 'lein repl' and start playing with bacnet4j objects
(com.serotonin.bacnet4j.Network. 1 (byte-array (map byte [127 0 0 1])))
creates a new Network object
#<Network Network(networkNumber=1, networkAddress=[7f,0,0,1])>
calls the getNetworkAddress method on it.
To avoid typing the package name, enter e.g.
(import '[com.serotonin.bacnet4j Network LocalDevice RemoteDevice])
in the REPL. Then the previous example would look like
(Network. 1 (byte-array (map byte [127 0 0 1])))
Leiningen created a src/clj_bacnet/core.clj in the project
and you can add the import declaration
(:import [com.serotonin.bacnet4j Network LocalDevice RemoteDevice]))
to use the short names in your code.
With emacs and SLIME you can add lein-swank as a dependency and start
a swank server with 'lein swank' and then connect from emacs as explained inhttp://data-sorcery.org/2009/12/22/lein-swank/
Please note that it took me quite a while to wrap my head around this; I really need things to be explained
The next step should be to create and test the clojure functions. This is where a BACnet knowledge could be handy, if you have any.