Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

...

With the MINA 2.0 you are able to connect to serial port like you use to connect to a TCP/IP port with MINA.

...

If you prefer to build the code from the trunk, and need assistance to do so, please consult the Developer Guide.

Prerequisite

...

...

Before accessing serial port from a Java program you need a native library (.DLL or .so depending of your OS). MINA use the one from RXTX.org : ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7-bins-r2.zip.
Just put the good .dll or .so in the jre/lib/i386/ path of your JDK/JRE or use the -Djava.library.path= argument for specify where you placed the native libraries

...

...

The mina-transport-serial jar is not included in the full distribution. You can download it from here

...

Connecting to a serial port

...

Now for connecting to a serial port you need a SerialConnector :

...

...

Nothing very different of a SocketConnector.

Let's create an address for connecting to our serial port.

...

...

The first parameter is your port identifier. For Windows computer, the serial ports are called "COM1", "COM2", etc... For Linux and some other Unix : "/dev/ttyS0", "/dev/ttyS1", "/dev/ttyUSB0".

...

Once it's done, connect the connector to the address :

...

...

And voila ! Everything else is as usual, you can plug your filters and codecs.
for learn more about RS232 : http://en.wikipedia.org/wiki/RS232