The Artima Developer Community
Sponsored Link

Java Answers Forum
Javax.comm

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Rpaha

Posts: 3
Nickname: rpaha
Registered: Apr, 2003

Javax.comm Posted: Apr 23, 2003 1:46 AM
Reply to this message Reply
Advertisement
Hi
I have to translate vb-code to java-code.
I have a little reader with some chips and I have to get some data from the chips. The problem is, that i can't get the data from the chips. In vb it works well.

the vb-code is the following:

'Open connection
MSComm1.CommPort = 1
MSComm1.PortOpen = True
'Without this, it doesn't work
Sleep (100)

MSComm1.Output = "TT21" & vbCr
bof = MSComm1.Input
MSComm1.Output = "RD" & vbCr

Sleep (100)
temp = MSComm1.Input
--> temp = a number like this, if a chip is on the reader: 0,8004EA56; or 5 if nothing is on the reader.

-----------
In the java code I make this to connect and get output and inputstream:

try {
portId = CommPortIdentifier.getPortIdentifier("COM1");
serialPort = (SerialPort) portId.open("Reader", 2000);
serialPort.setSerialPortParams(4800,
SerialPort.DATABITS_8,
SerialPort.STOPBITS_1,
SerialPort.PARITY_NONE);
out = serialPort.getOutputStream();
in = serialPort.getInputStream();
CopyThread input = new CopyThread(System.in,out, "Input");
CopyThread output = new CopyThread(in,System.out, "Output");

} catch (Exception e) {}

The problem is, that i don't know how to get data from the chip and the reader.
The stream are something like this: com.sun.comm.Win32SerialInputStream@15a6029
What can I do to get the same numbers as them in vb?

Topic: Problematic Thread Previous Topic   Next Topic Topic: Converting a .java GUI to an .EXE

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use