qz-tray
Version:
Connects a web client to the QZ Tray software. Enables printing and device communication from javascript.
3,421 lines (1,034 loc) • 45.1 kB
HTML
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Namespace: hid</title>
<script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>
<body>
<div id="main">
<h1 class="page-title">Namespace: hid</h1>
<section>
<header>
<h2>
<span class="ancestors"><a href="qz.html">qz</a>.</span>hid</h2>
</header>
<article>
<div class="container-overview">
<div class="description">Calls related to interaction with HID USB devices<br/>
Many of these calls can be accomplished from the <code>qz.usb</code> namespace,
but HID allows for simpler interaction</div>
<dl class="details">
<dt class="tag-since">Since:</dt>
<dd class="tag-since"><ul class="dummy"><li>2.0.1</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="qz-tray.js.html">qz-tray.js</a>, <a href="qz-tray.js.html#line2231">line 2231</a>
</li></ul></dd>
</dl>
</div>
<h3 class="subsection-title">Methods</h3>
<h4 class="name" id=".claimDevice"><span class="type-signature">(static) </span>claimDevice<span class="signature">(deviceInfo)</span><span class="type-signature"> → {Promise.<(null|Error)>}</span></h4>
<div class="description">
Claim a HID device to enable sending/reading data across.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>deviceInfo</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last">Config details of the HID device.
<h6>Properties</h6>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>vendorId</code></td>
<td class="type">
</td>
<td class="description last">Hex string of HID device's vendor ID.</td>
</tr>
<tr>
<td class="name"><code>productId</code></td>
<td class="type">
</td>
<td class="description last">Hex string of HID device's product ID.</td>
</tr>
<tr>
<td class="name"><code>usagePage</code></td>
<td class="type">
</td>
<td class="description last">Hex string of HID device's usage page when multiple are present.</td>
</tr>
<tr>
<td class="name"><code>serial</code></td>
<td class="type">
</td>
<td class="description last">Serial ID of HID device.</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-since">Since:</dt>
<dd class="tag-since"><ul class="dummy"><li>2.0.1</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="qz-tray.js.html">qz-tray.js</a>, <a href="qz-tray.js.html#line2310">line 2310</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise.<(null|Error)></span>
</dd>
</dl>
<h4 class="name" id=".closeStream"><span class="type-signature">(static) </span>closeStream<span class="signature">(deviceInfo)</span><span class="type-signature"> → {Promise.<(null|Error)>}</span></h4>
<div class="description">
Stops the stream of read data from a claimed HID device.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>deviceInfo</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last">Config details of the HID device.
<h6>Properties</h6>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>vendorId</code></td>
<td class="type">
</td>
<td class="description last">Hex string of HID device's vendor ID.</td>
</tr>
<tr>
<td class="name"><code>productId</code></td>
<td class="type">
</td>
<td class="description last">Hex string of HID device's product ID.</td>
</tr>
<tr>
<td class="name"><code>usagePage</code></td>
<td class="type">
</td>
<td class="description last">Hex string of HID device's usage page when multiple are present.</td>
</tr>
<tr>
<td class="name"><code>serial</code></td>
<td class="type">
</td>
<td class="description last">Serial ID of HID device.</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-since">Since:</dt>
<dd class="tag-since"><ul class="dummy"><li>2.0.1</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="qz-tray.js.html">qz-tray.js</a>, <a href="qz-tray.js.html#line2498">line 2498</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise.<(null|Error)></span>
</dd>
</dl>
<h4 class="name" id=".getFeatureReport"><span class="type-signature">(static) </span>getFeatureReport<span class="signature">(deviceInfo)</span><span class="type-signature"> → {Promise.<(Array.<string>|Error)>}</span></h4>
<div class="description">
Get a feature report from a claimed HID device.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>deviceInfo</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last">Config details of the HID device.
<h6>Properties</h6>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>vendorId</code></td>
<td class="type">
</td>
<td class="description last">Hex string of HID device's vendor ID.</td>
</tr>
<tr>
<td class="name"><code>productId</code></td>
<td class="type">
</td>
<td class="description last">Hex string of HID device's product ID.</td>
</tr>
<tr>
<td class="name"><code>usagePage</code></td>
<td class="type">
</td>
<td class="description last">Hex string of HID device's usage page when multiple are present.</td>
</tr>
<tr>
<td class="name"><code>serial</code></td>
<td class="type">
</td>
<td class="description last">Serial ID of HID device.</td>
</tr>
<tr>
<td class="name"><code>responseSize</code></td>
<td class="type">
</td>
<td class="description last">Size of the byte array to receive a response in.</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="qz-tray.js.html">qz-tray.js</a>, <a href="qz-tray.js.html#line2450">line 2450</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
List of (hexadecimal) bytes received from the HID device.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise.<(Array.<string>|Error)></span>
</dd>
</dl>
<h4 class="name" id=".isClaimed"><span class="type-signature">(static) </span>isClaimed<span class="signature">(deviceInfo)</span><span class="type-signature"> → {Promise.<(boolean|Error)>}</span></h4>
<div class="description">
Check the current claim state of a HID device.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>deviceInfo</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last">Config details of the HID device.
<h6>Properties</h6>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>vendorId</code></td>
<td class="type">
</td>
<td class="description last">Hex string of HID device's vendor ID.</td>
</tr>
<tr>
<td class="name"><code>productId</code></td>
<td class="type">
</td>
<td class="description last">Hex string of HID device's product ID.</td>
</tr>
<tr>
<td class="name"><code>usagePage</code></td>
<td class="type">
</td>
<td class="description last">Hex string of HID device's usage page when multiple are present.</td>
</tr>
<tr>
<td class="name"><code>serial</code></td>
<td class="type">
</td>
<td class="description last">Serial ID of HID device.</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-since">Since:</dt>
<dd class="tag-since"><ul class="dummy"><li>2.0.2</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="qz-tray.js.html">qz-tray.js</a>, <a href="qz-tray.js.html#line2329">line 2329</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise.<(boolean|Error)></span>
</dd>
</dl>
<h4 class="name" id=".listDevices"><span class="type-signature">(static) </span>listDevices<span class="signature">()</span><span class="type-signature"> → {Promise.<(Array.<Object>|Error)>}</span></h4>
<div class="description">
List of available HID devices. Includes (hexadecimal) vendor ID and (hexadecimal) product ID.
If available, also returns manufacturer and product descriptions.
</div>
<dl class="details">
<dt class="tag-since">Since:</dt>
<dd class="tag-since"><ul class="dummy"><li>2.0.1</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="qz-tray.js.html">qz-tray.js</a>, <a href="qz-tray.js.html#line2248">line 2248</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
Array of JSON objects containing information on connected HID devices.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise.<(Array.<Object>|Error)></span>
</dd>
</dl>
<h4 class="name" id=".openStream"><span class="type-signature">(static) </span>openStream<span class="signature">(deviceInfo)</span><span class="type-signature"> → {Promise.<(null|Error)>}</span></h4>
<div class="description">
Provides a continuous stream of read data from a claimed HID device.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>deviceInfo</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last">Config details of the HID device.
<h6>Properties</h6>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>vendorId</code></td>
<td class="type">
</td>
<td class="default">
</td>
<td class="description last">Hex string of HID device's vendor ID.</td>
</tr>
<tr>
<td class="name"><code>productId</code></td>
<td class="type">
</td>
<td class="default">
</td>
<td class="description last">Hex string of HID device's product ID.</td>
</tr>
<tr>
<td class="name"><code>usagePage</code></td>
<td class="type">
</td>
<td class="default">
</td>
<td class="description last">Hex string of HID device's usage page when multiple are present.</td>
</tr>
<tr>
<td class="name"><code>serial</code></td>
<td class="type">
</td>
<td class="default">
</td>
<td class="description last">Serial ID of HID device.</td>
</tr>
<tr>
<td class="name"><code>responseSize</code></td>
<td class="type">
</td>
<td class="default">
</td>
<td class="description last">Size of the byte array to receive a response in.</td>
</tr>
<tr>
<td class="name"><code>interval</code></td>
<td class="type">
</td>
<td class="default">
100
</td>
<td class="description last">Frequency to send read data back, in milliseconds.</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-since">Since:</dt>
<dd class="tag-since"><ul class="dummy"><li>2.0.1</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="qz-tray.js.html">qz-tray.js</a>, <a href="qz-tray.js.html#line2471">line 2471</a>
</li></ul></dd>
<dt class="tag-see">See:</dt>
<dd class="tag-see">
<ul>
<li><a href="qz.hid.html#.setHidCallbacks">qz.hid.setHidCallbacks</a></li>
</ul>
</dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise.<(null|Error)></span>
</dd>
</dl>
<h4 class="name" id=".readData"><span class="type-signature">(static) </span>readData<span class="signature">(deviceInfo)</span><span class="type-signature"> → {Promise.<(Array.<string>|Error)>}</span></h4>
<div class="description">
Read data from a claimed HID device.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>deviceInfo</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last">Config details of the HID device.
<h6>Properties</h6>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>vendorId</code></td>
<td class="type">
</td>
<td class="description last">Hex string of HID device's vendor ID.</td>
</tr>
<tr>
<td class="name"><code>productId</code></td>
<td class="type">
</td>
<td class="description last">Hex string of HID device's product ID.</td>
</tr>
<tr>
<td class="name"><code>usagePage</code></td>
<td class="type">
</td>
<td class="description last">Hex string of HID device's usage page when multiple are present.</td>
</tr>
<tr>
<td class="name"><code>serial</code></td>
<td class="type">
</td>
<td class="description last">Serial ID of HID device.</td>
</tr>
<tr>
<td class="name"><code>responseSize</code></td>
<td class="type">
</td>
<td class="description last">Size of the byte array to receive a response in.</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-since">Since:</dt>
<dd class="tag-since"><ul class="dummy"><li>2.0.1</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="qz-tray.js.html">qz-tray.js</a>, <a href="qz-tray.js.html#line2403">line 2403</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
List of (hexadecimal) bytes received from the HID device.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise.<(Array.<string>|Error)></span>
</dd>
</dl>
<h4 class="name" id=".releaseDevice"><span class="type-signature">(static) </span>releaseDevice<span class="signature">(deviceInfo)</span><span class="type-signature"> → {Promise.<(null|Error)>}</span></h4>
<div class="description">
Release a claimed HID device to free resources after sending/reading data.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>deviceInfo</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last">Config details of the HID device.
<h6>Properties</h6>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>vendorId</code></td>
<td class="type">
</td>
<td class="description last">Hex string of HID device's vendor ID.</td>
</tr>
<tr>
<td class="name"><code>productId</code></td>
<td class="type">
</td>
<td class="description last">Hex string of HID device's product ID.</td>
</tr>
<tr>
<td class="name"><code>usagePage</code></td>
<td class="type">
</td>
<td class="description last">Hex string of HID device's usage page when multiple are present.</td>
</tr>
<tr>
<td class="name"><code>serial</code></td>
<td class="type">
</td>
<td class="description last">Serial ID of HID device.</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-since">Since:</dt>
<dd class="tag-since"><ul class="dummy"><li>2.0.1</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="qz-tray.js.html">qz-tray.js</a>, <a href="qz-tray.js.html#line2517">line 2517</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise.<(null|Error)></span>
</dd>
</dl>
<h4 class="name" id=".sendData"><span class="type-signature">(static) </span>sendData<span class="signature">(deviceInfo)</span><span class="type-signature"> → {Promise.<(null|Error)>}</span></h4>
<div class="description">
Send data to a claimed HID device.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>deviceInfo</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last">Config details of the HID device.
<h6>Properties</h6>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>vendorId</code></td>
<td class="type">
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last">Hex string of HID device's vendor ID.</td>
</tr>
<tr>
<td class="name"><code>productId</code></td>
<td class="type">
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last">Hex string of HID device's product ID.</td>
</tr>
<tr>
<td class="name"><code>usagePage</code></td>
<td class="type">
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last">Hex string of HID device's usage page when multiple are present.</td>
</tr>
<tr>
<td class="name"><code>serial</code></td>
<td class="type">
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last">Serial ID of HID device.</td>
</tr>
<tr>
<td class="name"><code>data</code></td>
<td class="type">
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last">Bytes to send over specified endpoint.</td>
</tr>
<tr>
<td class="name"><code>endpoint</code></td>
<td class="type">
</td>
<td class="attributes">
</td>
<td class="default">
0x00
</td>
<td class="description last">First byte of the data packet signifying the HID report ID.
Must be 0x00 for devices only supporting a single report.</td>
</tr>
<tr>
<td class="name"><code>reportId</code></td>
<td class="type">
</td>
<td class="attributes">
</td>
<td class="default">
0x00
</td>
<td class="description last">Alias for <code>deviceInfo.endpoint</code>. Not used if endpoint is provided.</td>
</tr>
<tr>
<td class="name"><code>type</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="default">
'PLAIN'
</td>
<td class="description last">Valid values <code>[FILE | PLAIN | HEX | BASE64]</code></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-since">Since:</dt>
<dd class="tag-since"><ul class="dummy"><li>2.0.1</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="qz-tray.js.html">qz-tray.js</a>, <a href="qz-tray.js.html#line2353">line 2353</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise.<(null|Error)></span>
</dd>
</dl>
<h4 class="name" id=".sendFeatureReport"><span class="type-signature">(static) </span>sendFeatureReport<span class="signature">(deviceInfo)</span><span class="type-signature"> → {Promise.<(null|Error)>}</span></h4>
<div class="description">
Send a feature report to a claimed HID device.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>deviceInfo</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last">Config details of the HID device.
<h6>Properties</h6>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>vendorId</code></td>
<td class="type">
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last">Hex string of HID device's vendor ID.</td>
</tr>
<tr>
<td class="name"><code>productId</code></td>
<td class="type">
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last">Hex string of HID device's product ID.</td>
</tr>
<tr>
<td class="name"><code>usagePage</code></td>
<td class="type">
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last">Hex string of HID device's usage page when multiple are present.</td>
</tr>
<tr>
<td class="name"><code>serial</code></td>
<td class="type">
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last">Serial ID of HID device.</td>
</tr>
<tr>
<td class="name"><code>data</code></td>
<td class="type">
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last">Bytes to send over specified endpoint.</td>
</tr>
<tr>
<td class="name"><code>endpoint</code></td>
<td class="type">
</td>
<td class="attributes">
</td>
<td class="default">
0x00
</td>
<td class="description last">First byte of the data packet signifying the HID report ID.
Must be 0x00 for devices only supporting a single report.</td>
</tr>
<tr>
<td class="name"><code>reportId</code></td>
<td class="type">
</td>
<td class="attributes">
</td>
<td class="default">
0x00
</td>
<td class="description last">Alias for <code>deviceInfo.endpoint</code>. Not used if endpoint is provided.</td>
</tr>
<tr>
<td class="name"><code>type</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="default">
'PLAIN'
</td>
<td class="description last">Valid values <code>[FILE | PLAIN | HEX | BASE64]</code></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="qz-tray.js.html">qz-tray.js</a>, <a href="qz-tray.js.html#line2433">line 2433</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise.<(null|Error)></span>
</dd>
</dl>
<h4 class="name" id=".setHidCallbacks"><span class="type-signature">(static) </span>setHidCallbacks<span class="signature">(calls)</span><span class="type-signature"></span></h4>
<div class="description">
List of functions called for any response from open usb devices.
Event data will contain <code>{string} vendorId</code> and <code>{string} productId</code> for all types.
For RECEIVE types, <code>{Array} output</code> (in hexadecimal format).
For ERROR types, <code>{string} exception</code>.
For ACTION types, <code>{string} actionType</code>.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>calls</code></td>
<td class="type">
<span class="param-type">function</span>
|
<span class="param-type">Array.<function()></span>
</td>
<td class="description last">Single or array of <code>Function({Object} eventData)</code> calls.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-since">Since:</dt>
<dd class="tag-since"><ul class="dummy"><li>2.0.1</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="qz-tray.js.html">qz-tray.js</a>, <a href="qz-tray.js.html#line2293">line 2293</a>
</li></ul></dd>
</dl>
<h4 class="name" id=".startListening"><span class="type-signature">(static) </span>startListening<span class="signature">()</span><span class="type-signature"> → {Promise.<(null|Error)>}</span></h4>
<div class="description">
Start listening for HID device actions, such as attach / detach events.
Reported under the ACTION type in the streamEvent on callbacks.
</div>
<dl class="details">
<dt class="tag-since">Since:</dt>
<dd class="tag-since"><ul class="dummy"><li>2.0.1</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="qz-tray.js.html">qz-tray.js</a>, <a href="qz-tray.js.html#line2263">line 2263</a>
</li></ul></dd>
<dt class="tag-see">See:</dt>
<dd class="tag-see">
<ul>
<li><a href="qz.hid.html#.setHidCallbacks">qz.hid.setHidCallbacks</a></li>
</ul>
</dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise.<(null|Error)></span>
</dd>
</dl>
<h4 class="name" id=".stopListening"><span class="type-signature">(static) </span>stopListening<span class="signature">()</span><span class="type-signature"> → {Promise.<(null|Error)>}</span></h4>
<div class="description">
Stop listening for HID device actions.
</div>
<dl class="details">
<dt class="tag-since">Since:</dt>
<dd class="tag-since"><ul class="dummy"><li>2.0.1</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="qz-tray.js.html">qz-tray.js</a>, <a href="qz-tray.js.html#line2277">line 2277</a>
</li></ul></dd>
<dt class="tag-see">See:</dt>
<dd class="tag-see">
<ul>
<li><a href="qz.hid.html#.setHidCallbacks">qz.hid.setHidCallbacks</a></li>
</ul>
</dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise.<(null|Error)></span>
</dd>
</dl>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Namespaces</h3><ul><li><a href="qz.html">qz</a></li><li><a href="qz.api.html">api</a></li><li><a href="qz.configs.html">configs</a></li><li><a href="qz.file.html">file</a></li><li><a href="qz.hid.html">hid</a></li><li><a href="qz.networking.html">networking</a></li><li><a href="qz.printers.html">printers</a></li><li><a href="qz.security.html">security</a></li><li><a href="qz.serial.html">serial</a></li><li><a href="qz.socket.html">socket</a></li><li><a href="qz.usb.html">usb</a></li><li><a href="qz.websocket.html">websocket</a></li></ul>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a> on Thu Apr 02 2026 13:01:02 GMT-0400 (Eastern Daylight Time)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>