Re: Serial Port API
- From: Martin Gregorie <martin@xxxxxxxxxxxxxxxxxxx>
- Date: Wed, 22 Aug 2007 19:34:02 +0100
GMM50 wrote:
As you know by now, Java doesn't have built-in serial port support, and there are issues with the various standard packages: SimpleSerial is the simplest, but its slow: it was designed to support byte at a time comms with a PIC microchip. Neither it or the Sun package are very current and RXTX looks complex to install. I looked at them all and decided that writing my own looked to be less problematic.
It appears the using the serial port will require that special piece
of code (a dll) on the users machine. That's OK for development and
the earlier users of this project.
You're right about needing specialized code. Serial ports are simple to handle under some OSen, e.g. Linux, any other *NIX, or Microware's OS9, but quite hard under DOS or Windows.
A while back I needed to talk to a Parallax STAMP from C. I was using a Borland compiler. Neither its standard libraries nor DOS/Windows supplied any serial port support worth a damn and I couldn't find any usable OSS code on the 'net. I ended up buying a copy of Willies Software's COMM/DRV package, which "just worked". If you do have to talk to serial ports on a DOS/Windows box this product is worth a look no matter what you end up putting behind it.
And My hope is that the Ethernet interface will not require any ofIf your devices have built-in TCP/IP support then it should be easy to handle them because Java's TCP/IP support is good and fairly easy to use, especially if you've used sockets or datagrams in C.
that special code.
Otherwise, you're going to end up building some sort of non-Java interface. I think the options are:
1)to build something that's likely to look remarkably like my
SerialPort server and talk to it over TCP/IP. Done right,
this code can be application independent: effectively just
a byte pipe that any application can use to talk to any device
plugged onto a serial port.
2)use JINI to let Java talk directly to a lump of C that drives
the ports. I think this would require the application to live
on the same box as the serial ports - either that or you ending up
writing another serial server, but this time in Java.
3)as (1) but use a small, dedicated interface box that runs the server
and nothing else. Plug it onto your LAN where Java can find it.
It could run under the OS of your choice, would be small and low
powered and would allow the control software to be installed on any
other host(s) that can see it.
If you go for (3) the support hardware could be anything from a Beck IPC@CHIP PC-on-a-chip or a Gumstix mini board upwards. The next step up would be small form factor kit like NorhTec's MicroClient Jr, the Sumo ST166 or systems based on mini-ITX boards. Many of these come with minimal Linux distros as a standard option, so that would solve the serial hardware interfacing problem. Or, or course, you could use a regular PC with its backplane crammed with serial ports.
I've used Visual C, Visual Basic and C++ Builder. They all stumbleIt seems to me that using a dedicated interface box to handle the serial ports is worth a close look. The benefit is that all the specialized support libraries, etc only exist on the interface box. All applications can be written in Java or whatever seems sensible and don't need anything (except possibly an interface class) to connect to it: they certainly don't need to know what's running in it.
when you need to install on users machines and support is difficult.
If you use Java for the applications then they can even be installed automatically on user's systems if you use Web Start to deploy them.
HTH
--
martin@ | Martin Gregorie
gregorie. | Essex, UK
org |
.
- Follow-Ups:
- Re: Serial Port API
- From: Roedy Green
- Re: Serial Port API
- From: GMM50
- Re: Serial Port API
- References:
- Serial Port API
- From: GMM50
- Re: Serial Port API
- From: Martin Gregorie
- Re: Serial Port API
- From: GMM50
- Serial Port API
- Prev by Date: download servlet
- Next by Date: Re: source for servlet-api.jar
- Previous by thread: Re: Serial Port API
- Next by thread: Re: Serial Port API
- Index(es):
Relevant Pages
|
|