You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by Julien Vermillard <jv...@archean.fr> on 2007/04/18 17:21:32 UTC
Serial port communication for MINA 2.0M1 (trunk)
Hi everybody,
I just added to MINA subversion trunk (the 2.0 branch) a new module
called transport-serial for supporting serial communications
( http://en.wikipedia.org/wiki/Rs232 ). It's based on the LGPL licensed
RXTX library ( http://www.rxtx.org ).
For using it you need to download RXTX yourself (it's not in maven
repos).
RXTX Binaries can be found there :
ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7-bins-r2.zip
Just unpack RXTXcomm.jar and put it in the ./lib/ directory (you will
prolly need to create it).
Then you need to explicitly say to maven to build the serial module by
adding "-Dwith-serial" to the command line.
I got good hope to have this jar uploaded to maven repository :)
Now the code :
for connect to a serial port :
SerialConnector connector= new SerialConnector();
//set the ususal IOHandler
connector.setHandler(...);
// connect ot the serial port
ConnectFuture future=connector.connect(new
SerialAddress("/dev/ttyS0",38400,8,StopBits.BITS_1,Parity.ODD,FlowControl.NONE));
try {
future.getSession();
} catch(SerialPortUnavailableException e) {
System.err.println("Unable to find the serial port. Does the hardware
is present ?.");
}
Ports are called /dev/ttyS0, /dev/ttyS1, /devttyUSB0 on Linux/UNIX and
COM1, COM2 on Windows.
More parameters are avaible in SerialSessionConfig just check the
javadoc and RXTX docs :)
For running this example you will need to install the RXTX .so or .DLL
files corresponding to your system (check RXTX install documentation).
Feedback and bug reports are welcome !
Julien
Re: Serial port communication for MINA 2.0M1 (trunk)
Posted by Trustin Lee <tr...@gmail.com>.
On 4/27/07, Julien Vermillard <jv...@archean.fr> wrote:
> RXTX jar was uploaded to maven repository, so it will compile without
> needing to manualy download extra jars.
Nice! Let's make it built without the -D flag.
Cheers,
Trustin
--
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP Key ID: 0x0255ECA6
Re: Serial port communication for MINA 2.0M1 (trunk)
Posted by Julien Vermillard <jv...@archean.fr>.
RXTX jar was uploaded to maven repository, so it will compile without
needing to manualy download extra jars.
Julien
Le mercredi 18 avril 2007 à 17:21 +0200, Julien Vermillard a écrit :
> Hi everybody,
>
> I just added to MINA subversion trunk (the 2.0 branch) a new module
> called transport-serial for supporting serial communications
> ( http://en.wikipedia.org/wiki/Rs232 ). It's based on the LGPL licensed
> RXTX library ( http://www.rxtx.org ).
>
> For using it you need to download RXTX yourself (it's not in maven
> repos).
>
> RXTX Binaries can be found there :
> ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7-bins-r2.zip
>
> Just unpack RXTXcomm.jar and put it in the ./lib/ directory (you will
> prolly need to create it).
>
> Then you need to explicitly say to maven to build the serial module by
> adding "-Dwith-serial" to the command line.
>
> I got good hope to have this jar uploaded to maven repository :)
>
> Now the code :
>
> for connect to a serial port :
>
> SerialConnector connector= new SerialConnector();
> //set the ususal IOHandler
> connector.setHandler(...);
>
> // connect ot the serial port
> ConnectFuture future=connector.connect(new
> SerialAddress("/dev/ttyS0",38400,8,StopBits.BITS_1,Parity.ODD,FlowControl.NONE));
> try {
> future.getSession();
> } catch(SerialPortUnavailableException e) {
> System.err.println("Unable to find the serial port. Does the hardware
> is present ?.");
> }
>
> Ports are called /dev/ttyS0, /dev/ttyS1, /devttyUSB0 on Linux/UNIX and
> COM1, COM2 on Windows.
>
> More parameters are avaible in SerialSessionConfig just check the
> javadoc and RXTX docs :)
>
> For running this example you will need to install the RXTX .so or .DLL
> files corresponding to your system (check RXTX install documentation).
>
> Feedback and bug reports are welcome !
>
> Julien
>
Re: Serial port communication for MINA 2.0M1 (trunk)
Posted by Trustin Lee <tr...@gmail.com>.
Hi Julien,
On 4/19/07, Julien Vermillard <jv...@archean.fr> wrote:
> Hi everybody,
>
> I just added to MINA subversion trunk (the 2.0 branch) a new module
> called transport-serial for supporting serial communications
> ( http://en.wikipedia.org/wiki/Rs232 ). It's based on the LGPL licensed
> RXTX library ( http://www.rxtx.org ).
>
> For using it you need to download RXTX yourself (it's not in maven
> repos).
>
> RXTX Binaries can be found there :
> ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7-bins-r2.zip
>
> Just unpack RXTXcomm.jar and put it in the ./lib/ directory (you will
> prolly need to create it).
>
> Then you need to explicitly say to maven to build the serial module by
> adding "-Dwith-serial" to the command line.
>
> I got good hope to have this jar uploaded to maven repository :)
>
> Now the code :
>
> for connect to a serial port :
>
> SerialConnector connector= new SerialConnector();
> //set the ususal IOHandler
> connector.setHandler(...);
>
> // connect ot the serial port
> ConnectFuture future=connector.connect(new
> SerialAddress("/dev/ttyS0",38400,8,StopBits.BITS_1,Parity.ODD,FlowControl.NONE));
> try {
> future.getSession();
> } catch(SerialPortUnavailableException e) {
> System.err.println("Unable to find the serial port. Does the hardware
> is present ?.");
> }
>
> Ports are called /dev/ttyS0, /dev/ttyS1, /devttyUSB0 on Linux/UNIX and
> COM1, COM2 on Windows.
>
> More parameters are avaible in SerialSessionConfig just check the
> javadoc and RXTX docs :)
>
> For running this example you will need to install the RXTX .so or .DLL
> files corresponding to your system (check RXTX install documentation).
>
> Feedback and bug reports are welcome !
This is a great news! Another transport support! :)
Trustin
--
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP Key ID: 0x0255ECA6