You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since version 1.6.0, You can send and receive serial port data using the jSSC plugin.
Note: Serial support requires jssc.jar, which is bundled with both QZ Print and QZ Tray.
Note: Some Linux versions require dialout group membership via sudo adduser $USER dialout. Reboot required.
Discovering local ports
qz.findPorts();// Alert COM ports that are availablefunctionqzDoneFindingPorts(){varports=qz.getPorts().split(",");for(pinports){alert(ports[p]);}}
Opening a local COM port
qz.openPort("COM1");//e.g. /dev/ttyS0, /dev/ttyUSB0, depending on platformfunctionqzDoneOpeningPort(port){alert(port+" open");}
Sending data to an open COM port
// Setup beginning and end patterns for a successful messageqz.setSerialBegin("\x02");// STX for Mettler Toledo Scaleqz.setSerialEnd("\x0D");// ETX for Mettler Toledo Scale// Baud rate, data bits, stop bits, parity, flow controlqz.setSerialProperties("9600","7","1","even","none");// Send raw commands to the specified port.// W = weight on Mettler Toledo Scaleqz.send("COM1","\nW\n");
Receiving the response
// Retrieve serial response (automatically called)functionqzSerialReturned(port,data){alert(port+" returned:\n\t"+data);}
Closing the COM Port
qz.closePort("COM1");// e.g. /dev/ttyS0, /dev/ttyUSB0functionqzDoneClosingPort(portName){alert(port+" closed");}