Issues communicating with a serial scale

189 views
Skip to first unread message

rtuin...@gmail.com

unread,
Jan 13, 2016, 4:37:44 PM1/13/16
to qz-print
I have insured my data communication parameters are correct, I am trying to communicate with a mettler toledo scale. I am using the sample.html screen to do my testing. When I send it a 'W', it said "no data returned". I get no data back even though I have something on the scale. One message is somewhat concerning, but I am not sure what it means.

basic: JNLP2ClassLoader.findClass: qz.utils.ByteUtilities: try again ..

Anyways, here is a dump of my Java console

security: Validate the certificate chain using CertPath API
security: SHA-256Certificate finger print: AD70D500C32E3CE0E6AA2FAFF01ACD79C6EC0FADA58D120F1AB96892E726D90A
security: SHA-256Certificate finger print: AD70D500C32E3CE0E6AA2FAFF01ACD79C6EC0FADA58D120F1AB96892E726D90A
security: The OCSP support is enabled
security: The CRL support is enabled
security: Saving certificates in Deployment session certificate store
security: Saved certificates in Deployment session certificate store
security: Saving certificates in Deployment session certificate store
security: Saved certificates in Deployment session certificate store
basic: Plugin2ClassLoader.getPermissions CeilingPolicy allPerms
security: JAVAWS AppPolicy Permission requested for: http://localhost:8005/qz-com/lib/jssc.jar
basic: JNLP2ClassLoader.getPermissions() X
basic: JNLP2ClassLoader.findClass: jssc.SerialPortException: try again ..
basic: JNLP2ClassLoader.findClass: jssc.SerialPort$EventThread: try again ..
basic: JNLP2ClassLoader.findClass: jssc.SerialPort$LinuxEventThread: try again ..
basic: JNLP2ClassLoader.findClass: jssc.SerialPortTimeoutException: try again ..
basic: JNLP2ClassLoader.findClass: jssc.SerialPortEventListener: try again ..
basic: JNLP2ClassLoader.findClass: jssc.SerialPortList: try again ..
basic: JNLP2ClassLoader.findClass: jssc.SerialNativeInterface: try again ..
basic: JNLP2ClassLoader.findClass: jssc.SerialPortList$1: try again ..
Jan 13, 2016 1:30:47 PM qz.PrintApplet call
INFO: Successfully called JavaScript function "qzDoneFindingPorts(...)"...
Jan 13, 2016 1:30:47 PM qz.PrintApplet notifyBrowser
INFO: Successfully called JavaScript function "qzDoneFindingPorts(...)"...
security: Javascript from a non secure page is accessing privileged code. Consider using HTTPS protocol when using Javascript -> Java liveconnect calls.
security: Javascript from a non secure page is accessing privileged code. Consider using HTTPS protocol when using Javascript -> Java liveconnect calls.
Jan 13, 2016 1:30:53 PM qz.PrintFunction openPort
INFO: ===== OPENING SERIAL PORT COM4 =====
basic: JNLP2ClassLoader.findClass: qz.common.SerialIO$1: try again ..
basic: JNLP2ClassLoader.findClass: jssc.SerialPortEvent: try again ..
Jan 13, 2016 1:30:53 PM qz.PrintApplet call
INFO: Successfully called JavaScript function "qzDoneOpeningPort(...)"...
Jan 13, 2016 1:30:53 PM qz.PrintApplet notifyBrowser
INFO: Successfully called JavaScript function "qzDoneOpeningPort(...)"...
basic: JNLP2ClassLoader.findClass: qz.utils.SerialUtilities: try again ..
Jan 13, 2016 1:30:56 PM qz.utils.SerialUtilities parseBaudRate
INFO: Parsed serial setting: 9600=BAUDRATE_9600
Jan 13, 2016 1:30:56 PM qz.utils.SerialUtilities parseDataBits
INFO: Parsed serial setting: 7=DATABITS_7
Jan 13, 2016 1:30:56 PM qz.utils.SerialUtilities parseStopBits
INFO: Parsed serial setting: 1=STOPBITS_1
Jan 13, 2016 1:30:56 PM qz.utils.SerialUtilities parseParity
INFO: Parsed serial setting: even=PARITY_EVEN
Jan 13, 2016 1:30:56 PM qz.utils.SerialUtilities parseFlowControl
INFO: Parsed serial setting: none=FLOWCONTROL_NONE
basic: JNLP2ClassLoader.findClass: qz.common.ByteArrayBuilder: try again ..
Jan 13, 2016 1:30:56 PM qz.PrintFunction logCommands
INFO:


