ATL-73: Added library examples to the app.

Signed-off-by: Akos Kitta <kittaakos@typefox.io>
This commit is contained in:
Akos Kitta 2020-08-19 08:26:38 +02:00 committed by Akos Kitta
parent 1c9fcd0cdf
commit 56ff86629c
28 changed files with 2827 additions and 346 deletions

View File

@ -10,7 +10,7 @@
(() => {
const DEFAULT_VERSION = '0.12.1'; // require('moment')().format('YYYYMMDD');
const DEFAULT_VERSION = '0.13.0-rc1'; // require('moment')().format('YYYYMMDD');
const path = require('path');
const shell = require('shelljs');

View File

@ -16,7 +16,7 @@
shell.exit(1);
}
if (shell.exec(`git clone https://github.com/arduino/arduino-cli.git ${repository}`).code !== 0) {
if (shell.exec(`git clone --depth 1 https://github.com/arduino/arduino-cli.git ${repository}`).code !== 0) {
shell.exit(1);
}

View File

@ -119,7 +119,7 @@ import { OutputWidget as TheiaOutputWidget } from '@theia/output/lib/browser/out
import { OutputWidget } from './theia/output/output-widget';
import { BurnBootloader } from './contributions/burn-bootloader';
import { ExamplesServicePath, ExamplesService } from '../common/protocol/examples-service';
import { Examples } from './contributions/examples';
import { BuiltInExamples, LibraryExamples } from './contributions/examples';
import { LibraryServiceProvider } from './library/library-service-provider';
import { IncludeLibrary } from './contributions/include-library';
import { IncludeLibraryMenuUpdater } from './library/include-library-menu-updater';
@ -371,6 +371,7 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {
Contribution.configure(bind, SketchControl);
Contribution.configure(bind, Settings);
Contribution.configure(bind, BurnBootloader);
Contribution.configure(bind, Examples);
Contribution.configure(bind, BuiltInExamples);
Contribution.configure(bind, LibraryExamples);
Contribution.configure(bind, IncludeLibrary);
});

View File

@ -1,20 +1,16 @@
import { inject, injectable } from 'inversify';
import { inject, injectable, postConstruct } from 'inversify';
import { MenuPath, SubMenuOptions } from '@theia/core/lib/common/menu';
import { Disposable, DisposableCollection } from '@theia/core/lib/common/disposable';
import { OpenSketch } from './open-sketch';
import { ArduinoMenus } from '../menu/arduino-menus';
import { MainMenuManager } from '../../common/main-menu-manager';
import { LibraryServiceProvider } from '../library/library-service-provider';
import { BoardsServiceClientImpl } from '../boards/boards-service-client-impl';
import { ExamplesService, ExampleContainer } from '../../common/protocol/examples-service';
import { SketchContribution, CommandRegistry, MenuModelRegistry } from './contribution';
@injectable()
export class Examples extends SketchContribution {
@inject(MainMenuManager)
protected readonly menuManager: MainMenuManager;
@inject(ExamplesService)
protected readonly examplesService: ExamplesService;
export abstract class Examples extends SketchContribution {
@inject(CommandRegistry)
protected readonly commandRegistry: CommandRegistry;
@ -22,26 +18,30 @@ export class Examples extends SketchContribution {
@inject(MenuModelRegistry)
protected readonly menuRegistry: MenuModelRegistry;
protected readonly toDisposeBeforeRegister = new DisposableCollection();
@inject(MainMenuManager)
protected readonly menuManager: MainMenuManager;
onStart(): void {
this.registerExamples(); // no `await`
@inject(ExamplesService)
protected readonly examplesService: ExamplesService;
@inject(BoardsServiceClientImpl)
protected readonly boardsServiceClient: BoardsServiceClientImpl;
protected readonly toDispose = new DisposableCollection();
@postConstruct()
init(): void {
this.boardsServiceClient.onBoardsConfigChanged(({ selectedBoard }) => this.handleBoardChanged(selectedBoard?.fqbn));
}
protected async registerExamples() {
let exampleContainer: ExampleContainer | undefined;
try {
exampleContainer = await this.examplesService.all();
} catch (e) {
console.error('Could not initialize built-in examples.', e);
}
if (!exampleContainer) {
this.messageService.error('Could not initialize built-in examples.');
return;
}
this.toDisposeBeforeRegister.dispose();
this.registerRecursively(exampleContainer, ArduinoMenus.FILE__SKETCH_GROUP, this.toDisposeBeforeRegister, { order: '4' });
this.menuManager.update();
protected handleBoardChanged(fqbn: string | undefined): void {
// NOOP
}
registerMenus(registry: MenuModelRegistry): void {
// Registering the same submenu multiple times has no side-effect.
// TODO: unregister submenu? https://github.com/eclipse-theia/theia/issues/7300
registry.registerSubmenu(ArduinoMenus.FILE__EXAMPLES_SUBMENU, 'Examples', { order: '4' });
}
registerRecursively(
@ -52,7 +52,6 @@ export class Examples extends SketchContribution {
const { label, sketches, children } = exampleContainer;
const submenuPath = [...menuPath, label];
// TODO: unregister submenu? https://github.com/eclipse-theia/theia/issues/7300
this.menuRegistry.registerSubmenu(submenuPath, label, options);
children.forEach(child => this.registerRecursively(child, submenuPath, pushToDispose));
for (const sketch of sketches) {
@ -72,3 +71,68 @@ export class Examples extends SketchContribution {
}
}
@injectable()
export class BuiltInExamples extends Examples {
onStart(): void {
this.register(); // no `await`
}
protected async register() {
let exampleContainers: ExampleContainer[] | undefined;
try {
exampleContainers = await this.examplesService.builtIns();
} catch (e) {
console.error('Could not initialize built-in examples.', e);
this.messageService.error('Could not initialize built-in examples.');
return;
}
this.toDispose.dispose();
for (const container of exampleContainers) {
this.registerRecursively(container, ArduinoMenus.EXAMPLES__BUILT_IN_GROUP, this.toDispose);
}
this.menuManager.update();
}
}
@injectable()
export class LibraryExamples extends Examples {
@inject(LibraryServiceProvider)
protected readonly libraryServiceProvider: LibraryServiceProvider;
protected readonly queue = new PQueue({ autoStart: true, concurrency: 1 });
onStart(): void {
this.register(); // no `await`
this.libraryServiceProvider.onLibraryPackageInstalled(() => this.register());
this.libraryServiceProvider.onLibraryPackageUninstalled(() => this.register());
}
protected handleBoardChanged(fqbn: string | undefined): void {
this.register(fqbn);
}
protected async register(fqbn: string | undefined = this.boardsServiceClient.boardsConfig.selectedBoard?.fqbn) {
return this.queue.add(async () => {
this.toDispose.dispose();
if (!fqbn) {
return;
}
const { user, current, any } = await this.examplesService.installed({ fqbn });
for (const container of user) {
this.registerRecursively(container, ArduinoMenus.EXAMPLES__USER_LIBS_GROUP, this.toDispose);
}
for (const container of current) {
this.registerRecursively(container, ArduinoMenus.EXAMPLES__CURRENT_BOARD_GROUP, this.toDispose);
}
for (const container of any) {
this.registerRecursively(container, ArduinoMenus.EXAMPLES__ANY_BOARD_GROUP, this.toDispose);
}
this.menuManager.update();
});
}
}

View File

@ -7,7 +7,7 @@ import { ArduinoMenus } from '../menu/arduino-menus';
import { ArduinoToolbar } from '../toolbar/arduino-toolbar';
import { SketchContribution, Sketch, URI, Command, CommandRegistry, MenuModelRegistry, KeybindingRegistry, TabBarToolbarRegistry } from './contribution';
import { ExamplesService } from '../../common/protocol/examples-service';
import { Examples } from './examples';
import { BuiltInExamples } from './examples';
@injectable()
export class OpenSketch extends SketchContribution {
@ -18,8 +18,8 @@ export class OpenSketch extends SketchContribution {
@inject(ContextMenuRenderer)
protected readonly contextMenuRenderer: ContextMenuRenderer;
@inject(Examples)
protected readonly examples: Examples;
@inject(BuiltInExamples)
protected readonly builtInExamples: BuiltInExamples;
@inject(ExamplesService)
protected readonly examplesService: ExamplesService;
@ -62,9 +62,9 @@ export class OpenSketch extends SketchContribution {
this.toDisposeBeforeCreateNewContextMenu.push(Disposable.create(() => this.menuRegistry.unregisterMenuAction(command)));
}
try {
const { children } = await this.examplesService.all();
for (const child of children) {
this.examples.registerRecursively(child, ArduinoMenus.OPEN_SKETCH__CONTEXT__EXAMPLES_GROUP, this.toDisposeBeforeCreateNewContextMenu);
const containers = await this.examplesService.builtIns();
for (const container of containers) {
this.builtInExamples.registerRecursively(container, ArduinoMenus.OPEN_SKETCH__CONTEXT__EXAMPLES_GROUP, this.toDisposeBeforeCreateNewContextMenu);
}
} catch (e) {
console.error('Error when collecting built-in examples.', e);

View File

@ -44,8 +44,12 @@ export class IncludeLibraryMenuUpdater implements FrontendApplicationContributio
return this.queue.add(async () => {
this.toDispose.dispose();
this.mainMenuManager.update();
const libraries: LibraryPackage[] = []
const fqbn = this.boardsServiceClient.boardsConfig.selectedBoard?.fqbn;
const libraries = await this.libraryServiceProvider.list({ fqbn });
// Do not show board specific examples, when no board is selected.
if (fqbn) {
libraries.push(...await this.libraryServiceProvider.list({ fqbn }));
}
// `Include Library` submenu
const includeLibMenuPath = [...ArduinoMenus.SKETCH__UTILS_GROUP, '0_include'];

View File

@ -12,6 +12,13 @@ export namespace ArduinoMenus {
export const FILE__SETTINGS_GROUP = [...(isOSX ? MAIN_MENU_BAR : CommonMenus.FILE), '2_settings'];
export const FILE__QUIT_GROUP = [...CommonMenus.FILE, '3_quit'];
// -- File / Examples
export const FILE__EXAMPLES_SUBMENU = [...FILE__SKETCH_GROUP, '0_examples'];
export const EXAMPLES__BUILT_IN_GROUP = [...FILE__EXAMPLES_SUBMENU, '0_built_ins'];
export const EXAMPLES__ANY_BOARD_GROUP = [...FILE__EXAMPLES_SUBMENU, '1_any_board'];
export const EXAMPLES__CURRENT_BOARD_GROUP = [...FILE__EXAMPLES_SUBMENU, '2_current_board'];
export const EXAMPLES__USER_LIBS_GROUP = [...FILE__EXAMPLES_SUBMENU, '3_user_libs'];
// -- Edit
// `Copy`, `Copy to Forum`, `Paste`, etc.
// Note: `1_undo` is the first group from Theia, we start with `2`

View File

@ -3,7 +3,8 @@ import { Sketch } from './sketches-service';
export const ExamplesServicePath = '/services/example-service';
export const ExamplesService = Symbol('ExamplesService');
export interface ExamplesService {
all(): Promise<ExampleContainer>;
builtIns(): Promise<ExampleContainer[]>;
installed(options: { fqbn: string }): Promise<{ user: ExampleContainer[], current: ExampleContainer[], any: ExampleContainer[] }>;
}
export interface ExampleContainer {

View File

@ -25,13 +25,41 @@ export namespace LibraryService {
}
}
export enum LibraryLocation {
/**
* In the `libraries` subdirectory of the Arduino IDE installation.
*/
IDE_BUILTIN = 0,
/**
* In the `libraries` subdirectory of the user directory (sketchbook).
*/
USER = 1,
/**
* In the `libraries` subdirectory of a platform.
*/
PLATFORM_BUILTIN = 2,
/**
* When `LibraryLocation` is used in a context where a board is specified, this indicates the library is in the `libraries`
* subdirectory of a platform referenced by the board's platform.
*/
REFERENCED_PLATFORM_BUILTIN = 3
}
export interface LibraryPackage extends ArduinoComponent {
/**
* Same as [`Library#real_name`](https://arduino.github.io/arduino-cli/latest/rpc/commands/#library).
* Should be used for the UI, and `name` is used to uniquely identify a library. It does not have an ID.
*/
readonly label: string;
/**
* An array of string that should be included into the `ino` file if this library is used.
* For example, including `SD` will prepend `#include <SD.h>` to the `ino` file. While including `Bridge`
* requires multiple `#include` declarations: `YunClient`, `YunServer`, `Bridge`, etc.
*/
readonly includes: string[];
readonly exampleUris: string[];
readonly location: LibraryLocation;
readonly installDirUri?: string;
}
export namespace LibraryPackage {

View File

@ -9,7 +9,7 @@ import { LanguageServerContribution } from '@theia/languages/lib/node';
import { ArduinoLanguageServerContribution } from './language/arduino-language-server-contribution';
import { LibraryServiceServerPath, LibraryServiceServer, LibraryServiceClient } from '../common/protocol/library-service';
import { BoardsService, BoardsServicePath, BoardsServiceClient } from '../common/protocol/boards-service';
import { LibraryServiceImpl } from './library-service-impl';
import { LibraryServiceServerImpl } from './library-service-server-impl';
import { BoardsServiceImpl } from './boards-service-impl';
import { CoreServiceImpl } from './core-service-impl';
import { CoreService, CoreServicePath, CoreServiceClient } from '../common/protocol/core-service';
@ -78,11 +78,11 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {
bind(LanguageServerContribution).toService(ArduinoLanguageServerContribution);
// Library service
bind(LibraryServiceImpl).toSelf().inSingletonScope();
bind(LibraryServiceServer).toService(LibraryServiceImpl);
bind(LibraryServiceServerImpl).toSelf().inSingletonScope();
bind(LibraryServiceServer).toService(LibraryServiceServerImpl);
bind(ConnectionHandler).toDynamicValue(context =>
new JsonRpcConnectionHandler<LibraryServiceClient>(LibraryServiceServerPath, client => {
const server = context.container.get<LibraryServiceImpl>(LibraryServiceImpl);
const server = context.container.get<LibraryServiceServerImpl>(LibraryServiceServerImpl);
server.setClient(client);
client.onDidCloseConnection(() => server.dispose());
return server;

View File

@ -84,6 +84,11 @@ export class BoardDetailsResp extends jspb.Message {
setIdentificationPrefList(value: Array<IdentificationPref>): BoardDetailsResp;
addIdentificationPref(value?: IdentificationPref, index?: number): IdentificationPref;
clearProgrammersList(): void;
getProgrammersList(): Array<commands_common_pb.Programmer>;
setProgrammersList(value: Array<commands_common_pb.Programmer>): BoardDetailsResp;
addProgrammers(value?: commands_common_pb.Programmer, index?: number): commands_common_pb.Programmer;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): BoardDetailsResp.AsObject;
@ -109,6 +114,7 @@ export namespace BoardDetailsResp {
toolsdependenciesList: Array<ToolsDependencies.AsObject>,
configOptionsList: Array<ConfigOption.AsObject>,
identificationPrefList: Array<IdentificationPref.AsObject>,
programmersList: Array<commands_common_pb.Programmer.AsObject>,
}
}

View File

@ -619,7 +619,7 @@ proto.cc.arduino.cli.commands.BoardDetailsReq.prototype.setFqbn = function(value
* @private {!Array<number>}
* @const
*/
proto.cc.arduino.cli.commands.BoardDetailsResp.repeatedFields_ = [10,11,12];
proto.cc.arduino.cli.commands.BoardDetailsResp.repeatedFields_ = [10,11,12,13];
@ -666,7 +666,9 @@ proto.cc.arduino.cli.commands.BoardDetailsResp.toObject = function(includeInstan
configOptionsList: jspb.Message.toObjectList(msg.getConfigOptionsList(),
proto.cc.arduino.cli.commands.ConfigOption.toObject, includeInstance),
identificationPrefList: jspb.Message.toObjectList(msg.getIdentificationPrefList(),
proto.cc.arduino.cli.commands.IdentificationPref.toObject, includeInstance)
proto.cc.arduino.cli.commands.IdentificationPref.toObject, includeInstance),
programmersList: jspb.Message.toObjectList(msg.getProgrammersList(),
commands_common_pb.Programmer.toObject, includeInstance)
};
if (includeInstance) {
@ -756,6 +758,11 @@ proto.cc.arduino.cli.commands.BoardDetailsResp.deserializeBinaryFromReader = fun
reader.readMessage(value,proto.cc.arduino.cli.commands.IdentificationPref.deserializeBinaryFromReader);
msg.addIdentificationPref(value);
break;
case 13:
var value = new commands_common_pb.Programmer;
reader.readMessage(value,commands_common_pb.Programmer.deserializeBinaryFromReader);
msg.addProgrammers(value);
break;
default:
reader.skipField();
break;
@ -874,6 +881,14 @@ proto.cc.arduino.cli.commands.BoardDetailsResp.serializeBinaryToWriter = functio
proto.cc.arduino.cli.commands.IdentificationPref.serializeBinaryToWriter
);
}
f = message.getProgrammersList();
if (f.length > 0) {
writer.writeRepeatedMessage(
13,
f,
commands_common_pb.Programmer.serializeBinaryToWriter
);
}
};
@ -1191,6 +1206,44 @@ proto.cc.arduino.cli.commands.BoardDetailsResp.prototype.clearIdentificationPref
};
/**
* repeated Programmer programmers = 13;
* @return {!Array<!proto.cc.arduino.cli.commands.Programmer>}
*/
proto.cc.arduino.cli.commands.BoardDetailsResp.prototype.getProgrammersList = function() {
return /** @type{!Array<!proto.cc.arduino.cli.commands.Programmer>} */ (
jspb.Message.getRepeatedWrapperField(this, commands_common_pb.Programmer, 13));
};
/**
* @param {!Array<!proto.cc.arduino.cli.commands.Programmer>} value
* @return {!proto.cc.arduino.cli.commands.BoardDetailsResp} returns this
*/
proto.cc.arduino.cli.commands.BoardDetailsResp.prototype.setProgrammersList = function(value) {
return jspb.Message.setRepeatedWrapperField(this, 13, value);
};
/**
* @param {!proto.cc.arduino.cli.commands.Programmer=} opt_value
* @param {number=} opt_index
* @return {!proto.cc.arduino.cli.commands.Programmer}
*/
proto.cc.arduino.cli.commands.BoardDetailsResp.prototype.addProgrammers = function(opt_value, opt_index) {
return jspb.Message.addToRepeatedWrapperField(this, 13, opt_value, proto.cc.arduino.cli.commands.Programmer, opt_index);
};
/**
* Clears the list making it empty but non-null.
* @return {!proto.cc.arduino.cli.commands.BoardDetailsResp} returns this
*/
proto.cc.arduino.cli.commands.BoardDetailsResp.prototype.clearProgrammersList = function() {
return this.setProgrammersList([]);
};

View File

@ -20,7 +20,11 @@ interface IArduinoCoreService extends grpc.ServiceDefinition<grpc.UntypedService
rescan: IArduinoCoreService_IRescan;
updateIndex: IArduinoCoreService_IUpdateIndex;
updateLibrariesIndex: IArduinoCoreService_IUpdateLibrariesIndex;
updateCoreLibrariesIndex: IArduinoCoreService_IUpdateCoreLibrariesIndex;
outdated: IArduinoCoreService_IOutdated;
upgrade: IArduinoCoreService_IUpgrade;
version: IArduinoCoreService_IVersion;
loadSketch: IArduinoCoreService_ILoadSketch;
boardDetails: IArduinoCoreService_IBoardDetails;
boardAttach: IArduinoCoreService_IBoardAttach;
boardList: IArduinoCoreService_IBoardList;
@ -89,6 +93,33 @@ interface IArduinoCoreService_IUpdateLibrariesIndex extends grpc.MethodDefinitio
responseSerialize: grpc.serialize<commands_commands_pb.UpdateLibrariesIndexResp>;
responseDeserialize: grpc.deserialize<commands_commands_pb.UpdateLibrariesIndexResp>;
}
interface IArduinoCoreService_IUpdateCoreLibrariesIndex extends grpc.MethodDefinition<commands_commands_pb.UpdateCoreLibrariesIndexReq, commands_commands_pb.UpdateCoreLibrariesIndexResp> {
path: string; // "/cc.arduino.cli.commands.ArduinoCore/UpdateCoreLibrariesIndex"
requestStream: false;
responseStream: true;
requestSerialize: grpc.serialize<commands_commands_pb.UpdateCoreLibrariesIndexReq>;
requestDeserialize: grpc.deserialize<commands_commands_pb.UpdateCoreLibrariesIndexReq>;
responseSerialize: grpc.serialize<commands_commands_pb.UpdateCoreLibrariesIndexResp>;
responseDeserialize: grpc.deserialize<commands_commands_pb.UpdateCoreLibrariesIndexResp>;
}
interface IArduinoCoreService_IOutdated extends grpc.MethodDefinition<commands_commands_pb.OutdatedReq, commands_commands_pb.OutdatedResp> {
path: string; // "/cc.arduino.cli.commands.ArduinoCore/Outdated"
requestStream: false;
responseStream: false;
requestSerialize: grpc.serialize<commands_commands_pb.OutdatedReq>;
requestDeserialize: grpc.deserialize<commands_commands_pb.OutdatedReq>;
responseSerialize: grpc.serialize<commands_commands_pb.OutdatedResp>;
responseDeserialize: grpc.deserialize<commands_commands_pb.OutdatedResp>;
}
interface IArduinoCoreService_IUpgrade extends grpc.MethodDefinition<commands_commands_pb.UpgradeReq, commands_commands_pb.UpgradeResp> {
path: string; // "/cc.arduino.cli.commands.ArduinoCore/Upgrade"
requestStream: false;
responseStream: true;
requestSerialize: grpc.serialize<commands_commands_pb.UpgradeReq>;
requestDeserialize: grpc.deserialize<commands_commands_pb.UpgradeReq>;
responseSerialize: grpc.serialize<commands_commands_pb.UpgradeResp>;
responseDeserialize: grpc.deserialize<commands_commands_pb.UpgradeResp>;
}
interface IArduinoCoreService_IVersion extends grpc.MethodDefinition<commands_commands_pb.VersionReq, commands_commands_pb.VersionResp> {
path: string; // "/cc.arduino.cli.commands.ArduinoCore/Version"
requestStream: false;
@ -98,6 +129,15 @@ interface IArduinoCoreService_IVersion extends grpc.MethodDefinition<commands_co
responseSerialize: grpc.serialize<commands_commands_pb.VersionResp>;
responseDeserialize: grpc.deserialize<commands_commands_pb.VersionResp>;
}
interface IArduinoCoreService_ILoadSketch extends grpc.MethodDefinition<commands_commands_pb.LoadSketchReq, commands_commands_pb.LoadSketchResp> {
path: string; // "/cc.arduino.cli.commands.ArduinoCore/LoadSketch"
requestStream: false;
responseStream: false;
requestSerialize: grpc.serialize<commands_commands_pb.LoadSketchReq>;
requestDeserialize: grpc.deserialize<commands_commands_pb.LoadSketchReq>;
responseSerialize: grpc.serialize<commands_commands_pb.LoadSketchResp>;
responseDeserialize: grpc.deserialize<commands_commands_pb.LoadSketchResp>;
}
interface IArduinoCoreService_IBoardDetails extends grpc.MethodDefinition<commands_board_pb.BoardDetailsReq, commands_board_pb.BoardDetailsResp> {
path: string; // "/cc.arduino.cli.commands.ArduinoCore/BoardDetails"
requestStream: false;
@ -296,7 +336,11 @@ export interface IArduinoCoreServer {
rescan: grpc.handleUnaryCall<commands_commands_pb.RescanReq, commands_commands_pb.RescanResp>;
updateIndex: grpc.handleServerStreamingCall<commands_commands_pb.UpdateIndexReq, commands_commands_pb.UpdateIndexResp>;
updateLibrariesIndex: grpc.handleServerStreamingCall<commands_commands_pb.UpdateLibrariesIndexReq, commands_commands_pb.UpdateLibrariesIndexResp>;
updateCoreLibrariesIndex: grpc.handleServerStreamingCall<commands_commands_pb.UpdateCoreLibrariesIndexReq, commands_commands_pb.UpdateCoreLibrariesIndexResp>;
outdated: grpc.handleUnaryCall<commands_commands_pb.OutdatedReq, commands_commands_pb.OutdatedResp>;
upgrade: grpc.handleServerStreamingCall<commands_commands_pb.UpgradeReq, commands_commands_pb.UpgradeResp>;
version: grpc.handleUnaryCall<commands_commands_pb.VersionReq, commands_commands_pb.VersionResp>;
loadSketch: grpc.handleUnaryCall<commands_commands_pb.LoadSketchReq, commands_commands_pb.LoadSketchResp>;
boardDetails: grpc.handleUnaryCall<commands_board_pb.BoardDetailsReq, commands_board_pb.BoardDetailsResp>;
boardAttach: grpc.handleServerStreamingCall<commands_board_pb.BoardAttachReq, commands_board_pb.BoardAttachResp>;
boardList: grpc.handleUnaryCall<commands_board_pb.BoardListReq, commands_board_pb.BoardListResp>;
@ -333,9 +377,19 @@ export interface IArduinoCoreClient {
updateIndex(request: commands_commands_pb.UpdateIndexReq, metadata?: grpc.Metadata, options?: Partial<grpc.CallOptions>): grpc.ClientReadableStream<commands_commands_pb.UpdateIndexResp>;
updateLibrariesIndex(request: commands_commands_pb.UpdateLibrariesIndexReq, options?: Partial<grpc.CallOptions>): grpc.ClientReadableStream<commands_commands_pb.UpdateLibrariesIndexResp>;
updateLibrariesIndex(request: commands_commands_pb.UpdateLibrariesIndexReq, metadata?: grpc.Metadata, options?: Partial<grpc.CallOptions>): grpc.ClientReadableStream<commands_commands_pb.UpdateLibrariesIndexResp>;
updateCoreLibrariesIndex(request: commands_commands_pb.UpdateCoreLibrariesIndexReq, options?: Partial<grpc.CallOptions>): grpc.ClientReadableStream<commands_commands_pb.UpdateCoreLibrariesIndexResp>;
updateCoreLibrariesIndex(request: commands_commands_pb.UpdateCoreLibrariesIndexReq, metadata?: grpc.Metadata, options?: Partial<grpc.CallOptions>): grpc.ClientReadableStream<commands_commands_pb.UpdateCoreLibrariesIndexResp>;
outdated(request: commands_commands_pb.OutdatedReq, callback: (error: grpc.ServiceError | null, response: commands_commands_pb.OutdatedResp) => void): grpc.ClientUnaryCall;
outdated(request: commands_commands_pb.OutdatedReq, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: commands_commands_pb.OutdatedResp) => void): grpc.ClientUnaryCall;
outdated(request: commands_commands_pb.OutdatedReq, metadata: grpc.Metadata, options: Partial<grpc.CallOptions>, callback: (error: grpc.ServiceError | null, response: commands_commands_pb.OutdatedResp) => void): grpc.ClientUnaryCall;
upgrade(request: commands_commands_pb.UpgradeReq, options?: Partial<grpc.CallOptions>): grpc.ClientReadableStream<commands_commands_pb.UpgradeResp>;
upgrade(request: commands_commands_pb.UpgradeReq, metadata?: grpc.Metadata, options?: Partial<grpc.CallOptions>): grpc.ClientReadableStream<commands_commands_pb.UpgradeResp>;
version(request: commands_commands_pb.VersionReq, callback: (error: grpc.ServiceError | null, response: commands_commands_pb.VersionResp) => void): grpc.ClientUnaryCall;
version(request: commands_commands_pb.VersionReq, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: commands_commands_pb.VersionResp) => void): grpc.ClientUnaryCall;
version(request: commands_commands_pb.VersionReq, metadata: grpc.Metadata, options: Partial<grpc.CallOptions>, callback: (error: grpc.ServiceError | null, response: commands_commands_pb.VersionResp) => void): grpc.ClientUnaryCall;
loadSketch(request: commands_commands_pb.LoadSketchReq, callback: (error: grpc.ServiceError | null, response: commands_commands_pb.LoadSketchResp) => void): grpc.ClientUnaryCall;
loadSketch(request: commands_commands_pb.LoadSketchReq, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: commands_commands_pb.LoadSketchResp) => void): grpc.ClientUnaryCall;
loadSketch(request: commands_commands_pb.LoadSketchReq, metadata: grpc.Metadata, options: Partial<grpc.CallOptions>, callback: (error: grpc.ServiceError | null, response: commands_commands_pb.LoadSketchResp) => void): grpc.ClientUnaryCall;
boardDetails(request: commands_board_pb.BoardDetailsReq, callback: (error: grpc.ServiceError | null, response: commands_board_pb.BoardDetailsResp) => void): grpc.ClientUnaryCall;
boardDetails(request: commands_board_pb.BoardDetailsReq, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: commands_board_pb.BoardDetailsResp) => void): grpc.ClientUnaryCall;
boardDetails(request: commands_board_pb.BoardDetailsReq, metadata: grpc.Metadata, options: Partial<grpc.CallOptions>, callback: (error: grpc.ServiceError | null, response: commands_board_pb.BoardDetailsResp) => void): grpc.ClientUnaryCall;
@ -403,9 +457,19 @@ export class ArduinoCoreClient extends grpc.Client implements IArduinoCoreClient
public updateIndex(request: commands_commands_pb.UpdateIndexReq, metadata?: grpc.Metadata, options?: Partial<grpc.CallOptions>): grpc.ClientReadableStream<commands_commands_pb.UpdateIndexResp>;
public updateLibrariesIndex(request: commands_commands_pb.UpdateLibrariesIndexReq, options?: Partial<grpc.CallOptions>): grpc.ClientReadableStream<commands_commands_pb.UpdateLibrariesIndexResp>;
public updateLibrariesIndex(request: commands_commands_pb.UpdateLibrariesIndexReq, metadata?: grpc.Metadata, options?: Partial<grpc.CallOptions>): grpc.ClientReadableStream<commands_commands_pb.UpdateLibrariesIndexResp>;
public updateCoreLibrariesIndex(request: commands_commands_pb.UpdateCoreLibrariesIndexReq, options?: Partial<grpc.CallOptions>): grpc.ClientReadableStream<commands_commands_pb.UpdateCoreLibrariesIndexResp>;
public updateCoreLibrariesIndex(request: commands_commands_pb.UpdateCoreLibrariesIndexReq, metadata?: grpc.Metadata, options?: Partial<grpc.CallOptions>): grpc.ClientReadableStream<commands_commands_pb.UpdateCoreLibrariesIndexResp>;
public outdated(request: commands_commands_pb.OutdatedReq, callback: (error: grpc.ServiceError | null, response: commands_commands_pb.OutdatedResp) => void): grpc.ClientUnaryCall;
public outdated(request: commands_commands_pb.OutdatedReq, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: commands_commands_pb.OutdatedResp) => void): grpc.ClientUnaryCall;
public outdated(request: commands_commands_pb.OutdatedReq, metadata: grpc.Metadata, options: Partial<grpc.CallOptions>, callback: (error: grpc.ServiceError | null, response: commands_commands_pb.OutdatedResp) => void): grpc.ClientUnaryCall;
public upgrade(request: commands_commands_pb.UpgradeReq, options?: Partial<grpc.CallOptions>): grpc.ClientReadableStream<commands_commands_pb.UpgradeResp>;
public upgrade(request: commands_commands_pb.UpgradeReq, metadata?: grpc.Metadata, options?: Partial<grpc.CallOptions>): grpc.ClientReadableStream<commands_commands_pb.UpgradeResp>;
public version(request: commands_commands_pb.VersionReq, callback: (error: grpc.ServiceError | null, response: commands_commands_pb.VersionResp) => void): grpc.ClientUnaryCall;
public version(request: commands_commands_pb.VersionReq, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: commands_commands_pb.VersionResp) => void): grpc.ClientUnaryCall;
public version(request: commands_commands_pb.VersionReq, metadata: grpc.Metadata, options: Partial<grpc.CallOptions>, callback: (error: grpc.ServiceError | null, response: commands_commands_pb.VersionResp) => void): grpc.ClientUnaryCall;
public loadSketch(request: commands_commands_pb.LoadSketchReq, callback: (error: grpc.ServiceError | null, response: commands_commands_pb.LoadSketchResp) => void): grpc.ClientUnaryCall;
public loadSketch(request: commands_commands_pb.LoadSketchReq, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: commands_commands_pb.LoadSketchResp) => void): grpc.ClientUnaryCall;
public loadSketch(request: commands_commands_pb.LoadSketchReq, metadata: grpc.Metadata, options: Partial<grpc.CallOptions>, callback: (error: grpc.ServiceError | null, response: commands_commands_pb.LoadSketchResp) => void): grpc.ClientUnaryCall;
public boardDetails(request: commands_board_pb.BoardDetailsReq, callback: (error: grpc.ServiceError | null, response: commands_board_pb.BoardDetailsResp) => void): grpc.ClientUnaryCall;
public boardDetails(request: commands_board_pb.BoardDetailsReq, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: commands_board_pb.BoardDetailsResp) => void): grpc.ClientUnaryCall;
public boardDetails(request: commands_board_pb.BoardDetailsReq, metadata: grpc.Metadata, options: Partial<grpc.CallOptions>, callback: (error: grpc.ServiceError | null, response: commands_board_pb.BoardDetailsResp) => void): grpc.ClientUnaryCall;

View File

@ -377,6 +377,50 @@ function deserialize_cc_arduino_cli_commands_ListProgrammersAvailableForUploadRe
return commands_upload_pb.ListProgrammersAvailableForUploadResp.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_cc_arduino_cli_commands_LoadSketchReq(arg) {
if (!(arg instanceof commands_commands_pb.LoadSketchReq)) {
throw new Error('Expected argument of type cc.arduino.cli.commands.LoadSketchReq');
}
return Buffer.from(arg.serializeBinary());
}
function deserialize_cc_arduino_cli_commands_LoadSketchReq(buffer_arg) {
return commands_commands_pb.LoadSketchReq.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_cc_arduino_cli_commands_LoadSketchResp(arg) {
if (!(arg instanceof commands_commands_pb.LoadSketchResp)) {
throw new Error('Expected argument of type cc.arduino.cli.commands.LoadSketchResp');
}
return Buffer.from(arg.serializeBinary());
}
function deserialize_cc_arduino_cli_commands_LoadSketchResp(buffer_arg) {
return commands_commands_pb.LoadSketchResp.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_cc_arduino_cli_commands_OutdatedReq(arg) {
if (!(arg instanceof commands_commands_pb.OutdatedReq)) {
throw new Error('Expected argument of type cc.arduino.cli.commands.OutdatedReq');
}
return Buffer.from(arg.serializeBinary());
}
function deserialize_cc_arduino_cli_commands_OutdatedReq(buffer_arg) {
return commands_commands_pb.OutdatedReq.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_cc_arduino_cli_commands_OutdatedResp(arg) {
if (!(arg instanceof commands_commands_pb.OutdatedResp)) {
throw new Error('Expected argument of type cc.arduino.cli.commands.OutdatedResp');
}
return Buffer.from(arg.serializeBinary());
}
function deserialize_cc_arduino_cli_commands_OutdatedResp(buffer_arg) {
return commands_commands_pb.OutdatedResp.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_cc_arduino_cli_commands_PlatformDownloadReq(arg) {
if (!(arg instanceof commands_core_pb.PlatformDownloadReq)) {
throw new Error('Expected argument of type cc.arduino.cli.commands.PlatformDownloadReq');
@ -531,6 +575,28 @@ function deserialize_cc_arduino_cli_commands_RescanResp(buffer_arg) {
return commands_commands_pb.RescanResp.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_cc_arduino_cli_commands_UpdateCoreLibrariesIndexReq(arg) {
if (!(arg instanceof commands_commands_pb.UpdateCoreLibrariesIndexReq)) {
throw new Error('Expected argument of type cc.arduino.cli.commands.UpdateCoreLibrariesIndexReq');
}
return Buffer.from(arg.serializeBinary());
}
function deserialize_cc_arduino_cli_commands_UpdateCoreLibrariesIndexReq(buffer_arg) {
return commands_commands_pb.UpdateCoreLibrariesIndexReq.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_cc_arduino_cli_commands_UpdateCoreLibrariesIndexResp(arg) {
if (!(arg instanceof commands_commands_pb.UpdateCoreLibrariesIndexResp)) {
throw new Error('Expected argument of type cc.arduino.cli.commands.UpdateCoreLibrariesIndexResp');
}
return Buffer.from(arg.serializeBinary());
}
function deserialize_cc_arduino_cli_commands_UpdateCoreLibrariesIndexResp(buffer_arg) {
return commands_commands_pb.UpdateCoreLibrariesIndexResp.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_cc_arduino_cli_commands_UpdateIndexReq(arg) {
if (!(arg instanceof commands_commands_pb.UpdateIndexReq)) {
throw new Error('Expected argument of type cc.arduino.cli.commands.UpdateIndexReq');
@ -575,6 +641,28 @@ function deserialize_cc_arduino_cli_commands_UpdateLibrariesIndexResp(buffer_arg
return commands_commands_pb.UpdateLibrariesIndexResp.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_cc_arduino_cli_commands_UpgradeReq(arg) {
if (!(arg instanceof commands_commands_pb.UpgradeReq)) {
throw new Error('Expected argument of type cc.arduino.cli.commands.UpgradeReq');
}
return Buffer.from(arg.serializeBinary());
}
function deserialize_cc_arduino_cli_commands_UpgradeReq(buffer_arg) {
return commands_commands_pb.UpgradeReq.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_cc_arduino_cli_commands_UpgradeResp(arg) {
if (!(arg instanceof commands_commands_pb.UpgradeResp)) {
throw new Error('Expected argument of type cc.arduino.cli.commands.UpgradeResp');
}
return Buffer.from(arg.serializeBinary());
}
function deserialize_cc_arduino_cli_commands_UpgradeResp(buffer_arg) {
return commands_commands_pb.UpgradeResp.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_cc_arduino_cli_commands_UploadReq(arg) {
if (!(arg instanceof commands_upload_pb.UploadReq)) {
throw new Error('Expected argument of type cc.arduino.cli.commands.UploadReq');
@ -682,6 +770,42 @@ updateLibrariesIndex: {
responseSerialize: serialize_cc_arduino_cli_commands_UpdateLibrariesIndexResp,
responseDeserialize: deserialize_cc_arduino_cli_commands_UpdateLibrariesIndexResp,
},
// Update packages indexes for both Cores and Libraries
updateCoreLibrariesIndex: {
path: '/cc.arduino.cli.commands.ArduinoCore/UpdateCoreLibrariesIndex',
requestStream: false,
responseStream: true,
requestType: commands_commands_pb.UpdateCoreLibrariesIndexReq,
responseType: commands_commands_pb.UpdateCoreLibrariesIndexResp,
requestSerialize: serialize_cc_arduino_cli_commands_UpdateCoreLibrariesIndexReq,
requestDeserialize: deserialize_cc_arduino_cli_commands_UpdateCoreLibrariesIndexReq,
responseSerialize: serialize_cc_arduino_cli_commands_UpdateCoreLibrariesIndexResp,
responseDeserialize: deserialize_cc_arduino_cli_commands_UpdateCoreLibrariesIndexResp,
},
// Outdated returns a message with a list of outdated Cores and Libraries
outdated: {
path: '/cc.arduino.cli.commands.ArduinoCore/Outdated',
requestStream: false,
responseStream: false,
requestType: commands_commands_pb.OutdatedReq,
responseType: commands_commands_pb.OutdatedResp,
requestSerialize: serialize_cc_arduino_cli_commands_OutdatedReq,
requestDeserialize: deserialize_cc_arduino_cli_commands_OutdatedReq,
responseSerialize: serialize_cc_arduino_cli_commands_OutdatedResp,
responseDeserialize: deserialize_cc_arduino_cli_commands_OutdatedResp,
},
// Upgrade both Cores and Libraries
upgrade: {
path: '/cc.arduino.cli.commands.ArduinoCore/Upgrade',
requestStream: false,
responseStream: true,
requestType: commands_commands_pb.UpgradeReq,
responseType: commands_commands_pb.UpgradeResp,
requestSerialize: serialize_cc_arduino_cli_commands_UpgradeReq,
requestDeserialize: deserialize_cc_arduino_cli_commands_UpgradeReq,
responseSerialize: serialize_cc_arduino_cli_commands_UpgradeResp,
responseDeserialize: deserialize_cc_arduino_cli_commands_UpgradeResp,
},
// Get the version of Arduino CLI in use.
version: {
path: '/cc.arduino.cli.commands.ArduinoCore/Version',
@ -694,6 +818,18 @@ version: {
responseSerialize: serialize_cc_arduino_cli_commands_VersionResp,
responseDeserialize: deserialize_cc_arduino_cli_commands_VersionResp,
},
// Returns all files composing a Sketch
loadSketch: {
path: '/cc.arduino.cli.commands.ArduinoCore/LoadSketch',
requestStream: false,
responseStream: false,
requestType: commands_commands_pb.LoadSketchReq,
responseType: commands_commands_pb.LoadSketchResp,
requestSerialize: serialize_cc_arduino_cli_commands_LoadSketchReq,
requestDeserialize: deserialize_cc_arduino_cli_commands_LoadSketchReq,
responseSerialize: serialize_cc_arduino_cli_commands_LoadSketchResp,
responseDeserialize: deserialize_cc_arduino_cli_commands_LoadSketchResp,
},
// BOARD COMMANDS
// --------------
//
@ -709,7 +845,7 @@ boardDetails: {
responseSerialize: serialize_cc_arduino_cli_commands_BoardDetailsResp,
responseDeserialize: deserialize_cc_arduino_cli_commands_BoardDetailsResp,
},
// Attach a board to a sketch. When the `fqbn` field of a request is not
// Attach a board to a sketch. When the `fqbn` field of a request is not
// provided, the FQBN of the attached board will be used.
boardAttach: {
path: '/cc.arduino.cli.commands.ArduinoCore/BoardAttach',

View File

@ -269,6 +269,162 @@ export namespace UpdateLibrariesIndexResp {
}
}
export class UpdateCoreLibrariesIndexReq extends jspb.Message {
hasInstance(): boolean;
clearInstance(): void;
getInstance(): commands_common_pb.Instance | undefined;
setInstance(value?: commands_common_pb.Instance): UpdateCoreLibrariesIndexReq;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): UpdateCoreLibrariesIndexReq.AsObject;
static toObject(includeInstance: boolean, msg: UpdateCoreLibrariesIndexReq): UpdateCoreLibrariesIndexReq.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: UpdateCoreLibrariesIndexReq, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): UpdateCoreLibrariesIndexReq;
static deserializeBinaryFromReader(message: UpdateCoreLibrariesIndexReq, reader: jspb.BinaryReader): UpdateCoreLibrariesIndexReq;
}
export namespace UpdateCoreLibrariesIndexReq {
export type AsObject = {
instance?: commands_common_pb.Instance.AsObject,
}
}
export class UpdateCoreLibrariesIndexResp extends jspb.Message {
hasDownloadProgress(): boolean;
clearDownloadProgress(): void;
getDownloadProgress(): commands_common_pb.DownloadProgress | undefined;
setDownloadProgress(value?: commands_common_pb.DownloadProgress): UpdateCoreLibrariesIndexResp;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): UpdateCoreLibrariesIndexResp.AsObject;
static toObject(includeInstance: boolean, msg: UpdateCoreLibrariesIndexResp): UpdateCoreLibrariesIndexResp.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: UpdateCoreLibrariesIndexResp, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): UpdateCoreLibrariesIndexResp;
static deserializeBinaryFromReader(message: UpdateCoreLibrariesIndexResp, reader: jspb.BinaryReader): UpdateCoreLibrariesIndexResp;
}
export namespace UpdateCoreLibrariesIndexResp {
export type AsObject = {
downloadProgress?: commands_common_pb.DownloadProgress.AsObject,
}
}
export class OutdatedReq extends jspb.Message {
hasInstance(): boolean;
clearInstance(): void;
getInstance(): commands_common_pb.Instance | undefined;
setInstance(value?: commands_common_pb.Instance): OutdatedReq;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): OutdatedReq.AsObject;
static toObject(includeInstance: boolean, msg: OutdatedReq): OutdatedReq.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: OutdatedReq, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): OutdatedReq;
static deserializeBinaryFromReader(message: OutdatedReq, reader: jspb.BinaryReader): OutdatedReq;
}
export namespace OutdatedReq {
export type AsObject = {
instance?: commands_common_pb.Instance.AsObject,
}
}
export class OutdatedResp extends jspb.Message {
clearOutdatedLibraryList(): void;
getOutdatedLibraryList(): Array<commands_lib_pb.InstalledLibrary>;
setOutdatedLibraryList(value: Array<commands_lib_pb.InstalledLibrary>): OutdatedResp;
addOutdatedLibrary(value?: commands_lib_pb.InstalledLibrary, index?: number): commands_lib_pb.InstalledLibrary;
clearOutdatedPlatformList(): void;
getOutdatedPlatformList(): Array<commands_core_pb.Platform>;
setOutdatedPlatformList(value: Array<commands_core_pb.Platform>): OutdatedResp;
addOutdatedPlatform(value?: commands_core_pb.Platform, index?: number): commands_core_pb.Platform;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): OutdatedResp.AsObject;
static toObject(includeInstance: boolean, msg: OutdatedResp): OutdatedResp.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: OutdatedResp, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): OutdatedResp;
static deserializeBinaryFromReader(message: OutdatedResp, reader: jspb.BinaryReader): OutdatedResp;
}
export namespace OutdatedResp {
export type AsObject = {
outdatedLibraryList: Array<commands_lib_pb.InstalledLibrary.AsObject>,
outdatedPlatformList: Array<commands_core_pb.Platform.AsObject>,
}
}
export class UpgradeReq extends jspb.Message {
hasInstance(): boolean;
clearInstance(): void;
getInstance(): commands_common_pb.Instance | undefined;
setInstance(value?: commands_common_pb.Instance): UpgradeReq;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): UpgradeReq.AsObject;
static toObject(includeInstance: boolean, msg: UpgradeReq): UpgradeReq.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: UpgradeReq, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): UpgradeReq;
static deserializeBinaryFromReader(message: UpgradeReq, reader: jspb.BinaryReader): UpgradeReq;
}
export namespace UpgradeReq {
export type AsObject = {
instance?: commands_common_pb.Instance.AsObject,
}
}
export class UpgradeResp extends jspb.Message {
hasProgress(): boolean;
clearProgress(): void;
getProgress(): commands_common_pb.DownloadProgress | undefined;
setProgress(value?: commands_common_pb.DownloadProgress): UpgradeResp;
hasTaskProgress(): boolean;
clearTaskProgress(): void;
getTaskProgress(): commands_common_pb.TaskProgress | undefined;
setTaskProgress(value?: commands_common_pb.TaskProgress): UpgradeResp;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): UpgradeResp.AsObject;
static toObject(includeInstance: boolean, msg: UpgradeResp): UpgradeResp.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: UpgradeResp, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): UpgradeResp;
static deserializeBinaryFromReader(message: UpgradeResp, reader: jspb.BinaryReader): UpgradeResp;
}
export namespace UpgradeResp {
export type AsObject = {
progress?: commands_common_pb.DownloadProgress.AsObject,
taskProgress?: commands_common_pb.TaskProgress.AsObject,
}
}
export class VersionReq extends jspb.Message {
serializeBinary(): Uint8Array;
@ -306,3 +462,68 @@ export namespace VersionResp {
version: string,
}
}
export class LoadSketchReq extends jspb.Message {
hasInstance(): boolean;
clearInstance(): void;
getInstance(): commands_common_pb.Instance | undefined;
setInstance(value?: commands_common_pb.Instance): LoadSketchReq;
getSketchPath(): string;
setSketchPath(value: string): LoadSketchReq;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): LoadSketchReq.AsObject;
static toObject(includeInstance: boolean, msg: LoadSketchReq): LoadSketchReq.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: LoadSketchReq, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): LoadSketchReq;
static deserializeBinaryFromReader(message: LoadSketchReq, reader: jspb.BinaryReader): LoadSketchReq;
}
export namespace LoadSketchReq {
export type AsObject = {
instance?: commands_common_pb.Instance.AsObject,
sketchPath: string,
}
}
export class LoadSketchResp extends jspb.Message {
getMainFile(): string;
setMainFile(value: string): LoadSketchResp;
getLocationPath(): string;
setLocationPath(value: string): LoadSketchResp;
clearOtherSketchFilesList(): void;
getOtherSketchFilesList(): Array<string>;
setOtherSketchFilesList(value: Array<string>): LoadSketchResp;
addOtherSketchFiles(value: string, index?: number): string;
clearAdditionalFilesList(): void;
getAdditionalFilesList(): Array<string>;
setAdditionalFilesList(value: Array<string>): LoadSketchResp;
addAdditionalFiles(value: string, index?: number): string;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): LoadSketchResp.AsObject;
static toObject(includeInstance: boolean, msg: LoadSketchResp): LoadSketchResp.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: LoadSketchResp, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): LoadSketchResp;
static deserializeBinaryFromReader(message: LoadSketchResp, reader: jspb.BinaryReader): LoadSketchResp;
}
export namespace LoadSketchResp {
export type AsObject = {
mainFile: string,
locationPath: string,
otherSketchFilesList: Array<string>,
additionalFilesList: Array<string>,
}
}

View File

@ -92,3 +92,32 @@ export namespace TaskProgress {
completed: boolean,
}
}
export class Programmer extends jspb.Message {
getPlatform(): string;
setPlatform(value: string): Programmer;
getId(): string;
setId(value: string): Programmer;
getName(): string;
setName(value: string): Programmer;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): Programmer.AsObject;
static toObject(includeInstance: boolean, msg: Programmer): Programmer.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: Programmer, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): Programmer;
static deserializeBinaryFromReader(message: Programmer, reader: jspb.BinaryReader): Programmer;
}
export namespace Programmer {
export type AsObject = {
platform: string,
id: string,
name: string,
}
}

View File

@ -14,6 +14,7 @@ var global = Function('return this')();
goog.exportSymbol('proto.cc.arduino.cli.commands.DownloadProgress', null, global);
goog.exportSymbol('proto.cc.arduino.cli.commands.Instance', null, global);
goog.exportSymbol('proto.cc.arduino.cli.commands.Programmer', null, global);
goog.exportSymbol('proto.cc.arduino.cli.commands.TaskProgress', null, global);
/**
* Generated by JsPbCodeGenerator.
@ -78,6 +79,27 @@ if (goog.DEBUG && !COMPILED) {
*/
proto.cc.arduino.cli.commands.TaskProgress.displayName = 'proto.cc.arduino.cli.commands.TaskProgress';
}
/**
* 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.Programmer = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.cc.arduino.cli.commands.Programmer, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.cc.arduino.cli.commands.Programmer.displayName = 'proto.cc.arduino.cli.commands.Programmer';
}
@ -648,4 +670,194 @@ proto.cc.arduino.cli.commands.TaskProgress.prototype.setCompleted = function(val
};
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.Programmer.prototype.toObject = function(opt_includeInstance) {
return proto.cc.arduino.cli.commands.Programmer.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.Programmer} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.cc.arduino.cli.commands.Programmer.toObject = function(includeInstance, msg) {
var f, obj = {
platform: jspb.Message.getFieldWithDefault(msg, 1, ""),
id: jspb.Message.getFieldWithDefault(msg, 2, ""),
name: jspb.Message.getFieldWithDefault(msg, 3, "")
};
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.Programmer}
*/
proto.cc.arduino.cli.commands.Programmer.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.cc.arduino.cli.commands.Programmer;
return proto.cc.arduino.cli.commands.Programmer.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.Programmer} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.cc.arduino.cli.commands.Programmer}
*/
proto.cc.arduino.cli.commands.Programmer.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.setPlatform(value);
break;
case 2:
var value = /** @type {string} */ (reader.readString());
msg.setId(value);
break;
case 3:
var value = /** @type {string} */ (reader.readString());
msg.setName(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.cc.arduino.cli.commands.Programmer.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.cc.arduino.cli.commands.Programmer.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.Programmer} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.cc.arduino.cli.commands.Programmer.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getPlatform();
if (f.length > 0) {
writer.writeString(
1,
f
);
}
f = message.getId();
if (f.length > 0) {
writer.writeString(
2,
f
);
}
f = message.getName();
if (f.length > 0) {
writer.writeString(
3,
f
);
}
};
/**
* optional string platform = 1;
* @return {string}
*/
proto.cc.arduino.cli.commands.Programmer.prototype.getPlatform = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
};
/**
* @param {string} value
* @return {!proto.cc.arduino.cli.commands.Programmer} returns this
*/
proto.cc.arduino.cli.commands.Programmer.prototype.setPlatform = function(value) {
return jspb.Message.setProto3StringField(this, 1, value);
};
/**
* optional string id = 2;
* @return {string}
*/
proto.cc.arduino.cli.commands.Programmer.prototype.getId = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, ""));
};
/**
* @param {string} value
* @return {!proto.cc.arduino.cli.commands.Programmer} returns this
*/
proto.cc.arduino.cli.commands.Programmer.prototype.setId = function(value) {
return jspb.Message.setProto3StringField(this, 2, value);
};
/**
* optional string name = 3;
* @return {string}
*/
proto.cc.arduino.cli.commands.Programmer.prototype.getName = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, ""));
};
/**
* @param {string} value
* @return {!proto.cc.arduino.cli.commands.Programmer} returns this
*/
proto.cc.arduino.cli.commands.Programmer.prototype.setName = function(value) {
return jspb.Message.setProto3StringField(this, 3, value);
};
goog.object.extend(exports, proto.cc.arduino.cli.commands);

