A Java interface for BR847

For some time ago i bought a DIY serial I/O interface with 24 input ports and 36 output ports. The serial board is from Brink elektronik and has the product code BR847. As far as I can see, they do however not sell this board anymore, thus no new code interface is developed. The only interface provided is a binary executable, which is not easily coded up against. Therefore I have created a Java interface, which can communicate with the I/O board.

This interface uses the RXTX interface. I will not in detail describe how this is installed on different platforms. But on my Linux Debian Etch installation I have copied the two following files to the java directory – this worked fine for me.
RXTXcomm.jar goes in /jre/lib/ext (under java)
librxtxSerial.so goes in /jre/lib/[machine type] (i386 for instance)

Any class that uses the interface must implement the following interface [InfPortListener].

public interface InfPortListener
{
    public void inputPortChange(int port, boolean state);
    public void outputPortChange(int port, boolean state);
}

Then we must add a listener

br847.addListener(this);
br847.start();

Now if a port changes, one of the methods will be called.

In order to change a port we must use the followning method.

br847.setPortState(1,true);

You can see the whole java class here here

Leave a Reply