feat: use new debug -I -P CLI output

- Can pick a programmer if missing,
 - Can auto-select a programmer on app start,
 - Can edit the `launch.json`,
 - Adjust board discovery to new gRPC API. From now on, it's a client
 read stream, not a duplex.
 - Allow `.cxx` and `.cc` file extensions. (Closes #2265)
 - Drop `debuggingSupported` from `BoardDetails`.
 - Dedicated service endpoint for checking the debugger.

Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
This commit is contained in:
Akos Kitta
2023-11-08 12:04:44 +01:00
committed by Akos Kitta
parent 42bf1a0e99
commit 73b6dc4774
48 changed files with 4697 additions and 3041 deletions

View File

@@ -69,6 +69,7 @@
"deepmerge": "^4.2.2",
"drivelist": "^9.2.4",
"electron-updater": "^4.6.5",
"fast-deep-equal": "^3.1.3",
"fast-json-stable-stringify": "^2.1.0",
"fast-safe-stringify": "^2.1.1",
"filename-reserved-regex": "^2.0.0",
@@ -169,7 +170,7 @@
],
"arduino": {
"arduino-cli": {
"version": "0.34.0"
"version": "0.35.0-rc.7"
},
"arduino-fwuploader": {
"version": "2.4.1"

View File

@@ -1,5 +1,5 @@
import '../../src/browser/style/index.css';
import { ContainerModule } from '@theia/core/shared/inversify';
import { Container, ContainerModule } from '@theia/core/shared/inversify';
import { WidgetFactory } from '@theia/core/lib/browser/widget-manager';
import { CommandContribution } from '@theia/core/lib/common/command';
import { bindViewContribution } from '@theia/core/lib/browser/shell/view-contribution';
@@ -361,6 +361,16 @@ import { TerminalFrontendContribution as TheiaTerminalFrontendContribution } fro
import { SelectionService } from '@theia/core/lib/common/selection-service';
import { CommandService } from '@theia/core/lib/common/command';
import { CorePreferences } from '@theia/core/lib/browser/core-preferences';
import { AutoSelectProgrammer } from './contributions/auto-select-programmer';
import { HostedPluginSupport } from './hosted/hosted-plugin-support';
import { DebugSessionManager as TheiaDebugSessionManager } from '@theia/debug/lib/browser/debug-session-manager';
import { DebugSessionManager } from './theia/debug/debug-session-manager';
import { DebugWidget } from '@theia/debug/lib/browser/view/debug-widget';
import { DebugViewModel } from '@theia/debug/lib/browser/view/debug-view-model';
import { DebugSessionWidget } from '@theia/debug/lib/browser/view/debug-session-widget';
import { DebugConfigurationWidget } from './theia/debug/debug-configuration-widget';
import { DebugConfigurationWidget as TheiaDebugConfigurationWidget } from '@theia/debug/lib/browser/view/debug-configuration-widget';
import { DebugToolBar } from '@theia/debug/lib/browser/view/debug-toolbar-widget';
// Hack to fix copy/cut/paste issue after electron version update in Theia.
// https://github.com/eclipse-theia/theia/issues/12487
@@ -756,6 +766,7 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {
Contribution.configure(bind, CreateCloudCopy);
Contribution.configure(bind, UpdateArduinoState);
Contribution.configure(bind, BoardsDataMenuUpdater);
Contribution.configure(bind, AutoSelectProgrammer);
bindContributionProvider(bind, StartupTaskProvider);
bind(StartupTaskProvider).toService(BoardsServiceProvider); // to reuse the boards config in another window
@@ -857,6 +868,28 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {
// To be able to use a `launch.json` from outside of the workspace.
bind(DebugConfigurationManager).toSelf().inSingletonScope();
rebind(TheiaDebugConfigurationManager).toService(DebugConfigurationManager);
// To update the currently selected debug config <select> option when starting a debug session.
bind(DebugSessionManager).toSelf().inSingletonScope();
rebind(TheiaDebugSessionManager).toService(DebugSessionManager);
// Customized debug widget with its customized config <select> to update it programmatically.
bind(WidgetFactory)
.toDynamicValue(({ container }) => ({
id: DebugWidget.ID,
createWidget: () => {
const child = new Container({ defaultScope: 'Singleton' });
child.parent = container;
child.bind(DebugViewModel).toSelf();
child.bind(DebugToolBar).toSelf();
child.bind(DebugSessionWidget).toSelf();
child.bind(DebugConfigurationWidget).toSelf(); // with the patched select
child // use the customized one in the Theia DI
.bind(TheiaDebugConfigurationWidget)
.toService(DebugConfigurationWidget);
child.bind(DebugWidget).toSelf();
return child.get(DebugWidget);
},
}))
.inSingletonScope();
// To avoid duplicate tabs use deepEqual instead of string equal: https://github.com/eclipse-theia/theia/issues/11309
bind(WidgetManager).toSelf().inSingletonScope();

View File

@@ -10,13 +10,16 @@ import { DisposableCollection } from '@theia/core/lib/common/disposable';
import { Emitter, Event } from '@theia/core/lib/common/event';
import { ILogger } from '@theia/core/lib/common/logger';
import { deepClone, deepFreeze } from '@theia/core/lib/common/objects';
import type { Mutable } from '@theia/core/lib/common/types';
import { inject, injectable, named } from '@theia/core/shared/inversify';
import {
BoardDetails,
BoardsService,
ConfigOption,
ConfigValue,
Programmer,
isBoardIdentifierChangeEvent,
isProgrammer,
} from '../../common/protocol';
import { notEmpty } from '../../common/utils';
import type {
@@ -74,7 +77,7 @@ export class BoardsDataStore
const storedData =
await this.storageService.getData<BoardsDataStore.Data>(key);
if (!storedData) {
// if not previously value is available for the board, do not update the cache
// if no previously value is available for the board, do not update the cache
continue;
}
const details = await this.loadBoardDetails(fqbn);
@@ -88,6 +91,13 @@ export class BoardsDataStore
this.fireChanged(...changes);
}
}),
this.onDidChange((event) => {
const selectedFqbn =
this.boardsServiceProvider.boardsConfig.selectedBoard?.fqbn;
if (event.changes.find((change) => change.fqbn === selectedFqbn)) {
this.updateSelectedBoardData(selectedFqbn);
}
}),
]);
Promise.all([
@@ -174,7 +184,7 @@ export class BoardsDataStore
return storedData;
}
const boardDetails = await this.getBoardDetailsSafe(fqbn);
const boardDetails = await this.loadBoardDetails(fqbn);
if (!boardDetails) {
return BoardsDataStore.Data.EMPTY;
}
@@ -220,11 +230,12 @@ export class BoardsDataStore
}
let updated = false;
for (const value of configOption.values) {
if (value.value === selectedValue) {
(value as any).selected = true;
const mutable: Mutable<ConfigValue> = value;
if (mutable.value === selectedValue) {
mutable.selected = true;
updated = true;
} else {
(value as any).selected = false;
mutable.selected = false;
}
}
if (!updated) {
@@ -245,9 +256,7 @@ export class BoardsDataStore
return `.arduinoIDE-configOptions-${fqbn}`;
}
protected async getBoardDetailsSafe(
fqbn: string
): Promise<BoardDetails | undefined> {
async loadBoardDetails(fqbn: string): Promise<BoardDetails | undefined> {
try {
const details = await this.boardsService.getBoardDetails({ fqbn });
return details;
@@ -280,21 +289,24 @@ export namespace BoardsDataStore {
readonly configOptions: ConfigOption[];
readonly programmers: Programmer[];
readonly selectedProgrammer?: Programmer;
readonly defaultProgrammerId?: string;
}
export namespace Data {
export const EMPTY: Data = deepFreeze({
configOptions: [],
programmers: [],
defaultProgrammerId: undefined,
});
export function is(arg: unknown): arg is Data {
return (
!!arg &&
'configOptions' in arg &&
Array.isArray(arg['configOptions']) &&
'programmers' in arg &&
Array.isArray(arg['programmers'])
typeof arg === 'object' &&
arg !== null &&
Array.isArray((<Data>arg).configOptions) &&
Array.isArray((<Data>arg).programmers) &&
((<Data>arg).selectedProgrammer === undefined ||
isProgrammer((<Data>arg).selectedProgrammer)) &&
((<Data>arg).defaultProgrammerId === undefined ||
typeof (<Data>arg).defaultProgrammerId === 'string')
);
}
}
@@ -304,7 +316,8 @@ export function isEmptyData(data: BoardsDataStore.Data): boolean {
return (
Boolean(!data.configOptions.length) &&
Boolean(!data.programmers.length) &&
Boolean(!data.selectedProgrammer)
Boolean(!data.selectedProgrammer) &&
Boolean(!data.defaultProgrammerId)
);
}
@@ -324,16 +337,18 @@ export function findDefaultProgrammer(
function createDataStoreEntry(details: BoardDetails): BoardsDataStore.Data {
const configOptions = details.configOptions.slice();
const programmers = details.programmers.slice();
const { defaultProgrammerId } = details;
const selectedProgrammer = findDefaultProgrammer(
programmers,
details.defaultProgrammerId
defaultProgrammerId
);
return {
const data = {
configOptions,
programmers,
defaultProgrammerId: details.defaultProgrammerId,
selectedProgrammer,
...(selectedProgrammer ? { selectedProgrammer } : {}),
...(defaultProgrammerId ? { defaultProgrammerId } : {}),
};
return data;
}
export interface BoardsDataStoreChange {

View File

@@ -0,0 +1,123 @@
import type { MaybePromise } from '@theia/core/lib/common/types';
import { inject, injectable } from '@theia/core/shared/inversify';
import {
BoardDetails,
Programmer,
isBoardIdentifierChangeEvent,
} from '../../common/protocol';
import {
BoardsDataStore,
findDefaultProgrammer,
isEmptyData,
} from '../boards/boards-data-store';
import { BoardsServiceProvider } from '../boards/boards-service-provider';
import { Contribution } from './contribution';
/**
* Before CLI 0.35.0-rc.3, there was no `programmer#default` property in the `board details` response.
* This method does the programmer migration in the data store. If there is a programmer selected, it's a noop.
* If no programmer is selected, it forcefully reloads the details from the CLI and updates it in the local storage.
*/
@injectable()
export class AutoSelectProgrammer extends Contribution {
@inject(BoardsServiceProvider)
private readonly boardsServiceProvider: BoardsServiceProvider;
@inject(BoardsDataStore)
private readonly boardsDataStore: BoardsDataStore;
override onStart(): void {
this.boardsServiceProvider.onBoardsConfigDidChange((event) => {
if (isBoardIdentifierChangeEvent(event)) {
this.ensureProgrammerIsSelected();
}
});
}
override onReady(): void {
this.boardsServiceProvider.ready.then(() =>
this.ensureProgrammerIsSelected()
);
}
private async ensureProgrammerIsSelected(): Promise<boolean> {
return ensureProgrammerIsSelected({
fqbn: this.boardsServiceProvider.boardsConfig.selectedBoard?.fqbn,
getData: (fqbn) => this.boardsDataStore.getData(fqbn),
loadBoardDetails: (fqbn) => this.boardsDataStore.loadBoardDetails(fqbn),
selectProgrammer: (arg) => this.boardsDataStore.selectProgrammer(arg),
});
}
}
interface EnsureProgrammerIsSelectedParams {
fqbn: string | undefined;
getData: (fqbn: string | undefined) => MaybePromise<BoardsDataStore.Data>;
loadBoardDetails: (fqbn: string) => MaybePromise<BoardDetails | undefined>;
selectProgrammer(options: {
fqbn: string;
selectedProgrammer: Programmer;
}): MaybePromise<boolean>;
}
export async function ensureProgrammerIsSelected(
params: EnsureProgrammerIsSelectedParams
): Promise<boolean> {
const { fqbn, getData, loadBoardDetails, selectProgrammer } = params;
if (!fqbn) {
return false;
}
console.debug(`Ensuring a programmer is selected for ${fqbn}...`);
const data = await getData(fqbn);
if (isEmptyData(data)) {
// For example, the platform is not installed.
console.debug(`Skipping. No boards data is available for ${fqbn}.`);
return false;
}
if (data.selectedProgrammer) {
console.debug(
`A programmer is already selected for ${fqbn}: '${data.selectedProgrammer.id}'.`
);
return true;
}
let programmer = findDefaultProgrammer(data.programmers, data);
if (programmer) {
// select the programmer if the default info is available
const result = await selectProgrammer({
fqbn,
selectedProgrammer: programmer,
});
if (result) {
console.debug(`Selected '${programmer.id}' programmer for ${fqbn}.`);
return result;
}
}
console.debug(`Reloading board details for ${fqbn}...`);
const reloadedData = await loadBoardDetails(fqbn);
if (!reloadedData) {
console.debug(`Skipping. No board details found for ${fqbn}.`);
return false;
}
if (!reloadedData.programmers.length) {
console.debug(`Skipping. ${fqbn} does not have programmers.`);
return false;
}
programmer = findDefaultProgrammer(reloadedData.programmers, reloadedData);
if (!programmer) {
console.debug(
`Skipping. Could not find a default programmer for ${fqbn}. Programmers were: `
);
return false;
}
const result = await selectProgrammer({
fqbn,
selectedProgrammer: programmer,
});
if (result) {
console.debug(`Selected '${programmer.id}' programmer for ${fqbn}.`);
} else {
console.debug(
`Could not select '${programmer.id}' programmer for ${fqbn}.`
);
}
return result;
}

View File

@@ -1,12 +1,20 @@
import { Emitter, Event } from '@theia/core/lib/common/event';
import { MenuModelRegistry } from '@theia/core/lib/common/menu/menu-model-registry';
import { nls } from '@theia/core/lib/common/nls';
import { MaybePromise } from '@theia/core/lib/common/types';
import { inject, injectable } from '@theia/core/shared/inversify';
import { noBoardSelected } from '../../common/nls';
import {
Board,
BoardDetails,
BoardIdentifier,
BoardsService,
CheckDebugEnabledParams,
ExecutableService,
SketchRef,
isBoardIdentifierChangeEvent,
Sketch,
isCompileSummary,
} from '../../common/protocol';
import { BoardsDataStore } from '../boards/boards-data-store';
import { BoardsServiceProvider } from '../boards/boards-service-provider';
import { HostedPluginSupport } from '../hosted/hosted-plugin-support';
import { ArduinoMenus } from '../menu/arduino-menus';
@@ -14,95 +22,119 @@ import { NotificationCenter } from '../notification-center';
import { CurrentSketch } from '../sketches-service-client-impl';
import { ArduinoToolbar } from '../toolbar/arduino-toolbar';
import {
URI,
Command,
CommandRegistry,
SketchContribution,
TabBarToolbarRegistry,
URI,
} from './contribution';
import { MenuModelRegistry, nls } from '@theia/core/lib/common';
import { CurrentSketch } from '../sketches-service-client-impl';
import { ArduinoMenus } from '../menu/arduino-menus';
const COMPILE_FOR_DEBUG_KEY = 'arduino-compile-for-debug';
interface StartDebugParams {
/**
* Absolute filesystem path to the Arduino CLI executable.
*/
readonly cliPath: string;
/**
* The the board to debug.
*/
readonly board: Readonly<{ fqbn: string; name?: string }>;
/**
* Absolute filesystem path of the sketch to debug.
*/
readonly sketchPath: string;
/**
* Location where the `launch.json` will be created on the fly before starting every debug session.
* If not defined, it falls back to `sketchPath/.vscode/launch.json`.
*/
readonly launchConfigsDirPath?: string;
/**
* Absolute path to the `arduino-cli.yaml` file. If not specified, it falls back to `~/.arduinoIDE/arduino-cli.yaml`.
*/
readonly cliConfigPath?: string;
/**
* Programmer for the debugging.
*/
readonly programmer?: string;
/**
* Custom progress title to use when getting the debug information from the CLI.
*/
readonly title?: string;
}
type StartDebugResult = boolean;
@injectable()
export class Debug extends SketchContribution {
@inject(HostedPluginSupport)
private readonly hostedPluginSupport: HostedPluginSupport;
@inject(NotificationCenter)
private readonly notificationCenter: NotificationCenter;
@inject(ExecutableService)
private readonly executableService: ExecutableService;
@inject(BoardsService)
private readonly boardService: BoardsService;
@inject(BoardsServiceProvider)
private readonly boardsServiceProvider: BoardsServiceProvider;
@inject(BoardsDataStore)
private readonly boardsDataStore: BoardsDataStore;
/**
* If `undefined`, debugging is enabled. Otherwise, the reason why it's disabled.
* If `undefined`, debugging is enabled. Otherwise, the human-readable reason why it's disabled.
*/
private _disabledMessages?: string = nls.localize(
'arduino/common/noBoardSelected',
'No board selected'
); // Initial pessimism.
private disabledMessageDidChangeEmitter = new Emitter<string | undefined>();
private onDisabledMessageDidChange =
this.disabledMessageDidChangeEmitter.event;
private _message?: string = noBoardSelected; // Initial pessimism.
private didChangeMessageEmitter = new Emitter<string | undefined>();
private onDidChangeMessage = this.didChangeMessageEmitter.event;
private get disabledMessage(): string | undefined {
return this._disabledMessages;
private get message(): string | undefined {
return this._message;
}
private set disabledMessage(message: string | undefined) {
this._disabledMessages = message;
this.disabledMessageDidChangeEmitter.fire(this._disabledMessages);
private set message(message: string | undefined) {
this._message = message;
this.didChangeMessageEmitter.fire(this._message);
}
private readonly debugToolbarItem = {
id: Debug.Commands.START_DEBUGGING.id,
command: Debug.Commands.START_DEBUGGING.id,
tooltip: `${
this.disabledMessage
this.message
? nls.localize(
'arduino/debug/debugWithMessage',
'Debug - {0}',
this.disabledMessage
this.message
)
: Debug.Commands.START_DEBUGGING.label
}`,
priority: 3,
onDidChange: this.onDisabledMessageDidChange as Event<void>,
onDidChange: this.onDidChangeMessage as Event<void>,
};
override onStart(): void {
this.onDisabledMessageDidChange(
this.onDidChangeMessage(
() =>
(this.debugToolbarItem.tooltip = `${
this.disabledMessage
this.message
? nls.localize(
'arduino/debug/debugWithMessage',
'Debug - {0}',
this.disabledMessage
this.message
)
: Debug.Commands.START_DEBUGGING.label
}`)
);
this.boardsServiceProvider.onBoardsConfigDidChange((event) => {
if (isBoardIdentifierChangeEvent(event)) {
this.refreshState(event.selectedBoard);
this.updateMessage();
}
});
this.notificationCenter.onPlatformDidInstall(() => this.refreshState());
this.notificationCenter.onPlatformDidUninstall(() => this.refreshState());
this.notificationCenter.onPlatformDidInstall(() => this.updateMessage());
this.notificationCenter.onPlatformDidUninstall(() => this.updateMessage());
this.boardsDataStore.onDidChange((event) => {
const selectedFqbn =
this.boardsServiceProvider.boardsConfig.selectedBoard?.fqbn;
if (event.changes.find((change) => change.fqbn === selectedFqbn)) {
this.refreshState();
this.updateMessage();
}
});
this.commandService.onDidExecuteCommand((event) => {
@@ -111,13 +143,13 @@ export class Debug extends SketchContribution {
commandId === 'arduino.languageserver.notifyBuildDidComplete' &&
isCompileSummary(args[0])
) {
this.refreshState();
this.updateMessage();
}
});
}
override onReady(): void {
this.boardsServiceProvider.ready.then(() => this.refreshState());
this.boardsServiceProvider.ready.then(() => this.updateMessage());
}
override registerCommands(registry: CommandRegistry): void {
@@ -125,7 +157,7 @@ export class Debug extends SketchContribution {
execute: () => this.startDebug(),
isVisible: (widget) =>
ArduinoToolbar.is(widget) && widget.side === 'left',
isEnabled: () => !this.disabledMessage,
isEnabled: () => !this.message,
});
registry.registerCommand(Debug.Commands.TOGGLE_OPTIMIZE_FOR_DEBUG, {
execute: () => this.toggleCompileForDebug(),
@@ -148,94 +180,56 @@ export class Debug extends SketchContribution {
});
}
private async refreshState(
board: Board | undefined = this.boardsServiceProvider.boardsConfig
private async updateMessage(): Promise<void> {
try {
await this.isDebugEnabled();
this.message = undefined;
} catch (err) {
let message = String(err);
if (err instanceof Error) {
message = err.message;
}
this.message = message;
}
}
private async isDebugEnabled(
board: BoardIdentifier | undefined = this.boardsServiceProvider.boardsConfig
.selectedBoard
): Promise<void> {
if (!board) {
this.disabledMessage = nls.localize(
'arduino/common/noBoardSelected',
'No board selected'
);
return;
}
const fqbn = board.fqbn;
if (!fqbn) {
this.disabledMessage = nls.localize(
'arduino/debug/noPlatformInstalledFor',
"Platform is not installed for '{0}'",
board.name
);
return;
}
const details = await this.boardService.getBoardDetails({ fqbn });
if (!details) {
this.disabledMessage = nls.localize(
'arduino/debug/noPlatformInstalledFor',
"Platform is not installed for '{0}'",
board.name
);
return;
}
const { debuggingSupported } = details;
if (!debuggingSupported) {
this.disabledMessage = nls.localize(
'arduino/debug/debuggingNotSupported',
"Debugging is not supported by '{0}'",
board.name
);
} else {
this.disabledMessage = undefined;
}
): Promise<string> {
const debugFqbn = await isDebugEnabled(
board,
(fqbn) => this.boardService.getBoardDetails({ fqbn }),
(fqbn) => this.boardsDataStore.getData(fqbn),
(fqbn) => this.boardsDataStore.appendConfigToFqbn(fqbn),
(params) => this.boardService.checkDebugEnabled(params)
);
return debugFqbn;
}
private async startDebug(
board: BoardIdentifier | undefined = this.boardsServiceProvider.boardsConfig
.selectedBoard
): Promise<void> {
if (!board) {
return;
.selectedBoard,
sketch:
| CurrentSketch
| undefined = this.sketchServiceClient.tryGetCurrentSketch()
): Promise<StartDebugResult> {
if (!CurrentSketch.isValid(sketch)) {
return false;
}
const { name, fqbn } = board;
if (!fqbn) {
return;
const params = await this.createStartDebugParams(board);
if (!params) {
return false;
}
await this.hostedPluginSupport.didStart;
const [sketch, executables] = await Promise.all([
this.sketchServiceClient.currentSketch(),
this.executableService.list(),
]);
if (!CurrentSketch.isValid(sketch)) {
return;
}
const ideTempFolderUri = await this.sketchesService.getIdeTempFolderUri(
sketch
);
const [cliPath, sketchPath, configPath] = await Promise.all([
this.fileService.fsPath(new URI(executables.cliUri)),
this.fileService.fsPath(new URI(sketch.uri)),
this.fileService.fsPath(new URI(ideTempFolderUri)),
]);
const config = {
cliPath,
board: {
fqbn,
name,
},
sketchPath,
configPath,
};
try {
await this.commandService.executeCommand('arduino.debug.start', config);
const result = await this.debug(params);
return Boolean(result);
} catch (err) {
if (await this.isSketchNotVerifiedError(err, sketch)) {
const yes = nls.localize('vscode/extensionsUtils/yes', 'Yes');
const answer = await this.messageService.error(
nls.localize(
'arduino/debug/sketchIsNotCompiled',
"Sketch '{0}' must be verified before starting a debug session. Please verify the sketch and start debugging again. Do you want to verify the sketch now?",
sketch.name
),
sketchIsNotCompiled(sketch.name),
yes
);
if (answer === yes) {
@@ -247,6 +241,16 @@ export class Debug extends SketchContribution {
);
}
}
return false;
}
private async debug(
params: StartDebugParams
): Promise<StartDebugResult | undefined> {
return this.commandService.executeCommand<StartDebugResult>(
'arduino.debug.start',
params
);
}
get compileForDebug(): boolean {
@@ -254,7 +258,7 @@ export class Debug extends SketchContribution {
return value === 'true';
}
async toggleCompileForDebug(): Promise<void> {
private toggleCompileForDebug(): void {
const oldState = this.compileForDebug;
const newState = !oldState;
window.localStorage.setItem(COMPILE_FOR_DEBUG_KEY, String(newState));
@@ -263,7 +267,7 @@ export class Debug extends SketchContribution {
private async isSketchNotVerifiedError(
err: unknown,
sketch: Sketch
sketch: SketchRef
): Promise<boolean> {
if (err instanceof Error) {
try {
@@ -277,6 +281,48 @@ export class Debug extends SketchContribution {
}
return false;
}
private async createStartDebugParams(
board: BoardIdentifier | undefined
): Promise<StartDebugParams | undefined> {
if (!board || !board.fqbn) {
return undefined;
}
let debugFqbn: string | undefined = undefined;
try {
debugFqbn = await this.isDebugEnabled(board);
} catch {}
if (!debugFqbn) {
return undefined;
}
const [sketch, executables, boardsData] = await Promise.all([
this.sketchServiceClient.currentSketch(),
this.executableService.list(),
this.boardsDataStore.getData(board.fqbn),
]);
if (!CurrentSketch.isValid(sketch)) {
return undefined;
}
const ideTempFolderUri = await this.sketchesService.getIdeTempFolderUri(
sketch
);
const [cliPath, sketchPath, launchConfigsDirPath] = await Promise.all([
this.fileService.fsPath(new URI(executables.cliUri)),
this.fileService.fsPath(new URI(sketch.uri)),
this.fileService.fsPath(new URI(ideTempFolderUri)),
]);
return {
board: { fqbn: debugFqbn, name: board.name },
cliPath,
sketchPath,
launchConfigsDirPath,
programmer: boardsData.selectedProgrammer?.id,
title: nls.localize(
'arduino/debug/getDebugInfo',
'Getting debug info...'
),
};
}
}
export namespace Debug {
export namespace Commands {
@@ -301,3 +347,89 @@ export namespace Debug {
};
}
}
/**
* (non-API)
*/
export async function isDebugEnabled(
board: BoardIdentifier | undefined,
getDetails: (fqbn: string) => MaybePromise<BoardDetails | undefined>,
getData: (fqbn: string) => MaybePromise<BoardsDataStore.Data>,
appendConfigToFqbn: (fqbn: string) => MaybePromise<string | undefined>,
checkDebugEnabled: (params: CheckDebugEnabledParams) => MaybePromise<string>
): Promise<string> {
if (!board) {
throw new Error(noBoardSelected);
}
const { fqbn } = board;
if (!fqbn) {
throw new Error(noPlatformInstalledFor(board.name));
}
const [details, data, fqbnWithConfig] = await Promise.all([
getDetails(fqbn),
getData(fqbn),
appendConfigToFqbn(fqbn),
]);
if (!details) {
throw new Error(noPlatformInstalledFor(board.name));
}
if (!fqbnWithConfig) {
throw new Error(
`Failed to append boards config to the FQBN. Original FQBN was: ${fqbn}`
);
}
if (!data.selectedProgrammer) {
throw new Error(noProgrammerSelectedFor(board.name));
}
const params = {
fqbn: fqbnWithConfig,
programmer: data.selectedProgrammer.id,
};
try {
const debugFqbn = await checkDebugEnabled(params);
return debugFqbn;
} catch (err) {
throw new Error(debuggingNotSupported(board.name));
}
}
/**
* (non-API)
*/
export function sketchIsNotCompiled(sketchName: string): string {
return nls.localize(
'arduino/debug/sketchIsNotCompiled',
"Sketch '{0}' must be verified before starting a debug session. Please verify the sketch and start debugging again. Do you want to verify the sketch now?",
sketchName
);
}
/**
* (non-API)
*/
export function noPlatformInstalledFor(boardName: string): string {
return nls.localize(
'arduino/debug/noPlatformInstalledFor',
"Platform is not installed for '{0}'",
boardName
);
}
/**
* (non-API)
*/
export function debuggingNotSupported(boardName: string): string {
return nls.localize(
'arduino/debug/debuggingNotSupported',
"Debugging is not supported by '{0}'",
boardName
);
}
/**
* (non-API)
*/
export function noProgrammerSelectedFor(boardName: string): string {
return nls.localize(
'arduino/debug/noProgrammerSelectedFor',
"No programmer selected for '{0}'",
boardName
);
}

View File

@@ -20,26 +20,83 @@ import { NotificationCenter } from '../notification-center';
import { SketchContribution, URI } from './contribution';
import { BoardsDataStore } from '../boards/boards-data-store';
interface DaemonAddress {
/**
* The host where the Arduino CLI daemon is available.
*/
readonly hostname: string;
/**
* The port where the Arduino CLI daemon is listening.
*/
readonly port: number;
/**
* The [id](https://arduino.github.io/arduino-cli/latest/rpc/commands/#instance) of the initialized core Arduino client instance.
*/
readonly instance: number;
}
interface StartLanguageServerParams {
/**
* Absolute filesystem path to the Arduino Language Server executable.
*/
readonly lsPath: string;
/**
* The hostname and the port for the gRPC channel connecting to the Arduino CLI daemon.
* The `instance` number is for the initialized core Arduino client.
*/
readonly daemonAddress: DaemonAddress;
/**
* Absolute filesystem path to [`clangd`](https://clangd.llvm.org/).
*/
readonly clangdPath: string;
/**
* The board is relevant to start a specific "flavor" of the language.
*/
readonly board: { fqbn: string; name?: string };
/**
* `true` if the LS should generate the log files into the default location. The default location is the `cwd` of the process.
* It's very often the same as the workspace root of the IDE, aka the sketch folder.
* When it is a string, it is the absolute filesystem path to the folder to generate the log files.
* If `string`, but the path is inaccessible, the log files will be generated into the default location.
*/
readonly log?: boolean | string;
/**
* Optional `env` for the language server process.
*/
readonly env?: NodeJS.ProcessEnv;
/**
* Additional flags for the Arduino Language server process.
*/
readonly flags?: readonly string[];
/**
* Set to `true`, to enable `Diagnostics`.
*/
readonly realTimeDiagnostics?: boolean;
/**
* If `true`, the logging is not forwarded to the _Output_ view via the language client.
*/
readonly silentOutput?: boolean;
}
/**
* The FQBN the language server runs with or `undefined` if it could not start.
*/
type StartLanguageServerResult = string | undefined;
@injectable()
export class InoLanguage extends SketchContribution {
@inject(HostedPluginEvents)
private readonly hostedPluginEvents: HostedPluginEvents;
@inject(ExecutableService)
private readonly executableService: ExecutableService;
@inject(ArduinoDaemon)
private readonly daemon: ArduinoDaemon;
@inject(BoardsService)
private readonly boardsService: BoardsService;
@inject(BoardsServiceProvider)
private readonly boardsServiceProvider: BoardsServiceProvider;
@inject(NotificationCenter)
private readonly notificationCenter: NotificationCenter;
@inject(BoardsDataStore)
private readonly boardDataStore: BoardsDataStore;
@@ -129,6 +186,10 @@ export class InoLanguage extends SketchContribution {
if (!port) {
return;
}
const portNumber = Number.parseInt(port, 10); // TODO: IDE2 APIs should provide a number and not string
if (Number.isNaN(portNumber)) {
return;
}
const release = await this.languageServerStartMutex.acquire();
const toDisposeOnRelease = new DisposableCollection();
try {
@@ -197,22 +258,22 @@ export class InoLanguage extends SketchContribution {
);
toDisposeOnRelease.push(Disposable.create(() => clearTimeout(timer)));
}),
this.commandService.executeCommand<string>(
'arduino.languageserver.start',
{
lsPath,
cliDaemonAddr: `localhost:${port}`,
clangdPath,
log: currentSketchPath ? currentSketchPath : log,
cliDaemonInstance: '1',
board: {
fqbn: fqbnWithConfig,
name: name ? `"${name}"` : undefined,
},
realTimeDiagnostics,
silentOutput: true,
}
),
this.start({
lsPath,
daemonAddress: {
hostname: 'localhost',
port: portNumber,
instance: 1, // TODO: get it from the backend
},
clangdPath,
log: currentSketchPath ? currentSketchPath : log,
board: {
fqbn: fqbnWithConfig,
name,
},
realTimeDiagnostics,
silentOutput: true,
}),
]);
} catch (e) {
console.log(`Failed to start language server. Original FQBN: ${fqbn}`, e);
@@ -222,4 +283,13 @@ export class InoLanguage extends SketchContribution {
release();
}
}
private async start(
params: StartLanguageServerParams
): Promise<StartLanguageServerResult | undefined> {
return this.commandService.executeCommand<StartLanguageServerResult>(
'arduino.languageserver.start',
params
);
}
}

View File

@@ -67,6 +67,7 @@ export class SketchesServiceClientImpl
);
private _currentSketch: CurrentSketch | undefined;
private _currentIdeTempFolderUri: URI | undefined;
private currentSketchLoaded = new Deferred<CurrentSketch>();
onStart(): void {
@@ -74,7 +75,10 @@ export class SketchesServiceClientImpl
this.watchSketchbookDir(sketchDirUri);
const refreshCurrentSketch = async () => {
const currentSketch = await this.loadCurrentSketch();
this.useCurrentSketch(currentSketch);
const ideTempFolderUri = await this.getIdeTempFolderUriForSketch(
currentSketch
);
this.useCurrentSketch(currentSketch, ideTempFolderUri);
};
this.toDispose.push(
this.configService.onDidChangeSketchDirUri((sketchDirUri) => {
@@ -141,7 +145,10 @@ export class SketchesServiceClientImpl
}
if (!Sketch.sameAs(this._currentSketch, reloadedSketch)) {
this.useCurrentSketch(reloadedSketch, true);
const ideTempFolderUri = await this.getIdeTempFolderUriForSketch(
reloadedSketch
);
this.useCurrentSketch(reloadedSketch, ideTempFolderUri, true);
}
return;
}
@@ -179,11 +186,23 @@ export class SketchesServiceClientImpl
]);
}
private async getIdeTempFolderUriForSketch(
sketch: CurrentSketch
): Promise<URI | undefined> {
if (CurrentSketch.isValid(sketch)) {
const uri = await this.sketchesService.getIdeTempFolderUri(sketch);
return new URI(uri);
}
return undefined;
}
private useCurrentSketch(
currentSketch: CurrentSketch,
ideTempFolderUri: URI | undefined,
reassignPromise = false
) {
this._currentSketch = currentSketch;
this._currentIdeTempFolderUri = ideTempFolderUri;
if (reassignPromise) {
this.currentSketchLoaded = new Deferred();
}
@@ -273,6 +292,14 @@ export class SketchesServiceClientImpl
return false;
}
if (
this._currentIdeTempFolderUri &&
this._currentIdeTempFolderUri.resolve('launch.json').toString() ===
toCheck.toString()
) {
return false;
}
const isCloudSketch = toCheck
.toString()
.includes(`${REMOTE_SKETCHBOOK_FOLDER}/${ARDUINO_CLOUD_FOLDER}`);

View File

@@ -1,44 +1,44 @@
import debounce from 'p-debounce';
import { inject, injectable } from '@theia/core/shared/inversify';
import URI from '@theia/core/lib/common/uri';
import { Event, Emitter } from '@theia/core/lib/common/event';
import { FrontendApplicationStateService } from '@theia/core/lib/browser/frontend-application-state';
import { DebugConfiguration } from '@theia/debug/lib/common/debug-common';
import { DebugConfigurationModel as TheiaDebugConfigurationModel } from '@theia/debug/lib/browser/debug-configuration-model';
import { Disposable } from '@theia/core/lib/common/disposable';
import { Emitter, Event } from '@theia/core/lib/common/event';
import URI from '@theia/core/lib/common/uri';
import { inject, injectable } from '@theia/core/shared/inversify';
import { DebugConfigurationManager as TheiaDebugConfigurationManager } from '@theia/debug/lib/browser/debug-configuration-manager';
import { DebugConfigurationModel as TheiaDebugConfigurationModel } from '@theia/debug/lib/browser/debug-configuration-model';
import { DebugConfiguration } from '@theia/debug/lib/common/debug-common';
import { FileService } from '@theia/filesystem/lib/browser/file-service';
import {
FileOperationError,
FileOperationResult,
} from '@theia/filesystem/lib/common/files';
import debounce from 'p-debounce';
import { SketchesService } from '../../../common/protocol';
import {
CurrentSketch,
SketchesServiceClientImpl,
} from '../../sketches-service-client-impl';
import { maybeUpdateReadOnlyState } from '../monaco/monaco-editor-provider';
import { DebugConfigurationModel } from './debug-configuration-model';
import {
FileOperationError,
FileOperationResult,
} from '@theia/filesystem/lib/common/files';
import { FileService } from '@theia/filesystem/lib/browser/file-service';
@injectable()
export class DebugConfigurationManager extends TheiaDebugConfigurationManager {
@inject(SketchesService)
protected readonly sketchesService: SketchesService;
private readonly sketchesService: SketchesService;
@inject(SketchesServiceClientImpl)
protected readonly sketchesServiceClient: SketchesServiceClientImpl;
private readonly sketchesServiceClient: SketchesServiceClientImpl;
@inject(FrontendApplicationStateService)
protected readonly appStateService: FrontendApplicationStateService;
private readonly appStateService: FrontendApplicationStateService;
@inject(FileService)
protected readonly fileService: FileService;
private readonly fileService: FileService;
protected onTempContentDidChangeEmitter =
private onTempContentDidChangeEmitter =
new Emitter<TheiaDebugConfigurationModel.JsonContent>();
get onTempContentDidChange(): Event<TheiaDebugConfigurationModel.JsonContent> {
return this.onTempContentDidChangeEmitter.event;
}
protected override async doInit(): Promise<void> {
this.watchLaunchConfigEditor();
this.appStateService.reachedState('ready').then(async () => {
const tempContent = await this.getTempLaunchJsonContent();
if (!tempContent) {
@@ -75,6 +75,19 @@ export class DebugConfigurationManager extends TheiaDebugConfigurationManager {
return super.doInit();
}
/**
* Sets a listener on current sketch change, and maybe updates the readonly state of the editor showing the debug configuration. aka the `launch.json`.
*/
private watchLaunchConfigEditor(): Disposable {
return this.sketchesServiceClient.onCurrentSketchDidChange(() => {
for (const widget of this.editorManager.all) {
maybeUpdateReadOnlyState(widget, (uri) =>
this.sketchesServiceClient.isReadOnly(uri)
);
}
});
}
protected override updateModels = debounce(async () => {
await this.appStateService.reachedState('ready');
const roots = await this.workspaceService.roots;
@@ -111,7 +124,7 @@ export class DebugConfigurationManager extends TheiaDebugConfigurationManager {
this.updateCurrent();
}, 500);
protected async getTempLaunchJsonContent(): Promise<
private async getTempLaunchJsonContent(): Promise<
(TheiaDebugConfigurationModel.JsonContent & { uri: URI }) | URI | undefined
> {
const sketch = await this.sketchesServiceClient.currentSketch();

View File

@@ -0,0 +1,57 @@
import { DisposableCollection } from '@theia/core/lib/common/disposable';
import { nls } from '@theia/core/lib/common/nls';
import { injectable } from '@theia/core/shared/inversify';
import React from '@theia/core/shared/react';
import { DebugAction } from '@theia/debug/lib/browser/view/debug-action';
import { DebugConfigurationSelect as TheiaDebugConfigurationSelect } from '@theia/debug/lib/browser/view/debug-configuration-select';
import { DebugConfigurationWidget as TheiaDebugConfigurationWidget } from '@theia/debug/lib/browser/view/debug-configuration-widget';
/**
* Patched to programmatically update the debug config <select> in the widget.
*/
@injectable()
export class DebugConfigurationWidget extends TheiaDebugConfigurationWidget {
override render(): React.ReactNode {
return (
<React.Fragment>
<DebugAction
run={this.start}
label={nls.localizeByDefault('Start Debugging')}
iconClass="debug-start"
ref={this.setStepRef}
/>
{/* The customized select component that will refresh when the config manager did change */}
<DebugConfigurationSelect
manager={this.manager}
quickInputService={this.quickInputService}
isMultiRoot={this.workspaceService.isMultiRootWorkspaceOpened}
/>
<DebugAction
run={this.openConfiguration}
label={nls.localizeByDefault('Open {0}', '"launch.json"')}
iconClass="settings-gear"
/>
<DebugAction
run={this.openConsole}
label={nls.localizeByDefault('Debug Console')}
iconClass="terminal"
/>
</React.Fragment>
);
}
}
class DebugConfigurationSelect extends TheiaDebugConfigurationSelect {
private readonly toDisposeOnUnmount = new DisposableCollection();
override componentDidMount(): void {
super.componentDidMount();
this.toDisposeOnUnmount.push(
this['manager'].onDidChange(() => this.refreshDebugConfigurations())
);
}
override componentWillUnmount(): void {
this.toDisposeOnUnmount.dispose();
}
}

View File

@@ -0,0 +1,39 @@
import { inject, injectable } from '@theia/core/shared/inversify';
import { DebugSession } from '@theia/debug/lib/browser/debug-session';
import { DebugSessionManager as TheiaDebugSessionManager } from '@theia/debug/lib/browser/debug-session-manager';
import { DebugConfigurationSessionOptions } from '@theia/debug/lib/browser/debug-session-options';
import { WorkspaceService } from '@theia/workspace/lib/browser/workspace-service';
import deepEqual from 'fast-deep-equal';
@injectable()
export class DebugSessionManager extends TheiaDebugSessionManager {
@inject(WorkspaceService)
private readonly workspaceService: WorkspaceService;
protected override doStart(
sessionId: string,
options: DebugConfigurationSessionOptions
): Promise<DebugSession> {
this.syncCurrentOptions(options);
return super.doStart(sessionId, options);
}
/**
* If the debug config manager knows about the currently started options, and it's not the currently selected one, select it.
*/
private syncCurrentOptions(options: DebugConfigurationSessionOptions): void {
const knownConfigOptions = this.debugConfigurationManager.find(
options.configuration,
options.workspaceFolderUri ??
this.workspaceService
.tryGetRoots()
.map((stat) => stat.resource.toString())[0]
);
if (
knownConfigOptions &&
!deepEqual(knownConfigOptions, this.debugConfigurationManager.current)
) {
this.debugConfigurationManager.current = knownConfigOptions;
}
}
}

View File

@@ -1,17 +1,20 @@
import { inject, injectable } from '@theia/core/shared/inversify';
import URI from '@theia/core/lib/common/uri';
import { LOCKED_CLASS, lock } from '@theia/core/lib/browser/widgets/widget';
import {
Disposable,
DisposableCollection,
} from '@theia/core/lib/common/disposable';
import URI from '@theia/core/lib/common/uri';
import { Title, Widget } from '@theia/core/shared/@phosphor/widgets';
import { inject, injectable } from '@theia/core/shared/inversify';
import { EditorWidget } from '@theia/editor/lib/browser/editor-widget';
import * as monaco from '@theia/monaco-editor-core';
import type { ReferencesModel } from '@theia/monaco-editor-core/esm/vs/editor/contrib/gotoSymbol/browser/referencesModel';
import {
EditorServiceOverrides,
MonacoEditor,
} from '@theia/monaco/lib/browser/monaco-editor';
import { MonacoEditorProvider as TheiaMonacoEditorProvider } from '@theia/monaco/lib/browser/monaco-editor-provider';
import { SketchesServiceClientImpl } from '../../sketches-service-client-impl';
import * as monaco from '@theia/monaco-editor-core';
import type { ReferencesModel } from '@theia/monaco-editor-core/esm/vs/editor/contrib/gotoSymbol/browser/referencesModel';
type CancelablePromise = Promise<ReferencesModel> & {
cancel: () => void;
@@ -101,3 +104,30 @@ export class MonacoEditorProvider extends TheiaMonacoEditorProvider {
editor.updateOptions({ readOnly });
}
}
// Theia cannot dynamically set an editor to writable once it was readonly.
export function maybeUpdateReadOnlyState(
widget: EditorWidget,
isReadOnly: (uri: string | URI | monaco.Uri) => boolean
): void {
const editor = widget.editor;
if (!(editor instanceof MonacoEditor)) {
return;
}
const model = editor.document;
const oldReadOnly = model.readOnly;
const resource = model['resource'];
const newReadOnly = Boolean(resource.isReadonly) || isReadOnly(resource.uri);
if (oldReadOnly !== newReadOnly) {
editor.getControl().updateOptions({ readOnly: newReadOnly });
if (newReadOnly) {
lock(widget.title);
} else {
unlock(widget.title);
}
}
}
function unlock(title: Title<Widget>): void {
title.className = title.className.replace(LOCKED_CLASS, '').trim();
}

View File

@@ -77,7 +77,7 @@ class MaybeReadonlyMonacoEditorModel extends SilentMonacoEditorModel {
}
this._dirty = dirty;
if (dirty === false) {
(this as any).updateSavedVersionId();
this['updateSavedVersionId']();
}
this.onDirtyChangedEmitter.fire(undefined);
}

View File

@@ -20,8 +20,22 @@ export const InstallManually = nls.localize(
'arduino/common/installManually',
'Install Manually'
);
export const SelectManually = nls.localize(
'arduino/common/selectManually',
'Select Manually'
);
export const serialMonitorWidgetLabel = nls.localize(
'arduino/common/serialMonitor',
'Serial Monitor'
);
export const noBoardSelected = nls.localize(
'arduino/common/noBoardSelected',
'No board selected'
);
export const noSketchOpened = nls.localize(
'arduino/common/noSketchOpened',
'No sketch opened'
);

View File

@@ -80,6 +80,22 @@ export interface BoardsService
fqbn: string;
protocol: string;
}): Promise<BoardUserField[]>;
/**
* Checks whether the debugging is enabled with the FQBN, programmer, current sketch, and custom board options.
*
* When the debugging is enabled, the promise resolves with the FQBN to use with the debugger. This is the same
* FQBN given in the `CheckDebugEnabledParams#fqbn` but cleaned up of the board options that do not affect the debugger configuration.
* It may be used by clients/IDE to group slightly different boards option selections under the same debug configuration.
*/
checkDebugEnabled(params: CheckDebugEnabledParams): Promise<string>;
}
export interface CheckDebugEnabledParams {
/**
* The FQBN might contain custom board config options. For example, `arduino:esp32:nano_nora:USBMode=hwcdc,option2=value2`.
*/
readonly fqbn: string;
readonly programmer: string;
}
export interface BoardSearch extends Searchable.Options {
@@ -330,10 +346,10 @@ export interface BoardDetails {
readonly requiredTools: Tool[];
readonly configOptions: ConfigOption[];
readonly programmers: Programmer[];
readonly debuggingSupported: boolean;
readonly VID: string;
readonly PID: string;
readonly buildProperties: string[];
readonly defaultProgrammerId?: string;
}
export interface Tool {
@@ -425,6 +441,18 @@ export namespace Programmer {
);
}
}
export function isProgrammer(arg: unknown): arg is Programmer {
return (
typeof arg === 'object' &&
arg !== null &&
(<Programmer>arg).id !== undefined &&
typeof (<Programmer>arg).id === 'string' &&
(<Programmer>arg).name !== undefined &&
typeof (<Programmer>arg).name === 'string' &&
(<Programmer>arg).platform !== undefined &&
typeof (<Programmer>arg).platform === 'string'
);
}
export namespace Board {
export function is(board: any): board is Board {

View File

@@ -121,7 +121,7 @@ export interface SketchesService {
* Hence, IDE2 has to provide multiple build paths on Windows. This hack will be obsolete when the CLI can provide error codes:
* https://github.com/arduino/arduino-cli/issues/1762.
*/
tempBuildPath(sketch: Sketch): Promise<string[]>;
tempBuildPath(sketch: SketchRef): Promise<string[]>;
}
export interface SketchRef {
@@ -308,7 +308,7 @@ export namespace Sketch {
export namespace Extensions {
export const DEFAULT = '.ino';
export const MAIN = [DEFAULT, '.pde'];
export const SOURCE = ['.c', '.cpp', '.S'];
export const SOURCE = ['.c', '.cpp', '.S', '.cxx', '.cc'];
export const CODE_FILES = [
...MAIN,
...SOURCE,

View File

@@ -1,4 +1,4 @@
import type { ClientDuplexStream } from '@grpc/grpc-js';
import type { ClientReadableStream } from '@grpc/grpc-js';
import {
Disposable,
DisposableCollection,
@@ -30,9 +30,9 @@ import type { Port as RpcPort } from './cli-protocol/cc/arduino/cli/commands/v1/
import { CoreClientAware } from './core-client-provider';
import { ServiceError } from './service-error';
type Duplex = ClientDuplexStream<BoardListWatchRequest, BoardListWatchResponse>;
type Stream = ClientReadableStream<BoardListWatchResponse>;
interface StreamWrapper extends Disposable {
readonly stream: Duplex;
readonly stream: Stream;
readonly uuid: string; // For logging only
}
@@ -121,34 +121,15 @@ export class BoardDiscovery
return Disposable.create(() => clearTimeout(timer));
}
private async requestStartWatch(
req: BoardListWatchRequest,
duplex: Duplex
): Promise<void> {
return new Promise<void>((resolve, reject) => {
if (
!duplex.write(req, (err: Error | undefined) => {
if (err) {
reject(err);
return;
}
})
) {
duplex.once('drain', resolve);
} else {
process.nextTick(resolve);
}
});
}
private async createWrapper(
client: ArduinoCoreServiceClient
client: ArduinoCoreServiceClient,
req: BoardListWatchRequest
): Promise<StreamWrapper> {
if (this.wrapper) {
throw new Error(`Duplex was already set.`);
}
const stream = client
.boardListWatch()
.boardListWatch(req)
.on('end', () => {
this.logger.info('received end');
this.onStreamDidEndEmitter.fire();
@@ -202,14 +183,11 @@ export class BoardDiscovery
this.watching = new Deferred();
this.logger.info('start new deferred');
const { client, instance } = await this.coreClient;
const wrapper = await this.createWrapper(client);
wrapper.stream.on('data', (resp) => this.onBoardListWatchResponse(resp));
this.logger.info('start request start watch');
await this.requestStartWatch(
new BoardListWatchRequest().setInstance(instance),
wrapper.stream
const wrapper = await this.createWrapper(
client,
new BoardListWatchRequest().setInstance(instance)
);
this.logger.info('start requested start watch');
wrapper.stream.on('data', (resp) => this.onBoardListWatchResponse(resp));
this.watching.resolve();
this.logger.info('start resolved watching');
}

View File

@@ -1,27 +1,38 @@
import { injectable, inject } from '@theia/core/shared/inversify';
import { ILogger } from '@theia/core/lib/common/logger';
import { nls } from '@theia/core/lib/common/nls';
import { notEmpty } from '@theia/core/lib/common/objects';
import { inject, injectable } from '@theia/core/shared/inversify';
import {
BoardsService,
Installable,
BoardsPackage,
Board,
BoardDetails,
BoardSearch,
BoardUserField,
BoardWithPackage,
BoardsPackage,
BoardsService,
CheckDebugEnabledParams,
ConfigOption,
ConfigValue,
DetectedPorts,
Installable,
NotificationServiceServer,
Programmer,
ResponseService,
NotificationServiceServer,
DetectedPorts,
BoardWithPackage,
BoardUserField,
BoardSearch,
sortComponents,
SortGroup,
platformInstallFailed,
createPlatformIdentifier,
platformIdentifierEquals,
platformInstallFailed,
sortComponents,
} from '../common/protocol';
import { BoardDiscovery } from './board-discovery';
import {
BoardDetailsRequest,
BoardDetailsResponse,
BoardListAllRequest,
BoardListAllResponse,
BoardSearchRequest,
} from './cli-protocol/cc/arduino/cli/commands/v1/board_pb';
import { Platform } from './cli-protocol/cc/arduino/cli/commands/v1/common_pb';
import {
PlatformInstallRequest,
PlatformListRequest,
@@ -30,25 +41,16 @@ import {
PlatformSearchResponse,
PlatformUninstallRequest,
} from './cli-protocol/cc/arduino/cli/commands/v1/core_pb';
import { Platform } from './cli-protocol/cc/arduino/cli/commands/v1/common_pb';
import { BoardDiscovery } from './board-discovery';
import { CoreClientAware } from './core-client-provider';
import {
BoardDetailsRequest,
BoardDetailsResponse,
BoardListAllRequest,
BoardListAllResponse,
BoardSearchRequest,
} from './cli-protocol/cc/arduino/cli/commands/v1/board_pb';
import { IsDebugSupportedRequest } from './cli-protocol/cc/arduino/cli/commands/v1/debug_pb';
import {
ListProgrammersAvailableForUploadRequest,
ListProgrammersAvailableForUploadResponse,
SupportedUserFieldsRequest,
SupportedUserFieldsResponse,
} from './cli-protocol/cc/arduino/cli/commands/v1/upload_pb';
import { CoreClientAware } from './core-client-provider';
import { ExecuteWithProgress } from './grpc-progressible';
import { ServiceError } from './service-error';
import { nls } from '@theia/core/lib/common';
@injectable()
export class BoardsServiceImpl
@@ -99,8 +101,6 @@ export class BoardsServiceImpl
return undefined;
}
const debuggingSupported = detailsResp.getDebuggingSupported();
const requiredTools = detailsResp.getToolsDependenciesList().map((t) => ({
name: t.getName(),
packager: t.getPackager(),
@@ -146,6 +146,7 @@ export class BoardsServiceImpl
platform: p.getPlatform(),
}
);
const defaultProgrammerId = detailsResp.getDefaultProgrammerId();
let VID = 'N/A';
let PID = 'N/A';
@@ -164,13 +165,43 @@ export class BoardsServiceImpl
requiredTools,
configOptions,
programmers,
debuggingSupported,
VID,
PID,
buildProperties,
...(defaultProgrammerId ? { defaultProgrammerId } : {}),
};
}
async checkDebugEnabled(params: CheckDebugEnabledParams): Promise<string> {
const { fqbn, programmer } = params;
const { client, instance } = await this.coreClient;
const req = new IsDebugSupportedRequest()
.setInstance(instance)
.setFqbn(fqbn)
.setProgrammer(programmer);
try {
const debugFqbn = await new Promise<string>((resolve, reject) =>
client.isDebugSupported(req, (err, resp) => {
if (err) {
reject(err);
return;
}
if (resp.getDebuggingSupported()) {
const debugFqbn = resp.getDebugFqbn();
if (debugFqbn) {
resolve(debugFqbn);
}
}
reject(new Error(`Debugging is not supported.`));
})
);
return debugFqbn;
} catch (err) {
console.error(`Failed to get debug config: ${fqbn}, ${programmer}`, err);
throw err;
}
}
async getBoardPackage(options: {
id: string;
}): Promise<BoardsPackage | undefined> {

View File

@@ -74,8 +74,6 @@ export class BoardDetailsResponse extends jspb.Message {
getProgrammersList(): Array<cc_arduino_cli_commands_v1_common_pb.Programmer>;
setProgrammersList(value: Array<cc_arduino_cli_commands_v1_common_pb.Programmer>): BoardDetailsResponse;
addProgrammers(value?: cc_arduino_cli_commands_v1_common_pb.Programmer, index?: number): cc_arduino_cli_commands_v1_common_pb.Programmer;
getDebuggingSupported(): boolean;
setDebuggingSupported(value: boolean): BoardDetailsResponse;
clearIdentificationPropertiesList(): void;
getIdentificationPropertiesList(): Array<BoardIdentificationProperties>;
setIdentificationPropertiesList(value: Array<BoardIdentificationProperties>): BoardDetailsResponse;
@@ -84,6 +82,8 @@ export class BoardDetailsResponse extends jspb.Message {
getBuildPropertiesList(): Array<string>;
setBuildPropertiesList(value: Array<string>): BoardDetailsResponse;
addBuildProperties(value: string, index?: number): string;
getDefaultProgrammerId(): string;
setDefaultProgrammerId(value: string): BoardDetailsResponse;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): BoardDetailsResponse.AsObject;
@@ -109,9 +109,9 @@ export namespace BoardDetailsResponse {
toolsDependenciesList: Array<ToolsDependencies.AsObject>,
configOptionsList: Array<ConfigOption.AsObject>,
programmersList: Array<cc_arduino_cli_commands_v1_common_pb.Programmer.AsObject>,
debuggingSupported: boolean,
identificationPropertiesList: Array<BoardIdentificationProperties.AsObject>,
buildPropertiesList: Array<string>,
defaultProgrammerId: string,
}
}
@@ -488,8 +488,6 @@ export class BoardListWatchRequest extends jspb.Message {
clearInstance(): void;
getInstance(): cc_arduino_cli_commands_v1_common_pb.Instance | undefined;
setInstance(value?: cc_arduino_cli_commands_v1_common_pb.Instance): BoardListWatchRequest;
getInterrupt(): boolean;
setInterrupt(value: boolean): BoardListWatchRequest;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): BoardListWatchRequest.AsObject;
@@ -504,7 +502,6 @@ export class BoardListWatchRequest extends jspb.Message {
export namespace BoardListWatchRequest {
export type AsObject = {
instance?: cc_arduino_cli_commands_v1_common_pb.Instance.AsObject,
interrupt: boolean,
}
}

View File

@@ -730,10 +730,10 @@ proto.cc.arduino.cli.commands.v1.BoardDetailsResponse.toObject = function(includ
proto.cc.arduino.cli.commands.v1.ConfigOption.toObject, includeInstance),
programmersList: jspb.Message.toObjectList(msg.getProgrammersList(),
cc_arduino_cli_commands_v1_common_pb.Programmer.toObject, includeInstance),
debuggingSupported: jspb.Message.getBooleanFieldWithDefault(msg, 14, false),
identificationPropertiesList: jspb.Message.toObjectList(msg.getIdentificationPropertiesList(),
proto.cc.arduino.cli.commands.v1.BoardIdentificationProperties.toObject, includeInstance),
buildPropertiesList: (f = jspb.Message.getRepeatedField(msg, 16)) == null ? undefined : f
buildPropertiesList: (f = jspb.Message.getRepeatedField(msg, 16)) == null ? undefined : f,
defaultProgrammerId: jspb.Message.getFieldWithDefault(msg, 17, "")
};
if (includeInstance) {
@@ -823,10 +823,6 @@ proto.cc.arduino.cli.commands.v1.BoardDetailsResponse.deserializeBinaryFromReade
reader.readMessage(value,cc_arduino_cli_commands_v1_common_pb.Programmer.deserializeBinaryFromReader);
msg.addProgrammers(value);
break;
case 14:
var value = /** @type {boolean} */ (reader.readBool());
msg.setDebuggingSupported(value);
break;
case 15:
var value = new proto.cc.arduino.cli.commands.v1.BoardIdentificationProperties;
reader.readMessage(value,proto.cc.arduino.cli.commands.v1.BoardIdentificationProperties.deserializeBinaryFromReader);
@@ -836,6 +832,10 @@ proto.cc.arduino.cli.commands.v1.BoardDetailsResponse.deserializeBinaryFromReade
var value = /** @type {string} */ (reader.readString());
msg.addBuildProperties(value);
break;
case 17:
var value = /** @type {string} */ (reader.readString());
msg.setDefaultProgrammerId(value);
break;
default:
reader.skipField();
break;
@@ -954,13 +954,6 @@ proto.cc.arduino.cli.commands.v1.BoardDetailsResponse.serializeBinaryToWriter =
cc_arduino_cli_commands_v1_common_pb.Programmer.serializeBinaryToWriter
);
}
f = message.getDebuggingSupported();
if (f) {
writer.writeBool(
14,
f
);
}
f = message.getIdentificationPropertiesList();
if (f.length > 0) {
writer.writeRepeatedMessage(
@@ -976,6 +969,13 @@ proto.cc.arduino.cli.commands.v1.BoardDetailsResponse.serializeBinaryToWriter =
f
);
}
f = message.getDefaultProgrammerId();
if (f.length > 0) {
writer.writeString(
17,
f
);
}
};
@@ -1293,24 +1293,6 @@ proto.cc.arduino.cli.commands.v1.BoardDetailsResponse.prototype.clearProgrammers
};
/**
* optional bool debugging_supported = 14;
* @return {boolean}
*/
proto.cc.arduino.cli.commands.v1.BoardDetailsResponse.prototype.getDebuggingSupported = function() {
return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 14, false));
};
/**
* @param {boolean} value
* @return {!proto.cc.arduino.cli.commands.v1.BoardDetailsResponse} returns this
*/
proto.cc.arduino.cli.commands.v1.BoardDetailsResponse.prototype.setDebuggingSupported = function(value) {
return jspb.Message.setProto3BooleanField(this, 14, value);
};
/**
* repeated BoardIdentificationProperties identification_properties = 15;
* @return {!Array<!proto.cc.arduino.cli.commands.v1.BoardIdentificationProperties>}
@@ -1386,6 +1368,24 @@ proto.cc.arduino.cli.commands.v1.BoardDetailsResponse.prototype.clearBuildProper
};
/**
* optional string default_programmer_id = 17;
* @return {string}
*/
proto.cc.arduino.cli.commands.v1.BoardDetailsResponse.prototype.getDefaultProgrammerId = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 17, ""));
};
/**
* @param {string} value
* @return {!proto.cc.arduino.cli.commands.v1.BoardDetailsResponse} returns this
*/
proto.cc.arduino.cli.commands.v1.BoardDetailsResponse.prototype.setDefaultProgrammerId = function(value) {
return jspb.Message.setProto3StringField(this, 17, value);
};
@@ -4181,8 +4181,7 @@ proto.cc.arduino.cli.commands.v1.BoardListWatchRequest.prototype.toObject = func
*/
proto.cc.arduino.cli.commands.v1.BoardListWatchRequest.toObject = function(includeInstance, msg) {
var f, obj = {
instance: (f = msg.getInstance()) && cc_arduino_cli_commands_v1_common_pb.Instance.toObject(includeInstance, f),
interrupt: jspb.Message.getBooleanFieldWithDefault(msg, 2, false)
instance: (f = msg.getInstance()) && cc_arduino_cli_commands_v1_common_pb.Instance.toObject(includeInstance, f)
};
if (includeInstance) {
@@ -4224,10 +4223,6 @@ proto.cc.arduino.cli.commands.v1.BoardListWatchRequest.deserializeBinaryFromRead
reader.readMessage(value,cc_arduino_cli_commands_v1_common_pb.Instance.deserializeBinaryFromReader);
msg.setInstance(value);
break;
case 2:
var value = /** @type {boolean} */ (reader.readBool());
msg.setInterrupt(value);
break;
default:
reader.skipField();
break;
@@ -4265,13 +4260,6 @@ proto.cc.arduino.cli.commands.v1.BoardListWatchRequest.serializeBinaryToWriter =
cc_arduino_cli_commands_v1_common_pb.Instance.serializeBinaryToWriter
);
}
f = message.getInterrupt();
if (f) {
writer.writeBool(
2,
f
);
}
};
@@ -4312,24 +4300,6 @@ proto.cc.arduino.cli.commands.v1.BoardListWatchRequest.prototype.hasInstance = f
};
/**
* optional bool interrupt = 2;
* @return {boolean}
*/
proto.cc.arduino.cli.commands.v1.BoardListWatchRequest.prototype.getInterrupt = function() {
return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false));
};
/**
* @param {boolean} value
* @return {!proto.cc.arduino.cli.commands.v1.BoardListWatchRequest} returns this
*/
proto.cc.arduino.cli.commands.v1.BoardListWatchRequest.prototype.setInterrupt = function(value) {
return jspb.Message.setProto3BooleanField(this, 2, value);
};

View File

@@ -11,6 +11,7 @@ import * as cc_arduino_cli_commands_v1_common_pb from "../../../../../cc/arduino
import * as cc_arduino_cli_commands_v1_board_pb from "../../../../../cc/arduino/cli/commands/v1/board_pb";
import * as cc_arduino_cli_commands_v1_compile_pb from "../../../../../cc/arduino/cli/commands/v1/compile_pb";
import * as cc_arduino_cli_commands_v1_core_pb from "../../../../../cc/arduino/cli/commands/v1/core_pb";
import * as cc_arduino_cli_commands_v1_debug_pb from "../../../../../cc/arduino/cli/commands/v1/debug_pb";
import * as cc_arduino_cli_commands_v1_monitor_pb from "../../../../../cc/arduino/cli/commands/v1/monitor_pb";
import * as cc_arduino_cli_commands_v1_upload_pb from "../../../../../cc/arduino/cli/commands/v1/upload_pb";
import * as cc_arduino_cli_commands_v1_lib_pb from "../../../../../cc/arduino/cli/commands/v1/lib_pb";
@@ -55,6 +56,9 @@ interface IArduinoCoreServiceService extends grpc.ServiceDefinition<grpc.Untyped
libraryList: IArduinoCoreServiceService_ILibraryList;
monitor: IArduinoCoreServiceService_IMonitor;
enumerateMonitorPortSettings: IArduinoCoreServiceService_IEnumerateMonitorPortSettings;
debug: IArduinoCoreServiceService_IDebug;
isDebugSupported: IArduinoCoreServiceService_IIsDebugSupported;
getDebugConfig: IArduinoCoreServiceService_IGetDebugConfig;
}
interface IArduinoCoreServiceService_ICreate extends grpc.MethodDefinition<cc_arduino_cli_commands_v1_commands_pb.CreateRequest, cc_arduino_cli_commands_v1_commands_pb.CreateResponse> {
@@ -185,7 +189,7 @@ interface IArduinoCoreServiceService_IBoardSearch extends grpc.MethodDefinition<
}
interface IArduinoCoreServiceService_IBoardListWatch extends grpc.MethodDefinition<cc_arduino_cli_commands_v1_board_pb.BoardListWatchRequest, cc_arduino_cli_commands_v1_board_pb.BoardListWatchResponse> {
path: "/cc.arduino.cli.commands.v1.ArduinoCoreService/BoardListWatch";
requestStream: true;
requestStream: false;
responseStream: true;
requestSerialize: grpc.serialize<cc_arduino_cli_commands_v1_board_pb.BoardListWatchRequest>;
requestDeserialize: grpc.deserialize<cc_arduino_cli_commands_v1_board_pb.BoardListWatchRequest>;
@@ -408,6 +412,33 @@ interface IArduinoCoreServiceService_IEnumerateMonitorPortSettings extends grpc.
responseSerialize: grpc.serialize<cc_arduino_cli_commands_v1_monitor_pb.EnumerateMonitorPortSettingsResponse>;
responseDeserialize: grpc.deserialize<cc_arduino_cli_commands_v1_monitor_pb.EnumerateMonitorPortSettingsResponse>;
}
interface IArduinoCoreServiceService_IDebug extends grpc.MethodDefinition<cc_arduino_cli_commands_v1_debug_pb.DebugRequest, cc_arduino_cli_commands_v1_debug_pb.DebugResponse> {
path: "/cc.arduino.cli.commands.v1.ArduinoCoreService/Debug";
requestStream: true;
responseStream: true;
requestSerialize: grpc.serialize<cc_arduino_cli_commands_v1_debug_pb.DebugRequest>;
requestDeserialize: grpc.deserialize<cc_arduino_cli_commands_v1_debug_pb.DebugRequest>;
responseSerialize: grpc.serialize<cc_arduino_cli_commands_v1_debug_pb.DebugResponse>;
responseDeserialize: grpc.deserialize<cc_arduino_cli_commands_v1_debug_pb.DebugResponse>;
}
interface IArduinoCoreServiceService_IIsDebugSupported extends grpc.MethodDefinition<cc_arduino_cli_commands_v1_debug_pb.IsDebugSupportedRequest, cc_arduino_cli_commands_v1_debug_pb.IsDebugSupportedResponse> {
path: "/cc.arduino.cli.commands.v1.ArduinoCoreService/IsDebugSupported";
requestStream: false;
responseStream: false;
requestSerialize: grpc.serialize<cc_arduino_cli_commands_v1_debug_pb.IsDebugSupportedRequest>;
requestDeserialize: grpc.deserialize<cc_arduino_cli_commands_v1_debug_pb.IsDebugSupportedRequest>;
responseSerialize: grpc.serialize<cc_arduino_cli_commands_v1_debug_pb.IsDebugSupportedResponse>;
responseDeserialize: grpc.deserialize<cc_arduino_cli_commands_v1_debug_pb.IsDebugSupportedResponse>;
}
interface IArduinoCoreServiceService_IGetDebugConfig extends grpc.MethodDefinition<cc_arduino_cli_commands_v1_debug_pb.GetDebugConfigRequest, cc_arduino_cli_commands_v1_debug_pb.GetDebugConfigResponse> {
path: "/cc.arduino.cli.commands.v1.ArduinoCoreService/GetDebugConfig";
requestStream: false;
responseStream: false;
requestSerialize: grpc.serialize<cc_arduino_cli_commands_v1_debug_pb.GetDebugConfigRequest>;
requestDeserialize: grpc.deserialize<cc_arduino_cli_commands_v1_debug_pb.GetDebugConfigRequest>;
responseSerialize: grpc.serialize<cc_arduino_cli_commands_v1_debug_pb.GetDebugConfigResponse>;
responseDeserialize: grpc.deserialize<cc_arduino_cli_commands_v1_debug_pb.GetDebugConfigResponse>;
}
export const ArduinoCoreServiceService: IArduinoCoreServiceService;
@@ -426,7 +457,7 @@ export interface IArduinoCoreServiceServer extends grpc.UntypedServiceImplementa
boardList: grpc.handleUnaryCall<cc_arduino_cli_commands_v1_board_pb.BoardListRequest, cc_arduino_cli_commands_v1_board_pb.BoardListResponse>;
boardListAll: grpc.handleUnaryCall<cc_arduino_cli_commands_v1_board_pb.BoardListAllRequest, cc_arduino_cli_commands_v1_board_pb.BoardListAllResponse>;
boardSearch: grpc.handleUnaryCall<cc_arduino_cli_commands_v1_board_pb.BoardSearchRequest, cc_arduino_cli_commands_v1_board_pb.BoardSearchResponse>;
boardListWatch: grpc.handleBidiStreamingCall<cc_arduino_cli_commands_v1_board_pb.BoardListWatchRequest, cc_arduino_cli_commands_v1_board_pb.BoardListWatchResponse>;
boardListWatch: grpc.handleServerStreamingCall<cc_arduino_cli_commands_v1_board_pb.BoardListWatchRequest, cc_arduino_cli_commands_v1_board_pb.BoardListWatchResponse>;
compile: grpc.handleServerStreamingCall<cc_arduino_cli_commands_v1_compile_pb.CompileRequest, cc_arduino_cli_commands_v1_compile_pb.CompileResponse>;
platformInstall: grpc.handleServerStreamingCall<cc_arduino_cli_commands_v1_core_pb.PlatformInstallRequest, cc_arduino_cli_commands_v1_core_pb.PlatformInstallResponse>;
platformDownload: grpc.handleServerStreamingCall<cc_arduino_cli_commands_v1_core_pb.PlatformDownloadRequest, cc_arduino_cli_commands_v1_core_pb.PlatformDownloadResponse>;
@@ -451,6 +482,9 @@ export interface IArduinoCoreServiceServer extends grpc.UntypedServiceImplementa
libraryList: grpc.handleUnaryCall<cc_arduino_cli_commands_v1_lib_pb.LibraryListRequest, cc_arduino_cli_commands_v1_lib_pb.LibraryListResponse>;
monitor: grpc.handleBidiStreamingCall<cc_arduino_cli_commands_v1_monitor_pb.MonitorRequest, cc_arduino_cli_commands_v1_monitor_pb.MonitorResponse>;
enumerateMonitorPortSettings: grpc.handleUnaryCall<cc_arduino_cli_commands_v1_monitor_pb.EnumerateMonitorPortSettingsRequest, cc_arduino_cli_commands_v1_monitor_pb.EnumerateMonitorPortSettingsResponse>;
debug: grpc.handleBidiStreamingCall<cc_arduino_cli_commands_v1_debug_pb.DebugRequest, cc_arduino_cli_commands_v1_debug_pb.DebugResponse>;
isDebugSupported: grpc.handleUnaryCall<cc_arduino_cli_commands_v1_debug_pb.IsDebugSupportedRequest, cc_arduino_cli_commands_v1_debug_pb.IsDebugSupportedResponse>;
getDebugConfig: grpc.handleUnaryCall<cc_arduino_cli_commands_v1_debug_pb.GetDebugConfigRequest, cc_arduino_cli_commands_v1_debug_pb.GetDebugConfigResponse>;
}
export interface IArduinoCoreServiceClient {
@@ -493,9 +527,8 @@ export interface IArduinoCoreServiceClient {
boardSearch(request: cc_arduino_cli_commands_v1_board_pb.BoardSearchRequest, callback: (error: grpc.ServiceError | null, response: cc_arduino_cli_commands_v1_board_pb.BoardSearchResponse) => void): grpc.ClientUnaryCall;
boardSearch(request: cc_arduino_cli_commands_v1_board_pb.BoardSearchRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: cc_arduino_cli_commands_v1_board_pb.BoardSearchResponse) => void): grpc.ClientUnaryCall;
boardSearch(request: cc_arduino_cli_commands_v1_board_pb.BoardSearchRequest, metadata: grpc.Metadata, options: Partial<grpc.CallOptions>, callback: (error: grpc.ServiceError | null, response: cc_arduino_cli_commands_v1_board_pb.BoardSearchResponse) => void): grpc.ClientUnaryCall;
boardListWatch(): grpc.ClientDuplexStream<cc_arduino_cli_commands_v1_board_pb.BoardListWatchRequest, cc_arduino_cli_commands_v1_board_pb.BoardListWatchResponse>;
boardListWatch(options: Partial<grpc.CallOptions>): grpc.ClientDuplexStream<cc_arduino_cli_commands_v1_board_pb.BoardListWatchRequest, cc_arduino_cli_commands_v1_board_pb.BoardListWatchResponse>;
boardListWatch(metadata: grpc.Metadata, options?: Partial<grpc.CallOptions>): grpc.ClientDuplexStream<cc_arduino_cli_commands_v1_board_pb.BoardListWatchRequest, cc_arduino_cli_commands_v1_board_pb.BoardListWatchResponse>;
boardListWatch(request: cc_arduino_cli_commands_v1_board_pb.BoardListWatchRequest, options?: Partial<grpc.CallOptions>): grpc.ClientReadableStream<cc_arduino_cli_commands_v1_board_pb.BoardListWatchResponse>;
boardListWatch(request: cc_arduino_cli_commands_v1_board_pb.BoardListWatchRequest, metadata?: grpc.Metadata, options?: Partial<grpc.CallOptions>): grpc.ClientReadableStream<cc_arduino_cli_commands_v1_board_pb.BoardListWatchResponse>;
compile(request: cc_arduino_cli_commands_v1_compile_pb.CompileRequest, options?: Partial<grpc.CallOptions>): grpc.ClientReadableStream<cc_arduino_cli_commands_v1_compile_pb.CompileResponse>;
compile(request: cc_arduino_cli_commands_v1_compile_pb.CompileRequest, metadata?: grpc.Metadata, options?: Partial<grpc.CallOptions>): grpc.ClientReadableStream<cc_arduino_cli_commands_v1_compile_pb.CompileResponse>;
platformInstall(request: cc_arduino_cli_commands_v1_core_pb.PlatformInstallRequest, options?: Partial<grpc.CallOptions>): grpc.ClientReadableStream<cc_arduino_cli_commands_v1_core_pb.PlatformInstallResponse>;
@@ -553,6 +586,15 @@ export interface IArduinoCoreServiceClient {
enumerateMonitorPortSettings(request: cc_arduino_cli_commands_v1_monitor_pb.EnumerateMonitorPortSettingsRequest, callback: (error: grpc.ServiceError | null, response: cc_arduino_cli_commands_v1_monitor_pb.EnumerateMonitorPortSettingsResponse) => void): grpc.ClientUnaryCall;
enumerateMonitorPortSettings(request: cc_arduino_cli_commands_v1_monitor_pb.EnumerateMonitorPortSettingsRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: cc_arduino_cli_commands_v1_monitor_pb.EnumerateMonitorPortSettingsResponse) => void): grpc.ClientUnaryCall;
enumerateMonitorPortSettings(request: cc_arduino_cli_commands_v1_monitor_pb.EnumerateMonitorPortSettingsRequest, metadata: grpc.Metadata, options: Partial<grpc.CallOptions>, callback: (error: grpc.ServiceError | null, response: cc_arduino_cli_commands_v1_monitor_pb.EnumerateMonitorPortSettingsResponse) => void): grpc.ClientUnaryCall;
debug(): grpc.ClientDuplexStream<cc_arduino_cli_commands_v1_debug_pb.DebugRequest, cc_arduino_cli_commands_v1_debug_pb.DebugResponse>;
debug(options: Partial<grpc.CallOptions>): grpc.ClientDuplexStream<cc_arduino_cli_commands_v1_debug_pb.DebugRequest, cc_arduino_cli_commands_v1_debug_pb.DebugResponse>;
debug(metadata: grpc.Metadata, options?: Partial<grpc.CallOptions>): grpc.ClientDuplexStream<cc_arduino_cli_commands_v1_debug_pb.DebugRequest, cc_arduino_cli_commands_v1_debug_pb.DebugResponse>;
isDebugSupported(request: cc_arduino_cli_commands_v1_debug_pb.IsDebugSupportedRequest, callback: (error: grpc.ServiceError | null, response: cc_arduino_cli_commands_v1_debug_pb.IsDebugSupportedResponse) => void): grpc.ClientUnaryCall;
isDebugSupported(request: cc_arduino_cli_commands_v1_debug_pb.IsDebugSupportedRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: cc_arduino_cli_commands_v1_debug_pb.IsDebugSupportedResponse) => void): grpc.ClientUnaryCall;
isDebugSupported(request: cc_arduino_cli_commands_v1_debug_pb.IsDebugSupportedRequest, metadata: grpc.Metadata, options: Partial<grpc.CallOptions>, callback: (error: grpc.ServiceError | null, response: cc_arduino_cli_commands_v1_debug_pb.IsDebugSupportedResponse) => void): grpc.ClientUnaryCall;
getDebugConfig(request: cc_arduino_cli_commands_v1_debug_pb.GetDebugConfigRequest, callback: (error: grpc.ServiceError | null, response: cc_arduino_cli_commands_v1_debug_pb.GetDebugConfigResponse) => void): grpc.ClientUnaryCall;
getDebugConfig(request: cc_arduino_cli_commands_v1_debug_pb.GetDebugConfigRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: cc_arduino_cli_commands_v1_debug_pb.GetDebugConfigResponse) => void): grpc.ClientUnaryCall;
getDebugConfig(request: cc_arduino_cli_commands_v1_debug_pb.GetDebugConfigRequest, metadata: grpc.Metadata, options: Partial<grpc.CallOptions>, callback: (error: grpc.ServiceError | null, response: cc_arduino_cli_commands_v1_debug_pb.GetDebugConfigResponse) => void): grpc.ClientUnaryCall;
}
export class ArduinoCoreServiceClient extends grpc.Client implements IArduinoCoreServiceClient {
@@ -596,8 +638,8 @@ export class ArduinoCoreServiceClient extends grpc.Client implements IArduinoCor
public boardSearch(request: cc_arduino_cli_commands_v1_board_pb.BoardSearchRequest, callback: (error: grpc.ServiceError | null, response: cc_arduino_cli_commands_v1_board_pb.BoardSearchResponse) => void): grpc.ClientUnaryCall;
public boardSearch(request: cc_arduino_cli_commands_v1_board_pb.BoardSearchRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: cc_arduino_cli_commands_v1_board_pb.BoardSearchResponse) => void): grpc.ClientUnaryCall;
public boardSearch(request: cc_arduino_cli_commands_v1_board_pb.BoardSearchRequest, metadata: grpc.Metadata, options: Partial<grpc.CallOptions>, callback: (error: grpc.ServiceError | null, response: cc_arduino_cli_commands_v1_board_pb.BoardSearchResponse) => void): grpc.ClientUnaryCall;
public boardListWatch(options?: Partial<grpc.CallOptions>): grpc.ClientDuplexStream<cc_arduino_cli_commands_v1_board_pb.BoardListWatchRequest, cc_arduino_cli_commands_v1_board_pb.BoardListWatchResponse>;
public boardListWatch(metadata?: grpc.Metadata, options?: Partial<grpc.CallOptions>): grpc.ClientDuplexStream<cc_arduino_cli_commands_v1_board_pb.BoardListWatchRequest, cc_arduino_cli_commands_v1_board_pb.BoardListWatchResponse>;
public boardListWatch(request: cc_arduino_cli_commands_v1_board_pb.BoardListWatchRequest, options?: Partial<grpc.CallOptions>): grpc.ClientReadableStream<cc_arduino_cli_commands_v1_board_pb.BoardListWatchResponse>;
public boardListWatch(request: cc_arduino_cli_commands_v1_board_pb.BoardListWatchRequest, metadata?: grpc.Metadata, options?: Partial<grpc.CallOptions>): grpc.ClientReadableStream<cc_arduino_cli_commands_v1_board_pb.BoardListWatchResponse>;
public compile(request: cc_arduino_cli_commands_v1_compile_pb.CompileRequest, options?: Partial<grpc.CallOptions>): grpc.ClientReadableStream<cc_arduino_cli_commands_v1_compile_pb.CompileResponse>;
public compile(request: cc_arduino_cli_commands_v1_compile_pb.CompileRequest, metadata?: grpc.Metadata, options?: Partial<grpc.CallOptions>): grpc.ClientReadableStream<cc_arduino_cli_commands_v1_compile_pb.CompileResponse>;
public platformInstall(request: cc_arduino_cli_commands_v1_core_pb.PlatformInstallRequest, options?: Partial<grpc.CallOptions>): grpc.ClientReadableStream<cc_arduino_cli_commands_v1_core_pb.PlatformInstallResponse>;
@@ -654,4 +696,12 @@ export class ArduinoCoreServiceClient extends grpc.Client implements IArduinoCor
public enumerateMonitorPortSettings(request: cc_arduino_cli_commands_v1_monitor_pb.EnumerateMonitorPortSettingsRequest, callback: (error: grpc.ServiceError | null, response: cc_arduino_cli_commands_v1_monitor_pb.EnumerateMonitorPortSettingsResponse) => void): grpc.ClientUnaryCall;
public enumerateMonitorPortSettings(request: cc_arduino_cli_commands_v1_monitor_pb.EnumerateMonitorPortSettingsRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: cc_arduino_cli_commands_v1_monitor_pb.EnumerateMonitorPortSettingsResponse) => void): grpc.ClientUnaryCall;
public enumerateMonitorPortSettings(request: cc_arduino_cli_commands_v1_monitor_pb.EnumerateMonitorPortSettingsRequest, metadata: grpc.Metadata, options: Partial<grpc.CallOptions>, callback: (error: grpc.ServiceError | null, response: cc_arduino_cli_commands_v1_monitor_pb.EnumerateMonitorPortSettingsResponse) => void): grpc.ClientUnaryCall;
public debug(options?: Partial<grpc.CallOptions>): grpc.ClientDuplexStream<cc_arduino_cli_commands_v1_debug_pb.DebugRequest, cc_arduino_cli_commands_v1_debug_pb.DebugResponse>;
public debug(metadata?: grpc.Metadata, options?: Partial<grpc.CallOptions>): grpc.ClientDuplexStream<cc_arduino_cli_commands_v1_debug_pb.DebugRequest, cc_arduino_cli_commands_v1_debug_pb.DebugResponse>;
public isDebugSupported(request: cc_arduino_cli_commands_v1_debug_pb.IsDebugSupportedRequest, callback: (error: grpc.ServiceError | null, response: cc_arduino_cli_commands_v1_debug_pb.IsDebugSupportedResponse) => void): grpc.ClientUnaryCall;
public isDebugSupported(request: cc_arduino_cli_commands_v1_debug_pb.IsDebugSupportedRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: cc_arduino_cli_commands_v1_debug_pb.IsDebugSupportedResponse) => void): grpc.ClientUnaryCall;
public isDebugSupported(request: cc_arduino_cli_commands_v1_debug_pb.IsDebugSupportedRequest, metadata: grpc.Metadata, options: Partial<grpc.CallOptions>, callback: (error: grpc.ServiceError | null, response: cc_arduino_cli_commands_v1_debug_pb.IsDebugSupportedResponse) => void): grpc.ClientUnaryCall;
public getDebugConfig(request: cc_arduino_cli_commands_v1_debug_pb.GetDebugConfigRequest, callback: (error: grpc.ServiceError | null, response: cc_arduino_cli_commands_v1_debug_pb.GetDebugConfigResponse) => void): grpc.ClientUnaryCall;
public getDebugConfig(request: cc_arduino_cli_commands_v1_debug_pb.GetDebugConfigRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: cc_arduino_cli_commands_v1_debug_pb.GetDebugConfigResponse) => void): grpc.ClientUnaryCall;
public getDebugConfig(request: cc_arduino_cli_commands_v1_debug_pb.GetDebugConfigRequest, metadata: grpc.Metadata, options: Partial<grpc.CallOptions>, callback: (error: grpc.ServiceError | null, response: cc_arduino_cli_commands_v1_debug_pb.GetDebugConfigResponse) => void): grpc.ClientUnaryCall;
}

View File

@@ -23,6 +23,7 @@ var cc_arduino_cli_commands_v1_common_pb = require('../../../../../cc/arduino/cl
var cc_arduino_cli_commands_v1_board_pb = require('../../../../../cc/arduino/cli/commands/v1/board_pb.js');
var cc_arduino_cli_commands_v1_compile_pb = require('../../../../../cc/arduino/cli/commands/v1/compile_pb.js');
var cc_arduino_cli_commands_v1_core_pb = require('../../../../../cc/arduino/cli/commands/v1/core_pb.js');
var cc_arduino_cli_commands_v1_debug_pb = require('../../../../../cc/arduino/cli/commands/v1/debug_pb.js');
var cc_arduino_cli_commands_v1_monitor_pb = require('../../../../../cc/arduino/cli/commands/v1/monitor_pb.js');
var cc_arduino_cli_commands_v1_upload_pb = require('../../../../../cc/arduino/cli/commands/v1/upload_pb.js');
var cc_arduino_cli_commands_v1_lib_pb = require('../../../../../cc/arduino/cli/commands/v1/lib_pb.js');
@@ -225,6 +226,28 @@ function deserialize_cc_arduino_cli_commands_v1_CreateResponse(buffer_arg) {
return cc_arduino_cli_commands_v1_commands_pb.CreateResponse.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_cc_arduino_cli_commands_v1_DebugRequest(arg) {
if (!(arg instanceof cc_arduino_cli_commands_v1_debug_pb.DebugRequest)) {
throw new Error('Expected argument of type cc.arduino.cli.commands.v1.DebugRequest');
}
return Buffer.from(arg.serializeBinary());
}
function deserialize_cc_arduino_cli_commands_v1_DebugRequest(buffer_arg) {
return cc_arduino_cli_commands_v1_debug_pb.DebugRequest.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_cc_arduino_cli_commands_v1_DebugResponse(arg) {
if (!(arg instanceof cc_arduino_cli_commands_v1_debug_pb.DebugResponse)) {
throw new Error('Expected argument of type cc.arduino.cli.commands.v1.DebugResponse');
}
return Buffer.from(arg.serializeBinary());
}
function deserialize_cc_arduino_cli_commands_v1_DebugResponse(buffer_arg) {
return cc_arduino_cli_commands_v1_debug_pb.DebugResponse.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_cc_arduino_cli_commands_v1_DestroyRequest(arg) {
if (!(arg instanceof cc_arduino_cli_commands_v1_commands_pb.DestroyRequest)) {
throw new Error('Expected argument of type cc.arduino.cli.commands.v1.DestroyRequest');
@@ -269,6 +292,28 @@ function deserialize_cc_arduino_cli_commands_v1_EnumerateMonitorPortSettingsResp
return cc_arduino_cli_commands_v1_monitor_pb.EnumerateMonitorPortSettingsResponse.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_cc_arduino_cli_commands_v1_GetDebugConfigRequest(arg) {
if (!(arg instanceof cc_arduino_cli_commands_v1_debug_pb.GetDebugConfigRequest)) {
throw new Error('Expected argument of type cc.arduino.cli.commands.v1.GetDebugConfigRequest');
}
return Buffer.from(arg.serializeBinary());
}
function deserialize_cc_arduino_cli_commands_v1_GetDebugConfigRequest(buffer_arg) {
return cc_arduino_cli_commands_v1_debug_pb.GetDebugConfigRequest.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_cc_arduino_cli_commands_v1_GetDebugConfigResponse(arg) {
if (!(arg instanceof cc_arduino_cli_commands_v1_debug_pb.GetDebugConfigResponse)) {
throw new Error('Expected argument of type cc.arduino.cli.commands.v1.GetDebugConfigResponse');
}
return Buffer.from(arg.serializeBinary());
}
function deserialize_cc_arduino_cli_commands_v1_GetDebugConfigResponse(buffer_arg) {
return cc_arduino_cli_commands_v1_debug_pb.GetDebugConfigResponse.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_cc_arduino_cli_commands_v1_GitLibraryInstallRequest(arg) {
if (!(arg instanceof cc_arduino_cli_commands_v1_lib_pb.GitLibraryInstallRequest)) {
throw new Error('Expected argument of type cc.arduino.cli.commands.v1.GitLibraryInstallRequest');
@@ -313,6 +358,28 @@ function deserialize_cc_arduino_cli_commands_v1_InitResponse(buffer_arg) {
return cc_arduino_cli_commands_v1_commands_pb.InitResponse.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_cc_arduino_cli_commands_v1_IsDebugSupportedRequest(arg) {
if (!(arg instanceof cc_arduino_cli_commands_v1_debug_pb.IsDebugSupportedRequest)) {
throw new Error('Expected argument of type cc.arduino.cli.commands.v1.IsDebugSupportedRequest');
}
return Buffer.from(arg.serializeBinary());
}
function deserialize_cc_arduino_cli_commands_v1_IsDebugSupportedRequest(buffer_arg) {
return cc_arduino_cli_commands_v1_debug_pb.IsDebugSupportedRequest.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_cc_arduino_cli_commands_v1_IsDebugSupportedResponse(arg) {
if (!(arg instanceof cc_arduino_cli_commands_v1_debug_pb.IsDebugSupportedResponse)) {
throw new Error('Expected argument of type cc.arduino.cli.commands.v1.IsDebugSupportedResponse');
}
return Buffer.from(arg.serializeBinary());
}
function deserialize_cc_arduino_cli_commands_v1_IsDebugSupportedResponse(buffer_arg) {
return cc_arduino_cli_commands_v1_debug_pb.IsDebugSupportedResponse.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_cc_arduino_cli_commands_v1_LibraryDownloadRequest(arg) {
if (!(arg instanceof cc_arduino_cli_commands_v1_lib_pb.LibraryDownloadRequest)) {
throw new Error('Expected argument of type cc.arduino.cli.commands.v1.LibraryDownloadRequest');
@@ -1065,7 +1132,7 @@ boardSearch: {
// List boards connection and disconnected events.
boardListWatch: {
path: '/cc.arduino.cli.commands.v1.ArduinoCoreService/BoardListWatch',
requestStream: true,
requestStream: false,
responseStream: true,
requestType: cc_arduino_cli_commands_v1_board_pb.BoardListWatchRequest,
responseType: cc_arduino_cli_commands_v1_board_pb.BoardListWatchResponse,
@@ -1367,5 +1434,41 @@ enumerateMonitorPortSettings: {
responseSerialize: serialize_cc_arduino_cli_commands_v1_EnumerateMonitorPortSettingsResponse,
responseDeserialize: deserialize_cc_arduino_cli_commands_v1_EnumerateMonitorPortSettingsResponse,
},
// Start a debug session and communicate with the debugger tool.
debug: {
path: '/cc.arduino.cli.commands.v1.ArduinoCoreService/Debug',
requestStream: true,
responseStream: true,
requestType: cc_arduino_cli_commands_v1_debug_pb.DebugRequest,
responseType: cc_arduino_cli_commands_v1_debug_pb.DebugResponse,
requestSerialize: serialize_cc_arduino_cli_commands_v1_DebugRequest,
requestDeserialize: deserialize_cc_arduino_cli_commands_v1_DebugRequest,
responseSerialize: serialize_cc_arduino_cli_commands_v1_DebugResponse,
responseDeserialize: deserialize_cc_arduino_cli_commands_v1_DebugResponse,
},
// Determine if debugging is suported given a specific configuration.
isDebugSupported: {
path: '/cc.arduino.cli.commands.v1.ArduinoCoreService/IsDebugSupported',
requestStream: false,
responseStream: false,
requestType: cc_arduino_cli_commands_v1_debug_pb.IsDebugSupportedRequest,
responseType: cc_arduino_cli_commands_v1_debug_pb.IsDebugSupportedResponse,
requestSerialize: serialize_cc_arduino_cli_commands_v1_IsDebugSupportedRequest,
requestDeserialize: deserialize_cc_arduino_cli_commands_v1_IsDebugSupportedRequest,
responseSerialize: serialize_cc_arduino_cli_commands_v1_IsDebugSupportedResponse,
responseDeserialize: deserialize_cc_arduino_cli_commands_v1_IsDebugSupportedResponse,
},
// Query the debugger information given a specific configuration.
getDebugConfig: {
path: '/cc.arduino.cli.commands.v1.ArduinoCoreService/GetDebugConfig',
requestStream: false,
responseStream: false,
requestType: cc_arduino_cli_commands_v1_debug_pb.GetDebugConfigRequest,
responseType: cc_arduino_cli_commands_v1_debug_pb.GetDebugConfigResponse,
requestSerialize: serialize_cc_arduino_cli_commands_v1_GetDebugConfigRequest,
requestDeserialize: deserialize_cc_arduino_cli_commands_v1_GetDebugConfigRequest,
responseSerialize: serialize_cc_arduino_cli_commands_v1_GetDebugConfigResponse,
responseDeserialize: deserialize_cc_arduino_cli_commands_v1_GetDebugConfigResponse,
},
};

View File

@@ -10,6 +10,7 @@ import * as cc_arduino_cli_commands_v1_common_pb from "../../../../../cc/arduino
import * as cc_arduino_cli_commands_v1_board_pb from "../../../../../cc/arduino/cli/commands/v1/board_pb";
import * as cc_arduino_cli_commands_v1_compile_pb from "../../../../../cc/arduino/cli/commands/v1/compile_pb";
import * as cc_arduino_cli_commands_v1_core_pb from "../../../../../cc/arduino/cli/commands/v1/core_pb";
import * as cc_arduino_cli_commands_v1_debug_pb from "../../../../../cc/arduino/cli/commands/v1/debug_pb";
import * as cc_arduino_cli_commands_v1_monitor_pb from "../../../../../cc/arduino/cli/commands/v1/monitor_pb";
import * as cc_arduino_cli_commands_v1_upload_pb from "../../../../../cc/arduino/cli/commands/v1/upload_pb";
import * as cc_arduino_cli_commands_v1_lib_pb from "../../../../../cc/arduino/cli/commands/v1/lib_pb";

View File

@@ -31,6 +31,8 @@ var cc_arduino_cli_commands_v1_compile_pb = require('../../../../../cc/arduino/c
goog.object.extend(proto, cc_arduino_cli_commands_v1_compile_pb);
var cc_arduino_cli_commands_v1_core_pb = require('../../../../../cc/arduino/cli/commands/v1/core_pb.js');
goog.object.extend(proto, cc_arduino_cli_commands_v1_core_pb);
var cc_arduino_cli_commands_v1_debug_pb = require('../../../../../cc/arduino/cli/commands/v1/debug_pb.js');
goog.object.extend(proto, cc_arduino_cli_commands_v1_debug_pb);
var cc_arduino_cli_commands_v1_monitor_pb = require('../../../../../cc/arduino/cli/commands/v1/monitor_pb.js');
goog.object.extend(proto, cc_arduino_cli_commands_v1_monitor_pb);
var cc_arduino_cli_commands_v1_upload_pb = require('../../../../../cc/arduino/cli/commands/v1/upload_pb.js');

View File

@@ -195,6 +195,23 @@ export namespace Programmer {
}
}
export class MissingProgrammerError extends jspb.Message {
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): MissingProgrammerError.AsObject;
static toObject(includeInstance: boolean, msg: MissingProgrammerError): MissingProgrammerError.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: MissingProgrammerError, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): MissingProgrammerError;
static deserializeBinaryFromReader(message: MissingProgrammerError, reader: jspb.BinaryReader): MissingProgrammerError;
}
export namespace MissingProgrammerError {
export type AsObject = {
}
}
export class Platform extends jspb.Message {
getId(): string;
setId(value: string): Platform;

View File

@@ -30,6 +30,7 @@ goog.exportSymbol('proto.cc.arduino.cli.commands.v1.DownloadProgressUpdate', nul
goog.exportSymbol('proto.cc.arduino.cli.commands.v1.HelpResources', null, global);
goog.exportSymbol('proto.cc.arduino.cli.commands.v1.InstalledPlatformReference', null, global);
goog.exportSymbol('proto.cc.arduino.cli.commands.v1.Instance', null, global);
goog.exportSymbol('proto.cc.arduino.cli.commands.v1.MissingProgrammerError', null, global);
goog.exportSymbol('proto.cc.arduino.cli.commands.v1.Platform', null, global);
goog.exportSymbol('proto.cc.arduino.cli.commands.v1.Profile', null, global);
goog.exportSymbol('proto.cc.arduino.cli.commands.v1.Programmer', null, global);
@@ -181,6 +182,27 @@ if (goog.DEBUG && !COMPILED) {
*/
proto.cc.arduino.cli.commands.v1.Programmer.displayName = 'proto.cc.arduino.cli.commands.v1.Programmer';
}
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
* server response, or constructed directly in Javascript. The array is used
* in place and becomes part of the constructed object. It is not cloned.
* If no data is provided, the constructed object will be empty, but still
* valid.
* @extends {jspb.Message}
* @constructor
*/
proto.cc.arduino.cli.commands.v1.MissingProgrammerError = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.cc.arduino.cli.commands.v1.MissingProgrammerError, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.cc.arduino.cli.commands.v1.MissingProgrammerError.displayName = 'proto.cc.arduino.cli.commands.v1.MissingProgrammerError';
}
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
@@ -1587,6 +1609,107 @@ proto.cc.arduino.cli.commands.v1.Programmer.prototype.setName = function(value)
if (jspb.Message.GENERATE_TO_OBJECT) {
/**
* Creates an object representation of this proto.
* Field names that are reserved in JavaScript and will be renamed to pb_name.
* Optional fields that are not set will be set to undefined.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* net/proto2/compiler/js/internal/generator.cc#kKeyword.
* @param {boolean=} opt_includeInstance Deprecated. whether to include the
* JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @return {!Object}
*/
proto.cc.arduino.cli.commands.v1.MissingProgrammerError.prototype.toObject = function(opt_includeInstance) {
return proto.cc.arduino.cli.commands.v1.MissingProgrammerError.toObject(opt_includeInstance, this);
};
/**
* Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
* the JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.cc.arduino.cli.commands.v1.MissingProgrammerError} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.cc.arduino.cli.commands.v1.MissingProgrammerError.toObject = function(includeInstance, msg) {
var f, obj = {
};
if (includeInstance) {
obj.$jspbMessageInstance = msg;
}
return obj;
};
}
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.cc.arduino.cli.commands.v1.MissingProgrammerError}
*/
proto.cc.arduino.cli.commands.v1.MissingProgrammerError.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.cc.arduino.cli.commands.v1.MissingProgrammerError;
return proto.cc.arduino.cli.commands.v1.MissingProgrammerError.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.cc.arduino.cli.commands.v1.MissingProgrammerError} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.cc.arduino.cli.commands.v1.MissingProgrammerError}
*/
proto.cc.arduino.cli.commands.v1.MissingProgrammerError.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.cc.arduino.cli.commands.v1.MissingProgrammerError.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.cc.arduino.cli.commands.v1.MissingProgrammerError.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.cc.arduino.cli.commands.v1.MissingProgrammerError} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.cc.arduino.cli.commands.v1.MissingProgrammerError.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
};
/**
* List of repeated fields within this message type.
* @private {!Array<number>}

View File

@@ -23,6 +23,8 @@ export class PlatformInstallRequest extends jspb.Message {
setSkipPostInstall(value: boolean): PlatformInstallRequest;
getNoOverwrite(): boolean;
setNoOverwrite(value: boolean): PlatformInstallRequest;
getSkipPreUninstall(): boolean;
setSkipPreUninstall(value: boolean): PlatformInstallRequest;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): PlatformInstallRequest.AsObject;
@@ -42,6 +44,7 @@ export namespace PlatformInstallRequest {
version: string,
skipPostInstall: boolean,
noOverwrite: boolean,
skipPreUninstall: boolean,
}
}
@@ -156,6 +159,8 @@ export class PlatformUninstallRequest extends jspb.Message {
setPlatformPackage(value: string): PlatformUninstallRequest;
getArchitecture(): string;
setArchitecture(value: string): PlatformUninstallRequest;
getSkipPreUninstall(): boolean;
setSkipPreUninstall(value: boolean): PlatformUninstallRequest;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): PlatformUninstallRequest.AsObject;
@@ -172,6 +177,7 @@ export namespace PlatformUninstallRequest {
instance?: cc_arduino_cli_commands_v1_common_pb.Instance.AsObject,
platformPackage: string,
architecture: string,
skipPreUninstall: boolean,
}
}
@@ -227,6 +233,8 @@ export class PlatformUpgradeRequest extends jspb.Message {
setArchitecture(value: string): PlatformUpgradeRequest;
getSkipPostInstall(): boolean;
setSkipPostInstall(value: boolean): PlatformUpgradeRequest;
getSkipPreUninstall(): boolean;
setSkipPreUninstall(value: boolean): PlatformUpgradeRequest;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): PlatformUpgradeRequest.AsObject;
@@ -244,6 +252,7 @@ export namespace PlatformUpgradeRequest {
platformPackage: string,
architecture: string,
skipPostInstall: boolean,
skipPreUninstall: boolean,
}
}

View File

@@ -368,7 +368,8 @@ proto.cc.arduino.cli.commands.v1.PlatformInstallRequest.toObject = function(incl
architecture: jspb.Message.getFieldWithDefault(msg, 3, ""),
version: jspb.Message.getFieldWithDefault(msg, 4, ""),
skipPostInstall: jspb.Message.getBooleanFieldWithDefault(msg, 5, false),
noOverwrite: jspb.Message.getBooleanFieldWithDefault(msg, 6, false)
noOverwrite: jspb.Message.getBooleanFieldWithDefault(msg, 6, false),
skipPreUninstall: jspb.Message.getBooleanFieldWithDefault(msg, 7, false)
};
if (includeInstance) {
@@ -430,6 +431,10 @@ proto.cc.arduino.cli.commands.v1.PlatformInstallRequest.deserializeBinaryFromRea
var value = /** @type {boolean} */ (reader.readBool());
msg.setNoOverwrite(value);
break;
case 7:
var value = /** @type {boolean} */ (reader.readBool());
msg.setSkipPreUninstall(value);
break;
default:
reader.skipField();
break;
@@ -502,6 +507,13 @@ proto.cc.arduino.cli.commands.v1.PlatformInstallRequest.serializeBinaryToWriter
f
);
}
f = message.getSkipPreUninstall();
if (f) {
writer.writeBool(
7,
f
);
}
};
@@ -632,6 +644,24 @@ proto.cc.arduino.cli.commands.v1.PlatformInstallRequest.prototype.setNoOverwrite
};
/**
* optional bool skip_pre_uninstall = 7;
* @return {boolean}
*/
proto.cc.arduino.cli.commands.v1.PlatformInstallRequest.prototype.getSkipPreUninstall = function() {
return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 7, false));
};
/**
* @param {boolean} value
* @return {!proto.cc.arduino.cli.commands.v1.PlatformInstallRequest} returns this
*/
proto.cc.arduino.cli.commands.v1.PlatformInstallRequest.prototype.setSkipPreUninstall = function(value) {
return jspb.Message.setProto3BooleanField(this, 7, value);
};
@@ -1361,7 +1391,8 @@ proto.cc.arduino.cli.commands.v1.PlatformUninstallRequest.toObject = function(in
var f, obj = {
instance: (f = msg.getInstance()) && cc_arduino_cli_commands_v1_common_pb.Instance.toObject(includeInstance, f),
platformPackage: jspb.Message.getFieldWithDefault(msg, 2, ""),
architecture: jspb.Message.getFieldWithDefault(msg, 3, "")
architecture: jspb.Message.getFieldWithDefault(msg, 3, ""),
skipPreUninstall: jspb.Message.getBooleanFieldWithDefault(msg, 4, false)
};
if (includeInstance) {
@@ -1411,6 +1442,10 @@ proto.cc.arduino.cli.commands.v1.PlatformUninstallRequest.deserializeBinaryFromR
var value = /** @type {string} */ (reader.readString());
msg.setArchitecture(value);
break;
case 4:
var value = /** @type {boolean} */ (reader.readBool());
msg.setSkipPreUninstall(value);
break;
default:
reader.skipField();
break;
@@ -1462,6 +1497,13 @@ proto.cc.arduino.cli.commands.v1.PlatformUninstallRequest.serializeBinaryToWrite
f
);
}
f = message.getSkipPreUninstall();
if (f) {
writer.writeBool(
4,
f
);
}
};
@@ -1538,6 +1580,24 @@ proto.cc.arduino.cli.commands.v1.PlatformUninstallRequest.prototype.setArchitect
};
/**
* optional bool skip_pre_uninstall = 4;
* @return {boolean}
*/
proto.cc.arduino.cli.commands.v1.PlatformUninstallRequest.prototype.getSkipPreUninstall = function() {
return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 4, false));
};
/**
* @param {boolean} value
* @return {!proto.cc.arduino.cli.commands.v1.PlatformUninstallRequest} returns this
*/
proto.cc.arduino.cli.commands.v1.PlatformUninstallRequest.prototype.setSkipPreUninstall = function(value) {
return jspb.Message.setProto3BooleanField(this, 4, value);
};
@@ -1825,7 +1885,8 @@ proto.cc.arduino.cli.commands.v1.PlatformUpgradeRequest.toObject = function(incl
instance: (f = msg.getInstance()) && cc_arduino_cli_commands_v1_common_pb.Instance.toObject(includeInstance, f),
platformPackage: jspb.Message.getFieldWithDefault(msg, 2, ""),
architecture: jspb.Message.getFieldWithDefault(msg, 3, ""),
skipPostInstall: jspb.Message.getBooleanFieldWithDefault(msg, 4, false)
skipPostInstall: jspb.Message.getBooleanFieldWithDefault(msg, 4, false),
skipPreUninstall: jspb.Message.getBooleanFieldWithDefault(msg, 5, false)
};
if (includeInstance) {
@@ -1879,6 +1940,10 @@ proto.cc.arduino.cli.commands.v1.PlatformUpgradeRequest.deserializeBinaryFromRea
var value = /** @type {boolean} */ (reader.readBool());
msg.setSkipPostInstall(value);
break;
case 5:
var value = /** @type {boolean} */ (reader.readBool());
msg.setSkipPreUninstall(value);
break;
default:
reader.skipField();
break;
@@ -1937,6 +2002,13 @@ proto.cc.arduino.cli.commands.v1.PlatformUpgradeRequest.serializeBinaryToWriter
f
);
}
f = message.getSkipPreUninstall();
if (f) {
writer.writeBool(
5,
f
);
}
};
@@ -2031,6 +2103,24 @@ proto.cc.arduino.cli.commands.v1.PlatformUpgradeRequest.prototype.setSkipPostIns
};
/**
* optional bool skip_pre_uninstall = 5;
* @return {boolean}
*/
proto.cc.arduino.cli.commands.v1.PlatformUpgradeRequest.prototype.getSkipPreUninstall = function() {
return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 5, false));
};
/**
* @param {boolean} value
* @return {!proto.cc.arduino.cli.commands.v1.PlatformUpgradeRequest} returns this
*/
proto.cc.arduino.cli.commands.v1.PlatformUpgradeRequest.prototype.setSkipPreUninstall = function(value) {
return jspb.Message.setProto3BooleanField(this, 5, value);
};

View File

@@ -0,0 +1 @@
// GENERATED CODE -- NO SERVICES IN PROTO

View File

@@ -0,0 +1,274 @@
// package: cc.arduino.cli.commands.v1
// file: cc/arduino/cli/commands/v1/debug.proto
/* tslint:disable */
/* eslint-disable */
import * as jspb from "google-protobuf";
import * as cc_arduino_cli_commands_v1_common_pb from "../../../../../cc/arduino/cli/commands/v1/common_pb";
import * as cc_arduino_cli_commands_v1_port_pb from "../../../../../cc/arduino/cli/commands/v1/port_pb";
import * as google_protobuf_any_pb from "google-protobuf/google/protobuf/any_pb";
export class DebugRequest extends jspb.Message {
hasDebugRequest(): boolean;
clearDebugRequest(): void;
getDebugRequest(): GetDebugConfigRequest | undefined;
setDebugRequest(value?: GetDebugConfigRequest): DebugRequest;
getData(): Uint8Array | string;
getData_asU8(): Uint8Array;
getData_asB64(): string;
setData(value: Uint8Array | string): DebugRequest;
getSendInterrupt(): boolean;
setSendInterrupt(value: boolean): DebugRequest;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): DebugRequest.AsObject;
static toObject(includeInstance: boolean, msg: DebugRequest): DebugRequest.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: DebugRequest, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): DebugRequest;
static deserializeBinaryFromReader(message: DebugRequest, reader: jspb.BinaryReader): DebugRequest;
}
export namespace DebugRequest {
export type AsObject = {
debugRequest?: GetDebugConfigRequest.AsObject,
data: Uint8Array | string,
sendInterrupt: boolean,
}
}
export class DebugResponse extends jspb.Message {
getData(): Uint8Array | string;
getData_asU8(): Uint8Array;
getData_asB64(): string;
setData(value: Uint8Array | string): DebugResponse;
getError(): string;
setError(value: string): DebugResponse;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): DebugResponse.AsObject;
static toObject(includeInstance: boolean, msg: DebugResponse): DebugResponse.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: DebugResponse, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): DebugResponse;
static deserializeBinaryFromReader(message: DebugResponse, reader: jspb.BinaryReader): DebugResponse;
}
export namespace DebugResponse {
export type AsObject = {
data: Uint8Array | string,
error: string,
}
}
export class IsDebugSupportedRequest extends jspb.Message {
hasInstance(): boolean;
clearInstance(): void;
getInstance(): cc_arduino_cli_commands_v1_common_pb.Instance | undefined;
setInstance(value?: cc_arduino_cli_commands_v1_common_pb.Instance): IsDebugSupportedRequest;
getFqbn(): string;
setFqbn(value: string): IsDebugSupportedRequest;
hasPort(): boolean;
clearPort(): void;
getPort(): cc_arduino_cli_commands_v1_port_pb.Port | undefined;
setPort(value?: cc_arduino_cli_commands_v1_port_pb.Port): IsDebugSupportedRequest;
getInterpreter(): string;
setInterpreter(value: string): IsDebugSupportedRequest;
getProgrammer(): string;
setProgrammer(value: string): IsDebugSupportedRequest;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): IsDebugSupportedRequest.AsObject;
static toObject(includeInstance: boolean, msg: IsDebugSupportedRequest): IsDebugSupportedRequest.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: IsDebugSupportedRequest, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): IsDebugSupportedRequest;
static deserializeBinaryFromReader(message: IsDebugSupportedRequest, reader: jspb.BinaryReader): IsDebugSupportedRequest;
}
export namespace IsDebugSupportedRequest {
export type AsObject = {
instance?: cc_arduino_cli_commands_v1_common_pb.Instance.AsObject,
fqbn: string,
port?: cc_arduino_cli_commands_v1_port_pb.Port.AsObject,
interpreter: string,
programmer: string,
}
}
export class IsDebugSupportedResponse extends jspb.Message {
getDebuggingSupported(): boolean;
setDebuggingSupported(value: boolean): IsDebugSupportedResponse;
getDebugFqbn(): string;
setDebugFqbn(value: string): IsDebugSupportedResponse;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): IsDebugSupportedResponse.AsObject;
static toObject(includeInstance: boolean, msg: IsDebugSupportedResponse): IsDebugSupportedResponse.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: IsDebugSupportedResponse, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): IsDebugSupportedResponse;
static deserializeBinaryFromReader(message: IsDebugSupportedResponse, reader: jspb.BinaryReader): IsDebugSupportedResponse;
}
export namespace IsDebugSupportedResponse {
export type AsObject = {
debuggingSupported: boolean,
debugFqbn: string,
}
}
export class GetDebugConfigRequest extends jspb.Message {
hasInstance(): boolean;
clearInstance(): void;
getInstance(): cc_arduino_cli_commands_v1_common_pb.Instance | undefined;
setInstance(value?: cc_arduino_cli_commands_v1_common_pb.Instance): GetDebugConfigRequest;
getFqbn(): string;
setFqbn(value: string): GetDebugConfigRequest;
getSketchPath(): string;
setSketchPath(value: string): GetDebugConfigRequest;
hasPort(): boolean;
clearPort(): void;
getPort(): cc_arduino_cli_commands_v1_port_pb.Port | undefined;
setPort(value?: cc_arduino_cli_commands_v1_port_pb.Port): GetDebugConfigRequest;
getInterpreter(): string;
setInterpreter(value: string): GetDebugConfigRequest;
getImportDir(): string;
setImportDir(value: string): GetDebugConfigRequest;
getProgrammer(): string;
setProgrammer(value: string): GetDebugConfigRequest;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): GetDebugConfigRequest.AsObject;
static toObject(includeInstance: boolean, msg: GetDebugConfigRequest): GetDebugConfigRequest.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: GetDebugConfigRequest, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): GetDebugConfigRequest;
static deserializeBinaryFromReader(message: GetDebugConfigRequest, reader: jspb.BinaryReader): GetDebugConfigRequest;
}
export namespace GetDebugConfigRequest {
export type AsObject = {
instance?: cc_arduino_cli_commands_v1_common_pb.Instance.AsObject,
fqbn: string,
sketchPath: string,
port?: cc_arduino_cli_commands_v1_port_pb.Port.AsObject,
interpreter: string,
importDir: string,
programmer: string,
}
}
export class GetDebugConfigResponse extends jspb.Message {
getExecutable(): string;
setExecutable(value: string): GetDebugConfigResponse;
getToolchain(): string;
setToolchain(value: string): GetDebugConfigResponse;
getToolchainPath(): string;
setToolchainPath(value: string): GetDebugConfigResponse;
getToolchainPrefix(): string;
setToolchainPrefix(value: string): GetDebugConfigResponse;
getServer(): string;
setServer(value: string): GetDebugConfigResponse;
getServerPath(): string;
setServerPath(value: string): GetDebugConfigResponse;
hasToolchainConfiguration(): boolean;
clearToolchainConfiguration(): void;
getToolchainConfiguration(): google_protobuf_any_pb.Any | undefined;
setToolchainConfiguration(value?: google_protobuf_any_pb.Any): GetDebugConfigResponse;
hasServerConfiguration(): boolean;
clearServerConfiguration(): void;
getServerConfiguration(): google_protobuf_any_pb.Any | undefined;
setServerConfiguration(value?: google_protobuf_any_pb.Any): GetDebugConfigResponse;
getCustomConfigsMap(): jspb.Map<string, string>;
clearCustomConfigsMap(): void;
getSvdFile(): string;
setSvdFile(value: string): GetDebugConfigResponse;
getProgrammer(): string;
setProgrammer(value: string): GetDebugConfigResponse;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): GetDebugConfigResponse.AsObject;
static toObject(includeInstance: boolean, msg: GetDebugConfigResponse): GetDebugConfigResponse.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: GetDebugConfigResponse, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): GetDebugConfigResponse;
static deserializeBinaryFromReader(message: GetDebugConfigResponse, reader: jspb.BinaryReader): GetDebugConfigResponse;
}
export namespace GetDebugConfigResponse {
export type AsObject = {
executable: string,
toolchain: string,
toolchainPath: string,
toolchainPrefix: string,
server: string,
serverPath: string,
toolchainConfiguration?: google_protobuf_any_pb.Any.AsObject,
serverConfiguration?: google_protobuf_any_pb.Any.AsObject,
customConfigsMap: Array<[string, string]>,
svdFile: string,
programmer: string,
}
}
export class DebugGCCToolchainConfiguration extends jspb.Message {
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): DebugGCCToolchainConfiguration.AsObject;
static toObject(includeInstance: boolean, msg: DebugGCCToolchainConfiguration): DebugGCCToolchainConfiguration.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: DebugGCCToolchainConfiguration, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): DebugGCCToolchainConfiguration;
static deserializeBinaryFromReader(message: DebugGCCToolchainConfiguration, reader: jspb.BinaryReader): DebugGCCToolchainConfiguration;
}
export namespace DebugGCCToolchainConfiguration {
export type AsObject = {
}
}
export class DebugOpenOCDServerConfiguration extends jspb.Message {
getPath(): string;
setPath(value: string): DebugOpenOCDServerConfiguration;
getScriptsDir(): string;
setScriptsDir(value: string): DebugOpenOCDServerConfiguration;
clearScriptsList(): void;
getScriptsList(): Array<string>;
setScriptsList(value: Array<string>): DebugOpenOCDServerConfiguration;
addScripts(value: string, index?: number): string;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): DebugOpenOCDServerConfiguration.AsObject;
static toObject(includeInstance: boolean, msg: DebugOpenOCDServerConfiguration): DebugOpenOCDServerConfiguration.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: DebugOpenOCDServerConfiguration, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): DebugOpenOCDServerConfiguration;
static deserializeBinaryFromReader(message: DebugOpenOCDServerConfiguration, reader: jspb.BinaryReader): DebugOpenOCDServerConfiguration;
}
export namespace DebugOpenOCDServerConfiguration {
export type AsObject = {
path: string,
scriptsDir: string,
scriptsList: Array<string>,
}
}

