Julien, thank you very much for the tips!! I have been researching the state of the javax.comm development, and it seems that Sun is shying away from adding Windows support to the Comm 3.0 library because of incompatibility with Win2k and WinXP. I guess for now, we are all left with version 2.0
To provide me the clearest understanding of how MINA works, from head to toe, I am attempting to integrate serial support into MINA, and if nothing else, I can just use it in the system I am working on. In doing so, I have come across a few questions that I am hoping that one of you fine minded programmers can help me with. :-) It seems to me that I need to do the following, to add serial support. * Create a SerialSocketAddress, that extends SocketAddress * Create a SerialStreamIoHandler, which extends StreamIoHandler and implements SerialPortEventListener * When the serialEvent(SerialPortEvent) method is invoked, I will read data from the input stream, create a ByteBuffer, and pass it to messageReceived() * Create SerialIoConnector, that extends BaseIoConnector * Inside the connect method, I plan on doing the javax.comm plumbing to get to the serial port * Instantiating the SerialStreamIoHandler, and passing it the InputStream and OutputStream of the socket. I guess my main question is, am I using the StreamIoHandler correctly in this case. I think when I saw "Stream" in its name, it was all to irresistible to me, to integrate with the streaming nature of the serial IO. My other question is, where would I specify what serial port I want to open, before the SerialIoConnector.connect method gets called? It seems to me that I could set it in the SerialSocketAddress, that is passed in. Or, I could have it in the IoServiceConfig, that is also passed to the connect method. Julian, I completely understand why you would like to wait, to add the serial implementation. But, I am really interested in how MINA works, and I would appreciate any advice anyone could give me, in helping me to figure it out. :-) Thanks so much! Brian _____ From: Julien Vermillard [mailto:[EMAIL PROTECTED] Sent: Monday, May 22, 2006 3:06 AM To: [email protected] Subject: Re: Serial access with Java Communications API Le vendredi 19 mai 2006 à 10:46 -0400, Gaston, Brian a écrit : Greetings all, I am interested in deploying a MINA application on an embedded device that supports both serial and network communications. In the FAQs, it says the Java Comm API is on its way, and I was just wondering how far along this implementation is. If this is something that I need to implement, could anyone give me pointers on where to start. It appears that the logical approach I would take, would be to create a SerialPortConnector that implements the IoConnector interface? The problem I see with that is that all the connect methods in the IoConnector interface contain a SocketAddress in the signature. I have a Mina server sending everything read on the serialport to the TCP/IP connections and everything read on the TCP/IP side to the serial connection. Actualy there is a lot of change undergoing in Sun Java comm API & RXTX and I wanted to see how it's going to evolve before implementing full serial support for MINA. Here an example on how to start it : SerialTCPServer serialServ=new SerialTCPServer(); serialServ.addSerialPort(9001,new SerialSocketAddress("/dev/ttyS0",38400,SerialPort.DATABITS_8,SerialPort.STOP BITS_1,SerialPort.PARITY_NONE)); serialServ.addSerialPort(9002,new SerialSocketAddress("/dev/ttyS1",2400,SerialPort.DATABITS_8,SerialPort.STOPB ITS_1,SerialPort.PARITY_NONE)); serialServ.addSerialPort(9003,new SerialSocketAddress("/dev/ttyS2",9600,SerialPort.DATABITS_8,SerialPort.STOPB ITS_1,SerialPort.PARITY_EVEN)); serialServ.addSerialPort(9004,new SerialSocketAddress("/dev/ttyS3",9600,SerialPort.DATABITS_8,SerialPort.STOPB ITS_1,SerialPort.PARITY_NONE)); serialServ.start(); BTW it's dependant of my reconnectionFilters & JMX patches, you can find it in JIRa or simply delete the references. Hope it helps, contact me if any questions, Julien