View File

@ -23,6 +23,9 @@ export class PlatformInstallReq extends jspb.Message {
getVersion(): string;
setVersion(value: string): PlatformInstallReq;
getSkippostinstall(): boolean;
setSkippostinstall(value: boolean): PlatformInstallReq;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): PlatformInstallReq.AsObject;
@ -40,6 +43,7 @@ export namespace PlatformInstallReq {
platformPackage: string,
architecture: string,
version: string,
skippostinstall: boolean,
}
}
@ -203,6 +207,9 @@ export class PlatformUpgradeReq extends jspb.Message {
getArchitecture(): string;
setArchitecture(value: string): PlatformUpgradeReq;
getSkippostinstall(): boolean;
setSkippostinstall(value: boolean): PlatformUpgradeReq;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): PlatformUpgradeReq.AsObject;
@ -219,6 +226,7 @@ export namespace PlatformUpgradeReq {
instance?: commands_common_pb.Instance.AsObject,
platformPackage: string,
architecture: string,
skippostinstall: boolean,
}
}

View File

@ -357,7 +357,8 @@ proto.cc.arduino.cli.commands.PlatformInstallReq.toObject = function(includeInst
instance: (f = msg.getInstance()) && commands_common_pb.Instance.toObject(includeInstance, f),
platformPackage: jspb.Message.getFieldWithDefault(msg, 2, ""),
architecture: jspb.Message.getFieldWithDefault(msg, 3, ""),
version: jspb.Message.getFieldWithDefault(msg, 4, "")
version: jspb.Message.getFieldWithDefault(msg, 4, ""),
skippostinstall: jspb.Message.getBooleanFieldWithDefault(msg, 5, false)
};
if (includeInstance) {
@ -411,6 +412,10 @@ proto.cc.arduino.cli.commands.PlatformInstallReq.deserializeBinaryFromReader = f
var value = /** @type {string} */ (reader.readString());
msg.setVersion(value);
break;
case 5:
var value = /** @type {boolean} */ (reader.readBool());
msg.setSkippostinstall(value);
break;
default:
reader.skipField();
break;
@ -469,6 +474,13 @@ proto.cc.arduino.cli.commands.PlatformInstallReq.serializeBinaryToWriter = funct
f
);
}
f = message.getSkippostinstall();
if (f) {
writer.writeBool(
5,
f
);
}
};
@ -563,6 +575,24 @@ proto.cc.arduino.cli.commands.PlatformInstallReq.prototype.setVersion = function
};
/**
* optional bool skipPostInstall = 5;
* @return {boolean}
*/
proto.cc.arduino.cli.commands.PlatformInstallReq.prototype.getSkippostinstall = function() {
return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 5, false));
};
/**
* @param {boolean} value
* @return {!proto.cc.arduino.cli.commands.PlatformInstallReq} returns this
*/
proto.cc.arduino.cli.commands.PlatformInstallReq.prototype.setSkippostinstall = function(value) {
return jspb.Message.setProto3BooleanField(this, 5, value);
};
@ -1553,7 +1583,8 @@ proto.cc.arduino.cli.commands.PlatformUpgradeReq.toObject = function(includeInst
var f, obj = {
instance: (f = msg.getInstance()) && commands_common_pb.Instance.toObject(includeInstance, f),
platformPackage: jspb.Message.getFieldWithDefault(msg, 2, ""),
architecture: jspb.Message.getFieldWithDefault(msg, 3, "")
architecture: jspb.Message.getFieldWithDefault(msg, 3, ""),
skippostinstall: jspb.Message.getBooleanFieldWithDefault(msg, 4, false)
};
if (includeInstance) {
@ -1603,6 +1634,10 @@ proto.cc.arduino.cli.commands.PlatformUpgradeReq.deserializeBinaryFromReader = f
var value = /** @type {string} */ (reader.readString());
msg.setArchitecture(value);
break;
case 4:
var value = /** @type {boolean} */ (reader.readBool());
msg.setSkippostinstall(value);
break;
default:
reader.skipField();
break;
@ -1654,6 +1689,13 @@ proto.cc.arduino.cli.commands.PlatformUpgradeReq.serializeBinaryToWriter = funct
f
);
}
f = message.getSkippostinstall();
if (f) {
writer.writeBool(
4,
f
);
}
};
@ -1730,6 +1772,24 @@ proto.cc.arduino.cli.commands.PlatformUpgradeReq.prototype.setArchitecture = fun
};
/**
* optional bool skipPostInstall = 4;
* @return {boolean}
*/
proto.cc.arduino.cli.commands.PlatformUpgradeReq.prototype.getSkippostinstall = function() {
return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 4, false));
};
/**
* @param {boolean} value
* @return {!proto.cc.arduino.cli.commands.PlatformUpgradeReq} returns this
*/
proto.cc.arduino.cli.commands.PlatformUpgradeReq.prototype.setSkippostinstall = function(value) {
return jspb.Message.setProto3BooleanField(this, 4, value);
};

