Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes I/O and Streams and the fly likes Serial Port App Design Question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "Serial Port App Design Question" Watch "Serial Port App Design Question" New topic

Serial Port App Design Question

Mike Bates
Ranch Hand

Joined: Sep 19, 2009
Posts: 81
Based on all the reading I have done there are two approaches to two-way communication with a serial port device --1) Lock Step and 2) Serial Events.

The device I am coding against has three basic command sets, 1) send return wait for 1.2 seconds for response if no response send again (try a couple of times); 2) send a command and expect single result of anywhere from 2 to 440 bytes; and 3) send command and data returned in 100 to 200 bytes (based on command) every two seconds for the length of the request.

It seems like "lock step" would be the way to go but "Serial Events" seems more flexible. I just have not figured out how to manage the command set 1 type of commands with threads.

Any for those of you who have done this which direction would you recommend or may be it would be a mix of the two?

Thanks from a newbie

I agree. Here's the link:
subject: Serial Port App Design Question
jQuery in Action, 3rd edition