W



Jan 13, 2016 1:30:56 PM qz.common.SerialIO send
INFO: Sending data to [COM4]:


W



basic: JNLP2ClassLoader.findClass: qz.utils.ByteUtilities: try again ..
Jan 13, 2016 1:30:56 PM qz.common.SerialIO serialEvent
INFO: 000.00
Jan 13, 2016 1:30:56 PM qz.PrintApplet call
INFO: Successfully called JavaScript function "qzSerialReturned(...)"...
Jan 13, 2016 1:30:56 PM qz.PrintApplet notifyBrowser
INFO: Successfully called JavaScript function "qzSerialReturned(...)"...
Jan 13, 2016 1:31:03 PM qz.utils.SerialUtilities parseBaudRate
INFO: Parsed serial setting: 9600=BAUDRATE_9600
Jan 13, 2016 1:31:03 PM qz.utils.SerialUtilities parseDataBits
INFO: Parsed serial setting: 7=DATABITS_7
Jan 13, 2016 1:31:03 PM qz.utils.SerialUtilities parseStopBits
INFO: Parsed serial setting: 1=STOPBITS_1
Jan 13, 2016 1:31:03 PM qz.utils.SerialUtilities parseParity
INFO: Parsed serial setting: even=PARITY_EVEN
Jan 13, 2016 1:31:03 PM qz.utils.SerialUtilities parseFlowControl
INFO: Parsed serial setting: none=FLOWCONTROL_NONE
Jan 13, 2016 1:31:03 PM qz.PrintFunction logCommands
INFO:


W



Jan 13, 2016 1:31:03 PM qz.common.SerialIO send
INFO: Sending data to [COM4]:


W



Jan 13, 2016 1:31:03 PM qz.common.SerialIO serialEvent
INFO: 000.40
Jan 13, 2016 1:31:03 PM qz.PrintApplet call
INFO: Successfully called JavaScript function "qzSerialReturned(...)"...
Jan 13, 2016 1:31:03 PM qz.PrintApplet notifyBrowser
INFO: Successfully called JavaScript function "qzSerialReturned(...)"...
cache: MemoryCache: removed entry http://localhost:8005/qz-com/qz-print_jnlp.jnlp
Jan 13, 2016 1:31:46 PM qz.utils.SerialUtilities parseBaudRate
INFO: Parsed serial setting: 9600=BAUDRATE_9600
Jan 13, 2016 1:31:46 PM qz.utils.SerialUtilities parseDataBits
INFO: Parsed serial setting: 7=DATABITS_7
Jan 13, 2016 1:31:46 PM qz.utils.SerialUtilities parseStopBits
INFO: Parsed serial setting: 1=STOPBITS_1
Jan 13, 2016 1:31:46 PM qz.utils.SerialUtilities parseParity
INFO: Parsed serial setting: even=PARITY_EVEN
Jan 13, 2016 1:31:46 PM qz.utils.SerialUtilities parseFlowControl
INFO: Parsed serial setting: none=FLOWCONTROL_NONE
Jan 13, 2016 1:31:46 PM qz.PrintFunction logCommands
INFO:


W



Jan 13, 2016 1:31:46 PM qz.common.SerialIO send
INFO: Sending data to [COM4]:


W



Jan 13, 2016 1:31:46 PM qz.common.SerialIO serialEvent
INFO: 000.40
Jan 13, 2016 1:31:46 PM qz.PrintApplet call
INFO: Successfully called JavaScript function "qzSerialReturned(...)"...
Jan 13, 2016 1:31:46 PM qz.PrintApplet notifyBrowser
INFO: Successfully called JavaScript function "qzSerialReturned(...)"...



Any help is appreciated,
Rick

Tres Finocchiaro

unread,
Jan 13, 2016, 5:08:06 PM1/13/16
to Rick Tuinenburg, qz-print
I believe a newline is required for the scale to answer per https://qz.io/wiki/serial-communication