View File

@ -565,6 +565,12 @@ export class LibraryListReq extends jspb.Message {
getUpdatable(): boolean;
setUpdatable(value: boolean): LibraryListReq;
getName(): string;
setName(value: string): LibraryListReq;
getFqbn(): string;
setFqbn(value: string): LibraryListReq;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): LibraryListReq.AsObject;
@ -581,6 +587,8 @@ export namespace LibraryListReq {
instance?: commands_common_pb.Instance.AsObject,
all: boolean,
updatable: boolean,
name: string,
fqbn: string,
}
}
@ -713,6 +721,11 @@ export class Library extends jspb.Message {
getLayout(): LibraryLayout;
setLayout(value: LibraryLayout): Library;
clearExamplesList(): void;
getExamplesList(): Array<string>;
setExamplesList(value: Array<string>): Library;
addExamples(value: string, index?: number): string;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): Library.AsObject;
@ -750,6 +763,7 @@ export namespace Library {
propertiesMap: Array<[string, string]>,
location: LibraryLocation,
layout: LibraryLayout,
examplesList: Array<string>,
}
}

View File

@ -4157,7 +4157,9 @@ proto.cc.arduino.cli.commands.LibraryListReq.toObject = function(includeInstance
var f, obj = {
instance: (f = msg.getInstance()) && commands_common_pb.Instance.toObject(includeInstance, f),
all: jspb.Message.getBooleanFieldWithDefault(msg, 2, false),
updatable: jspb.Message.getBooleanFieldWithDefault(msg, 3, false)
updatable: jspb.Message.getBooleanFieldWithDefault(msg, 3, false),
name: jspb.Message.getFieldWithDefault(msg, 4, ""),
fqbn: jspb.Message.getFieldWithDefault(msg, 5, "")
};
if (includeInstance) {
@ -4207,6 +4209,14 @@ proto.cc.arduino.cli.commands.LibraryListReq.deserializeBinaryFromReader = funct
var value = /** @type {boolean} */ (reader.readBool());
msg.setUpdatable(value);
break;
case 4:
var value = /** @type {string} */ (reader.readString());
msg.setName(value);
break;
case 5:
var value = /** @type {string} */ (reader.readString());
msg.setFqbn(value);
break;
default:
reader.skipField();
break;
@ -4258,6 +4268,20 @@ proto.cc.arduino.cli.commands.LibraryListReq.serializeBinaryToWriter = function(
f
);
}
f = message.getName();
if (f.length > 0) {
writer.writeString(
4,
f
);
}
f = message.getFqbn();
if (f.length > 0) {
writer.writeString(
5,
f
);
}
};
@ -4334,6 +4358,42 @@ proto.cc.arduino.cli.commands.LibraryListReq.prototype.setUpdatable = function(v
};
/**
* optional string name = 4;
* @return {string}
*/
proto.cc.arduino.cli.commands.LibraryListReq.prototype.getName = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, ""));
};
/**
* @param {string} value
* @return {!proto.cc.arduino.cli.commands.LibraryListReq} returns this
*/
proto.cc.arduino.cli.commands.LibraryListReq.prototype.setName = function(value) {
return jspb.Message.setProto3StringField(this, 4, value);
};
/**
* optional string fqbn = 5;
* @return {string}
*/
proto.cc.arduino.cli.commands.LibraryListReq.prototype.getFqbn = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 5, ""));
};
/**
* @param {string} value
* @return {!proto.cc.arduino.cli.commands.LibraryListReq} returns this
*/
proto.cc.arduino.cli.commands.LibraryListReq.prototype.setFqbn = function(value) {
return jspb.Message.setProto3StringField(this, 5, value);
};
/**
* List of repeated fields within this message type.
@ -4702,7 +4762,7 @@ proto.cc.arduino.cli.commands.InstalledLibrary.prototype.hasRelease = function()
* @private {!Array<number>}
* @const
*/
proto.cc.arduino.cli.commands.Library.repeatedFields_ = [8,9];
proto.cc.arduino.cli.commands.Library.repeatedFields_ = [8,9,26];
@ -4757,7 +4817,8 @@ proto.cc.arduino.cli.commands.Library.toObject = function(includeInstance, msg)
license: jspb.Message.getFieldWithDefault(msg, 22, ""),
propertiesMap: (f = msg.getPropertiesMap()) ? f.toObject(includeInstance, undefined) : [],
location: jspb.Message.getFieldWithDefault(msg, 24, 0),
layout: jspb.Message.getFieldWithDefault(msg, 25, 0)
layout: jspb.Message.getFieldWithDefault(msg, 25, 0),
examplesList: (f = jspb.Message.getRepeatedField(msg, 26)) == null ? undefined : f
};
if (includeInstance) {
@ -4888,6 +4949,10 @@ proto.cc.arduino.cli.commands.Library.deserializeBinaryFromReader = function(msg
var value = /** @type {!proto.cc.arduino.cli.commands.LibraryLayout} */ (reader.readEnum());
msg.setLayout(value);
break;
case 26:
var value = /** @type {string} */ (reader.readString());
msg.addExamples(value);
break;
default:
reader.skipField();
break;
@ -5075,6 +5140,13 @@ proto.cc.arduino.cli.commands.Library.serializeBinaryToWriter = function(message
f
);
}
f = message.getExamplesList();
if (f.length > 0) {
writer.writeRepeatedString(
26,
f
);
}
};
@ -5534,6 +5606,43 @@ proto.cc.arduino.cli.commands.Library.prototype.setLayout = function(value) {
};
/**
* repeated string examples = 26;
* @return {!Array<string>}
*/
proto.cc.arduino.cli.commands.Library.prototype.getExamplesList = function() {
return /** @type {!Array<string>} */ (jspb.Message.getRepeatedField(this, 26));
};
/**
* @param {!Array<string>} value
* @return {!proto.cc.arduino.cli.commands.Library} returns this
*/
proto.cc.arduino.cli.commands.Library.prototype.setExamplesList = function(value) {
return jspb.Message.setField(this, 26, value || []);
};
/**
* @param {string} value
* @param {number=} opt_index
* @return {!proto.cc.arduino.cli.commands.Library} returns this
*/
proto.cc.arduino.cli.commands.Library.prototype.addExamples = function(value, opt_index) {
return jspb.Message.addToRepeatedField(this, 26, value, opt_index);
};
/**
* Clears the list making it empty but non-null.
* @return {!proto.cc.arduino.cli.commands.Library} returns this
*/
proto.cc.arduino.cli.commands.Library.prototype.clearExamplesList = function() {
return this.setExamplesList([]);
};
/**
* @enum {number}
*/

