Conversation
|
@auzcoder thanks, I approved the workflow to run so that you can download the binaries. They'll appear in the summary section of GitHub actions once ready.... e.g. https://github.com/qzind/tray/actions/runs/24137180724#artifacts Thanks for this code contribution. I didn't expect this to require JNA... can you explain a bit about the addition of COM calls to this per (e.g. Also note that all API calls are subject to change, so please feel free to integrate with the one-off builds provided by our build system, but if we add this feature for 2.3.x the API may change. We provide a https://qz.io/api/qz.api#.isVersionGreater call that you can potentially use in the future to support both versions. |
|
This guide provides technical details for integrating industrial hardware (specifically Shtrikh-M scales) with your web application using the custom UDP-enabled QZ Tray. To establish a connection with the scale over UDP, use the following JavaScript configuration: var config = { host: "192.168.85.208", // Scale IP port: 1213, // Scale listening port (default for Shtrih-M Ethernet) options: { protocol: "udp", localPort: 2000, // PC source port (Scale expects 2000) responseFormat: "HEX" // Critical for binary protocols } }; <clipboard-copy aria-label="Copy" class="ClipboardButton btn btn-invisible js-clipboard-copy m-2 p-0 d-flex flex-justify-center flex-items-center" data-copy-feedback="Copied!" data-tooltip-direction="w" value="var config = { host: "192.168.85.208", // Scale IP port: 1213, // Scale listening port (default for Shtrih-M Ethernet) options: { protocol: "udp", localPort: 2000, // PC source port (Scale expects 2000) responseFormat: "HEX" // Critical for binary protocols } }; qz.socket.open(config.host, config.port, config.options) Since hardware protocols are binary, QZ Tray converts incoming bytes into HEX strings. You must set up an event listener to capture these. qz.socket.setEventListener(function(event) { <clipboard-copy aria-label="Copy" class="ClipboardButton btn btn-invisible js-clipboard-copy m-2 p-0 d-flex flex-justify-center flex-items-center" data-copy-feedback="Copied!" data-tooltip-direction="w" value="qz.socket.setEventListener(function(event) { if (event.type === 'RECEIVE') { processScaleResponse(event.response); } }); function processScaleResponse(hex) { }" tabindex="0" role="button" style="box-sizing: border-box; padding: 0px !important; font-size: 14px; font-weight: 500; white-space: nowrap; vertical-align: middle; cursor: pointer; user-select: none; appearance: none; border: 0px; border-radius: 6px; line-height: 20px; display: flex !important; position: relative; color: rgb(68, 147, 248); background-color: rgba(0, 0, 0, 0); box-shadow: none; transition: color 80ms cubic-bezier(0.33, 1, 0.68, 1), background-color 80ms cubic-bezier(0.33, 1, 0.68, 1), box-shadow 80ms cubic-bezier(0.33, 1, 0.68, 1), border-color 80ms cubic-bezier(0.33, 1, 0.68, 1); justify-content: center !important; align-items: center !important; margin: 8px !important; width: 28px; height: 28px;"> All packets follow this structure:
Use this helper to construct packets dynamically: function sendShtrihPacket(cmd, dataBytes) { <clipboard-copy aria-label="Copy" class="ClipboardButton btn btn-invisible js-clipboard-copy m-2 p-0 d-flex flex-justify-center flex-items-center" data-copy-feedback="Copied!" data-tooltip-direction="w" value="function sendShtrihPacket(cmd, dataBytes) { var len = dataBytes.length + 1; var packet = [len, cmd].concat(dataBytes); }" tabindex="0" role="button" style="box-sizing: border-box; padding: 0px !important; font-size: 14px; font-weight: 500; white-space: nowrap; vertical-align: middle; cursor: pointer; user-select: none; appearance: none; border: 0px; border-radius: 6px; line-height: 20px; display: flex !important; position: relative; color: rgb(68, 147, 248); background-color: rgba(0, 0, 0, 0); box-shadow: none; transition: color 80ms cubic-bezier(0.33, 1, 0.68, 1), background-color 80ms cubic-bezier(0.33, 1, 0.68, 1), box-shadow 80ms cubic-bezier(0.33, 1, 0.68, 1), border-color 80ms cubic-bezier(0.33, 1, 0.68, 1); justify-content: center !important; align-items: center !important; margin: 8px !important; width: 28px; height: 28px;">
|
|
@auzcoder please cleanup the above post it's filled with formatting issues. |
No description provided.