Sprinkler
xPL4Java Module
If you use the xPL4Java
framework, you
can install the jSprinkler module that will allow you to control your
sprinkler
controller board with xPL messages. The module is packaged in the
same Java .jar file as the Sprinkler
Configurator.
NOTE: You must be running xPL4Java
V1.3 or later for this to work
The xPL Schema for the sprinkler gateway allows you to do everything
the
sprinkler board supports. It would be helpful to be familiar with
the sprinkler control
protocol as
these most of this documentation discusses only the xPL messages and
such -- the details on what each command does are best understood from
the protocl documentation.
The xPL4Java sprinkler module introduces a new schema: sprinklr.basic.
There is
also a CDP1802 plugin
file
(cdp1802 is the vendor ID all my xPL code is developed under) for folks
using xPLHAL to allow them to easily create scripts and determinators
to control the sprinklers.
Because the sprinkler controller requires a serial port to control and
serial
ports are one thing Java does not natively support, there is a bit of
extra work you have to do the first time you use a Java program (like
this) that controls serial ports. The package is called Javacomm
and you can learn more
about it, where to download it and tips and notes on getting it
working here.
Once done, this should not ned
to be redone if you ever have any other Java serial port oriented
programs. My apologies, but it's out of my hands.
Once Java and the javacomm software is installed, download the
sprinkler configurator file here
(including the
source) (tgz format). Once
downloaded and unzipped, just copy the jSprinkler.jar file
into your xPL4Java jars subdirectory and it should automatically
load.
Note: The supplied .jar file also houses a GUI based sprinkler
configurator program. You can learn more about that here
Next step is to configure it to tell it about the serial port you have
the sprinkler controller attached to. Use a configuration
tool like xPLHAL
or DCM.
If the sprinkler gateway module is working, it should show
up under the xPL devices needing configuration. I'd suggest you
change the instance ID to something more memorable, then edit the
"serial-port" parameter.
Each serial-port configuration item describes the serial port the
controller is attached to. For example, under
linux, this might look like
/dev/ttyS0
Under Windows, it would be
COM1
If you had previously used the sprinkler configurator GUI and entered
names for your valves and/or queues, you can tell the xPL gateway to
load that file and use it to identify the valve and queue names when
the gateway is interrogated. The "sprinkler-config" configuration
item should have the full path the the sprinkler.dat file that the
configuraton created for you. So if the files was stored in
C:\temp (windows), you would enter C:\temp\sprinkler.dat. If it
was in /etc (unixy systems), you'd enter /etc/sprinkler.dat.
Once you save the configuration, the sprinkler gateway should
immediatly open the
serial port and be ready to accept xPL commands. If it does not
seem to send command over, insure you have the "javacomm" serial port
drivers installed properly and the baud rate you entered matches what
the board is set for.
The configuration information is automatically saved, so when the
xPL4Java container next starts and loads the sprinkler gateway module,
it will
immediatly open the serial port you configured. You do not need
to visit the configuration for the service again, unless you need to
change the serial port setup.
Last updated June 12, 2006