import * as ASCIIUtils from "@/uni_modules/wrs-js-modbusCRCHex/js_sdk/wrs-ASCIIUtils"; // import {logs} from "@/utils/util"; import {Base} from "@/utils/usbSerial/base"; import {logs} from "@/utils/util"; export class ScanMachine extends Base { constructor(topClass, usbSerial) { super(topClass, usbSerial) this.id = 'scan' this.title = '扫码器' this.config = { baudRate: 115200, dataBits: 8, stopBits: 1, } } read(resp) { logs('read', this.id, resp) let resArr = this.packetManager(resp.data) resArr.forEach(it => { let data = it.slice(2, -2); it = ASCIIUtils.decodeUtf8(data) logs('scan usbSerial.read', it) if (this.notifyFun) this.notifyFun(it) }) } }