View File

@@ -1,59 +0,0 @@
// package: cc.arduino.cli.debug.v1
// file: cc/arduino/cli/debug/v1/debug.proto
/* tslint:disable */
/* eslint-disable */
import * as grpc from "@grpc/grpc-js";
import * as cc_arduino_cli_debug_v1_debug_pb from "../../../../../cc/arduino/cli/debug/v1/debug_pb";
import * as cc_arduino_cli_commands_v1_common_pb from "../../../../../cc/arduino/cli/commands/v1/common_pb";
import * as cc_arduino_cli_commands_v1_port_pb from "../../../../../cc/arduino/cli/commands/v1/port_pb";
interface IDebugServiceService extends grpc.ServiceDefinition<grpc.UntypedServiceImplementation> {
debug: IDebugServiceService_IDebug;
getDebugConfig: IDebugServiceService_IGetDebugConfig;
}
interface IDebugServiceService_IDebug extends grpc.MethodDefinition<cc_arduino_cli_debug_v1_debug_pb.DebugRequest, cc_arduino_cli_debug_v1_debug_pb.DebugResponse> {
path: "/cc.arduino.cli.debug.v1.DebugService/Debug";
requestStream: true;
responseStream: true;
requestSerialize: grpc.serialize<cc_arduino_cli_debug_v1_debug_pb.DebugRequest>;
requestDeserialize: grpc.deserialize<cc_arduino_cli_debug_v1_debug_pb.DebugRequest>;
responseSerialize: grpc.serialize<cc_arduino_cli_debug_v1_debug_pb.DebugResponse>;
responseDeserialize: grpc.deserialize<cc_arduino_cli_debug_v1_debug_pb.DebugResponse>;
}
interface IDebugServiceService_IGetDebugConfig extends grpc.MethodDefinition<cc_arduino_cli_debug_v1_debug_pb.DebugConfigRequest, cc_arduino_cli_debug_v1_debug_pb.GetDebugConfigResponse> {
path: "/cc.arduino.cli.debug.v1.DebugService/GetDebugConfig";
requestStream: false;
responseStream: false;
requestSerialize: grpc.serialize<cc_arduino_cli_debug_v1_debug_pb.DebugConfigRequest>;
requestDeserialize: grpc.deserialize<cc_arduino_cli_debug_v1_debug_pb.DebugConfigRequest>;
responseSerialize: grpc.serialize<cc_arduino_cli_debug_v1_debug_pb.GetDebugConfigResponse>;
responseDeserialize: grpc.deserialize<cc_arduino_cli_debug_v1_debug_pb.GetDebugConfigResponse>;
}
export const DebugServiceService: IDebugServiceService;
export interface IDebugServiceServer extends grpc.UntypedServiceImplementation {
debug: grpc.handleBidiStreamingCall<cc_arduino_cli_debug_v1_debug_pb.DebugRequest, cc_arduino_cli_debug_v1_debug_pb.DebugResponse>;
getDebugConfig: grpc.handleUnaryCall<cc_arduino_cli_debug_v1_debug_pb.DebugConfigRequest, cc_arduino_cli_debug_v1_debug_pb.GetDebugConfigResponse>;
}
export interface IDebugServiceClient {
debug(): grpc.ClientDuplexStream<cc_arduino_cli_debug_v1_debug_pb.DebugRequest, cc_arduino_cli_debug_v1_debug_pb.DebugResponse>;
debug(options: Partial<grpc.CallOptions>): grpc.ClientDuplexStream<cc_arduino_cli_debug_v1_debug_pb.DebugRequest, cc_arduino_cli_debug_v1_debug_pb.DebugResponse>;
debug(metadata: grpc.Metadata, options?: Partial<grpc.CallOptions>): grpc.ClientDuplexStream<cc_arduino_cli_debug_v1_debug_pb.DebugRequest, cc_arduino_cli_debug_v1_debug_pb.DebugResponse>;
getDebugConfig(request: cc_arduino_cli_debug_v1_debug_pb.DebugConfigRequest, callback: (error: grpc.ServiceError | null, response: cc_arduino_cli_debug_v1_debug_pb.GetDebugConfigResponse) => void): grpc.ClientUnaryCall;
getDebugConfig(request: cc_arduino_cli_debug_v1_debug_pb.DebugConfigRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: cc_arduino_cli_debug_v1_debug_pb.GetDebugConfigResponse) => void): grpc.ClientUnaryCall;
getDebugConfig(request: cc_arduino_cli_debug_v1_debug_pb.DebugConfigRequest, metadata: grpc.Metadata, options: Partial<grpc.CallOptions>, callback: (error: grpc.ServiceError | null, response: cc_arduino_cli_debug_v1_debug_pb.GetDebugConfigResponse) => void): grpc.ClientUnaryCall;
}
export class DebugServiceClient extends grpc.Client implements IDebugServiceClient {
constructor(address: string, credentials: grpc.ChannelCredentials, options?: Partial<grpc.ClientOptions>);
public debug(options?: Partial<grpc.CallOptions>): grpc.ClientDuplexStream<cc_arduino_cli_debug_v1_debug_pb.DebugRequest, cc_arduino_cli_debug_v1_debug_pb.DebugResponse>;
public debug(metadata?: grpc.Metadata, options?: Partial<grpc.CallOptions>): grpc.ClientDuplexStream<cc_arduino_cli_debug_v1_debug_pb.DebugRequest, cc_arduino_cli_debug_v1_debug_pb.DebugResponse>;
public getDebugConfig(request: cc_arduino_cli_debug_v1_debug_pb.DebugConfigRequest, callback: (error: grpc.ServiceError | null, response: cc_arduino_cli_debug_v1_debug_pb.GetDebugConfigResponse) => void): grpc.ClientUnaryCall;
public getDebugConfig(request: cc_arduino_cli_debug_v1_debug_pb.DebugConfigRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: cc_arduino_cli_debug_v1_debug_pb.GetDebugConfigResponse) => void): grpc.ClientUnaryCall;
public getDebugConfig(request: cc_arduino_cli_debug_v1_debug_pb.DebugConfigRequest, metadata: grpc.Metadata, options: Partial<grpc.CallOptions>, callback: (error: grpc.ServiceError | null, response: cc_arduino_cli_debug_v1_debug_pb.GetDebugConfigResponse) => void): grpc.ClientUnaryCall;
}

