Skip to content

Commit

Permalink
Make the connection port for SceneGraphDebugCommandController configu…
Browse files Browse the repository at this point in the history
…rable (#177)

* Make the connection port for SceneGraphDebugCommandController configurable

* Update src/SceneGraphDebugCommandController.ts

Co-authored-by: Bronley Plumb <bronley@gmail.com>

* Update src/SceneGraphDebugCommandController.ts

* Add description to sceneGraphDebugCommandsPort

* Update src/LaunchConfiguration.ts

---------

Co-authored-by: Christian Holbrook <dev.ramnage@gmail.com>
Co-authored-by: Bronley Plumb <bronley@gmail.com>
  • Loading branch information
3 people authored Dec 7, 2023
1 parent 97c37c4 commit 8ceb32c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
6 changes: 6 additions & 0 deletions src/LaunchConfiguration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,12 @@ export interface LaunchConfiguration extends DebugProtocol.LaunchRequestArgument
* @default false
*/
deleteDevChannelBeforeInstall: boolean;

/**
* sceneGraphDebugCommandsPort
* The port that should be used to send SceneGraph debug commands. Defaults to 8080.
*/
sceneGraphDebugCommandsPort: number;
}

export interface ComponentLibraryConfiguration {
Expand Down
2 changes: 1 addition & 1 deletion src/RendezvousTracker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ export class RendezvousTracker {
* Run a SceneGraph logendezvous 8080 command and get the text output
*/
private async runSGLogrendezvousCommand(command: 'status' | 'on' | 'off'): Promise<string> {
let sgDebugCommandController = new SceneGraphDebugCommandController(this.launchConfiguration.host);
let sgDebugCommandController = new SceneGraphDebugCommandController(this.launchConfiguration.host, this.launchConfiguration.sceneGraphDebugCommandsPort);
try {
this.logger.info(`port 8080 command: logrendezvous ${command}`);
return (await sgDebugCommandController.logrendezvous(command)).result.rawResponse;
Expand Down
5 changes: 3 additions & 2 deletions src/SceneGraphDebugCommandController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import { logger } from './logging';
const Telnet = require('telnet-client');

export class SceneGraphDebugCommandController {
constructor(public host: string) {
constructor(public host: string, port?: number) {
this.port = port ?? 8080;
}

private connection: typeof Telnet;
Expand All @@ -13,7 +14,7 @@ export class SceneGraphDebugCommandController {
private echoLines = 0;
public timeout = 5000;
public execTimeout = 2000;
private port = 8080;
private port;
private maxBufferLength = 5242880;

private logger = logger.createLogger(`[${SceneGraphDebugCommandController.name}]`);
Expand Down
2 changes: 1 addition & 1 deletion src/debugSession/BrightScriptDebugSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ export class BrightScriptDebugSession extends BaseDebugSession {

private async runAutomaticSceneGraphCommands(commands: string[]) {
if (commands) {
let connection = new SceneGraphDebugCommandController(this.launchConfiguration.host);
let connection = new SceneGraphDebugCommandController(this.launchConfiguration.host, this.launchConfiguration.sceneGraphDebugCommandsPort);

try {
await connection.connect();
Expand Down

0 comments on commit 8ceb32c

Please sign in to comment.