MCPcopy Create free account
hub / github.com/Marus/cortex-debug / softwareEvent

Method softwareEvent

src/frontend/swo/decoders/binary.ts:73–101  ·  view source on GitHub ↗
(packet: Packet)

Source from the content-addressed store, hash-verified

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() {}

Callers

nothing calls this directly

Calls 4

toStringMethod · 0.80
createDateTimestampMethod · 0.80
parseEncodedFunction · 0.70
writeMethod · 0.45

Tested by

no test coverage detected