View File

@ -195,9 +195,9 @@ export namespace ListProgrammersAvailableForUploadReq {
export class ListProgrammersAvailableForUploadResp extends jspb.Message {
clearProgrammersList(): void;
getProgrammersList(): Array<Programmer>;
setProgrammersList(value: Array<Programmer>): ListProgrammersAvailableForUploadResp;
addProgrammers(value?: Programmer, index?: number): Programmer;
getProgrammersList(): Array<commands_common_pb.Programmer>;
setProgrammersList(value: Array<commands_common_pb.Programmer>): ListProgrammersAvailableForUploadResp;
addProgrammers(value?: commands_common_pb.Programmer, index?: number): commands_common_pb.Programmer;
serializeBinary(): Uint8Array;
@ -212,35 +212,6 @@ export class ListProgrammersAvailableForUploadResp extends jspb.Message {
export namespace ListProgrammersAvailableForUploadResp {
export type AsObject = {
programmersList: Array<Programmer.AsObject>,
}
}
export class Programmer extends jspb.Message {
getPlatform(): string;
setPlatform(value: string): Programmer;
getId(): string;
setId(value: string): Programmer;
getName(): string;
setName(value: string): Programmer;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): Programmer.AsObject;
static toObject(includeInstance: boolean, msg: Programmer): Programmer.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: Programmer, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): Programmer;
static deserializeBinaryFromReader(message: Programmer, reader: jspb.BinaryReader): Programmer;
}
export namespace Programmer {
export type AsObject = {
platform: string,
id: string,
name: string,
programmersList: Array<commands_common_pb.Programmer.AsObject>,
}
}

View File

@ -18,7 +18,6 @@ goog.exportSymbol('proto.cc.arduino.cli.commands.BurnBootloaderReq', null, globa
goog.exportSymbol('proto.cc.arduino.cli.commands.BurnBootloaderResp', null, global);
goog.exportSymbol('proto.cc.arduino.cli.commands.ListProgrammersAvailableForUploadReq', null, global);
goog.exportSymbol('proto.cc.arduino.cli.commands.ListProgrammersAvailableForUploadResp', null, global);
goog.exportSymbol('proto.cc.arduino.cli.commands.Programmer', null, global);
goog.exportSymbol('proto.cc.arduino.cli.commands.UploadReq', null, global);
goog.exportSymbol('proto.cc.arduino.cli.commands.UploadResp', null, global);
/**
@ -147,27 +146,6 @@ if (goog.DEBUG && !COMPILED) {
*/
proto.cc.arduino.cli.commands.ListProgrammersAvailableForUploadResp.displayName = 'proto.cc.arduino.cli.commands.ListProgrammersAvailableForUploadResp';
}
/**
* 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.Programmer = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.cc.arduino.cli.commands.Programmer, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.cc.arduino.cli.commands.Programmer.displayName = 'proto.cc.arduino.cli.commands.Programmer';
}
@ -1497,7 +1475,7 @@ proto.cc.arduino.cli.commands.ListProgrammersAvailableForUploadResp.prototype.to
proto.cc.arduino.cli.commands.ListProgrammersAvailableForUploadResp.toObject = function(includeInstance, msg) {
var f, obj = {
programmersList: jspb.Message.toObjectList(msg.getProgrammersList(),
proto.cc.arduino.cli.commands.Programmer.toObject, includeInstance)
commands_common_pb.Programmer.toObject, includeInstance)
};
if (includeInstance) {
@ -1535,8 +1513,8 @@ proto.cc.arduino.cli.commands.ListProgrammersAvailableForUploadResp.deserializeB
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = new proto.cc.arduino.cli.commands.Programmer;
reader.readMessage(value,proto.cc.arduino.cli.commands.Programmer.deserializeBinaryFromReader);
var value = new commands_common_pb.Programmer;
reader.readMessage(value,commands_common_pb.Programmer.deserializeBinaryFromReader);
msg.addProgrammers(value);
break;
default:
@ -1573,7 +1551,7 @@ proto.cc.arduino.cli.commands.ListProgrammersAvailableForUploadResp.serializeBin
writer.writeRepeatedMessage(
1,
f,
proto.cc.arduino.cli.commands.Programmer.serializeBinaryToWriter
commands_common_pb.Programmer.serializeBinaryToWriter
);
}
};
@ -1585,7 +1563,7 @@ proto.cc.arduino.cli.commands.ListProgrammersAvailableForUploadResp.serializeBin
*/
proto.cc.arduino.cli.commands.ListProgrammersAvailableForUploadResp.prototype.getProgrammersList = function() {
return /** @type{!Array<!proto.cc.arduino.cli.commands.Programmer>} */ (
jspb.Message.getRepeatedWrapperField(this, proto.cc.arduino.cli.commands.Programmer, 1));
jspb.Message.getRepeatedWrapperField(this, commands_common_pb.Programmer, 1));
};
@ -1617,194 +1595,4 @@ proto.cc.arduino.cli.commands.ListProgrammersAvailableForUploadResp.prototype.cl
};
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.Programmer.prototype.toObject = function(opt_includeInstance) {
return proto.cc.arduino.cli.commands.Programmer.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.Programmer} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.cc.arduino.cli.commands.Programmer.toObject = function(includeInstance, msg) {
var f, obj = {
platform: jspb.Message.getFieldWithDefault(msg, 1, ""),
id: jspb.Message.getFieldWithDefault(msg, 2, ""),
name: jspb.Message.getFieldWithDefault(msg, 3, "")
};
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.Programmer}
*/
proto.cc.arduino.cli.commands.Programmer.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.cc.arduino.cli.commands.Programmer;
return proto.cc.arduino.cli.commands.Programmer.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.Programmer} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.cc.arduino.cli.commands.Programmer}
*/
proto.cc.arduino.cli.commands.Programmer.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.setPlatform(value);
break;
case 2:
var value = /** @type {string} */ (reader.readString());
msg.setId(value);
break;
case 3:
var value = /** @type {string} */ (reader.readString());
msg.setName(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.cc.arduino.cli.commands.Programmer.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.cc.arduino.cli.commands.Programmer.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.Programmer} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.cc.arduino.cli.commands.Programmer.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getPlatform();
if (f.length > 0) {
writer.writeString(
1,
f
);
}
f = message.getId();
if (f.length > 0) {
writer.writeString(
2,
f
);
}
f = message.getName();
if (f.length > 0) {
writer.writeString(
3,
f
);
}
};
/**
* optional string platform = 1;
* @return {string}
*/
proto.cc.arduino.cli.commands.Programmer.prototype.getPlatform = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
};
/**
* @param {string} value
* @return {!proto.cc.arduino.cli.commands.Programmer} returns this
*/
proto.cc.arduino.cli.commands.Programmer.prototype.setPlatform = function(value) {
return jspb.Message.setProto3StringField(this, 1, value);
};
/**
* optional string id = 2;
* @return {string}
*/
proto.cc.arduino.cli.commands.Programmer.prototype.getId = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, ""));
};
/**
* @param {string} value
* @return {!proto.cc.arduino.cli.commands.Programmer} returns this
*/
proto.cc.arduino.cli.commands.Programmer.prototype.setId = function(value) {
return jspb.Message.setProto3StringField(this, 2, value);
};
/**
* optional string name = 3;
* @return {string}
*/
proto.cc.arduino.cli.commands.Programmer.prototype.getName = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, ""));
};
/**
* @param {string} value
* @return {!proto.cc.arduino.cli.commands.Programmer} returns this
*/
proto.cc.arduino.cli.commands.Programmer.prototype.setName = function(value) {
return jspb.Message.setProto3StringField(this, 3, value);
};
goog.object.extend(exports, proto.cc.arduino.cli.commands);

