mirror of
https://github.com/arduino/arduino-ide.git
synced 2025-07-27 21:26:41 +00:00
coreClientProvider is now set when constructing MonitorService
This commit is contained in:
parent
f9da9fc24b
commit
397ca5665f
@ -179,7 +179,8 @@ export class MonitorManager extends CoreClientAware {
|
|||||||
const monitor = new MonitorService(
|
const monitor = new MonitorService(
|
||||||
this.logger,
|
this.logger,
|
||||||
board,
|
board,
|
||||||
port
|
port,
|
||||||
|
this.coreClientProvider,
|
||||||
);
|
);
|
||||||
monitor.onDispose((() => {
|
monitor.onDispose((() => {
|
||||||
this.monitorServices.delete(monitorID);
|
this.monitorServices.delete(monitorID);
|
||||||
|
@ -3,7 +3,7 @@ import { Disposable, Emitter, ILogger } from "@theia/core";
|
|||||||
import { inject, named } from "@theia/core/shared/inversify";
|
import { inject, named } from "@theia/core/shared/inversify";
|
||||||
import { Board, Port, Status, MonitorSettings, Monitor } from "../common/protocol";
|
import { Board, Port, Status, MonitorSettings, Monitor } from "../common/protocol";
|
||||||
import { EnumerateMonitorPortSettingsRequest, EnumerateMonitorPortSettingsResponse, MonitorPortConfiguration, MonitorPortSetting, MonitorRequest, MonitorResponse } from "./cli-protocol/cc/arduino/cli/commands/v1/monitor_pb";
|
import { EnumerateMonitorPortSettingsRequest, EnumerateMonitorPortSettingsResponse, MonitorPortConfiguration, MonitorPortSetting, MonitorRequest, MonitorResponse } 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 WebSocketProviderImpl from "./web-socket/web-socket-provider-impl";
|
import WebSocketProviderImpl from "./web-socket/web-socket-provider-impl";
|
||||||
@ -46,6 +46,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 readonly coreClientProvider: CoreClientProvider,
|
||||||
) {
|
) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
@ -98,6 +99,7 @@ export class MonitorService extends CoreClientAware implements Disposable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.logger.info("starting monitor");
|
this.logger.info("starting monitor");
|
||||||
|
await this.coreClientProvider.initialized;
|
||||||
const coreClient = await this.coreClient();
|
const coreClient = await this.coreClient();
|
||||||
const { client, instance } = coreClient;
|
const { client, instance } = coreClient;
|
||||||
|
|
||||||
@ -151,6 +153,7 @@ export class MonitorService extends CoreClientAware implements Disposable {
|
|||||||
this.startMessagesHandlers();
|
this.startMessagesHandlers();
|
||||||
this.logger.info(`started monitor to ${this.port?.address} using ${this.port?.protocol}`)
|
this.logger.info(`started monitor to ${this.port?.address} using ${this.port?.protocol}`)
|
||||||
resolve(Status.OK);
|
resolve(Status.OK);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
this.logger.warn(`failed starting monitor to ${this.port?.address} using ${this.port?.protocol}`)
|
this.logger.warn(`failed starting monitor to ${this.port?.address} using ${this.port?.protocol}`)
|
||||||
resolve(Status.NOT_CONNECTED);
|
resolve(Status.NOT_CONNECTED);
|
||||||
@ -212,6 +215,7 @@ export class MonitorService extends CoreClientAware implements Disposable {
|
|||||||
if (!this.duplex) {
|
if (!this.duplex) {
|
||||||
return Status.NOT_CONNECTED;
|
return Status.NOT_CONNECTED;
|
||||||
}
|
}
|
||||||
|
await this.coreClientProvider.initialized;
|
||||||
const coreClient = await this.coreClient();
|
const coreClient = await this.coreClient();
|
||||||
const { instance } = coreClient;
|
const { instance } = coreClient;
|
||||||
|
|
||||||
@ -245,6 +249,7 @@ export class MonitorService extends CoreClientAware implements Disposable {
|
|||||||
* @returns a map of all the settings supported by the monitor
|
* @returns a map of all the settings supported by the monitor
|
||||||
*/
|
*/
|
||||||
private async portMonitorSettings(protocol: string, fqbn: string): Promise<MonitorSettings> {
|
private async portMonitorSettings(protocol: string, fqbn: string): Promise<MonitorSettings> {
|
||||||
|
await this.coreClientProvider.initialized;
|
||||||
const coreClient = await this.coreClient();
|
const coreClient = await this.coreClient();
|
||||||
const { client, instance } = coreClient;
|
const { client, instance } = coreClient;
|
||||||
const req = new EnumerateMonitorPortSettingsRequest();
|
const req = new EnumerateMonitorPortSettingsRequest();
|
||||||
@ -295,6 +300,7 @@ export class MonitorService extends CoreClientAware implements Disposable {
|
|||||||
if (!this.duplex) {
|
if (!this.duplex) {
|
||||||
return Status.NOT_CONNECTED;
|
return Status.NOT_CONNECTED;
|
||||||
}
|
}
|
||||||
|
await this.coreClientProvider.initialized;
|
||||||
const coreClient = await this.coreClient();
|
const coreClient = await this.coreClient();
|
||||||
const { instance } = coreClient;
|
const { instance } = coreClient;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user