View File

@@ -1,95 +0,0 @@
// GENERATED CODE -- DO NOT EDIT!
// Original file comments:
// This file is part of arduino-cli.
//
// Copyright 2020 ARDUINO SA (http://www.arduino.cc/)
//
// This software is released under the GNU General Public License version 3,
// which covers the main part of arduino-cli.
// The terms of this license can be found at:
// https://www.gnu.org/licenses/gpl-3.0.en.html
//
// You can be released from the requirements of the above licenses by purchasing
// a commercial license. Buying such a license is mandatory if you want to
// modify or otherwise use the software for commercial activities involving the
// Arduino software without disclosing the source code of your own applications.
// To purchase a commercial license, send an email to license@arduino.cc.
//
'use strict';
var cc_arduino_cli_debug_v1_debug_pb = require('../../../../../cc/arduino/cli/debug/v1/debug_pb.js');
var cc_arduino_cli_commands_v1_common_pb = require('../../../../../cc/arduino/cli/commands/v1/common_pb.js');
var cc_arduino_cli_commands_v1_port_pb = require('../../../../../cc/arduino/cli/commands/v1/port_pb.js');
function serialize_cc_arduino_cli_debug_v1_DebugConfigRequest(arg) {
if (!(arg instanceof cc_arduino_cli_debug_v1_debug_pb.DebugConfigRequest)) {
throw new Error('Expected argument of type cc.arduino.cli.debug.v1.DebugConfigRequest');
}
return Buffer.from(arg.serializeBinary());
}
function deserialize_cc_arduino_cli_debug_v1_DebugConfigRequest(buffer_arg) {
return cc_arduino_cli_debug_v1_debug_pb.DebugConfigRequest.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_cc_arduino_cli_debug_v1_DebugRequest(arg) {
if (!(arg instanceof cc_arduino_cli_debug_v1_debug_pb.DebugRequest)) {
throw new Error('Expected argument of type cc.arduino.cli.debug.v1.DebugRequest');
}
return Buffer.from(arg.serializeBinary());
}
function deserialize_cc_arduino_cli_debug_v1_DebugRequest(buffer_arg) {
return cc_arduino_cli_debug_v1_debug_pb.DebugRequest.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_cc_arduino_cli_debug_v1_DebugResponse(arg) {
if (!(arg instanceof cc_arduino_cli_debug_v1_debug_pb.DebugResponse)) {
throw new Error('Expected argument of type cc.arduino.cli.debug.v1.DebugResponse');
}
return Buffer.from(arg.serializeBinary());
}
function deserialize_cc_arduino_cli_debug_v1_DebugResponse(buffer_arg) {
return cc_arduino_cli_debug_v1_debug_pb.DebugResponse.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_cc_arduino_cli_debug_v1_GetDebugConfigResponse(arg) {
if (!(arg instanceof cc_arduino_cli_debug_v1_debug_pb.GetDebugConfigResponse)) {
throw new Error('Expected argument of type cc.arduino.cli.debug.v1.GetDebugConfigResponse');
}
return Buffer.from(arg.serializeBinary());
}
function deserialize_cc_arduino_cli_debug_v1_GetDebugConfigResponse(buffer_arg) {
return cc_arduino_cli_debug_v1_debug_pb.GetDebugConfigResponse.deserializeBinary(new Uint8Array(buffer_arg));
}
// DebugService abstracts a debug Session usage
var DebugServiceService = exports['cc.arduino.cli.debug.v1.DebugService'] = {
// Start a debug session and communicate with the debugger tool.
debug: {
path: '/cc.arduino.cli.debug.v1.DebugService/Debug',
requestStream: true,
responseStream: true,
requestType: cc_arduino_cli_debug_v1_debug_pb.DebugRequest,
responseType: cc_arduino_cli_debug_v1_debug_pb.DebugResponse,
requestSerialize: serialize_cc_arduino_cli_debug_v1_DebugRequest,
requestDeserialize: deserialize_cc_arduino_cli_debug_v1_DebugRequest,
responseSerialize: serialize_cc_arduino_cli_debug_v1_DebugResponse,
responseDeserialize: deserialize_cc_arduino_cli_debug_v1_DebugResponse,
},
getDebugConfig: {
path: '/cc.arduino.cli.debug.v1.DebugService/GetDebugConfig',
requestStream: false,
responseStream: false,
requestType: cc_arduino_cli_debug_v1_debug_pb.DebugConfigRequest,
responseType: cc_arduino_cli_debug_v1_debug_pb.GetDebugConfigResponse,
requestSerialize: serialize_cc_arduino_cli_debug_v1_DebugConfigRequest,
requestDeserialize: deserialize_cc_arduino_cli_debug_v1_DebugConfigRequest,
responseSerialize: serialize_cc_arduino_cli_debug_v1_GetDebugConfigResponse,
responseDeserialize: deserialize_cc_arduino_cli_debug_v1_GetDebugConfigResponse,
},
};

View File

@@ -1,154 +0,0 @@
// package: cc.arduino.cli.debug.v1
// file: cc/arduino/cli/debug/v1/debug.proto
/* tslint:disable */
/* eslint-disable */
import * as jspb from "google-protobuf";
import * as cc_arduino_cli_commands_v1_common_pb from "../../../../../cc/arduino/cli/commands/v1/common_pb";
import * as cc_arduino_cli_commands_v1_port_pb from "../../../../../cc/arduino/cli/commands/v1/port_pb";
export class DebugRequest extends jspb.Message {
hasDebugRequest(): boolean;
clearDebugRequest(): void;
getDebugRequest(): DebugConfigRequest | undefined;
setDebugRequest(value?: DebugConfigRequest): DebugRequest;
getData(): Uint8Array | string;
getData_asU8(): Uint8Array;
getData_asB64(): string;
setData(value: Uint8Array | string): DebugRequest;
getSendInterrupt(): boolean;
setSendInterrupt(value: boolean): DebugRequest;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): DebugRequest.AsObject;
static toObject(includeInstance: boolean, msg: DebugRequest): DebugRequest.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: DebugRequest, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): DebugRequest;
static deserializeBinaryFromReader(message: DebugRequest, reader: jspb.BinaryReader): DebugRequest;
}
export namespace DebugRequest {
export type AsObject = {
debugRequest?: DebugConfigRequest.AsObject,
data: Uint8Array | string,
sendInterrupt: boolean,
}
}
export class DebugConfigRequest extends jspb.Message {
hasInstance(): boolean;
clearInstance(): void;
getInstance(): cc_arduino_cli_commands_v1_common_pb.Instance | undefined;
setInstance(value?: cc_arduino_cli_commands_v1_common_pb.Instance): DebugConfigRequest;
getFqbn(): string;
setFqbn(value: string): DebugConfigRequest;
getSketchPath(): string;
setSketchPath(value: string): DebugConfigRequest;
hasPort(): boolean;
clearPort(): void;
getPort(): cc_arduino_cli_commands_v1_port_pb.Port | undefined;
setPort(value?: cc_arduino_cli_commands_v1_port_pb.Port): DebugConfigRequest;
getInterpreter(): string;
setInterpreter(value: string): DebugConfigRequest;
getImportDir(): string;
setImportDir(value: string): DebugConfigRequest;
getProgrammer(): string;
setProgrammer(value: string): DebugConfigRequest;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): DebugConfigRequest.AsObject;
static toObject(includeInstance: boolean, msg: DebugConfigRequest): DebugConfigRequest.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: DebugConfigRequest, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): DebugConfigRequest;
static deserializeBinaryFromReader(message: DebugConfigRequest, reader: jspb.BinaryReader): DebugConfigRequest;
}
export namespace DebugConfigRequest {
export type AsObject = {
instance?: cc_arduino_cli_commands_v1_common_pb.Instance.AsObject,
fqbn: string,
sketchPath: string,
port?: cc_arduino_cli_commands_v1_port_pb.Port.AsObject,
interpreter: string,
importDir: string,
programmer: string,
}
}
export class DebugResponse extends jspb.Message {
getData(): Uint8Array | string;
getData_asU8(): Uint8Array;
getData_asB64(): string;
setData(value: Uint8Array | string): DebugResponse;
getError(): string;
setError(value: string): DebugResponse;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): DebugResponse.AsObject;
static toObject(includeInstance: boolean, msg: DebugResponse): DebugResponse.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: DebugResponse, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): DebugResponse;
static deserializeBinaryFromReader(message: DebugResponse, reader: jspb.BinaryReader): DebugResponse;
}
export namespace DebugResponse {
export type AsObject = {
data: Uint8Array | string,
error: string,
}
}
export class GetDebugConfigResponse extends jspb.Message {
getExecutable(): string;
setExecutable(value: string): GetDebugConfigResponse;
getToolchain(): string;
setToolchain(value: string): GetDebugConfigResponse;
getToolchainPath(): string;
setToolchainPath(value: string): GetDebugConfigResponse;
getToolchainPrefix(): string;
setToolchainPrefix(value: string): GetDebugConfigResponse;
getServer(): string;
setServer(value: string): GetDebugConfigResponse;
getServerPath(): string;
setServerPath(value: string): GetDebugConfigResponse;
getToolchainConfigurationMap(): jspb.Map<string, string>;
clearToolchainConfigurationMap(): void;
getServerConfigurationMap(): jspb.Map<string, string>;
clearServerConfigurationMap(): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): GetDebugConfigResponse.AsObject;
static toObject(includeInstance: boolean, msg: GetDebugConfigResponse): GetDebugConfigResponse.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: GetDebugConfigResponse, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): GetDebugConfigResponse;
static deserializeBinaryFromReader(message: GetDebugConfigResponse, reader: jspb.BinaryReader): GetDebugConfigResponse;
}
export namespace GetDebugConfigResponse {
export type AsObject = {
executable: string,
toolchain: string,
toolchainPath: string,
toolchainPrefix: string,
server: string,
serverPath: string,
toolchainConfigurationMap: Array<[string, string]>,
serverConfigurationMap: Array<[string, string]>,
}
}

View File

@@ -1,42 +0,0 @@
// package: cc.arduino.cli.monitor.v1
// file: cc/arduino/cli/monitor/v1/monitor.proto
/* tslint:disable */
/* eslint-disable */
import * as grpc from "@grpc/grpc-js";
import {handleClientStreamingCall} from "@grpc/grpc-js/build/src/server-call";
import * as cc_arduino_cli_monitor_v1_monitor_pb from "../../../../../cc/arduino/cli/monitor/v1/monitor_pb";
import * as google_protobuf_struct_pb from "google-protobuf/google/protobuf/struct_pb";
interface IMonitorServiceService extends grpc.ServiceDefinition<grpc.UntypedServiceImplementation> {
streamingOpen: IMonitorServiceService_IStreamingOpen;
}
interface IMonitorServiceService_IStreamingOpen extends grpc.MethodDefinition<cc_arduino_cli_monitor_v1_monitor_pb.StreamingOpenRequest, cc_arduino_cli_monitor_v1_monitor_pb.StreamingOpenResponse> {
path: "/cc.arduino.cli.monitor.v1.MonitorService/StreamingOpen";
requestStream: true;
responseStream: true;
requestSerialize: grpc.serialize<cc_arduino_cli_monitor_v1_monitor_pb.StreamingOpenRequest>;
requestDeserialize: grpc.deserialize<cc_arduino_cli_monitor_v1_monitor_pb.StreamingOpenRequest>;
responseSerialize: grpc.serialize<cc_arduino_cli_monitor_v1_monitor_pb.StreamingOpenResponse>;
responseDeserialize: grpc.deserialize<cc_arduino_cli_monitor_v1_monitor_pb.StreamingOpenResponse>;
}
export const MonitorServiceService: IMonitorServiceService;
export interface IMonitorServiceServer {
streamingOpen: grpc.handleBidiStreamingCall<cc_arduino_cli_monitor_v1_monitor_pb.StreamingOpenRequest, cc_arduino_cli_monitor_v1_monitor_pb.StreamingOpenResponse>;
}
export interface IMonitorServiceClient {
streamingOpen(): grpc.ClientDuplexStream<cc_arduino_cli_monitor_v1_monitor_pb.StreamingOpenRequest, cc_arduino_cli_monitor_v1_monitor_pb.StreamingOpenResponse>;
streamingOpen(options: Partial<grpc.CallOptions>): grpc.ClientDuplexStream<cc_arduino_cli_monitor_v1_monitor_pb.StreamingOpenRequest, cc_arduino_cli_monitor_v1_monitor_pb.StreamingOpenResponse>;
streamingOpen(metadata: grpc.Metadata, options?: Partial<grpc.CallOptions>): grpc.ClientDuplexStream<cc_arduino_cli_monitor_v1_monitor_pb.StreamingOpenRequest, cc_arduino_cli_monitor_v1_monitor_pb.StreamingOpenResponse>;
}
export class MonitorServiceClient extends grpc.Client implements IMonitorServiceClient {
constructor(address: string, credentials: grpc.ChannelCredentials, options?: Partial<grpc.ClientOptions>);
public streamingOpen(options?: Partial<grpc.CallOptions>): grpc.ClientDuplexStream<cc_arduino_cli_monitor_v1_monitor_pb.StreamingOpenRequest, cc_arduino_cli_monitor_v1_monitor_pb.StreamingOpenResponse>;
public streamingOpen(metadata?: grpc.Metadata, options?: Partial<grpc.CallOptions>): grpc.ClientDuplexStream<cc_arduino_cli_monitor_v1_monitor_pb.StreamingOpenRequest, cc_arduino_cli_monitor_v1_monitor_pb.StreamingOpenResponse>;
}

