File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Other JSE/JEE APIs and the fly likes Java listening to Serial Port Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Reply Bookmark "Java listening to Serial Port" Watch "Java listening to Serial Port" New topic
Author

Java listening to Serial Port

Chris Emerson
Greenhorn

Joined: Jun 27, 2008
Posts: 7
Hi All,

I'm using the RXTXcomm.jar to listen to a device on a COM port in windows. The code is working and reading the data ( credit card mag strip ) but it's splitting the data into multiple inputstreams. I want all the data to come back in one shot. One swipe will hit the event listener 8 - 12 times. If all that data is concatenated together, it's all there. Here's the java code based off the example on the rxtx.org site:


[ October 15, 2008: Message edited by: Chris Emerson ]
Rob Spoor
Saloon Keeper

Joined: Oct 27, 2005
Posts: 17250

Please Use Code Tags to preserve your formatting.


SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
Chris Emerson
Greenhorn

Joined: Jun 27, 2008
Posts: 7
This was resolved by putting a Thread.sleep(1000); as the first line of the try block inside the serialEvent method above.
 
 
subject: Java listening to Serial Port
 
WebSphere development made easy
without the weight of IBM tools
http://www.myeclipseide.com

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture