Hi....
 It seems there are a few people that need the serial functionality.

Has there been any work done on this ?

I just did a Mina test to read a GPS...
 Pretty straight forward...

public class SerialHandler extends IoHandlerAdapter {
// ---------------------------------------------------
        @Override
        public void messageReceived(IoSession session, Object message)
                        throws Exception {
                System.out.println("Reseived:"+message.toString());
                super.messageReceived(session, message);
        }

        @Override
        public void messageSent(IoSession session, Object message) throws 
Exception
{
                System.out.println("Sent:"+message);
                super.messageSent(session, message);
        }
}
// ---------------------------------------------------
    public static void main(String[] args) throws IOException {
       
System.out.println("java.library.path="+System.getProperty("java.library.path"));
        
                // create your connector
                IoConnector connector = new SerialConnector();
                connector.setHandler(new SerialHandler());
//        connector.getFilterChain().addLast("logger", new LoggingFilter());
        connector.getFilterChain().addLast( "codec", new
ProtocolCodecFilter( new TextLineCodecFactory( Charset.forName( "UTF-8"
))));
                
                SerialAddress portAddress=new SerialAddress( "COM3", 4800,
SerialAddress.DataBits.DATABITS_8, StopBits.BITS_1, Parity.NONE,
FlowControl.NONE );             

                ConnectFuture future = null;
        IoSession session = null;
        try {
                future = connector.connect( portAddress );
            future.awaitUninterruptibly();
            session = future.getSession();
        } catch (RuntimeIoException e) {
            System.err.println("Failed to connect.");
            e.printStackTrace();
        }
                IoSession futsession = future.getSession();
    }
// --------------------------------------------------------------
  Output:
Reseived:$GPGGA,,,,,,0,00,,,,,,,*66
Reseived:$GPGLL,,,,,,V,N*64
Reseived:$GPVTG,,,,,,,,,N*30
Reseived:$GPGSA,A,1,,,,,,,,,,,,,,,*1E
...

I'd be willing to do some work on it....
Just want to make sure I'm not duplicating effort.

Though I'd need some guidance on protocol encoding etc...





--
View this message in context: 
http://camel.465427.n5.nabble.com/Mina-component-Serial-port-support-tp4315407p5748059.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to