Implement MonitorService to handle pluggable monitor lifetime

This commit is contained in:
Silvano Cerza 2022-03-04 17:57:23 +01:00 committed by Alberto Iannaccone
parent ebab0b226f
commit 3133b01c4a
2 changed files with 31 additions and 0 deletions

View File

@ -13,3 +13,4 @@ export * from './examples-service';
export * from './executable-service';
export * from './response-service';
export * from './notification-service';
export * from './monitor-service';

View File

@ -0,0 +1,30 @@
import { Event, JsonRpcServer } from "@theia/core";
import { Board, Port } from './boards-service';
export const MonitorManagerProxyPath = '/services/monitor-manager-proxy';
export const MonitorManagerProxy = Symbol('MonitorManagerProxy');
export interface MonitorManagerProxy extends JsonRpcServer<MonitorManagerProxyClient> {
//set the monitor settings, which includes address, port and other monitor-specific settings
setMonitorSettings(board: Board, port: Port, settings: MonitorSettings): Promise<void>;
}
export const MonitorManagerProxyClient = Symbol('MonitorManagerProxyClient');
export interface MonitorManagerProxyClient {
onWebSocketChanged: Event<string>;
notifyWebSocketChanged(message: string): void;
}
export interface MonitorSetting {
// The setting identifier
readonly id: string;
// A human-readable label of the setting (to be displayed on the GUI)
readonly label: string;
// The setting type (at the moment only "enum" is avaiable)
readonly type: string;
// The values allowed on "enum" types
readonly values: string[];
// The selected value
selectedValue: string;
}
export type MonitorSettings = Record<string, MonitorSetting>;