【问题标题】:Get data from barcode scanner (Honeywell MS 9540) in Node JS从 Node JS 中的条形码扫描仪 (Honeywell MS 9540) 获取数据
【发布时间】:2020-10-09 12:23:14
【问题描述】:

我正在尝试从 Node JS 中的条形码扫描仪中检索扫描的数据。我不确定这是否是正确的问题。如果问题错了,请见谅。

条形码扫描仪型号是 Honeywell MS 9540。我不知道如何实现它。 Node JS 发现它是一个 USB 设备。有什么方法可以实现吗?

我正在 Electron 中为 Windows 构建一个应用程序,并考虑使用本地 Node JS 服务器从设备中检索数据。

我在 Node JS 中使用了 usb-barcode-scanner 包。它可以在其他 USB 设备中找到条码扫描器。但我收到一个错误:

Error: cannot open device with vendor id 0xc2e and product id 0x200

这是我的代码:

const express = require('express')
const app = express()
const { getDevices, UsbScanner } = require('usb-barcode-scanner')

console.log(getDevices())

let scanner = new UsbScanner({
    vendorId: 3118,
    productId: 512,
    path: '\\\\?\\hid#vid_0c2e&pid_0200#6&24268576&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}\\kbd'
    /** You could also initialize the scanner by giving entering the path variable:
     *  path: 'IOService:/AppleACPI etc...'
    **/  
});

scanner.on('data', (data) => {
    console.log(data);
});

app.listen(8000, function () {
    console.log(`Express listening on port ` + 8000)
});

【问题讨论】:

标签: node.js barcode-scanner honeywell


【解决方案1】:

我意识到条码扫描仪可以用作键盘。只有一个输入应该被聚焦,扫描结果将是聚焦输入的值。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-06-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多