View File

@@ -1,65 +0,0 @@
// GENERATED CODE -- DO NOT EDIT!
// Original file comments:
// This file is part of arduino-cli.
//
// Copyright 2020 ARDUINO SA (http://www.arduino.cc/)
//
// This software is released under the GNU General Public License version 3,
// which covers the main part of arduino-cli.
// The terms of this license can be found at:
// https://www.gnu.org/licenses/gpl-3.0.en.html
//
// You can be released from the requirements of the above licenses by purchasing
// a commercial license. Buying such a license is mandatory if you want to
// modify or otherwise use the software for commercial activities involving the
// Arduino software without disclosing the source code of your own applications.
// To purchase a commercial license, send an email to license@arduino.cc.
//
'use strict';
var cc_arduino_cli_monitor_v1_monitor_pb = require('../../../../../cc/arduino/cli/monitor/v1/monitor_pb.js');
var google_protobuf_struct_pb = require('google-protobuf/google/protobuf/struct_pb.js');
function serialize_cc_arduino_cli_monitor_v1_StreamingOpenRequest(arg) {
if (!(arg instanceof cc_arduino_cli_monitor_v1_monitor_pb.StreamingOpenRequest)) {
throw new Error('Expected argument of type cc.arduino.cli.monitor.v1.StreamingOpenRequest');
}
return Buffer.from(arg.serializeBinary());
}
function deserialize_cc_arduino_cli_monitor_v1_StreamingOpenRequest(buffer_arg) {
return cc_arduino_cli_monitor_v1_monitor_pb.StreamingOpenRequest.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_cc_arduino_cli_monitor_v1_StreamingOpenResponse(arg) {
if (!(arg instanceof cc_arduino_cli_monitor_v1_monitor_pb.StreamingOpenResponse)) {
throw new Error('Expected argument of type cc.arduino.cli.monitor.v1.StreamingOpenResponse');
}
return Buffer.from(arg.serializeBinary());
}
function deserialize_cc_arduino_cli_monitor_v1_StreamingOpenResponse(buffer_arg) {
return cc_arduino_cli_monitor_v1_monitor_pb.StreamingOpenResponse.deserializeBinary(new Uint8Array(buffer_arg));
}
// MonitorService provides services for boards monitor.
// DEPRECATION WARNING: MonitorService is deprecated and will be removed in a
// future release. Use ArduinoCoreService.Monitor and
// ArduinoCoreService.EnumerateMonitorPortSettings instead.
var MonitorServiceService = exports['cc.arduino.cli.monitor.v1.MonitorService'] = {
// Open a bidirectional monitor stream. This can be used to implement
// something similar to the Arduino IDE's Serial Monitor.
streamingOpen: {
path: '/cc.arduino.cli.monitor.v1.MonitorService/StreamingOpen',
requestStream: true,
responseStream: true,
requestType: cc_arduino_cli_monitor_v1_monitor_pb.StreamingOpenRequest,
responseType: cc_arduino_cli_monitor_v1_monitor_pb.StreamingOpenResponse,
requestSerialize: serialize_cc_arduino_cli_monitor_v1_StreamingOpenRequest,
requestDeserialize: deserialize_cc_arduino_cli_monitor_v1_StreamingOpenRequest,
responseSerialize: serialize_cc_arduino_cli_monitor_v1_StreamingOpenResponse,
responseDeserialize: deserialize_cc_arduino_cli_monitor_v1_StreamingOpenResponse,
},
};

View File

@@ -1,131 +0,0 @@
// package: cc.arduino.cli.monitor.v1
// file: cc/arduino/cli/monitor/v1/monitor.proto
/* tslint:disable */
/* eslint-disable */
import * as jspb from "google-protobuf";
import * as google_protobuf_struct_pb from "google-protobuf/google/protobuf/struct_pb";
export class StreamingOpenRequest extends jspb.Message {
hasConfig(): boolean;
clearConfig(): void;
getConfig(): MonitorConfig | undefined;
setConfig(value?: MonitorConfig): StreamingOpenRequest;
hasData(): boolean;
clearData(): void;
getData(): Uint8Array | string;
getData_asU8(): Uint8Array;
getData_asB64(): string;
setData(value: Uint8Array | string): StreamingOpenRequest;
hasRecvAcknowledge(): boolean;
clearRecvAcknowledge(): void;
getRecvAcknowledge(): number;
setRecvAcknowledge(value: number): StreamingOpenRequest;
getContentCase(): StreamingOpenRequest.ContentCase;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): StreamingOpenRequest.AsObject;
static toObject(includeInstance: boolean, msg: StreamingOpenRequest): StreamingOpenRequest.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: StreamingOpenRequest, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): StreamingOpenRequest;
static deserializeBinaryFromReader(message: StreamingOpenRequest, reader: jspb.BinaryReader): StreamingOpenRequest;
}
export namespace StreamingOpenRequest {
export type AsObject = {
config?: MonitorConfig.AsObject,
data: Uint8Array | string,
recvAcknowledge: number,
}
export enum ContentCase {
CONTENT_NOT_SET = 0,
CONFIG = 1,
DATA = 2,
RECV_ACKNOWLEDGE = 3,
}
}
export class MonitorConfig extends jspb.Message {
getTarget(): string;
setTarget(value: string): MonitorConfig;
getType(): MonitorConfig.TargetType;
setType(value: MonitorConfig.TargetType): MonitorConfig;
hasAdditionalConfig(): boolean;
clearAdditionalConfig(): void;
getAdditionalConfig(): google_protobuf_struct_pb.Struct | undefined;
setAdditionalConfig(value?: google_protobuf_struct_pb.Struct): MonitorConfig;
getRecvRateLimitBuffer(): number;
setRecvRateLimitBuffer(value: number): MonitorConfig;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): MonitorConfig.AsObject;
static toObject(includeInstance: boolean, msg: MonitorConfig): MonitorConfig.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: MonitorConfig, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): MonitorConfig;
static deserializeBinaryFromReader(message: MonitorConfig, reader: jspb.BinaryReader): MonitorConfig;
}
export namespace MonitorConfig {
export type AsObject = {
target: string,
type: MonitorConfig.TargetType,
additionalConfig?: google_protobuf_struct_pb.Struct.AsObject,
recvRateLimitBuffer: number,
}
export enum TargetType {
TARGET_TYPE_SERIAL = 0,
TARGET_TYPE_NULL = 99,
}
}
export class StreamingOpenResponse extends jspb.Message {
getData(): Uint8Array | string;
getData_asU8(): Uint8Array;
getData_asB64(): string;
setData(value: Uint8Array | string): StreamingOpenResponse;
getDropped(): number;
setDropped(value: number): StreamingOpenResponse;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): StreamingOpenResponse.AsObject;
static toObject(includeInstance: boolean, msg: StreamingOpenResponse): StreamingOpenResponse.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: StreamingOpenResponse, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): StreamingOpenResponse;
static deserializeBinaryFromReader(message: StreamingOpenResponse, reader: jspb.BinaryReader): StreamingOpenResponse;
}
export namespace StreamingOpenResponse {
export type AsObject = {
data: Uint8Array | string,
dropped: number,
}
}

