Local serial port usage

Adding javax.comm for fun and enjoyment.

First run-through supports serial output only. good for label printers or old-fashioned line printers.

Enjoy!
javacomm.zip (349 KB)

Client script that would output unacknowledged alerts to the serial port, then acks them.

If you have a db installed on a PC with Panel Edition, you can have a local alerts table as well as on the SCADA-at-large. :wink:

EDIT: whoops! added the code…

[code]query=“SELECT alert_log_ndx, concat(path,’:’,State_Name,’ Value=’) as alert, alert_log_ndx FROM alert_log WHERE ack_timestamp is null order by active_timestamp desc”
alertList=system.db.runQuery(query)

if len(alertList)!=0:
ackquery=“UPDATE alert_log SET ack_timestamp=now() WHERE ack_timestamp is null”
system.db.runUpdateQuery(ackquery)
ndx=""
for row in alertList:
app.serial.out(str(row[“alert”])+chr(13)+chr(10))
ndx += str(row[“alert_log_ndx”])+","
ndx=ndx[:-1] # strip away last comma
ackquery=“UPDATE alert_log SET ack_timestamp=now() WHERE alert_log_ndx IN(”+ndx+")"
system.db.runUpdateQuery(ackquery)
else:
app.serial.out("") #sends empty string. This is to help negotiate connections, especially if you use something like Hyperterminal to troubleshoot.

[/code]