(cmd: string)
| 388 | private tclCommandQueue: TclCommandQueue[] = []; |
| 389 | private tclCommandId: number = 1; |
| 390 | private tclCommand(cmd: string): Promise<string> { |
| 391 | return new Promise<string>((resolve, reject) => { |
| 392 | this.tclStartSocket().then(() => { |
| 393 | if (!cmd) { |
| 394 | resolve(''); |
| 395 | return; |
| 396 | } |
| 397 | const newCmd: TclCommandQueue = { |
| 398 | cmd: cmd, |
| 399 | id: this.tclCommandId++, |
| 400 | resolve: resolve, |
| 401 | reject: reject |
| 402 | }; |
| 403 | if (this.args.showDevDebugOutput) { |
| 404 | this.session.handleMsg('log', `openocd <- ${newCmd.id}-${cmd}\n`); |
| 405 | } |
| 406 | this.tclCommandQueue.push(newCmd); |
| 407 | this.tclSendData(cmd); |
| 408 | }, (e) => { |
| 409 | reject(e); |
| 410 | return null; |
| 411 | }); |
| 412 | }); |
| 413 | } |
| 414 | |
| 415 | public tclStartSocket(): Promise<void> { |
| 416 | if (this.tclSocket) { |
no test coverage detected