Le mercredi 24 mai 2006 à 17:35 -0400, Gaston, Brian a écrit : > 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
Yes and an incompatibility with RXTX.org implementation for linux, and no implementation for Windows, actualy Sun Com API 3 is fubar I hope it's going to change soon. I was thinking about using directly the rxtx packages without bothering with compatibility with sun's one, but the license is LGPL and I think it's impossible to integrate easly with Mina (ASF v2 license). > 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. I use my Serial to TCP server in production, it's RXTX.org + Comm API v2 based, it's working like a charm (tested on linux & Windows) if you don't mind to have no direct Mina integration. > 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 Yes, I think there is one already I made in JIRA > * 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. Well, StreamIOHandler is just an utility class for provide Stream like interface for Mina users. You need to go deeper in MINA stack and implement a SocketSession extending BaseIOSession And add a SERIAL TransportType in TransportType. You can skip the SerialAcceptor ;) > > > 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. > Yep use the SerialsocketAddress. > > 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. :-) If you want to start implementating that, I can seriously help you :) BTW which Serial API do you use ?
smime.p7s
Description: S/MIME cryptographic signature