(packet: Packet)
| 71 | } |
| 72 | |
| 73 | public softwareEvent(packet: Packet) { |
| 74 | if (packet.port !== this.port) { return; } |
| 75 | |
| 76 | const date = new Date(); |
| 77 | |
| 78 | const hexvalue = packet.data.toString('hex'); |
| 79 | const decodedValue = parseEncoded(packet.data, this.encoding); |
| 80 | const scaledValue = decodedValue * this.scale; |
| 81 | const timestamp = this.hrTimer.createDateTimestamp(); |
| 82 | |
| 83 | const str = `${timestamp} ${hexvalue} - ${decodedValue} - ${scaledValue}`; |
| 84 | if (this.useTerminal) { |
| 85 | this.ptyTerm.write(str + '\n'); |
| 86 | } else { |
| 87 | this.output.appendLine(str); |
| 88 | } |
| 89 | |
| 90 | if (this.logFd >= 0) { |
| 91 | try { |
| 92 | fs.writeSync(this.logFd, packet.data); |
| 93 | } |
| 94 | catch (e) { |
| 95 | const msg = `Could not write to file ${this.logfile} for writing. ${e.toString()}`; |
| 96 | vscode.window.showErrorMessage(msg); |
| 97 | try { fs.closeSync(this.logFd); } catch {} |
| 98 | this.logFd = -1; |
| 99 | } |
| 100 | } |
| 101 | } |
| 102 | |
| 103 | public hardwareEvent(event: Packet) {} |
| 104 | public synchronized() {} |
nothing calls this directly
no test coverage detected