View File

@@ -1,819 +0,0 @@
// source: cc/arduino/cli/monitor/v1/monitor.proto
/**
* @fileoverview
* @enhanceable
* @suppress {missingRequire} reports error on implicit type usages.
* @suppress {messageConventions} JS Compiler reports an error if a variable or
* field starts with 'MSG_' and isn't a translatable message.
* @public
*/
// GENERATED CODE -- DO NOT EDIT!
/* eslint-disable */
// @ts-nocheck
var jspb = require('google-protobuf');
var goog = jspb;
var global = Function('return this')();
var google_protobuf_struct_pb = require('google-protobuf/google/protobuf/struct_pb.js');
goog.object.extend(proto, google_protobuf_struct_pb);
goog.exportSymbol('proto.cc.arduino.cli.monitor.v1.MonitorConfig', null, global);
goog.exportSymbol('proto.cc.arduino.cli.monitor.v1.MonitorConfig.TargetType', null, global);
goog.exportSymbol('proto.cc.arduino.cli.monitor.v1.StreamingOpenRequest', null, global);
goog.exportSymbol('proto.cc.arduino.cli.monitor.v1.StreamingOpenRequest.ContentCase', null, global);
goog.exportSymbol('proto.cc.arduino.cli.monitor.v1.StreamingOpenResponse', null, global);
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
* server response, or constructed directly in Javascript. The array is used
* in place and becomes part of the constructed object. It is not cloned.
* If no data is provided, the constructed object will be empty, but still
* valid.
* @extends {jspb.Message}
* @constructor
*/
proto.cc.arduino.cli.monitor.v1.StreamingOpenRequest = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, proto.cc.arduino.cli.monitor.v1.StreamingOpenRequest.oneofGroups_);
};
goog.inherits(proto.cc.arduino.cli.monitor.v1.StreamingOpenRequest, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.cc.arduino.cli.monitor.v1.StreamingOpenRequest.displayName = 'proto.cc.arduino.cli.monitor.v1.StreamingOpenRequest';
}
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
* server response, or constructed directly in Javascript. The array is used
* in place and becomes part of the constructed object. It is not cloned.
* If no data is provided, the constructed object will be empty, but still
* valid.
* @extends {jspb.Message}
* @constructor
*/
proto.cc.arduino.cli.monitor.v1.MonitorConfig = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.cc.arduino.cli.monitor.v1.MonitorConfig, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.cc.arduino.cli.monitor.v1.MonitorConfig.displayName = 'proto.cc.arduino.cli.monitor.v1.MonitorConfig';
}
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
* server response, or constructed directly in Javascript. The array is used
* in place and becomes part of the constructed object. It is not cloned.
* If no data is provided, the constructed object will be empty, but still
* valid.
* @extends {jspb.Message}
* @constructor
*/
proto.cc.arduino.cli.monitor.v1.StreamingOpenResponse = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.cc.arduino.cli.monitor.v1.StreamingOpenResponse, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.cc.arduino.cli.monitor.v1.StreamingOpenResponse.displayName = 'proto.cc.arduino.cli.monitor.v1.StreamingOpenResponse';
}
/**
* Oneof group definitions for this message. Each group defines the field
* numbers belonging to that group. When of these fields' value is set, all
* other fields in the group are cleared. During deserialization, if multiple
* fields are encountered for a group, only the last value seen will be kept.
* @private {!Array<!Array<number>>}
* @const
*/
proto.cc.arduino.cli.monitor.v1.StreamingOpenRequest.oneofGroups_ = [[1,2,3]];
/**
* @enum {number}
*/
proto.cc.arduino.cli.monitor.v1.StreamingOpenRequest.ContentCase = {
CONTENT_NOT_SET: 0,
CONFIG: 1,
DATA: 2,
RECV_ACKNOWLEDGE: 3
};
/**
* @return {proto.cc.arduino.cli.monitor.v1.StreamingOpenRequest.ContentCase}
*/
proto.cc.arduino.cli.monitor.v1.StreamingOpenRequest.prototype.getContentCase = function() {
return /** @type {proto.cc.arduino.cli.monitor.v1.StreamingOpenRequest.ContentCase} */(jspb.Message.computeOneofCase(this, proto.cc.arduino.cli.monitor.v1.StreamingOpenRequest.oneofGroups_[0]));
};
if (jspb.Message.GENERATE_TO_OBJECT) {
/**
* Creates an object representation of this proto.
* Field names that are reserved in JavaScript and will be renamed to pb_name.
* Optional fields that are not set will be set to undefined.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* net/proto2/compiler/js/internal/generator.cc#kKeyword.
* @param {boolean=} opt_includeInstance Deprecated. whether to include the
* JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @return {!Object}
*/
proto.cc.arduino.cli.monitor.v1.StreamingOpenRequest.prototype.toObject = function(opt_includeInstance) {
return proto.cc.arduino.cli.monitor.v1.StreamingOpenRequest.toObject(opt_includeInstance, this);
};
/**
* Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
* the JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.cc.arduino.cli.monitor.v1.StreamingOpenRequest} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.cc.arduino.cli.monitor.v1.StreamingOpenRequest.toObject = function(includeInstance, msg) {
var f, obj = {
config: (f = msg.getConfig()) && proto.cc.arduino.cli.monitor.v1.MonitorConfig.toObject(includeInstance, f),
data: msg.getData_asB64(),
recvAcknowledge: jspb.Message.getFieldWithDefault(msg, 3, 0)
};
if (includeInstance) {
obj.$jspbMessageInstance = msg;
}
return obj;
};
}
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.cc.arduino.cli.monitor.v1.StreamingOpenRequest}
*/
proto.cc.arduino.cli.monitor.v1.StreamingOpenRequest.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.cc.arduino.cli.monitor.v1.StreamingOpenRequest;
return proto.cc.arduino.cli.monitor.v1.StreamingOpenRequest.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.cc.arduino.cli.monitor.v1.StreamingOpenRequest} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.cc.arduino.cli.monitor.v1.StreamingOpenRequest}
*/
proto.cc.arduino.cli.monitor.v1.StreamingOpenRequest.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = new proto.cc.arduino.cli.monitor.v1.MonitorConfig;
reader.readMessage(value,proto.cc.arduino.cli.monitor.v1.MonitorConfig.deserializeBinaryFromReader);
msg.setConfig(value);
break;
case 2:
var value = /** @type {!Uint8Array} */ (reader.readBytes());
msg.setData(value);
break;
case 3:
var value = /** @type {number} */ (reader.readInt32());
msg.setRecvAcknowledge(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.cc.arduino.cli.monitor.v1.StreamingOpenRequest.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.cc.arduino.cli.monitor.v1.StreamingOpenRequest.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.cc.arduino.cli.monitor.v1.StreamingOpenRequest} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.cc.arduino.cli.monitor.v1.StreamingOpenRequest.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getConfig();
if (f != null) {
writer.writeMessage(
1,
f,
proto.cc.arduino.cli.monitor.v1.MonitorConfig.serializeBinaryToWriter
);
}
f = /** @type {!(string|Uint8Array)} */ (jspb.Message.getField(message, 2));
if (f != null) {
writer.writeBytes(
2,
f
);
}
f = /** @type {number} */ (jspb.Message.getField(message, 3));
if (f != null) {
writer.writeInt32(
3,
f
);
}
};
/**
* optional MonitorConfig config = 1;
* @return {?proto.cc.arduino.cli.monitor.v1.MonitorConfig}
*/
proto.cc.arduino.cli.monitor.v1.StreamingOpenRequest.prototype.getConfig = function() {
return /** @type{?proto.cc.arduino.cli.monitor.v1.MonitorConfig} */ (
jspb.Message.getWrapperField(this, proto.cc.arduino.cli.monitor.v1.MonitorConfig, 1));
};
/**
* @param {?proto.cc.arduino.cli.monitor.v1.MonitorConfig|undefined} value
* @return {!proto.cc.arduino.cli.monitor.v1.StreamingOpenRequest} returns this
*/
proto.cc.arduino.cli.monitor.v1.StreamingOpenRequest.prototype.setConfig = function(value) {
return jspb.Message.setOneofWrapperField(this, 1, proto.cc.arduino.cli.monitor.v1.StreamingOpenRequest.oneofGroups_[0], value);
};
/**
* Clears the message field making it undefined.
* @return {!proto.cc.arduino.cli.monitor.v1.StreamingOpenRequest} returns this
*/
proto.cc.arduino.cli.monitor.v1.StreamingOpenRequest.prototype.clearConfig = function() {
return this.setConfig(undefined);
};
/**
* Returns whether this field is set.
* @return {boolean}
*/
proto.cc.arduino.cli.monitor.v1.StreamingOpenRequest.prototype.hasConfig = function() {
return jspb.Message.getField(this, 1) != null;
};
/**
* optional bytes data = 2;
* @return {!(string|Uint8Array)}
*/
proto.cc.arduino.cli.monitor.v1.StreamingOpenRequest.prototype.getData = function() {
return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 2, ""));
};
/**
* optional bytes data = 2;
* This is a type-conversion wrapper around `getData()`
* @return {string}
*/
proto.cc.arduino.cli.monitor.v1.StreamingOpenRequest.prototype.getData_asB64 = function() {
return /** @type {string} */ (jspb.Message.bytesAsB64(
this.getData()));
};
/**
* optional bytes data = 2;
* Note that Uint8Array is not supported on all browsers.
* @see http://caniuse.com/Uint8Array
* This is a type-conversion wrapper around `getData()`
* @return {!Uint8Array}
*/
proto.cc.arduino.cli.monitor.v1.StreamingOpenRequest.prototype.getData_asU8 = function() {
return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8(
this.getData()));
};
/**
* @param {!(string|Uint8Array)} value
* @return {!proto.cc.arduino.cli.monitor.v1.StreamingOpenRequest} returns this
*/
proto.cc.arduino.cli.monitor.v1.StreamingOpenRequest.prototype.setData = function(value) {
return jspb.Message.setOneofField(this, 2, proto.cc.arduino.cli.monitor.v1.StreamingOpenRequest.oneofGroups_[0], value);
};
/**
* Clears the field making it undefined.
* @return {!proto.cc.arduino.cli.monitor.v1.StreamingOpenRequest} returns this
*/
proto.cc.arduino.cli.monitor.v1.StreamingOpenRequest.prototype.clearData = function() {
return jspb.Message.setOneofField(this, 2, proto.cc.arduino.cli.monitor.v1.StreamingOpenRequest.oneofGroups_[0], undefined);
};
/**
* Returns whether this field is set.
* @return {boolean}
*/
proto.cc.arduino.cli.monitor.v1.StreamingOpenRequest.prototype.hasData = function() {
return jspb.Message.getField(this, 2) != null;
};
/**
* optional int32 recv_acknowledge = 3;
* @return {number}
*/
proto.cc.arduino.cli.monitor.v1.StreamingOpenRequest.prototype.getRecvAcknowledge = function() {
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0));
};
/**
* @param {number} value
* @return {!proto.cc.arduino.cli.monitor.v1.StreamingOpenRequest} returns this
*/
proto.cc.arduino.cli.monitor.v1.StreamingOpenRequest.prototype.setRecvAcknowledge = function(value) {
return jspb.Message.setOneofField(this, 3, proto.cc.arduino.cli.monitor.v1.StreamingOpenRequest.oneofGroups_[0], value);
};
/**
* Clears the field making it undefined.
* @return {!proto.cc.arduino.cli.monitor.v1.StreamingOpenRequest} returns this
*/
proto.cc.arduino.cli.monitor.v1.StreamingOpenRequest.prototype.clearRecvAcknowledge = function() {
return jspb.Message.setOneofField(this, 3, proto.cc.arduino.cli.monitor.v1.StreamingOpenRequest.oneofGroups_[0], undefined);
};
/**
* Returns whether this field is set.
* @return {boolean}
*/
proto.cc.arduino.cli.monitor.v1.StreamingOpenRequest.prototype.hasRecvAcknowledge = function() {
return jspb.Message.getField(this, 3) != null;
};
if (jspb.Message.GENERATE_TO_OBJECT) {
/**
* Creates an object representation of this proto.
* Field names that are reserved in JavaScript and will be renamed to pb_name.
* Optional fields that are not set will be set to undefined.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* net/proto2/compiler/js/internal/generator.cc#kKeyword.
* @param {boolean=} opt_includeInstance Deprecated. whether to include the
* JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @return {!Object}
*/
proto.cc.arduino.cli.monitor.v1.MonitorConfig.prototype.toObject = function(opt_includeInstance) {
return proto.cc.arduino.cli.monitor.v1.MonitorConfig.toObject(opt_includeInstance, this);
};
/**
* Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
* the JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.cc.arduino.cli.monitor.v1.MonitorConfig} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.cc.arduino.cli.monitor.v1.MonitorConfig.toObject = function(includeInstance, msg) {
var f, obj = {
target: jspb.Message.getFieldWithDefault(msg, 1, ""),
type: jspb.Message.getFieldWithDefault(msg, 2, 0),
additionalConfig: (f = msg.getAdditionalConfig()) && google_protobuf_struct_pb.Struct.toObject(includeInstance, f),
recvRateLimitBuffer: jspb.Message.getFieldWithDefault(msg, 4, 0)
};
if (includeInstance) {
obj.$jspbMessageInstance = msg;
}
return obj;
};
}
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.cc.arduino.cli.monitor.v1.MonitorConfig}
*/
proto.cc.arduino.cli.monitor.v1.MonitorConfig.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.cc.arduino.cli.monitor.v1.MonitorConfig;
return proto.cc.arduino.cli.monitor.v1.MonitorConfig.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.cc.arduino.cli.monitor.v1.MonitorConfig} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.cc.arduino.cli.monitor.v1.MonitorConfig}
*/
proto.cc.arduino.cli.monitor.v1.MonitorConfig.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = /** @type {string} */ (reader.readString());
msg.setTarget(value);
break;
case 2:
var value = /** @type {!proto.cc.arduino.cli.monitor.v1.MonitorConfig.TargetType} */ (reader.readEnum());
msg.setType(value);
break;
case 3:
var value = new google_protobuf_struct_pb.Struct;
reader.readMessage(value,google_protobuf_struct_pb.Struct.deserializeBinaryFromReader);
msg.setAdditionalConfig(value);
break;
case 4:
var value = /** @type {number} */ (reader.readInt32());
msg.setRecvRateLimitBuffer(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.cc.arduino.cli.monitor.v1.MonitorConfig.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.cc.arduino.cli.monitor.v1.MonitorConfig.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.cc.arduino.cli.monitor.v1.MonitorConfig} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.cc.arduino.cli.monitor.v1.MonitorConfig.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getTarget();
if (f.length > 0) {
writer.writeString(
1,
f
);
}
f = message.getType();
if (f !== 0.0) {
writer.writeEnum(
2,
f
);
}
f = message.getAdditionalConfig();
if (f != null) {
writer.writeMessage(
3,
f,
google_protobuf_struct_pb.Struct.serializeBinaryToWriter
);
}
f = message.getRecvRateLimitBuffer();
if (f !== 0) {
writer.writeInt32(
4,
f
);
}
};
/**
* @enum {number}
*/
proto.cc.arduino.cli.monitor.v1.MonitorConfig.TargetType = {
TARGET_TYPE_SERIAL: 0,
TARGET_TYPE_NULL: 99
};
/**
* optional string target = 1;
* @return {string}
*/
proto.cc.arduino.cli.monitor.v1.MonitorConfig.prototype.getTarget = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
};
/**
* @param {string} value
* @return {!proto.cc.arduino.cli.monitor.v1.MonitorConfig} returns this
*/
proto.cc.arduino.cli.monitor.v1.MonitorConfig.prototype.setTarget = function(value) {
return jspb.Message.setProto3StringField(this, 1, value);
};
/**
* optional TargetType type = 2;
* @return {!proto.cc.arduino.cli.monitor.v1.MonitorConfig.TargetType}
*/
proto.cc.arduino.cli.monitor.v1.MonitorConfig.prototype.getType = function() {
return /** @type {!proto.cc.arduino.cli.monitor.v1.MonitorConfig.TargetType} */ (jspb.Message.getFieldWithDefault(this, 2, 0));
};
/**
* @param {!proto.cc.arduino.cli.monitor.v1.MonitorConfig.TargetType} value
* @return {!proto.cc.arduino.cli.monitor.v1.MonitorConfig} returns this
*/
proto.cc.arduino.cli.monitor.v1.MonitorConfig.prototype.setType = function(value) {
return jspb.Message.setProto3EnumField(this, 2, value);
};
/**
* optional google.protobuf.Struct additional_config = 3;
* @return {?proto.google.protobuf.Struct}
*/
proto.cc.arduino.cli.monitor.v1.MonitorConfig.prototype.getAdditionalConfig = function() {
return /** @type{?proto.google.protobuf.Struct} */ (
jspb.Message.getWrapperField(this, google_protobuf_struct_pb.Struct, 3));
};
/**
* @param {?proto.google.protobuf.Struct|undefined} value
* @return {!proto.cc.arduino.cli.monitor.v1.MonitorConfig} returns this
*/
proto.cc.arduino.cli.monitor.v1.MonitorConfig.prototype.setAdditionalConfig = function(value) {
return jspb.Message.setWrapperField(this, 3, value);
};
/**
* Clears the message field making it undefined.
* @return {!proto.cc.arduino.cli.monitor.v1.MonitorConfig} returns this
*/
proto.cc.arduino.cli.monitor.v1.MonitorConfig.prototype.clearAdditionalConfig = function() {
return this.setAdditionalConfig(undefined);
};
/**
* Returns whether this field is set.
* @return {boolean}
*/
proto.cc.arduino.cli.monitor.v1.MonitorConfig.prototype.hasAdditionalConfig = function() {
return jspb.Message.getField(this, 3) != null;
};
/**
* optional int32 recv_rate_limit_buffer = 4;
* @return {number}
*/
proto.cc.arduino.cli.monitor.v1.MonitorConfig.prototype.getRecvRateLimitBuffer = function() {
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0));
};
/**
* @param {number} value
* @return {!proto.cc.arduino.cli.monitor.v1.MonitorConfig} returns this
*/
proto.cc.arduino.cli.monitor.v1.MonitorConfig.prototype.setRecvRateLimitBuffer = function(value) {
return jspb.Message.setProto3IntField(this, 4, value);
};
if (jspb.Message.GENERATE_TO_OBJECT) {
/**
* Creates an object representation of this proto.
* Field names that are reserved in JavaScript and will be renamed to pb_name.
* Optional fields that are not set will be set to undefined.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* net/proto2/compiler/js/internal/generator.cc#kKeyword.
* @param {boolean=} opt_includeInstance Deprecated. whether to include the
* JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @return {!Object}
*/
proto.cc.arduino.cli.monitor.v1.StreamingOpenResponse.prototype.toObject = function(opt_includeInstance) {
return proto.cc.arduino.cli.monitor.v1.StreamingOpenResponse.toObject(opt_includeInstance, this);
};
/**
* Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
* the JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.cc.arduino.cli.monitor.v1.StreamingOpenResponse} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.cc.arduino.cli.monitor.v1.StreamingOpenResponse.toObject = function(includeInstance, msg) {
var f, obj = {
data: msg.getData_asB64(),
dropped: jspb.Message.getFieldWithDefault(msg, 2, 0)
};
if (includeInstance) {
obj.$jspbMessageInstance = msg;
}
return obj;
};
}
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.cc.arduino.cli.monitor.v1.StreamingOpenResponse}
*/
proto.cc.arduino.cli.monitor.v1.StreamingOpenResponse.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.cc.arduino.cli.monitor.v1.StreamingOpenResponse;
return proto.cc.arduino.cli.monitor.v1.StreamingOpenResponse.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.cc.arduino.cli.monitor.v1.StreamingOpenResponse} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.cc.arduino.cli.monitor.v1.StreamingOpenResponse}
*/
proto.cc.arduino.cli.monitor.v1.StreamingOpenResponse.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = /** @type {!Uint8Array} */ (reader.readBytes());
msg.setData(value);
break;
case 2:
var value = /** @type {number} */ (reader.readInt32());
msg.setDropped(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.cc.arduino.cli.monitor.v1.StreamingOpenResponse.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.cc.arduino.cli.monitor.v1.StreamingOpenResponse.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.cc.arduino.cli.monitor.v1.StreamingOpenResponse} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.cc.arduino.cli.monitor.v1.StreamingOpenResponse.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getData_asU8();
if (f.length > 0) {
writer.writeBytes(
1,
f
);
}
f = message.getDropped();
if (f !== 0) {
writer.writeInt32(
2,
f
);
}
};
/**
* optional bytes data = 1;
* @return {!(string|Uint8Array)}
*/
proto.cc.arduino.cli.monitor.v1.StreamingOpenResponse.prototype.getData = function() {
return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
};
/**
* optional bytes data = 1;
* This is a type-conversion wrapper around `getData()`
* @return {string}
*/
proto.cc.arduino.cli.monitor.v1.StreamingOpenResponse.prototype.getData_asB64 = function() {
return /** @type {string} */ (jspb.Message.bytesAsB64(
this.getData()));
};
/**
* optional bytes data = 1;
* Note that Uint8Array is not supported on all browsers.
* @see http://caniuse.com/Uint8Array
* This is a type-conversion wrapper around `getData()`
* @return {!Uint8Array}
*/
proto.cc.arduino.cli.monitor.v1.StreamingOpenResponse.prototype.getData_asU8 = function() {
return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8(
this.getData()));
};
/**
* @param {!(string|Uint8Array)} value
* @return {!proto.cc.arduino.cli.monitor.v1.StreamingOpenResponse} returns this
*/
proto.cc.arduino.cli.monitor.v1.StreamingOpenResponse.prototype.setData = function(value) {
return jspb.Message.setProto3BytesField(this, 1, value);
};
/**
* optional int32 dropped = 2;
* @return {number}
*/
proto.cc.arduino.cli.monitor.v1.StreamingOpenResponse.prototype.getDropped = function() {
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0));
};
/**
* @param {number} value
* @return {!proto.cc.arduino.cli.monitor.v1.StreamingOpenResponse} returns this
*/
proto.cc.arduino.cli.monitor.v1.StreamingOpenResponse.prototype.setDropped = function(value) {
return jspb.Message.setProto3IntField(this, 2, value);
};
goog.object.extend(exports, proto.cc.arduino.cli.monitor.v1);

