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
> 

Reply via email to