UNPKG

@ginden/blinkstick-v2

Version:
38 lines 1.24 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.NodeHidAsyncTransport = void 0; const usb_transport_1 = require("./usb-transport"); /** * @summary UsbTransport implementation using the 'node-hid' library with asynchronous methods. * @category Adapters */ class NodeHidAsyncTransport extends usb_transport_1.UsbTransport { constructor(device) { super(); this.device = device; } static async create(device) { const transport = new NodeHidAsyncTransport(device); transport.deviceInfo = await device.getDeviceInfo(); return transport; } static createWithKnownInfo(device, info) { const transport = new NodeHidAsyncTransport(device); transport.deviceInfo = info; return transport; } sendFeatureReport(data) { return this.device.sendFeatureReport(data); } getFeatureReport(reportId, reportLength) { return this.device.getFeatureReport(reportId, reportLength); } getDeviceInfo() { return this.deviceInfo; } close() { return this.device.close(); } } exports.NodeHidAsyncTransport = NodeHidAsyncTransport; //# sourceMappingURL=node-hid-async-transport.js.map