View File

@@ -555,12 +555,12 @@ export class SketchesServiceImpl
return destinationUri;
}
async getIdeTempFolderUri(sketch: Sketch): Promise<string> {
async getIdeTempFolderUri(sketch: SketchRef): Promise<string> {
const genBuildPath = await this.getIdeTempFolderPath(sketch);
return FileUri.create(genBuildPath).toString();
}
private async getIdeTempFolderPath(sketch: Sketch): Promise<string> {
private async getIdeTempFolderPath(sketch: SketchRef): Promise<string> {
const sketchPath = FileUri.fsPath(sketch.uri);
await fs.readdir(sketchPath); // Validates the sketch folder and rejects if not accessible.
const suffix = crypto.createHash('md5').update(sketchPath).digest('hex');

View File

@@ -12,25 +12,25 @@ export class HostedPluginReader extends TheiaHostedPluginReader {
): Promise<PluginContribution | undefined> {
const scanner = this.scanner.getScanner(plugin);
const contributions = await scanner.getContribution(plugin);
return this.filterContribution(plugin.name, contributions);
return this.mapContribution(plugin.name, contributions);
}
private filterContribution(
private mapContribution(
pluginName: string,
contributions: PluginContribution | undefined
): PluginContribution | undefined {
if (!contributions) {
return contributions;
}
const filter = pluginFilters.get(pluginName);
return filter ? filter(contributions) : contributions;
const mapper = pluginMappers.get(pluginName);
return mapper ? mapper(contributions) : contributions;
}
}
type PluginContributionFilter = (
type PluginContributionMapper = (
contribution: PluginContribution
) => PluginContribution | undefined;
const cortexDebugFilter: PluginContributionFilter = (
const cortexDebugMapper: PluginContributionMapper = (
contribution: PluginContribution
) => {
if (contribution.viewsContainers) {
@@ -81,9 +81,24 @@ const cortexDebugFilter: PluginContributionFilter = (
}
}
}
for (const _debugger of contribution.debuggers ?? []) {
if (_debugger.type === 'cortex-debug') {
for (const attributes of _debugger.configurationAttributes ?? []) {
if (attributes.properties) {
// Patch the cortex-debug debug config schema to allow the in-house `configId`.
attributes.properties['configId'] = {
type: 'string',
description:
'Arduino debug configuration identifier consisting of the Fully Qualified Board Name (FQBN) and the programmer identifier (for example, `esptool`)',
};
}
}
}
}
return contribution;
};
const pluginFilters = new Map<string, PluginContributionFilter>([
['cortex-debug', cortexDebugFilter],
const pluginMappers = new Map<string, PluginContributionMapper>([
['cortex-debug', cortexDebugMapper],
]);

View File

@@ -0,0 +1,176 @@
import { enableJSDOM } from '@theia/core/lib/browser/test/jsdom';
const disableJSDOM = enableJSDOM();
import { FrontendApplicationConfigProvider } from '@theia/core/lib/browser/frontend-application-config-provider';
FrontendApplicationConfigProvider.set({});
import {
Disposable,
DisposableCollection,
} from '@theia/core/lib/common/disposable';
import { expect } from 'chai';
import { BoardsDataStore } from '../../browser/boards/boards-data-store';
import { ensureProgrammerIsSelected } from '../../browser/contributions/auto-select-programmer';
import { Programmer } from '../../common/protocol';
disableJSDOM();
describe('auto-select-programmer', () => {
describe('ensureProgrammerIsSelected', () => {
let debugMessages: string[];
const toDispose = new DisposableCollection();
const fqbn = 'a:b:c';
const programmer: Programmer = {
id: 'p1',
name: 'P1',
platform: 'a:b',
};
const anotherProgrammer: Programmer = {
id: 'p2',
name: 'P2',
platform: 'a:b',
};
before(() => {
const debug = console.debug;
console.debug = (message: string) => debugMessages.push(message);
toDispose.push(Disposable.create(() => (console.debug = debug)));
});
beforeEach(() => (debugMessages = []));
after(() => toDispose.dispose());
it('should not set when the fqbn is missing', async () => {
const ok = await ensureProgrammerIsSelected({
fqbn: undefined,
getData: () => BoardsDataStore.Data.EMPTY,
loadBoardDetails: () => undefined,
selectProgrammer: () => false,
});
expect(ok).to.be.false;
expect(debugMessages).to.be.empty;
});
it('should not set when no board details found (missing core)', async () => {
const ok = await ensureProgrammerIsSelected({
fqbn,
getData: () => BoardsDataStore.Data.EMPTY,
loadBoardDetails: () => undefined,
selectProgrammer: () => false,
});
expect(ok).to.be.false;
expect(debugMessages).to.be.deep.equal([
'Ensuring a programmer is selected for a:b:c...',
'Skipping. No boards data is available for a:b:c.',
]);
});
it('should be noop when the programmer is already selected', async () => {
const ok = await ensureProgrammerIsSelected({
fqbn,
getData: () => ({
configOptions: [],
programmers: [programmer],
selectedProgrammer: programmer,
defaultProgrammerId: undefined,
}),
loadBoardDetails: () => undefined,
selectProgrammer: () => false,
});
expect(ok).to.be.true;
expect(debugMessages).to.be.deep.equal([
'Ensuring a programmer is selected for a:b:c...',
"A programmer is already selected for a:b:c: 'p1'.",
]);
});
it('should automatically select the default one if not selected', async () => {
const selectedProgrammers: Record<string, Programmer | undefined> = {};
const ok = await ensureProgrammerIsSelected({
fqbn,
getData: () => ({
configOptions: [],
programmers: [anotherProgrammer, programmer],
selectedProgrammer: undefined,
defaultProgrammerId: programmer.id,
}),
loadBoardDetails: () => undefined,
selectProgrammer: (arg) => {
selectedProgrammers[arg.fqbn] = arg.selectedProgrammer;
return true;
},
});
expect(ok).to.be.true;
expect(debugMessages).to.be.deep.equal([
'Ensuring a programmer is selected for a:b:c...',
"Selected 'p1' programmer for a:b:c.",
]);
expect(selectedProgrammers).to.be.deep.equal({
[fqbn]: programmer,
});
});
it('should not select the programmer when loading the board details fails', async () => {
const ok = await ensureProgrammerIsSelected({
fqbn,
getData: () => ({
configOptions: [],
programmers: [],
selectedProgrammer: undefined,
defaultProgrammerId: undefined,
}),
loadBoardDetails: () => undefined,
selectProgrammer: () => false,
});
expect(ok).to.be.false;
expect(debugMessages).to.be.deep.equal([
'Ensuring a programmer is selected for a:b:c...',
'Skipping. No boards data is available for a:b:c.',
]);
});
it('should select the programmer after reloading the data', async () => {
const selectedProgrammers: Record<string, Programmer | undefined> = {};
const ok = await ensureProgrammerIsSelected({
fqbn,
getData: () => ({
configOptions: [
{
label: 'config',
option: 'opt1',
values: [{ label: 'Opt1', selected: true, value: 'Value' }],
},
],
programmers: [],
selectedProgrammer: undefined,
defaultProgrammerId: undefined,
}),
loadBoardDetails: () => ({
fqbn,
requiredTools: [],
configOptions: [],
programmers: [programmer, anotherProgrammer],
debuggingSupported: false,
VID: 'VID',
PID: 'PID',
buildProperties: [],
defaultProgrammerId: programmer.id,
}),
selectProgrammer: (arg) => {
selectedProgrammers[arg.fqbn] = arg.selectedProgrammer;
return true;
},
});
expect(ok).to.be.true;
expect(debugMessages).to.be.deep.equal([
'Ensuring a programmer is selected for a:b:c...',
'Reloading board details for a:b:c...',
"Selected 'p1' programmer for a:b:c.",
]);
expect(selectedProgrammers).to.be.deep.equal({
[fqbn]: programmer,
});
});
});
});

View File

@@ -16,7 +16,6 @@ import {
} from '@theia/core/lib/common/disposable';
import { MessageService } from '@theia/core/lib/common/message-service';
import { wait } from '@theia/core/lib/common/promise-util';
import { MockLogger } from '@theia/core/lib/common/test/mock-logger';
import { Container, ContainerModule } from '@theia/core/shared/inversify';
import { expect } from 'chai';
import { BoardsDataStore } from '../../browser/boards/boards-data-store';
@@ -30,7 +29,7 @@ import {
Programmer,
} from '../../common/protocol/boards-service';
import { NotificationServiceServer } from '../../common/protocol/notification-service';
import { ConsoleLogger, bindCommon } from '../common/common-test-bindings';
import { bindBrowser } from './browser-test-bindings';
disableJSDOM();
@@ -76,7 +75,6 @@ describe('boards-data-store', function () {
const storedData: BoardsDataStore.Data = {
configOptions: [],
programmers: [edbg],
selectedProgrammer: edbg,
};
await setStorageData(fqbn, storedData);
const data = await boardsDataStore.getData(fqbn);
@@ -86,7 +84,7 @@ describe('boards-data-store', function () {
it('should update board details of selected board (selected with FQBN)', async () => {
const updated = boardsServiceProvider.updateConfig(board);
expect(updated).to.be.ok;
await wait(50);
await wait(1);
const selectedBoardData = boardsDataStore['_selectedBoardData'];
expect(selectedBoardData).to.be.deep.equal({
@@ -104,7 +102,7 @@ describe('boards-data-store', function () {
const board = { name, fqbn };
const updated = boardsServiceProvider.updateConfig(board);
expect(updated).to.ok;
await wait(50);
await wait(1);
const selectedBoardData = boardsDataStore['_selectedBoardData'];
expect(selectedBoardData).to.be.undefined;
@@ -113,7 +111,7 @@ describe('boards-data-store', function () {
it('should unset the the board details of selected board when no board was selected', async () => {
let updated = boardsServiceProvider.updateConfig(board);
expect(updated).to.ok;
await wait(50);
await wait(1);
let selectedBoardData = boardsDataStore['_selectedBoardData'];
expect(selectedBoardData).to.be.deep.equal({
@@ -126,18 +124,18 @@ describe('boards-data-store', function () {
updated = boardsServiceProvider.updateConfig('unset-board');
expect(updated).to.be.true;
await wait(50);
await wait(1);
selectedBoardData = boardsDataStore['_selectedBoardData'];
expect(selectedBoardData).to.be.undefined;
});
it('should provide startup tasks when the data is available for the selected board', async () => {
const updated = boardsServiceProvider.updateConfig(board);
let updated = boardsServiceProvider.updateConfig(board);
expect(updated).to.be.true;
await wait(50);
await wait(1);
const tasks = boardsDataStore.tasks();
let tasks = boardsDataStore.tasks();
expect(tasks).to.be.deep.equal([
{
command: 'arduino-use-inherited-boards-data',
@@ -152,6 +150,13 @@ describe('boards-data-store', function () {
],
},
]);
updated = boardsServiceProvider.updateConfig('unset-board');
expect(updated).to.be.true;
await wait(1);
tasks = boardsDataStore.tasks();
expect(tasks).to.be.empty;
});
it('should not provide any startup tasks when no data is available for the selected board', async () => {
@@ -159,6 +164,187 @@ describe('boards-data-store', function () {
expect(tasks).to.be.empty;
});
it('should update the startup task arg when the selected programmer changes', async () => {
let tasks = boardsDataStore.tasks();
expect(tasks).to.be.empty;
let data = await boardsDataStore.getData(fqbn);
expect(data).to.be.deep.equal({
configOptions: [configOption1],
programmers: [edbg, jlink],
});
const updated = boardsServiceProvider.updateConfig(board);
expect(updated).to.be.ok;
await wait(1);
tasks = boardsDataStore.tasks();
expect(tasks).to.be.deep.equal([
{
command: 'arduino-use-inherited-boards-data',
args: [
{
fqbn,
data: {
configOptions: [configOption1],
programmers: [edbg, jlink],
},
},
],
},
]);
const result = await boardsDataStore.selectProgrammer({
fqbn,
selectedProgrammer: edbg,
});
expect(result).to.be.ok;
data = await boardsDataStore.getData(fqbn);
expect(data).to.be.deep.equal({
configOptions: [configOption1],
programmers: [edbg, jlink],
selectedProgrammer: edbg,
});
tasks = boardsDataStore.tasks();
expect(tasks).to.be.deep.equal([
{
command: 'arduino-use-inherited-boards-data',
args: [
{
fqbn,
data: {
configOptions: [configOption1],
programmers: [edbg, jlink],
selectedProgrammer: edbg,
},
},
],
},
]);
});
it('should update the startup task arg when the config options change', async () => {
let tasks = boardsDataStore.tasks();
expect(tasks).to.be.empty;
let data = await boardsDataStore.getData(fqbn);
expect(data).to.be.deep.equal({
configOptions: [configOption1],
programmers: [edbg, jlink],
});
const updated = boardsServiceProvider.updateConfig(board);
expect(updated).to.be.ok;
await wait(1);
tasks = boardsDataStore.tasks();
expect(tasks).to.be.deep.equal([
{
command: 'arduino-use-inherited-boards-data',
args: [
{
fqbn,
data: {
configOptions: [configOption1],
programmers: [edbg, jlink],
},
},
],
},
]);
const result = await boardsDataStore.selectConfigOption({
fqbn,
option: configOption1.option,
selectedValue: configOption1.values[1].value,
});
expect(result).to.be.ok;
data = await boardsDataStore.getData(fqbn);
expect(data).to.be.deep.equal({
configOptions: [
{
...configOption1,
values: [
{ label: 'C1V1', selected: false, value: 'v1' },
{ label: 'C1V2', selected: true, value: 'v2' },
],
},
],
programmers: [edbg, jlink],
});
tasks = boardsDataStore.tasks();
expect(tasks).to.be.deep.equal([
{
command: 'arduino-use-inherited-boards-data',
args: [
{
fqbn,
data: {
configOptions: [
{
...configOption1,
values: [
{ label: 'C1V1', selected: false, value: 'v1' },
{ label: 'C1V2', selected: true, value: 'v2' },
],
},
],
programmers: [edbg, jlink],
},
},
],
},
]);
});
it('should select the default programmer', async () => {
const storedData = await getStoredData(fqbn);
expect(storedData).to.be.undefined;
toDisposeAfterEach.push(
mockBoardDetails([
{
fqbn,
...baseDetails,
defaultProgrammerId: edbg.id,
},
])
);
const data = await boardsDataStore.getData(fqbn);
expect(data).to.be.deep.equal({
configOptions: [configOption1],
programmers: [edbg, jlink],
defaultProgrammerId: edbg.id,
selectedProgrammer: edbg,
});
});
it('should not select the default programmer when no match', async () => {
const storedData = await getStoredData(fqbn);
expect(storedData).to.be.undefined;
toDisposeAfterEach.push(
mockBoardDetails([
{
fqbn,
...baseDetails,
defaultProgrammerId: 'missing',
},
])
);
const data = await boardsDataStore.getData(fqbn);
expect(data).to.be.deep.equal({
configOptions: [configOption1],
programmers: [edbg, jlink],
defaultProgrammerId: 'missing',
});
});
it('should select a programmer', async () => {
let data = await boardsDataStore.getData(fqbn);
expect(data).to.be.deep.equal({
@@ -306,7 +492,7 @@ describe('boards-data-store', function () {
boardsDataStore.onDidChange(() => didChangeCounter++)
);
notificationCenter.notifyPlatformDidInstall({ item: boardsPackage });
await wait(50);
await wait(1);
expect(didChangeCounter).to.be.equal(0);
storedData = await getStoredData(fqbn);
@@ -326,7 +512,7 @@ describe('boards-data-store', function () {
boardsDataStore.onDidChange(() => didChangeCounter++)
);
notificationCenter.notifyPlatformDidInstall({ item: boardsPackage });
await wait(50);
await wait(1);
expect(didChangeCounter).to.be.equal(1);
storedData = await getStoredData(fqbn);
@@ -359,7 +545,7 @@ describe('boards-data-store', function () {
boardsDataStore.onDidChange(() => didChangeCounter++)
);
notificationCenter.notifyPlatformDidInstall({ item: boardsPackage });
await wait(50);
await wait(1);
expect(didChangeCounter).to.be.equal(1);
storedData = await boardsDataStore.getData(fqbn);
@@ -390,7 +576,7 @@ describe('boards-data-store', function () {
const container = new Container({ defaultScope: 'Singleton' });
container.load(
new ContainerModule((bind, unbind, isBound, rebind) => {
bindCommon(bind);
bindBrowser(bind, unbind, isBound, rebind);
bind(MessageService).toConstantValue(<MessageService>{});
bind(BoardsService).toConstantValue(<BoardsService>{
getDetectedPorts() {
@@ -415,11 +601,6 @@ describe('boards-data-store', function () {
bind(WindowService).toConstantValue(<WindowService>{});
bind(StorageService).toService(LocalStorageService);
bind(BoardsServiceProvider).toSelf().inSingletonScope();
// IDE2's test console logger does not support `Loggable` arg.
// Rebind logger to suppress `[Function (anonymous)]` messages in tests when the storage service is initialized without `window.localStorage`.
// https://github.com/eclipse-theia/theia/blob/04c8cf07843ea67402131132e033cdd54900c010/packages/core/src/browser/storage-service.ts#L60
bind(MockLogger).toSelf().inSingletonScope();
rebind(ConsoleLogger).toService(MockLogger);
})
);
return container;
@@ -460,7 +641,6 @@ describe('boards-data-store', function () {
PID: '1',
buildProperties: [],
configOptions: [configOption1],
debuggingSupported: false,
programmers: [edbg, jlink],
requiredTools: [],
};

View File

@@ -1,10 +1,43 @@
import { FrontendApplicationStateService } from '@theia/core/lib/browser/frontend-application-state';
import { LabelProvider } from '@theia/core/lib/browser/label-provider';
import { OpenerService } from '@theia/core/lib/browser/opener-service';
import {
LocalStorageService,
StorageService,
} from '@theia/core/lib/browser/storage-service';
import { WindowService } from '@theia/core/lib/browser/window/window-service';
import { EnvVariablesServer } from '@theia/core/lib/common/env-variables';
import { MessageService } from '@theia/core/lib/common/message-service';
import { MockLogger } from '@theia/core/lib/common/test/mock-logger';
import { Container, ContainerModule } from '@theia/core/shared/inversify';
import {
Container,
ContainerModule,
injectable,
} from '@theia/core/shared/inversify';
import { EditorManager } from '@theia/editor/lib/browser/editor-manager';
import { FileService } from '@theia/filesystem/lib/browser/file-service';
import { ArduinoPreferences } from '../../browser/arduino-preferences';
import { BoardsDataStore } from '../../browser/boards/boards-data-store';
import { BoardsServiceProvider } from '../../browser/boards/boards-service-provider';
import { ConfigServiceClient } from '../../browser/config/config-service-client';
import { DialogService } from '../../browser/dialog-service';
import { SettingsService } from '../../browser/dialogs/settings/settings';
import { HostedPluginSupport } from '../../browser/hosted/hosted-plugin-support';
import { NotificationCenter } from '../../browser/notification-center';
import { SketchesServiceClientImpl } from '../../browser/sketches-service-client-impl';
import { ApplicationConnectionStatusContribution } from '../../browser/theia/core/connection-status-service';
import { OutputChannelManager } from '../../browser/theia/output/output-channel';
import { WorkspaceService } from '../../browser/theia/workspace/workspace-service';
import { MainMenuManager } from '../../common/main-menu-manager';
import { FileSystemExt, SketchesService } from '../../common/protocol';
import { BoardsService } from '../../common/protocol/boards-service';
import { NotificationServiceServer } from '../../common/protocol/notification-service';
import {
Bind,
ConsoleLogger,
bindCommon,
} from '../common/common-test-bindings';
import { never } from '../utils';
export function createBaseContainer(bind: Bind = bindBrowser): Container {
const container = new Container({ defaultScope: 'Singleton' });
@@ -23,3 +56,57 @@ export const bindBrowser: Bind = function (
bind(MockLogger).toSelf().inSingletonScope();
rebind(ConsoleLogger).toService(MockLogger);
};
/**
* Binds all required services as a mock to test a `SketchesContribution` instance.
*/
export const bindSketchesContribution: Bind = function (
...args: Parameters<Bind>
): ReturnType<Bind> {
const [bind] = args;
bindBrowser(...args);
bind(MessageService).toConstantValue(<MessageService>{});
bind(BoardsService).toConstantValue(<BoardsService>{});
bind(NotificationCenter).toSelf().inSingletonScope();
bind(NotificationServiceServer).toConstantValue(<NotificationServiceServer>{
// eslint-disable-next-line @typescript-eslint/no-unused-vars
setClient(_) {
// nothing
},
});
bind(FrontendApplicationStateService).toSelf().inSingletonScope();
bind(BoardsDataStore).toConstantValue(<BoardsDataStore>{});
bind(LocalStorageService).toSelf().inSingletonScope();
bind(WindowService).toConstantValue(<WindowService>{});
bind(StorageService).toService(LocalStorageService);
bind(BoardsServiceProvider).toSelf().inSingletonScope();
bind(NoopHostedPluginSupport).toSelf().inSingletonScope();
bind(HostedPluginSupport).toService(NoopHostedPluginSupport);
bind(FileService).toConstantValue(<FileService>{});
bind(FileSystemExt).toConstantValue(<FileSystemExt>{});
bind(ConfigServiceClient).toConstantValue(<ConfigServiceClient>{});
bind(SketchesService).toConstantValue(<SketchesService>{});
bind(OpenerService).toConstantValue(<OpenerService>{});
bind(SketchesServiceClientImpl).toConstantValue(
<SketchesServiceClientImpl>{}
);
bind(EditorManager).toConstantValue(<EditorManager>{});
bind(OutputChannelManager).toConstantValue(<OutputChannelManager>{});
bind(EnvVariablesServer).toConstantValue(<EnvVariablesServer>{});
bind(ApplicationConnectionStatusContribution).toConstantValue(
<ApplicationConnectionStatusContribution>{}
);
bind(WorkspaceService).toConstantValue(<WorkspaceService>{});
bind(LabelProvider).toConstantValue(<LabelProvider>{});
bind(SettingsService).toConstantValue(<SettingsService>{});
bind(ArduinoPreferences).toConstantValue(<ArduinoPreferences>{});
bind(DialogService).toConstantValue(<DialogService>{});
bind(MainMenuManager).toConstantValue(<MainMenuManager>{});
};
@injectable()
export class NoopHostedPluginSupport implements HostedPluginSupport {
readonly didStart = Promise.resolve();
readonly onDidCloseConnection = never();
readonly onDidLoad = never();
}

View File

@@ -0,0 +1,379 @@
import { enableJSDOM } from '@theia/core/lib/browser/test/jsdom';
const disableJSDOM = enableJSDOM();
import { FrontendApplicationConfigProvider } from '@theia/core/lib/browser/frontend-application-config-provider';
FrontendApplicationConfigProvider.set({});
import { DisposableCollection } from '@theia/core/lib/common/disposable';
import { CommandEvent, CommandRegistry } from '@theia/core/lib/common/command';
import { Emitter } from '@theia/core/lib/common/event';
import { deepClone } from '@theia/core/lib/common/objects';
import { wait } from '@theia/core/lib/common/promise-util';
import { Mutable } from '@theia/core/lib/common/types';
import {
Container,
ContainerModule,
injectable,
} from '@theia/core/shared/inversify';
import { expect } from 'chai';
import { doesNotReject, rejects } from 'node:assert/strict';
import {
BoardsDataStore,
BoardsDataStoreChangeEvent,
} from '../../browser/boards/boards-data-store';
import { BoardsServiceProvider } from '../../browser/boards/boards-service-provider';
import {
Debug,
debuggingNotSupported,
isDebugEnabled,
noPlatformInstalledFor,
noProgrammerSelectedFor,
} from '../../browser/contributions/debug';
import { NotificationCenter } from '../../browser/notification-center';
import { noBoardSelected } from '../../common/nls';
import {
BoardsConfigChangeEvent,
BoardsPackage,
CompileSummary,
ExecutableService,
type BoardDetails,
type Programmer,
} from '../../common/protocol';
import {
BoardsConfig,
emptyBoardsConfig,
} from '../../common/protocol/boards-service';
import { bindSketchesContribution } from './browser-test-bindings';
import { aPackage } from './fixtures/boards';
disableJSDOM();
describe('debug', () => {
describe('isDebugEnabled', () => {
const fqbn = 'a:b:c';
const name = 'ABC';
const board = { fqbn, name };
const p1: Programmer = { id: 'p1', name: 'P1', platform: 'The platform' };
const p2: Programmer = { id: 'p2', name: 'P2', platform: 'The platform' };
const data: BoardsDataStore.Data = {
configOptions: [],
defaultProgrammerId: 'p1',
programmers: [p1, p2],
selectedProgrammer: p1,
};
const boardDetails: BoardDetails = {
buildProperties: [],
configOptions: [],
defaultProgrammerId: 'p1',
programmers: [p1, p2],
fqbn,
PID: '0',
VID: '0',
requiredTools: [],
};
it('should error when no board selected', async () => {
await rejects(
isDebugEnabled(
undefined,
unexpectedCall(),
unexpectedCall(),
unexpectedCall(),
unexpectedCall()
),
(reason) =>
reason instanceof Error && reason.message === noBoardSelected
);
});
it('should error when platform is not installed (FQBN is undefined)', async () => {
await rejects(
isDebugEnabled(
{ name, fqbn: undefined },
unexpectedCall(),
unexpectedCall(),
unexpectedCall(),
unexpectedCall()
),
(reason) =>
reason instanceof Error &&
reason.message === noPlatformInstalledFor(board.name)
);
});
it('should error when platform is not installed (board details not available)', async () => {
await rejects(
isDebugEnabled(
board,
() => undefined,
() => data,
(fqbn) => fqbn,
unexpectedCall()
),
(reason) =>
reason instanceof Error &&
reason.message === noPlatformInstalledFor(board.name)
);
});
it('should error when no programmer selected', async () => {
const copyData: Mutable<BoardsDataStore.Data> = deepClone(data);
delete copyData.selectedProgrammer;
await rejects(
isDebugEnabled(
board,
() => boardDetails,
() => copyData,
(fqbn) => fqbn,
unexpectedCall()
),
(reason) =>
reason instanceof Error &&
reason.message === noProgrammerSelectedFor(board.name)
);
});
it('should error when it fails to get the debug info from the CLI', async () => {
await rejects(
isDebugEnabled(
board,
() => boardDetails,
() => data,
(fqbn) => fqbn,
() => {
throw new Error('unhandled error');
}
),
(reason) =>
reason instanceof Error &&
reason.message === debuggingNotSupported(board.name)
);
});
it('should resolve when debugging is supported', async () => {
await doesNotReject(
isDebugEnabled(
board,
() => boardDetails,
() => data,
(fqbn) => fqbn,
() => Promise.resolve(`${fqbn}:USBMode=hwcdc`)
)
);
});
describe('onDidChangeMessage', () => {
let debug: MockDebug;
let onDidChangeMessageEvents: (string | undefined)[];
let toDisposeAfterEach: DisposableCollection;
let mockBoardsConfig: BoardsConfig;
let mockBoardsConfigDidChangeEmitter: Emitter<BoardsConfigChangeEvent>;
let mockPlatformDidInstallEmitter: Emitter<{ item: BoardsPackage }>;
let mockPlatformDidUninstallEmitter: Emitter<{ item: BoardsPackage }>;
let mockBoardsDataStoreDidChangeEmitter: Emitter<BoardsDataStoreChangeEvent>;
let mockDidExecuteCommandEmitter: Emitter<CommandEvent>;
beforeEach(() => {
mockBoardsConfig = emptyBoardsConfig();
mockBoardsConfigDidChangeEmitter = new Emitter();
mockPlatformDidInstallEmitter = new Emitter();
mockPlatformDidUninstallEmitter = new Emitter();
mockBoardsDataStoreDidChangeEmitter = new Emitter();
mockDidExecuteCommandEmitter = new Emitter();
toDisposeAfterEach = new DisposableCollection(
mockBoardsConfigDidChangeEmitter,
mockPlatformDidInstallEmitter,
mockPlatformDidUninstallEmitter,
mockBoardsDataStoreDidChangeEmitter,
mockDidExecuteCommandEmitter
);
const container = createContainer();
const d = container.get<Debug>(Debug);
expect(d).to.be.an.instanceOf(MockDebug);
debug = d as MockDebug;
onDidChangeMessageEvents = [];
toDisposeAfterEach.push(
debug['onDidChangeMessage']((event) => {
onDidChangeMessageEvents.push(event);
})
);
const commandRegistry: Mutable<CommandRegistry> =
container.get<CommandRegistry>(CommandRegistry);
commandRegistry['onDidExecuteCommand'] =
mockDidExecuteCommandEmitter.event;
debug.onStart();
});
it('should update on board identifier change', async () => {
mockBoardsConfigDidChangeEmitter.fire({
previousSelectedBoard: undefined,
selectedBoard: { fqbn: 'a:b:c', name: 'ABC' },
});
await wait(1);
expect(onDidChangeMessageEvents).deep.equal([undefined]);
});
it('should not update on port identifier change', async () => {
mockBoardsConfigDidChangeEmitter.fire({
previousSelectedPort: undefined,
selectedPort: { protocol: 'serial', address: 'COM1' },
});
await wait(1);
expect(onDidChangeMessageEvents).to.be.empty;
});
it('should update on platform install', async () => {
mockPlatformDidInstallEmitter.fire({
item: aPackage,
});
await wait(1);
expect(onDidChangeMessageEvents).deep.equal([undefined]);
});
it('should update on platform uninstall', async () => {
mockPlatformDidUninstallEmitter.fire({
item: aPackage,
});
await wait(1);
expect(onDidChangeMessageEvents).deep.equal([undefined]);
});
it('should update on boards data store change when affects the selected board', async () => {
mockBoardsConfig = {
selectedBoard: { fqbn: 'a:b:c', name: '' },
selectedPort: undefined,
};
mockBoardsDataStoreDidChangeEmitter.fire({
changes: [
{
fqbn: 'a:b:c',
data: BoardsDataStore.Data.EMPTY, // it does not matter
},
],
});
await wait(1);
expect(onDidChangeMessageEvents).deep.equal([undefined]);
});
it('should not update on boards data store change when does not affect the selected board', async () => {
mockBoardsConfig = {
selectedBoard: { fqbn: 'a:b:c', name: '' },
selectedPort: undefined,
};
mockBoardsDataStoreDidChangeEmitter.fire({
changes: [
{
fqbn: 'x:y:z',
data: BoardsDataStore.Data.EMPTY, // it does not matter
},
],
});
await wait(1);
expect(onDidChangeMessageEvents).to.be.empty;
});
it('should update after verify', async () => {
const summary: CompileSummary = {
buildPath: '',
buildProperties: [],
executableSectionsSize: [],
usedLibraries: [],
boardPlatform: undefined,
buildPlatform: undefined,
buildOutputUri: '',
};
mockDidExecuteCommandEmitter.fire({
commandId: 'arduino.languageserver.notifyBuildDidComplete',
args: [summary],
});
await wait(1);
expect(onDidChangeMessageEvents).deep.equal([undefined]);
});
it('should not update when unrelated command executes', async () => {
mockDidExecuteCommandEmitter.fire({
commandId: 'other.command',
args: [],
});
await wait(1);
expect(onDidChangeMessageEvents).to.be.empty;
});
it('should update the error message', async () => {
debug.isDebugEnabledMock = Promise.reject(new Error('my error'));
mockBoardsConfigDidChangeEmitter.fire({
previousSelectedBoard: undefined,
selectedBoard: { fqbn: 'a:b:c', name: 'ABC' },
});
await wait(1);
expect(onDidChangeMessageEvents).deep.equal(['my error']);
});
afterEach(() => toDisposeAfterEach.dispose());
function createContainer(): Container {
const container = new Container({ defaultScope: 'Singleton' });
container.load(
new ContainerModule((bind, unbind, isBound, rebind) => {
bind(MockDebug).toSelf().inSingletonScope();
bind(Debug).toService(MockDebug);
bindSketchesContribution(bind, unbind, isBound, rebind);
bind(ExecutableService).toConstantValue(<ExecutableService>{});
rebind(NotificationCenter).toConstantValue(<NotificationCenter>{
get onPlatformDidInstall() {
return mockPlatformDidInstallEmitter.event;
},
get onPlatformDidUninstall() {
return mockPlatformDidUninstallEmitter.event;
},
});
rebind(BoardsServiceProvider).toConstantValue(<
BoardsServiceProvider
>{
get onBoardsConfigDidChange() {
return mockBoardsConfigDidChangeEmitter.event;
},
get boardsConfig() {
return mockBoardsConfig;
},
});
rebind(BoardsDataStore).toConstantValue(<BoardsDataStore>{
get onDidChange() {
return mockBoardsDataStoreDidChangeEmitter.event;
},
});
})
);
return container;
}
});
function unexpectedCall(): () => never {
return () => expect.fail('unexpected call');
}
});
});
@injectable()
class MockDebug extends Debug {
isDebugEnabledMock: Promise<string> = Promise.resolve('a:b:c:USBMode:hwcdc');
constructor() {
super();
this['isDebugEnabled'] = () => this.isDebugEnabledMock;
}
}

View File

@@ -5,29 +5,14 @@ import { FrontendApplicationConfigProvider } from '@theia/core/lib/browser/front
FrontendApplicationConfigProvider.set({});
import { FrontendApplicationStateService } from '@theia/core/lib/browser/frontend-application-state';
import { LabelProvider } from '@theia/core/lib/browser/label-provider';
import { OpenerService } from '@theia/core/lib/browser/opener-service';
import {
LocalStorageService,
StorageService,
} from '@theia/core/lib/browser/storage-service';
import { WindowService } from '@theia/core/lib/browser/window/window-service';
import {
Disposable,
DisposableCollection,
} from '@theia/core/lib/common/disposable';
import { EnvVariablesServer } from '@theia/core/lib/common/env-variables';
import { Emitter } from '@theia/core/lib/common/event';
import { MessageService } from '@theia/core/lib/common/message-service';
import { wait } from '@theia/core/lib/common/promise-util';
import URI from '@theia/core/lib/common/uri';
import {
Container,
ContainerModule,
injectable,
} from '@theia/core/shared/inversify';
import { EditorManager } from '@theia/editor/lib/browser/editor-manager';
import { FileService } from '@theia/filesystem/lib/browser/file-service';
import { Container, ContainerModule } from '@theia/core/shared/inversify';
import { expect } from 'chai';
import type {
BoardDetails as ApiBoardDetails,
@@ -35,8 +20,10 @@ import type {
Port as ApiPort,
} from 'vscode-arduino-api';
import { URI as CodeURI } from 'vscode-uri';
import { ArduinoPreferences } from '../../browser/arduino-preferences';
import { BoardsDataStore } from '../../browser/boards/boards-data-store';
import {
BoardsDataStore,
BoardsDataStoreChangeEvent,
} from '../../browser/boards/boards-data-store';
import { BoardsServiceProvider } from '../../browser/boards/boards-service-provider';
import { ConfigServiceClient } from '../../browser/config/config-service-client';
import { CommandRegistry } from '../../browser/contributions/contribution';
@@ -44,31 +31,18 @@ import {
UpdateArduinoState,
UpdateStateParams,
} from '../../browser/contributions/update-arduino-state';
import { DialogService } from '../../browser/dialog-service';
import { SettingsService } from '../../browser/dialogs/settings/settings';
import { HostedPluginSupport } from '../../browser/hosted/hosted-plugin-support';
import { NotificationCenter } from '../../browser/notification-center';
import {
CurrentSketch,
SketchesServiceClientImpl,
} from '../../browser/sketches-service-client-impl';
import { ApplicationConnectionStatusContribution } from '../../browser/theia/core/connection-status-service';
import { OutputChannelManager } from '../../browser/theia/output/output-channel';
import { WorkspaceService } from '../../browser/theia/workspace/workspace-service';
import { MainMenuManager } from '../../common/main-menu-manager';
import {
CompileSummary,
FileSystemExt,
SketchesService,
} from '../../common/protocol';
import { CompileSummary } from '../../common/protocol';
import {
BoardDetails,
BoardsService,
Port,
} from '../../common/protocol/boards-service';
import { NotificationServiceServer } from '../../common/protocol/notification-service';
import { never } from '../utils';
import { bindBrowser } from './browser-test-bindings';
import { bindSketchesContribution } from './browser-test-bindings';
disableJSDOM();
@@ -90,7 +64,7 @@ describe('update-arduino-state', function () {
let onCurrentSketchDidChangeEmitter: Emitter<CurrentSketch>;
let onDataDirDidChangeEmitter: Emitter<URI | undefined>;
let onSketchDirDidChangeEmitter: Emitter<URI | undefined>;
let onDataStoreDidChangeEmitter: Emitter<string[]>;
let onDataStoreDidChangeEmitter: Emitter<BoardsDataStoreChangeEvent>;
beforeEach(async () => {
toDisposeAfterEach = new DisposableCollection();
@@ -157,10 +131,10 @@ describe('update-arduino-state', function () {
it('should automatically update the boards config (board+port) on ready', async () => {
const fqbn = 'a:b:c';
const board = { fqbn, name: 'ABC' };
const boardDetails = {
const boardDetails: BoardDetails = {
buildProperties: [],
configOptions: [],
debuggingSupported: false,
defaultProgrammerId: undefined,
fqbn,
PID: '0',
VID: '0',
@@ -290,7 +264,7 @@ describe('update-arduino-state', function () {
const boardDetails = {
buildProperties: [],
configOptions: [],
debuggingSupported: false,
defaultProgrammerId: undefined,
fqbn,
PID: '0',
VID: '0',
@@ -372,7 +346,7 @@ describe('update-arduino-state', function () {
const boardDetails = {
buildProperties: [],
configOptions: [],
debuggingSupported: false,
defaultProgrammerId: undefined,
fqbn,
PID: '0',
VID: '0',
@@ -525,7 +499,25 @@ describe('update-arduino-state', function () {
});
it('should not update the board details when data store did change but the selected board does not match', async () => {
onDataStoreDidChangeEmitter.fire(['a:b:c']);
onDataStoreDidChangeEmitter.fire({
changes: [
{
fqbn: 'a:b:c',
// the data does not matter
data: {
configOptions: [
{
label: 'C1',
option: 'c1',
values: [{ label: 'C1V1', selected: true, value: 'c1v1' }],
},
],
programmers: [],
defaultProgrammerId: undefined,
},
},
],
});
await wait(50);
expect(stateUpdateParams).to.be.empty;
@@ -537,7 +529,7 @@ describe('update-arduino-state', function () {
const boardDetails = {
buildProperties: [],
configOptions: [],
debuggingSupported: false,
defaultProgrammerId: undefined,
fqbn,
PID: '0',
VID: '0',
@@ -552,7 +544,19 @@ describe('update-arduino-state', function () {
selectedPort: undefined,
};
onDataStoreDidChangeEmitter.fire(['a:b:c']);
onDataStoreDidChangeEmitter.fire({
changes: [
{
fqbn: 'a:b:c',
// the data does not matter
data: {
configOptions: [],
programmers: [{ id: 'p1', name: 'P1', platform: 'The platform' }],
defaultProgrammerId: 'p1',
},
},
],
});
await wait(50);
const params = stateUpdateParams.filter(
@@ -579,9 +583,9 @@ describe('update-arduino-state', function () {
const container = new Container({ defaultScope: 'Singleton' });
container.load(
new ContainerModule((bind, unbind, isBound, rebind) => {
bindBrowser(bind, unbind, isBound, rebind);
bind(MessageService).toConstantValue(<MessageService>{});
bind(BoardsService).toConstantValue(<BoardsService>{
bindSketchesContribution(bind, unbind, isBound, rebind);
bind(UpdateArduinoState).toSelf().inSingletonScope();
rebind(BoardsService).toConstantValue(<BoardsService>{
getDetectedPorts() {
return {};
},
@@ -589,17 +593,7 @@ describe('update-arduino-state', function () {
return boardDetailsMocks[fqbn];
},
});
bind(NotificationCenter).toSelf().inSingletonScope();
bind(NotificationServiceServer).toConstantValue(<
NotificationServiceServer
>{
// eslint-disable-next-line @typescript-eslint/no-unused-vars
setClient(_) {
// nothing
},
});
bind(FrontendApplicationStateService).toSelf().inSingletonScope();
bind(BoardsDataStore).toConstantValue(<BoardsDataStore>{
rebind(BoardsDataStore).toConstantValue(<BoardsDataStore>{
async getData(fqbn) {
if (!fqbn) {
return BoardsDataStore.Data.EMPTY;
@@ -607,20 +601,11 @@ describe('update-arduino-state', function () {
const data = dataStoreMocks[fqbn] ?? BoardsDataStore.Data.EMPTY;
return data;
},
get onChanged() {
get onDidChange() {
return onDataStoreDidChangeEmitter.event;
},
});
bind(LocalStorageService).toSelf().inSingletonScope();
bind(WindowService).toConstantValue(<WindowService>{});
bind(StorageService).toService(LocalStorageService);
bind(BoardsServiceProvider).toSelf().inSingletonScope();
bind(NoopHostedPluginSupport).toSelf().inSingletonScope();
bind(HostedPluginSupport).toService(NoopHostedPluginSupport);
bind(UpdateArduinoState).toSelf().inSingletonScope();
bind(FileService).toConstantValue(<FileService>{});
bind(FileSystemExt).toConstantValue(<FileSystemExt>{});
bind(ConfigServiceClient).toConstantValue(<ConfigServiceClient>{
rebind(ConfigServiceClient).toConstantValue(<ConfigServiceClient>{
tryGetSketchDirUri() {
return sketchDirUriMock;
},
@@ -634,9 +619,7 @@ describe('update-arduino-state', function () {
return onDataDirDidChangeEmitter.event;
},
});
bind(SketchesService).toConstantValue(<SketchesService>{});
bind(OpenerService).toConstantValue(<OpenerService>{});
bind(SketchesServiceClientImpl).toConstantValue(<
rebind(SketchesServiceClientImpl).toConstantValue(<
SketchesServiceClientImpl
>{
tryGetCurrentSketch() {
@@ -644,27 +627,8 @@ describe('update-arduino-state', function () {
},
onCurrentSketchDidChange: onCurrentSketchDidChangeEmitter.event,
});
bind(EditorManager).toConstantValue(<EditorManager>{});
bind(OutputChannelManager).toConstantValue(<OutputChannelManager>{});
bind(EnvVariablesServer).toConstantValue(<EnvVariablesServer>{});
bind(ApplicationConnectionStatusContribution).toConstantValue(
<ApplicationConnectionStatusContribution>{}
);
bind(WorkspaceService).toConstantValue(<WorkspaceService>{});
bind(LabelProvider).toConstantValue(<LabelProvider>{});
bind(SettingsService).toConstantValue(<SettingsService>{});
bind(ArduinoPreferences).toConstantValue(<ArduinoPreferences>{});
bind(DialogService).toConstantValue(<DialogService>{});
bind(MainMenuManager).toConstantValue(<MainMenuManager>{});
})
);
return container;
}
});
@injectable()
class NoopHostedPluginSupport implements HostedPluginSupport {
readonly didStart = Promise.resolve();
readonly onDidCloseConnection = never();
readonly onDidLoad = never();
}