(packet: Packet)
| 109 | } |
| 110 | |
| 111 | public softwareEvent(packet: Packet) { |
| 112 | if (packet.port !== this.port) { return; } |
| 113 | const letters = packet.data.toString(this.encoding); |
| 114 | |
| 115 | if (this.logFd >= 0) { |
| 116 | try { |
| 117 | fs.writeSync(this.logFd, letters); |
| 118 | } |
| 119 | catch (e) { |
| 120 | const msg = `Could not write to file ${this.logfile} for writing. ${e.toString()}`; |
| 121 | vscode.window.showErrorMessage(msg); |
| 122 | try { fs.closeSync(this.logFd); } catch {} |
| 123 | this.logFd = -1; |
| 124 | } |
| 125 | } |
| 126 | |
| 127 | for (const letter of letters) { |
| 128 | if (this.timeout) { clearTimeout(this.timeout); this.timeout = null; } |
| 129 | |
| 130 | if (letter === '\n') { |
| 131 | this.pushOutput('\n'); |
| 132 | this.position = 0; |
| 133 | continue; |
| 134 | } |
| 135 | |
| 136 | if (this.position === 0) { |
| 137 | this.pushOutput(this.createDateHeaderUs()); |
| 138 | } |
| 139 | |
| 140 | this.pushOutput(letter); |
| 141 | this.position += 1; |
| 142 | |
| 143 | if (this.timestamp && (this.position > 0)) { |
| 144 | if (this.timeout) { |
| 145 | clearTimeout(this.timeout); |
| 146 | } |
| 147 | this.timeout = setTimeout(() => { |
| 148 | this.pushOutput('\n'); |
| 149 | this.position = 0; |
| 150 | this.timeout = null; |
| 151 | }, 5000); |
| 152 | } |
| 153 | } |
| 154 | } |
| 155 | |
| 156 | public hardwareEvent(event: Packet) {} |
| 157 | public synchronized() {} |
nothing calls this directly
no test coverage detected