Wiki - 2.0 HID Communication

Compatibility

Read Data

// Hardware info (modify to match hardware)
var usb = {
   vendor: '0x0EB8',
   product: '0xF000'
};

// Generic error handler
var err = function(e) { console.error(e); }

// Generic data handler
var process = function(data) { console.log(data); }

// Handler to release claimed device    
var release = function() {
   qz.hid.releaseDevice(hid.vendor, hid.product).catch(err);
}

// Connect to QZ Tray, claim, read, release
qz.websocket.connect().then(function() {
   return qz.hid.claimDevice(hid.vendor, hid.product);
}).then(function() {
   return qz.hid.readData(hid.vendor, hid.product, '8'); // *
}).then(process).then(release).catch(err);

// Note:  Some hardware such as Fairbanks scales use '6' for byte length.  Adjust as needed

Send Data

function sendUsbData() {
   qz.usb.sendData('0x0EB8', '0xF000', data).catch(displayError);
}

qz.print(config, data).catch(function(e) { console.error(e); });
Edit this page