Serial Connection API

I’m developing a tool control application which interfaces through serial connection. I have successfully established connection and communication through hyperterminal and what I like about hyperterminal is that there is a status message at the bottom left corner of the window stating that it’s connected with the connecting time.
I can send command through hyperterminal and get response from the equipment fine.

Now I want to move on with the development to connect through the Ignition Gateway. I’m starting with Serial Support Client module. But eventually I will reconfigure to use Serial Support Gateway module (we have connected this equipment with a device that converts serial connection to ethernet network).

These are what we have right now.
-Ignition Gateway 7.6.4
-Serial Module 1.6.4
-Client Windows XP SP3
-Java 1.7.0_25

By following the documentation in the User manual, I have this in the client startup script

[code]system.serial.configureSerialPort(
port=“COM7”,
bitRate=system.serial.BIT_RATE_9600,
dataBits=system.serial.DATA_BITS_8,
handshake=system.serial.HANDSHAKE_NONE,
hardwareFlowControl=False,
parity=system.serial.PARITY_NONE,
stopBits=system.serial.STOP_BITS_1)

system.serial.openSerialPort(“COM7”)[/code]

In the Timer script, I have

system.serial.write("COM7", ":STAT?") stat = system.serial.readLine("COM7", 2000) system.tag.write("[Client]Status/State", stat)

And in the Shutdown script, I have

system.serial.closeSerialPort("COM7")

My questions are:

  • I want to get the status of the connection so I can show in the UI if the connection is good. Is there any function to check that? As of now, I can only assume that after the configureSerialPort() and openSerialPort(), it will connect to the tool.
  • When the timer script get executed, it returns zero bytes error. I looked up in forum and found one topic discussed about this error. It’s said that it was fixed in the module 1.5.1, however, I still got this error even though I have 1.6.4.
  • Where can I find a more detail documentation on this system.serial?

Thank you

Just want to update…

When I append \n to the command in write function
system.serial.write(“COM7”, “:STAT?\n”)
I no longer get zero bytes returned from readLine().