--
You received this message because you are subscribed to the Google Groups "qz-print" group.
To unsubscribe from this group and stop receiving emails from it, send an email to qz-print+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

rtuin...@gmail.com

unread,
Jan 13, 2016, 5:10:41 PM1/13/16
to qz-print, rtuin...@gmail.com
The sample.html does the following

qz.send(document.getElementById("port_name").value, "\nW\n");

It includes a \n

Tres Finocchiaro

unread,
Jan 13, 2016, 5:16:15 PM1/13/16
to Rick Tuinenburg, qz-print
On Wed, Jan 13, 2016 at 5:10 PM, <rtuin...@gmail.com> wrote:
The sample.html does the following

qz.send(document.getElementById("port_name").value, "\nW\n");

It includes a \n

Sorry I was unaware of the context.  Yes, sample.html should work out of the box with this scale.

The MT scales have several emulation modes and items such as baud rate, etc can be overridden.  The manual for your scale should have steps for ensuring it is in MT mode and resetting the RS232 params to match the default settings.

If the scale is emulating another protocol, not only will the baud settings be wrong, but it will also send a wrong ETX and STX, so the software won't ever be able to process the response.

I assume you've verified your port is correct.  The next step is to verify the baud and scale emulation.

As far as the other question...
   
>  "basic: JNLP2ClassLoader.findClass: qz.utils.ByteUtilities: try again .."

This is the Java applet lazily loading dependencies.  It's so an applet can start to load before all of its resources are downloaded.

On semi-related note, if you are ok with installing a desktop application, our 2.0 branch has some much better handling of bi-directional communication and we need early adopters prior to its release, if you're interested.

-Tres

rtuin...@gmail.com

unread,
Jan 14, 2016, 10:53:21 PM1/14/16
to qz-print, rtuin...@gmail.com
I defaulted the scale back to orig settings, I went through each on and made sure it matched the sample.html settings. Before I the did the QZ test sample.html test, I fired up the old hyper terminal and created a connection with the same settings, and I just type a W and it showed the weight right after. So I know I am connected properly. I disconnected and fired up example.html, I can open the port, and went I hit Send, I see the W in the java console, but no weight returns. I tried messing with the qz.send and just put in a plain W without \n around it. Nothing seems to fire the weight back, the way it did in hyper terminal. The only settings on the scale that I am questioning is "Proto" it's currently set to "Toledo", but there are many other options, like Proto 1, Proto 2, Proto 3, Proto 4, Proto 5, Proto 6, Disabled.

Other than that, I can't think of anything else to try. Any input is greatly appreciated.
Rick

Tres Finocchiaro

unread,
Jan 15, 2016, 1:44:01 AM1/15/16
to Rick Tuinenburg, qz-print
Rick,

Confirmed, this is a bug.  Sorry as I had completely missed the weight value readout in the console.  Oversight on my part.



Jan 13, 2016 1:31:03 PM qz.common.SerialIO serialEvent
INFO:  000.40
Jan 13, 2016 1:31:03 PM qz.PrintApplet call

We had an issue that was fixed here and I'm sure I tested it.... Now I'm starting to doubt myself.... 


What's even more bazaar is that I can debug the applet and see the value just-prior to calling qzSerialReturned, so I'm not sure why its never making it to the browser (perhaps the STX char -- ☐ in consoleis breaking the string)

We'll investigate more and report our findings.
Rick

--
You received this message because you are subscribed to the Google Groups "qz-print" group.

Tres Finocchiaro

unread,
Jan 15, 2016, 2:12:47 AM1/15/16
to Rick Tuinenburg, qz-print
Rick,

Fixed via 6318b11.

If you're compiling yourself, just pull down the latest 1.9 branch.  If you're a premium customer, you can compile 1.9 using our portal.

To try it out immediately, fix is now live at https://demo.qz.io, just close QZ Tray and give the browser a few seconds to fallback to the Java Applet.

-Tres

rtuin...@gmail.com

unread,
Jan 15, 2016, 1:55:56 PM1/15/16
to qz-print, rtuin...@gmail.com
I compiled it and it worked great!! Thank you so much!
Reply all
Reply to author
Forward
0 new messages