View File

@ -43,7 +43,7 @@ function deserialize_cc_arduino_cli_monitor_StreamingOpenResp(buffer_arg) {
}
// Service that abstract a Monitor usage
// Service that abstracts a Monitor usage
var MonitorService = exports['cc.arduino.cli.monitor.Monitor'] = {
// Open a bidirectional monitor stream. This can be used to implement
// something similar to the Arduino IDE's Serial Monitor.

View File

@ -2,9 +2,12 @@ import { inject, injectable, postConstruct } from 'inversify';
import { join, basename } from 'path';
import * as fs from './fs-extra';
import { FileUri } from '@theia/core/lib/node/file-uri';
import { notEmpty } from '@theia/core/lib/common/objects';
import { Sketch } from '../common/protocol/sketches-service';
import { SketchesServiceImpl } from './sketches-service-impl';
import { ExamplesService, ExampleContainer } from '../common/protocol/examples-service';
import { LibraryServiceServer, LibraryLocation, LibraryPackage } from '../common/protocol';
import { ConfigServiceImpl } from './config-service-impl';
@injectable()
export class ExamplesServiceImpl implements ExamplesService {
@ -12,22 +15,100 @@ export class ExamplesServiceImpl implements ExamplesService {
@inject(SketchesServiceImpl)
protected readonly sketchesService: SketchesServiceImpl;
protected _all: ExampleContainer | undefined;
@inject(LibraryServiceServer)
protected readonly libraryService: LibraryServiceServer;
@inject(ConfigServiceImpl)
protected readonly configService: ConfigServiceImpl;
protected _all: ExampleContainer[] | undefined;
@postConstruct()
protected init(): void {
this.all();
this.builtIns();
}
async all(): Promise<ExampleContainer> {
async builtIns(): Promise<ExampleContainer[]> {
if (this._all) {
return this._all;
}
this._all = await this.load();
const exampleRootPath = join(__dirname, '..', '..', 'Examples');
const exampleNames = await fs.readdir(exampleRootPath);
this._all = await Promise.all(exampleNames.map(name => join(exampleRootPath, name)).map(path => this.load(path)));
return this._all;
}
protected async load(path: string = join(__dirname, '..', '..', 'Examples')): Promise<ExampleContainer> {
// TODO: decide whether it makes sense to cache them. Keys should be: `fqbn` + version of containing core/library.
async installed({ fqbn }: { fqbn: string }): Promise<{ user: ExampleContainer[], current: ExampleContainer[], any: ExampleContainer[] }> {
const user: ExampleContainer[] = [];
const current: ExampleContainer[] = [];
const any: ExampleContainer[] = [];
if (fqbn) {
const packages = await this.libraryService.list({ fqbn });
for (const pkg of packages) {
const container = await this.tryGroupExamples(pkg);
const { location } = pkg;
if (location === LibraryLocation.USER) {
user.push(container);
} else if (location === LibraryLocation.PLATFORM_BUILTIN || LibraryLocation.REFERENCED_PLATFORM_BUILTIN) {
current.push(container);
} else {
any.push(container);
}
}
}
return { user, current, any };
}
/**
* The CLI provides direct FS paths to the examples so that menus and menu groups cannot be built for the UI by traversing the
* folder hierarchy. This method tries to workaround it by falling back to the `installDirUri` and manually creating the
* location of the examples. Otherwise it creates the example container from the direct examples FS paths.
*/
protected async tryGroupExamples({ label, exampleUris, installDirUri }: LibraryPackage): Promise<ExampleContainer> {
const paths = exampleUris.map(uri => FileUri.fsPath(uri));
if (installDirUri) {
for (const example of ['example', 'Example', 'EXAMPLE', 'examples', 'Examples', 'EXAMPLES']) {
const examplesPath = join(FileUri.fsPath(installDirUri), example);
const exists = await fs.exists(examplesPath);
const isDir = exists && (await fs.lstat(examplesPath)).isDirectory();
if (isDir) {
const fileNames = await fs.readdir(examplesPath);
const children: ExampleContainer[] = [];
const sketches: Sketch[] = [];
for (const fileName of fileNames) {
const subPath = join(examplesPath, fileName);
const subIsDir = (await fs.lstat(subPath)).isDirectory();
if (subIsDir) {
const sketch = await this.tryLoadSketch(subPath);
if (!sketch) {
const container = await this.load(subPath);
if (container.children.length || container.sketches.length) {
children.push(container);
}
} else {
sketches.push(sketch);
}
}
}
return {
label,
children,
sketches
};
}
}
}
const sketches = await Promise.all(paths.map(path => this.tryLoadSketch(path)));
return {
label,
children: [],
sketches: sketches.filter(notEmpty)
};
}
// Built-ins are included inside the IDE.
protected async load(path: string): Promise<ExampleContainer> {
if (!await fs.exists(path)) {
throw new Error('Examples are not available');
}

View File

@ -1,5 +1,5 @@
import { injectable, inject, postConstruct } from 'inversify';
import { LibraryPackage, LibraryService, LibraryServiceClient } from '../common/protocol/library-service';
import { LibraryPackage, LibraryServiceClient, LibraryServiceServer } from '../common/protocol/library-service';
import { CoreClientProvider } from './core-client-provider';
import {
LibrarySearchReq,
@ -17,9 +17,10 @@ import { ToolOutputServiceServer } from '../common/protocol/tool-output-service'
import { Installable } from '../common/protocol/installable';
import { ILogger, notEmpty } from '@theia/core';
import { Deferred } from '@theia/core/lib/common/promise-util';
import { FileUri } from '@theia/core/lib/node';
@injectable()
export class LibraryServiceImpl implements LibraryService {
export class LibraryServiceServerImpl implements LibraryServiceServer {
@inject(ILogger)
protected logger: ILogger;
@ -97,62 +98,37 @@ export class LibraryServiceImpl implements LibraryService {
if (!coreClient) {
return [];
}
const { client, instance } = coreClient;
const { client, instance } = coreClient;
const req = new LibraryListReq();
req.setInstance(instance);
req.setAll(true);
if (fqbn) {
req.setFqbn(fqbn);
}
const resp = await new Promise<LibraryListResp>((resolve, reject) => client.libraryList(req, ((error, resp) => !!error ? reject(error) : resolve(resp))));
const x = resp.getInstalledLibraryList().map(item => {
return resp.getInstalledLibraryList().map(item => {
const release = item.getRelease();
const library = item.getLibrary();
if (!release || !library) {
return undefined;
}
// https://arduino.github.io/arduino-cli/latest/rpc/commands/#librarylocation
// 0: In the libraries subdirectory of the Arduino IDE installation. (`ide_builtin`)
// 1: In the libraries subdirectory of the user directory (sketchbook). (`user`)
// 2: In the libraries subdirectory of a platform. (`platform_builtin`)
// 3: When LibraryLocation is used in a context where a board is specified, this indicates the library is
// in the libraries subdirectory of a platform referenced by the board's platform. (`referenced_platform_builtin`)
// If 0, we ignore it.
// If 1, we include always.
// If 2, we include iff `fqbn` is specified and the platform matches.
// if 3, TODO
const location = library.getLocation();
if (location === 0) {
return undefined;
}
if (location === 2) {
if (!fqbn) {
return undefined;
}
const architectures = library.getArchitecturesList();
const [platform] = library.getContainerPlatform().split(':');
if (!platform) {
return undefined;
}
const [boardPlatform, boardArchitecture] = fqbn.split(':');
if (boardPlatform !== platform || architectures.indexOf(boardArchitecture) === -1) {
return undefined;
}
}
const installedVersion = library.getVersion();
return toLibrary({
name: library.getName(),
label: library.getRealName(),
installedVersion,
installable: true,
description: library.getSentence(),
summary: library.getParagraph(),
moreInfoLink: library.getWebsite(),
includes: release.getProvidesIncludesList(),
moreInfoLink: library.getWebsite()
location: library.getLocation(),
installDirUri: FileUri.create(library.getInstallDir()).toString(),
exampleUris: library.getExamplesList().map(fsPath => FileUri.create(fsPath).toString())
}, release, [library.getVersion()]);
}).filter(notEmpty);
console.log(x);
return x;
}
async install(options: { item: LibraryPackage, version?: Installable.Version }): Promise<void> {
@ -236,11 +212,14 @@ export class LibraryServiceImpl implements LibraryService {
}
function toLibrary(tpl: Partial<LibraryPackage>, release: LibraryRelease, availableVersions: string[]): LibraryPackage {
function toLibrary(pkg: Partial<LibraryPackage>, release: LibraryRelease, availableVersions: string[]): LibraryPackage {
return {
name: '',
label: '',
exampleUris: [],
installable: false,
...tpl,
location: 0,
...pkg,
author: release.getAuthor(),
availableVersions,

View File

@ -7,6 +7,8 @@ import { ILogger } from '@theia/core/lib/common/logger';
import { Deferred } from '@theia/core/lib/common/promise-util';
import { MockLogger } from '@theia/core/lib/common/test/mock-logger';
import { MaybePromise } from '@theia/core/lib/common/types';
import { MessageClient } from '@theia/core/lib/common/message-service-protocol';
import { MessageService } from '@theia/core/lib/common/message-service';
import { StorageService } from '@theia/core/lib/browser/storage-service';
import { DisposableCollection } from '@theia/core/lib/common/disposable';
import { BoardsService, Board, Port, BoardsPackage, BoardDetails, BoardsServiceClient } from '../../common/protocol';
@ -164,6 +166,8 @@ function init(): Container {
container.bind(MockStorageService).toSelf();
container.bind(StorageService).toService(MockStorageService);
container.bind(BoardsServiceClientImpl).toSelf();
container.bind(MessageClient).toSelf().inSingletonScope();
container.bind(MessageService).toSelf().inSingletonScope();
return container;
}