mirror of
https://github.com/arduino/arduino-ide.git
synced 2025-07-14 14:56:33 +00:00
Fixed missing core client in the monitor service.
Restored monitor service creation state before a36524e: Pass core client provider into new instances as a field. Closes #1161 Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
This commit is contained in:
parent
7d961537eb
commit
f4a68e793e
@ -245,7 +245,7 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {
|
|||||||
const webSocketProvider =
|
const webSocketProvider =
|
||||||
container.get<WebSocketProvider>(WebSocketProvider);
|
container.get<WebSocketProvider>(WebSocketProvider);
|
||||||
|
|
||||||
const { board, port, monitorID } = options;
|
const { board, port, coreClientProvider, monitorID } = options;
|
||||||
|
|
||||||
return new MonitorService(
|
return new MonitorService(
|
||||||
logger,
|
logger,
|
||||||
@ -253,6 +253,7 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {
|
|||||||
webSocketProvider,
|
webSocketProvider,
|
||||||
board,
|
board,
|
||||||
port,
|
port,
|
||||||
|
coreClientProvider,
|
||||||
monitorID
|
monitorID
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -397,7 +397,7 @@ export namespace CoreClientProvider {
|
|||||||
@injectable()
|
@injectable()
|
||||||
export abstract class CoreClientAware {
|
export abstract class CoreClientAware {
|
||||||
@inject(CoreClientProvider)
|
@inject(CoreClientProvider)
|
||||||
private readonly coreClientProvider: CoreClientProvider;
|
protected readonly coreClientProvider: CoreClientProvider; // TODO: should be `private`, fix injection in subclasses. (https://github.com/arduino/arduino-ide/issues/1161)
|
||||||
/**
|
/**
|
||||||
* Returns with a promise that resolves when the core client is initialized and ready.
|
* Returns with a promise that resolves when the core client is initialized and ready.
|
||||||
*/
|
*/
|
||||||
|
@ -55,7 +55,7 @@ export class MonitorManager extends CoreClientAware {
|
|||||||
* @param board board connected to port
|
* @param board board connected to port
|
||||||
* @param port port to monitor
|
* @param port port to monitor
|
||||||
* @returns true if the monitor is currently monitoring the board/port
|
* @returns true if the monitor is currently monitoring the board/port
|
||||||
* combination specifed, false in all other cases.
|
* combination specified, false in all other cases.
|
||||||
*/
|
*/
|
||||||
isStarted(board: Board, port: Port): boolean {
|
isStarted(board: Board, port: Port): boolean {
|
||||||
const monitorID = this.monitorID(board, port);
|
const monitorID = this.monitorID(board, port);
|
||||||
@ -317,6 +317,7 @@ export class MonitorManager extends CoreClientAware {
|
|||||||
board,
|
board,
|
||||||
port,
|
port,
|
||||||
monitorID,
|
monitorID,
|
||||||
|
coreClientProvider: this.coreClientProvider,
|
||||||
});
|
});
|
||||||
this.monitorServices.set(monitorID, monitor);
|
this.monitorServices.set(monitorID, monitor);
|
||||||
monitor.onDispose(
|
monitor.onDispose(
|
||||||
|
@ -1,13 +1,20 @@
|
|||||||
import { Board, Port } from '../common/protocol';
|
import { Board, Port } from '../common/protocol';
|
||||||
|
import { CoreClientProvider } from './core-client-provider';
|
||||||
import { MonitorService } from './monitor-service';
|
import { MonitorService } from './monitor-service';
|
||||||
|
|
||||||
export const MonitorServiceFactory = Symbol('MonitorServiceFactory');
|
export const MonitorServiceFactory = Symbol('MonitorServiceFactory');
|
||||||
export interface MonitorServiceFactory {
|
export interface MonitorServiceFactory {
|
||||||
(options: { board: Board; port: Port; monitorID: string }): MonitorService;
|
(options: {
|
||||||
|
board: Board;
|
||||||
|
port: Port;
|
||||||
|
monitorID: string;
|
||||||
|
coreClientProvider: CoreClientProvider;
|
||||||
|
}): MonitorService;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface MonitorServiceFactoryOptions {
|
export interface MonitorServiceFactoryOptions {
|
||||||
board: Board;
|
board: Board;
|
||||||
port: Port;
|
port: Port;
|
||||||
monitorID: string;
|
monitorID: string;
|
||||||
|
coreClientProvider: CoreClientProvider;
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ import {
|
|||||||
MonitorRequest,
|
MonitorRequest,
|
||||||
MonitorResponse,
|
MonitorResponse,
|
||||||
} from './cli-protocol/cc/arduino/cli/commands/v1/monitor_pb';
|
} from './cli-protocol/cc/arduino/cli/commands/v1/monitor_pb';
|
||||||
import { CoreClientAware } from './core-client-provider';
|
import { CoreClientAware, CoreClientProvider } from './core-client-provider';
|
||||||
import { WebSocketProvider } from './web-socket/web-socket-provider';
|
import { WebSocketProvider } from './web-socket/web-socket-provider';
|
||||||
import { Port as gRPCPort } from 'arduino-ide-extension/src/node/cli-protocol/cc/arduino/cli/commands/v1/port_pb';
|
import { Port as gRPCPort } from 'arduino-ide-extension/src/node/cli-protocol/cc/arduino/cli/commands/v1/port_pb';
|
||||||
import {
|
import {
|
||||||
@ -77,6 +77,7 @@ export class MonitorService extends CoreClientAware implements Disposable {
|
|||||||
|
|
||||||
private readonly board: Board,
|
private readonly board: Board,
|
||||||
private readonly port: Port,
|
private readonly port: Port,
|
||||||
|
protected override readonly coreClientProvider: CoreClientProvider,
|
||||||
private readonly monitorID: string
|
private readonly monitorID: string
|
||||||
) {
|
) {
|
||||||
super();
|
super();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user