From 56ff86629caae309742bd02dcd7f692660b47910 Mon Sep 17 00:00:00 2001 From: Akos Kitta Date: Wed, 19 Aug 2020 08:26:38 +0200 Subject: [PATCH] ATL-73: Added library examples to the app. Signed-off-by: Akos Kitta --- arduino-ide-extension/scripts/download-cli.js | 2 +- .../scripts/generate-protocol.js | 2 +- .../browser/arduino-ide-frontend-module.ts | 5 +- .../src/browser/contributions/examples.ts | 116 +- .../src/browser/contributions/open-sketch.ts | 12 +- .../library/include-library-menu-updater.ts | 6 +- .../src/browser/menu/arduino-menus.ts | 7 + .../src/common/protocol/examples-service.ts | 3 +- .../src/common/protocol/library-service.ts | 28 + .../src/node/arduino-ide-backend-module.ts | 8 +- .../node/cli-protocol/commands/board_pb.d.ts | 6 + .../node/cli-protocol/commands/board_pb.js | 57 +- .../commands/commands_grpc_pb.d.ts | 64 + .../cli-protocol/commands/commands_grpc_pb.js | 138 +- .../cli-protocol/commands/commands_pb.d.ts | 221 +++ .../node/cli-protocol/commands/commands_pb.js | 1641 +++++++++++++++++ .../node/cli-protocol/commands/common_pb.d.ts | 29 + .../node/cli-protocol/commands/common_pb.js | 212 +++ .../node/cli-protocol/commands/core_pb.d.ts | 8 + .../src/node/cli-protocol/commands/core_pb.js | 64 +- .../node/cli-protocol/commands/lib_pb.d.ts | 14 + .../src/node/cli-protocol/commands/lib_pb.js | 115 +- .../node/cli-protocol/commands/upload_pb.d.ts | 37 +- .../node/cli-protocol/commands/upload_pb.js | 222 +-- .../cli-protocol/monitor/monitor_grpc_pb.js | 2 +- .../src/node/examples-service-impl.ts | 91 +- ...impl.ts => library-service-server-impl.ts} | 59 +- .../boards-service-client-impl.test.ts | 4 + 28 files changed, 2827 insertions(+), 346 deletions(-) rename arduino-ide-extension/src/node/{library-service-impl.ts => library-service-server-impl.ts} (80%) diff --git a/arduino-ide-extension/scripts/download-cli.js b/arduino-ide-extension/scripts/download-cli.js index e998ccb9..aa9a1aaa 100755 --- a/arduino-ide-extension/scripts/download-cli.js +++ b/arduino-ide-extension/scripts/download-cli.js @@ -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'); diff --git a/arduino-ide-extension/scripts/generate-protocol.js b/arduino-ide-extension/scripts/generate-protocol.js index f4b43b37..3d01cc51 100644 --- a/arduino-ide-extension/scripts/generate-protocol.js +++ b/arduino-ide-extension/scripts/generate-protocol.js @@ -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); } diff --git a/arduino-ide-extension/src/browser/arduino-ide-frontend-module.ts b/arduino-ide-extension/src/browser/arduino-ide-frontend-module.ts index 2e4f1b87..4dd90d08 100644 --- a/arduino-ide-extension/src/browser/arduino-ide-frontend-module.ts +++ b/arduino-ide-extension/src/browser/arduino-ide-frontend-module.ts @@ -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); }); diff --git a/arduino-ide-extension/src/browser/contributions/examples.ts b/arduino-ide-extension/src/browser/contributions/examples.ts index e294a889..8ce9a893 100644 --- a/arduino-ide-extension/src/browser/contributions/examples.ts +++ b/arduino-ide-extension/src/browser/contributions/examples.ts @@ -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(); + }); + } + +} diff --git a/arduino-ide-extension/src/browser/contributions/open-sketch.ts b/arduino-ide-extension/src/browser/contributions/open-sketch.ts index f6d4fe9b..4df217db 100644 --- a/arduino-ide-extension/src/browser/contributions/open-sketch.ts +++ b/arduino-ide-extension/src/browser/contributions/open-sketch.ts @@ -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); diff --git a/arduino-ide-extension/src/browser/library/include-library-menu-updater.ts b/arduino-ide-extension/src/browser/library/include-library-menu-updater.ts index 74a92e41..2dd1b5b7 100644 --- a/arduino-ide-extension/src/browser/library/include-library-menu-updater.ts +++ b/arduino-ide-extension/src/browser/library/include-library-menu-updater.ts @@ -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']; diff --git a/arduino-ide-extension/src/browser/menu/arduino-menus.ts b/arduino-ide-extension/src/browser/menu/arduino-menus.ts index 7008b48d..ea596910 100644 --- a/arduino-ide-extension/src/browser/menu/arduino-menus.ts +++ b/arduino-ide-extension/src/browser/menu/arduino-menus.ts @@ -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` diff --git a/arduino-ide-extension/src/common/protocol/examples-service.ts b/arduino-ide-extension/src/common/protocol/examples-service.ts index dfc7ae9f..783af370 100644 --- a/arduino-ide-extension/src/common/protocol/examples-service.ts +++ b/arduino-ide-extension/src/common/protocol/examples-service.ts @@ -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; + builtIns(): Promise; + installed(options: { fqbn: string }): Promise<{ user: ExampleContainer[], current: ExampleContainer[], any: ExampleContainer[] }>; } export interface ExampleContainer { diff --git a/arduino-ide-extension/src/common/protocol/library-service.ts b/arduino-ide-extension/src/common/protocol/library-service.ts index 69a0a849..4909f606 100644 --- a/arduino-ide-extension/src/common/protocol/library-service.ts +++ b/arduino-ide-extension/src/common/protocol/library-service.ts @@ -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 ` 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 { diff --git a/arduino-ide-extension/src/node/arduino-ide-backend-module.ts b/arduino-ide-extension/src/node/arduino-ide-backend-module.ts index 04e3e7cc..1ff2a3c4 100644 --- a/arduino-ide-extension/src/node/arduino-ide-backend-module.ts +++ b/arduino-ide-extension/src/node/arduino-ide-backend-module.ts @@ -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(LibraryServiceServerPath, client => { - const server = context.container.get(LibraryServiceImpl); + const server = context.container.get(LibraryServiceServerImpl); server.setClient(client); client.onDidCloseConnection(() => server.dispose()); return server; diff --git a/arduino-ide-extension/src/node/cli-protocol/commands/board_pb.d.ts b/arduino-ide-extension/src/node/cli-protocol/commands/board_pb.d.ts index 2e5054c8..3e0b6f70 100644 --- a/arduino-ide-extension/src/node/cli-protocol/commands/board_pb.d.ts +++ b/arduino-ide-extension/src/node/cli-protocol/commands/board_pb.d.ts @@ -84,6 +84,11 @@ export class BoardDetailsResp extends jspb.Message { setIdentificationPrefList(value: Array): BoardDetailsResp; addIdentificationPref(value?: IdentificationPref, index?: number): IdentificationPref; + clearProgrammersList(): void; + getProgrammersList(): Array; + setProgrammersList(value: Array): 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, configOptionsList: Array, identificationPrefList: Array, + programmersList: Array, } } diff --git a/arduino-ide-extension/src/node/cli-protocol/commands/board_pb.js b/arduino-ide-extension/src/node/cli-protocol/commands/board_pb.js index 27f6ca5f..4c2b1c99 100644 --- a/arduino-ide-extension/src/node/cli-protocol/commands/board_pb.js +++ b/arduino-ide-extension/src/node/cli-protocol/commands/board_pb.js @@ -619,7 +619,7 @@ proto.cc.arduino.cli.commands.BoardDetailsReq.prototype.setFqbn = function(value * @private {!Array} * @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.BoardDetailsResp.prototype.getProgrammersList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, commands_common_pb.Programmer, 13)); +}; + + +/** + * @param {!Array} 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([]); +}; + + diff --git a/arduino-ide-extension/src/node/cli-protocol/commands/commands_grpc_pb.d.ts b/arduino-ide-extension/src/node/cli-protocol/commands/commands_grpc_pb.d.ts index c1ec68ee..ddd2502b 100644 --- a/arduino-ide-extension/src/node/cli-protocol/commands/commands_grpc_pb.d.ts +++ b/arduino-ide-extension/src/node/cli-protocol/commands/commands_grpc_pb.d.ts @@ -20,7 +20,11 @@ interface IArduinoCoreService extends grpc.ServiceDefinition; responseDeserialize: grpc.deserialize; } +interface IArduinoCoreService_IUpdateCoreLibrariesIndex extends grpc.MethodDefinition { + path: string; // "/cc.arduino.cli.commands.ArduinoCore/UpdateCoreLibrariesIndex" + requestStream: false; + responseStream: true; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; +} +interface IArduinoCoreService_IOutdated extends grpc.MethodDefinition { + path: string; // "/cc.arduino.cli.commands.ArduinoCore/Outdated" + requestStream: false; + responseStream: false; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; +} +interface IArduinoCoreService_IUpgrade extends grpc.MethodDefinition { + path: string; // "/cc.arduino.cli.commands.ArduinoCore/Upgrade" + requestStream: false; + responseStream: true; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; +} interface IArduinoCoreService_IVersion extends grpc.MethodDefinition { path: string; // "/cc.arduino.cli.commands.ArduinoCore/Version" requestStream: false; @@ -98,6 +129,15 @@ interface IArduinoCoreService_IVersion extends grpc.MethodDefinition; responseDeserialize: grpc.deserialize; } +interface IArduinoCoreService_ILoadSketch extends grpc.MethodDefinition { + path: string; // "/cc.arduino.cli.commands.ArduinoCore/LoadSketch" + requestStream: false; + responseStream: false; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; +} interface IArduinoCoreService_IBoardDetails extends grpc.MethodDefinition { path: string; // "/cc.arduino.cli.commands.ArduinoCore/BoardDetails" requestStream: false; @@ -296,7 +336,11 @@ export interface IArduinoCoreServer { rescan: grpc.handleUnaryCall; updateIndex: grpc.handleServerStreamingCall; updateLibrariesIndex: grpc.handleServerStreamingCall; + updateCoreLibrariesIndex: grpc.handleServerStreamingCall; + outdated: grpc.handleUnaryCall; + upgrade: grpc.handleServerStreamingCall; version: grpc.handleUnaryCall; + loadSketch: grpc.handleUnaryCall; boardDetails: grpc.handleUnaryCall; boardAttach: grpc.handleServerStreamingCall; boardList: grpc.handleUnaryCall; @@ -333,9 +377,19 @@ export interface IArduinoCoreClient { updateIndex(request: commands_commands_pb.UpdateIndexReq, metadata?: grpc.Metadata, options?: Partial): grpc.ClientReadableStream; updateLibrariesIndex(request: commands_commands_pb.UpdateLibrariesIndexReq, options?: Partial): grpc.ClientReadableStream; updateLibrariesIndex(request: commands_commands_pb.UpdateLibrariesIndexReq, metadata?: grpc.Metadata, options?: Partial): grpc.ClientReadableStream; + updateCoreLibrariesIndex(request: commands_commands_pb.UpdateCoreLibrariesIndexReq, options?: Partial): grpc.ClientReadableStream; + updateCoreLibrariesIndex(request: commands_commands_pb.UpdateCoreLibrariesIndexReq, metadata?: grpc.Metadata, options?: Partial): grpc.ClientReadableStream; + 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, callback: (error: grpc.ServiceError | null, response: commands_commands_pb.OutdatedResp) => void): grpc.ClientUnaryCall; + upgrade(request: commands_commands_pb.UpgradeReq, options?: Partial): grpc.ClientReadableStream; + upgrade(request: commands_commands_pb.UpgradeReq, metadata?: grpc.Metadata, options?: Partial): grpc.ClientReadableStream; 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, 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, 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, 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.ClientReadableStream; public updateLibrariesIndex(request: commands_commands_pb.UpdateLibrariesIndexReq, options?: Partial): grpc.ClientReadableStream; public updateLibrariesIndex(request: commands_commands_pb.UpdateLibrariesIndexReq, metadata?: grpc.Metadata, options?: Partial): grpc.ClientReadableStream; + public updateCoreLibrariesIndex(request: commands_commands_pb.UpdateCoreLibrariesIndexReq, options?: Partial): grpc.ClientReadableStream; + public updateCoreLibrariesIndex(request: commands_commands_pb.UpdateCoreLibrariesIndexReq, metadata?: grpc.Metadata, options?: Partial): grpc.ClientReadableStream; + 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, callback: (error: grpc.ServiceError | null, response: commands_commands_pb.OutdatedResp) => void): grpc.ClientUnaryCall; + public upgrade(request: commands_commands_pb.UpgradeReq, options?: Partial): grpc.ClientReadableStream; + public upgrade(request: commands_commands_pb.UpgradeReq, metadata?: grpc.Metadata, options?: Partial): grpc.ClientReadableStream; 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, 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, 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, callback: (error: grpc.ServiceError | null, response: commands_board_pb.BoardDetailsResp) => void): grpc.ClientUnaryCall; diff --git a/arduino-ide-extension/src/node/cli-protocol/commands/commands_grpc_pb.js b/arduino-ide-extension/src/node/cli-protocol/commands/commands_grpc_pb.js index 10143c42..6f46c8b6 100644 --- a/arduino-ide-extension/src/node/cli-protocol/commands/commands_grpc_pb.js +++ b/arduino-ide-extension/src/node/cli-protocol/commands/commands_grpc_pb.js @@ -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', diff --git a/arduino-ide-extension/src/node/cli-protocol/commands/commands_pb.d.ts b/arduino-ide-extension/src/node/cli-protocol/commands/commands_pb.d.ts index f6ba9a57..d88be6da 100644 --- a/arduino-ide-extension/src/node/cli-protocol/commands/commands_pb.d.ts +++ b/arduino-ide-extension/src/node/cli-protocol/commands/commands_pb.d.ts @@ -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}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + 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}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + 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}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + 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; + setOutdatedLibraryList(value: Array): OutdatedResp; + addOutdatedLibrary(value?: commands_lib_pb.InstalledLibrary, index?: number): commands_lib_pb.InstalledLibrary; + + clearOutdatedPlatformList(): void; + getOutdatedPlatformList(): Array; + setOutdatedPlatformList(value: Array): 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}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + 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, + outdatedPlatformList: Array, + } +} + +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}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + 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}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + 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}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + 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; + setOtherSketchFilesList(value: Array): LoadSketchResp; + addOtherSketchFiles(value: string, index?: number): string; + + clearAdditionalFilesList(): void; + getAdditionalFilesList(): Array; + setAdditionalFilesList(value: Array): 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}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + 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, + additionalFilesList: Array, + } +} diff --git a/arduino-ide-extension/src/node/cli-protocol/commands/commands_pb.js b/arduino-ide-extension/src/node/cli-protocol/commands/commands_pb.js index 73bc5cfb..8a141d0e 100644 --- a/arduino-ide-extension/src/node/cli-protocol/commands/commands_pb.js +++ b/arduino-ide-extension/src/node/cli-protocol/commands/commands_pb.js @@ -28,12 +28,20 @@ goog.exportSymbol('proto.cc.arduino.cli.commands.DestroyReq', null, global); goog.exportSymbol('proto.cc.arduino.cli.commands.DestroyResp', null, global); goog.exportSymbol('proto.cc.arduino.cli.commands.InitReq', null, global); goog.exportSymbol('proto.cc.arduino.cli.commands.InitResp', null, global); +goog.exportSymbol('proto.cc.arduino.cli.commands.LoadSketchReq', null, global); +goog.exportSymbol('proto.cc.arduino.cli.commands.LoadSketchResp', null, global); +goog.exportSymbol('proto.cc.arduino.cli.commands.OutdatedReq', null, global); +goog.exportSymbol('proto.cc.arduino.cli.commands.OutdatedResp', null, global); goog.exportSymbol('proto.cc.arduino.cli.commands.RescanReq', null, global); goog.exportSymbol('proto.cc.arduino.cli.commands.RescanResp', null, global); +goog.exportSymbol('proto.cc.arduino.cli.commands.UpdateCoreLibrariesIndexReq', null, global); +goog.exportSymbol('proto.cc.arduino.cli.commands.UpdateCoreLibrariesIndexResp', null, global); goog.exportSymbol('proto.cc.arduino.cli.commands.UpdateIndexReq', null, global); goog.exportSymbol('proto.cc.arduino.cli.commands.UpdateIndexResp', null, global); goog.exportSymbol('proto.cc.arduino.cli.commands.UpdateLibrariesIndexReq', null, global); goog.exportSymbol('proto.cc.arduino.cli.commands.UpdateLibrariesIndexResp', null, global); +goog.exportSymbol('proto.cc.arduino.cli.commands.UpgradeReq', null, global); +goog.exportSymbol('proto.cc.arduino.cli.commands.UpgradeResp', null, global); goog.exportSymbol('proto.cc.arduino.cli.commands.VersionReq', null, global); goog.exportSymbol('proto.cc.arduino.cli.commands.VersionResp', null, global); /** @@ -246,6 +254,132 @@ if (goog.DEBUG && !COMPILED) { */ proto.cc.arduino.cli.commands.UpdateLibrariesIndexResp.displayName = 'proto.cc.arduino.cli.commands.UpdateLibrariesIndexResp'; } +/** + * 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.UpdateCoreLibrariesIndexReq = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.cc.arduino.cli.commands.UpdateCoreLibrariesIndexReq, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.cc.arduino.cli.commands.UpdateCoreLibrariesIndexReq.displayName = 'proto.cc.arduino.cli.commands.UpdateCoreLibrariesIndexReq'; +} +/** + * 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.UpdateCoreLibrariesIndexResp = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.cc.arduino.cli.commands.UpdateCoreLibrariesIndexResp, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.cc.arduino.cli.commands.UpdateCoreLibrariesIndexResp.displayName = 'proto.cc.arduino.cli.commands.UpdateCoreLibrariesIndexResp'; +} +/** + * 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.OutdatedReq = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.cc.arduino.cli.commands.OutdatedReq, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.cc.arduino.cli.commands.OutdatedReq.displayName = 'proto.cc.arduino.cli.commands.OutdatedReq'; +} +/** + * 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.OutdatedResp = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.cc.arduino.cli.commands.OutdatedResp.repeatedFields_, null); +}; +goog.inherits(proto.cc.arduino.cli.commands.OutdatedResp, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.cc.arduino.cli.commands.OutdatedResp.displayName = 'proto.cc.arduino.cli.commands.OutdatedResp'; +} +/** + * 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.UpgradeReq = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.cc.arduino.cli.commands.UpgradeReq, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.cc.arduino.cli.commands.UpgradeReq.displayName = 'proto.cc.arduino.cli.commands.UpgradeReq'; +} +/** + * 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.UpgradeResp = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.cc.arduino.cli.commands.UpgradeResp, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.cc.arduino.cli.commands.UpgradeResp.displayName = 'proto.cc.arduino.cli.commands.UpgradeResp'; +} /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a @@ -288,6 +422,48 @@ if (goog.DEBUG && !COMPILED) { */ proto.cc.arduino.cli.commands.VersionResp.displayName = 'proto.cc.arduino.cli.commands.VersionResp'; } +/** + * 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.LoadSketchReq = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.cc.arduino.cli.commands.LoadSketchReq, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.cc.arduino.cli.commands.LoadSketchReq.displayName = 'proto.cc.arduino.cli.commands.LoadSketchReq'; +} +/** + * 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.LoadSketchResp = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.cc.arduino.cli.commands.LoadSketchResp.repeatedFields_, null); +}; +goog.inherits(proto.cc.arduino.cli.commands.LoadSketchResp, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.cc.arduino.cli.commands.LoadSketchResp.displayName = 'proto.cc.arduino.cli.commands.LoadSketchResp'; +} @@ -1953,6 +2129,1025 @@ proto.cc.arduino.cli.commands.UpdateLibrariesIndexResp.prototype.hasDownloadProg +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_, 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.UpdateCoreLibrariesIndexReq.prototype.toObject = function(opt_includeInstance) { + return proto.cc.arduino.cli.commands.UpdateCoreLibrariesIndexReq.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.UpdateCoreLibrariesIndexReq} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.cc.arduino.cli.commands.UpdateCoreLibrariesIndexReq.toObject = function(includeInstance, msg) { + var f, obj = { + instance: (f = msg.getInstance()) && commands_common_pb.Instance.toObject(includeInstance, f) + }; + + 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.UpdateCoreLibrariesIndexReq} + */ +proto.cc.arduino.cli.commands.UpdateCoreLibrariesIndexReq.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.cc.arduino.cli.commands.UpdateCoreLibrariesIndexReq; + return proto.cc.arduino.cli.commands.UpdateCoreLibrariesIndexReq.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.UpdateCoreLibrariesIndexReq} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.cc.arduino.cli.commands.UpdateCoreLibrariesIndexReq} + */ +proto.cc.arduino.cli.commands.UpdateCoreLibrariesIndexReq.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new commands_common_pb.Instance; + reader.readMessage(value,commands_common_pb.Instance.deserializeBinaryFromReader); + msg.setInstance(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.UpdateCoreLibrariesIndexReq.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.cc.arduino.cli.commands.UpdateCoreLibrariesIndexReq.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.UpdateCoreLibrariesIndexReq} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.cc.arduino.cli.commands.UpdateCoreLibrariesIndexReq.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getInstance(); + if (f != null) { + writer.writeMessage( + 1, + f, + commands_common_pb.Instance.serializeBinaryToWriter + ); + } +}; + + +/** + * optional Instance instance = 1; + * @return {?proto.cc.arduino.cli.commands.Instance} + */ +proto.cc.arduino.cli.commands.UpdateCoreLibrariesIndexReq.prototype.getInstance = function() { + return /** @type{?proto.cc.arduino.cli.commands.Instance} */ ( + jspb.Message.getWrapperField(this, commands_common_pb.Instance, 1)); +}; + + +/** + * @param {?proto.cc.arduino.cli.commands.Instance|undefined} value + * @return {!proto.cc.arduino.cli.commands.UpdateCoreLibrariesIndexReq} returns this +*/ +proto.cc.arduino.cli.commands.UpdateCoreLibrariesIndexReq.prototype.setInstance = function(value) { + return jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.cc.arduino.cli.commands.UpdateCoreLibrariesIndexReq} returns this + */ +proto.cc.arduino.cli.commands.UpdateCoreLibrariesIndexReq.prototype.clearInstance = function() { + return this.setInstance(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.cc.arduino.cli.commands.UpdateCoreLibrariesIndexReq.prototype.hasInstance = function() { + return jspb.Message.getField(this, 1) != 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_, 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.UpdateCoreLibrariesIndexResp.prototype.toObject = function(opt_includeInstance) { + return proto.cc.arduino.cli.commands.UpdateCoreLibrariesIndexResp.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.UpdateCoreLibrariesIndexResp} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.cc.arduino.cli.commands.UpdateCoreLibrariesIndexResp.toObject = function(includeInstance, msg) { + var f, obj = { + downloadProgress: (f = msg.getDownloadProgress()) && commands_common_pb.DownloadProgress.toObject(includeInstance, f) + }; + + 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.UpdateCoreLibrariesIndexResp} + */ +proto.cc.arduino.cli.commands.UpdateCoreLibrariesIndexResp.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.cc.arduino.cli.commands.UpdateCoreLibrariesIndexResp; + return proto.cc.arduino.cli.commands.UpdateCoreLibrariesIndexResp.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.UpdateCoreLibrariesIndexResp} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.cc.arduino.cli.commands.UpdateCoreLibrariesIndexResp} + */ +proto.cc.arduino.cli.commands.UpdateCoreLibrariesIndexResp.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new commands_common_pb.DownloadProgress; + reader.readMessage(value,commands_common_pb.DownloadProgress.deserializeBinaryFromReader); + msg.setDownloadProgress(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.UpdateCoreLibrariesIndexResp.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.cc.arduino.cli.commands.UpdateCoreLibrariesIndexResp.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.UpdateCoreLibrariesIndexResp} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.cc.arduino.cli.commands.UpdateCoreLibrariesIndexResp.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getDownloadProgress(); + if (f != null) { + writer.writeMessage( + 1, + f, + commands_common_pb.DownloadProgress.serializeBinaryToWriter + ); + } +}; + + +/** + * optional DownloadProgress download_progress = 1; + * @return {?proto.cc.arduino.cli.commands.DownloadProgress} + */ +proto.cc.arduino.cli.commands.UpdateCoreLibrariesIndexResp.prototype.getDownloadProgress = function() { + return /** @type{?proto.cc.arduino.cli.commands.DownloadProgress} */ ( + jspb.Message.getWrapperField(this, commands_common_pb.DownloadProgress, 1)); +}; + + +/** + * @param {?proto.cc.arduino.cli.commands.DownloadProgress|undefined} value + * @return {!proto.cc.arduino.cli.commands.UpdateCoreLibrariesIndexResp} returns this +*/ +proto.cc.arduino.cli.commands.UpdateCoreLibrariesIndexResp.prototype.setDownloadProgress = function(value) { + return jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.cc.arduino.cli.commands.UpdateCoreLibrariesIndexResp} returns this + */ +proto.cc.arduino.cli.commands.UpdateCoreLibrariesIndexResp.prototype.clearDownloadProgress = function() { + return this.setDownloadProgress(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.cc.arduino.cli.commands.UpdateCoreLibrariesIndexResp.prototype.hasDownloadProgress = function() { + return jspb.Message.getField(this, 1) != 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_, 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.OutdatedReq.prototype.toObject = function(opt_includeInstance) { + return proto.cc.arduino.cli.commands.OutdatedReq.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.OutdatedReq} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.cc.arduino.cli.commands.OutdatedReq.toObject = function(includeInstance, msg) { + var f, obj = { + instance: (f = msg.getInstance()) && commands_common_pb.Instance.toObject(includeInstance, f) + }; + + 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.OutdatedReq} + */ +proto.cc.arduino.cli.commands.OutdatedReq.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.cc.arduino.cli.commands.OutdatedReq; + return proto.cc.arduino.cli.commands.OutdatedReq.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.OutdatedReq} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.cc.arduino.cli.commands.OutdatedReq} + */ +proto.cc.arduino.cli.commands.OutdatedReq.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new commands_common_pb.Instance; + reader.readMessage(value,commands_common_pb.Instance.deserializeBinaryFromReader); + msg.setInstance(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.OutdatedReq.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.cc.arduino.cli.commands.OutdatedReq.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.OutdatedReq} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.cc.arduino.cli.commands.OutdatedReq.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getInstance(); + if (f != null) { + writer.writeMessage( + 1, + f, + commands_common_pb.Instance.serializeBinaryToWriter + ); + } +}; + + +/** + * optional Instance instance = 1; + * @return {?proto.cc.arduino.cli.commands.Instance} + */ +proto.cc.arduino.cli.commands.OutdatedReq.prototype.getInstance = function() { + return /** @type{?proto.cc.arduino.cli.commands.Instance} */ ( + jspb.Message.getWrapperField(this, commands_common_pb.Instance, 1)); +}; + + +/** + * @param {?proto.cc.arduino.cli.commands.Instance|undefined} value + * @return {!proto.cc.arduino.cli.commands.OutdatedReq} returns this +*/ +proto.cc.arduino.cli.commands.OutdatedReq.prototype.setInstance = function(value) { + return jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.cc.arduino.cli.commands.OutdatedReq} returns this + */ +proto.cc.arduino.cli.commands.OutdatedReq.prototype.clearInstance = function() { + return this.setInstance(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.cc.arduino.cli.commands.OutdatedReq.prototype.hasInstance = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.cc.arduino.cli.commands.OutdatedResp.repeatedFields_ = [1,2]; + + + +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_, 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.OutdatedResp.prototype.toObject = function(opt_includeInstance) { + return proto.cc.arduino.cli.commands.OutdatedResp.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.OutdatedResp} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.cc.arduino.cli.commands.OutdatedResp.toObject = function(includeInstance, msg) { + var f, obj = { + outdatedLibraryList: jspb.Message.toObjectList(msg.getOutdatedLibraryList(), + commands_lib_pb.InstalledLibrary.toObject, includeInstance), + outdatedPlatformList: jspb.Message.toObjectList(msg.getOutdatedPlatformList(), + commands_core_pb.Platform.toObject, includeInstance) + }; + + 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.OutdatedResp} + */ +proto.cc.arduino.cli.commands.OutdatedResp.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.cc.arduino.cli.commands.OutdatedResp; + return proto.cc.arduino.cli.commands.OutdatedResp.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.OutdatedResp} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.cc.arduino.cli.commands.OutdatedResp} + */ +proto.cc.arduino.cli.commands.OutdatedResp.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new commands_lib_pb.InstalledLibrary; + reader.readMessage(value,commands_lib_pb.InstalledLibrary.deserializeBinaryFromReader); + msg.addOutdatedLibrary(value); + break; + case 2: + var value = new commands_core_pb.Platform; + reader.readMessage(value,commands_core_pb.Platform.deserializeBinaryFromReader); + msg.addOutdatedPlatform(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.OutdatedResp.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.cc.arduino.cli.commands.OutdatedResp.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.OutdatedResp} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.cc.arduino.cli.commands.OutdatedResp.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getOutdatedLibraryList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 1, + f, + commands_lib_pb.InstalledLibrary.serializeBinaryToWriter + ); + } + f = message.getOutdatedPlatformList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 2, + f, + commands_core_pb.Platform.serializeBinaryToWriter + ); + } +}; + + +/** + * repeated InstalledLibrary outdated_library = 1; + * @return {!Array} + */ +proto.cc.arduino.cli.commands.OutdatedResp.prototype.getOutdatedLibraryList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, commands_lib_pb.InstalledLibrary, 1)); +}; + + +/** + * @param {!Array} value + * @return {!proto.cc.arduino.cli.commands.OutdatedResp} returns this +*/ +proto.cc.arduino.cli.commands.OutdatedResp.prototype.setOutdatedLibraryList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 1, value); +}; + + +/** + * @param {!proto.cc.arduino.cli.commands.InstalledLibrary=} opt_value + * @param {number=} opt_index + * @return {!proto.cc.arduino.cli.commands.InstalledLibrary} + */ +proto.cc.arduino.cli.commands.OutdatedResp.prototype.addOutdatedLibrary = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.cc.arduino.cli.commands.InstalledLibrary, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.cc.arduino.cli.commands.OutdatedResp} returns this + */ +proto.cc.arduino.cli.commands.OutdatedResp.prototype.clearOutdatedLibraryList = function() { + return this.setOutdatedLibraryList([]); +}; + + +/** + * repeated Platform outdated_platform = 2; + * @return {!Array} + */ +proto.cc.arduino.cli.commands.OutdatedResp.prototype.getOutdatedPlatformList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, commands_core_pb.Platform, 2)); +}; + + +/** + * @param {!Array} value + * @return {!proto.cc.arduino.cli.commands.OutdatedResp} returns this +*/ +proto.cc.arduino.cli.commands.OutdatedResp.prototype.setOutdatedPlatformList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 2, value); +}; + + +/** + * @param {!proto.cc.arduino.cli.commands.Platform=} opt_value + * @param {number=} opt_index + * @return {!proto.cc.arduino.cli.commands.Platform} + */ +proto.cc.arduino.cli.commands.OutdatedResp.prototype.addOutdatedPlatform = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 2, opt_value, proto.cc.arduino.cli.commands.Platform, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.cc.arduino.cli.commands.OutdatedResp} returns this + */ +proto.cc.arduino.cli.commands.OutdatedResp.prototype.clearOutdatedPlatformList = function() { + return this.setOutdatedPlatformList([]); +}; + + + + + +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_, 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.UpgradeReq.prototype.toObject = function(opt_includeInstance) { + return proto.cc.arduino.cli.commands.UpgradeReq.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.UpgradeReq} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.cc.arduino.cli.commands.UpgradeReq.toObject = function(includeInstance, msg) { + var f, obj = { + instance: (f = msg.getInstance()) && commands_common_pb.Instance.toObject(includeInstance, f) + }; + + 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.UpgradeReq} + */ +proto.cc.arduino.cli.commands.UpgradeReq.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.cc.arduino.cli.commands.UpgradeReq; + return proto.cc.arduino.cli.commands.UpgradeReq.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.UpgradeReq} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.cc.arduino.cli.commands.UpgradeReq} + */ +proto.cc.arduino.cli.commands.UpgradeReq.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new commands_common_pb.Instance; + reader.readMessage(value,commands_common_pb.Instance.deserializeBinaryFromReader); + msg.setInstance(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.UpgradeReq.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.cc.arduino.cli.commands.UpgradeReq.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.UpgradeReq} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.cc.arduino.cli.commands.UpgradeReq.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getInstance(); + if (f != null) { + writer.writeMessage( + 1, + f, + commands_common_pb.Instance.serializeBinaryToWriter + ); + } +}; + + +/** + * optional Instance instance = 1; + * @return {?proto.cc.arduino.cli.commands.Instance} + */ +proto.cc.arduino.cli.commands.UpgradeReq.prototype.getInstance = function() { + return /** @type{?proto.cc.arduino.cli.commands.Instance} */ ( + jspb.Message.getWrapperField(this, commands_common_pb.Instance, 1)); +}; + + +/** + * @param {?proto.cc.arduino.cli.commands.Instance|undefined} value + * @return {!proto.cc.arduino.cli.commands.UpgradeReq} returns this +*/ +proto.cc.arduino.cli.commands.UpgradeReq.prototype.setInstance = function(value) { + return jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.cc.arduino.cli.commands.UpgradeReq} returns this + */ +proto.cc.arduino.cli.commands.UpgradeReq.prototype.clearInstance = function() { + return this.setInstance(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.cc.arduino.cli.commands.UpgradeReq.prototype.hasInstance = function() { + return jspb.Message.getField(this, 1) != 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_, 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.UpgradeResp.prototype.toObject = function(opt_includeInstance) { + return proto.cc.arduino.cli.commands.UpgradeResp.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.UpgradeResp} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.cc.arduino.cli.commands.UpgradeResp.toObject = function(includeInstance, msg) { + var f, obj = { + progress: (f = msg.getProgress()) && commands_common_pb.DownloadProgress.toObject(includeInstance, f), + taskProgress: (f = msg.getTaskProgress()) && commands_common_pb.TaskProgress.toObject(includeInstance, f) + }; + + 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.UpgradeResp} + */ +proto.cc.arduino.cli.commands.UpgradeResp.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.cc.arduino.cli.commands.UpgradeResp; + return proto.cc.arduino.cli.commands.UpgradeResp.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.UpgradeResp} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.cc.arduino.cli.commands.UpgradeResp} + */ +proto.cc.arduino.cli.commands.UpgradeResp.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new commands_common_pb.DownloadProgress; + reader.readMessage(value,commands_common_pb.DownloadProgress.deserializeBinaryFromReader); + msg.setProgress(value); + break; + case 2: + var value = new commands_common_pb.TaskProgress; + reader.readMessage(value,commands_common_pb.TaskProgress.deserializeBinaryFromReader); + msg.setTaskProgress(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.UpgradeResp.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.cc.arduino.cli.commands.UpgradeResp.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.UpgradeResp} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.cc.arduino.cli.commands.UpgradeResp.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getProgress(); + if (f != null) { + writer.writeMessage( + 1, + f, + commands_common_pb.DownloadProgress.serializeBinaryToWriter + ); + } + f = message.getTaskProgress(); + if (f != null) { + writer.writeMessage( + 2, + f, + commands_common_pb.TaskProgress.serializeBinaryToWriter + ); + } +}; + + +/** + * optional DownloadProgress progress = 1; + * @return {?proto.cc.arduino.cli.commands.DownloadProgress} + */ +proto.cc.arduino.cli.commands.UpgradeResp.prototype.getProgress = function() { + return /** @type{?proto.cc.arduino.cli.commands.DownloadProgress} */ ( + jspb.Message.getWrapperField(this, commands_common_pb.DownloadProgress, 1)); +}; + + +/** + * @param {?proto.cc.arduino.cli.commands.DownloadProgress|undefined} value + * @return {!proto.cc.arduino.cli.commands.UpgradeResp} returns this +*/ +proto.cc.arduino.cli.commands.UpgradeResp.prototype.setProgress = function(value) { + return jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.cc.arduino.cli.commands.UpgradeResp} returns this + */ +proto.cc.arduino.cli.commands.UpgradeResp.prototype.clearProgress = function() { + return this.setProgress(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.cc.arduino.cli.commands.UpgradeResp.prototype.hasProgress = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional TaskProgress task_progress = 2; + * @return {?proto.cc.arduino.cli.commands.TaskProgress} + */ +proto.cc.arduino.cli.commands.UpgradeResp.prototype.getTaskProgress = function() { + return /** @type{?proto.cc.arduino.cli.commands.TaskProgress} */ ( + jspb.Message.getWrapperField(this, commands_common_pb.TaskProgress, 2)); +}; + + +/** + * @param {?proto.cc.arduino.cli.commands.TaskProgress|undefined} value + * @return {!proto.cc.arduino.cli.commands.UpgradeResp} returns this +*/ +proto.cc.arduino.cli.commands.UpgradeResp.prototype.setTaskProgress = function(value) { + return jspb.Message.setWrapperField(this, 2, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.cc.arduino.cli.commands.UpgradeResp} returns this + */ +proto.cc.arduino.cli.commands.UpgradeResp.prototype.clearTaskProgress = function() { + return this.setTaskProgress(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.cc.arduino.cli.commands.UpgradeResp.prototype.hasTaskProgress = function() { + return jspb.Message.getField(this, 2) != null; +}; + + + + + if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. @@ -2181,4 +3376,450 @@ proto.cc.arduino.cli.commands.VersionResp.prototype.setVersion = 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_, 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.LoadSketchReq.prototype.toObject = function(opt_includeInstance) { + return proto.cc.arduino.cli.commands.LoadSketchReq.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.LoadSketchReq} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.cc.arduino.cli.commands.LoadSketchReq.toObject = function(includeInstance, msg) { + var f, obj = { + instance: (f = msg.getInstance()) && commands_common_pb.Instance.toObject(includeInstance, f), + sketchPath: jspb.Message.getFieldWithDefault(msg, 2, "") + }; + + 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.LoadSketchReq} + */ +proto.cc.arduino.cli.commands.LoadSketchReq.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.cc.arduino.cli.commands.LoadSketchReq; + return proto.cc.arduino.cli.commands.LoadSketchReq.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.LoadSketchReq} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.cc.arduino.cli.commands.LoadSketchReq} + */ +proto.cc.arduino.cli.commands.LoadSketchReq.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new commands_common_pb.Instance; + reader.readMessage(value,commands_common_pb.Instance.deserializeBinaryFromReader); + msg.setInstance(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setSketchPath(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.LoadSketchReq.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.cc.arduino.cli.commands.LoadSketchReq.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.LoadSketchReq} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.cc.arduino.cli.commands.LoadSketchReq.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getInstance(); + if (f != null) { + writer.writeMessage( + 1, + f, + commands_common_pb.Instance.serializeBinaryToWriter + ); + } + f = message.getSketchPath(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } +}; + + +/** + * optional Instance instance = 1; + * @return {?proto.cc.arduino.cli.commands.Instance} + */ +proto.cc.arduino.cli.commands.LoadSketchReq.prototype.getInstance = function() { + return /** @type{?proto.cc.arduino.cli.commands.Instance} */ ( + jspb.Message.getWrapperField(this, commands_common_pb.Instance, 1)); +}; + + +/** + * @param {?proto.cc.arduino.cli.commands.Instance|undefined} value + * @return {!proto.cc.arduino.cli.commands.LoadSketchReq} returns this +*/ +proto.cc.arduino.cli.commands.LoadSketchReq.prototype.setInstance = function(value) { + return jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.cc.arduino.cli.commands.LoadSketchReq} returns this + */ +proto.cc.arduino.cli.commands.LoadSketchReq.prototype.clearInstance = function() { + return this.setInstance(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.cc.arduino.cli.commands.LoadSketchReq.prototype.hasInstance = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional string sketch_path = 2; + * @return {string} + */ +proto.cc.arduino.cli.commands.LoadSketchReq.prototype.getSketchPath = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.cc.arduino.cli.commands.LoadSketchReq} returns this + */ +proto.cc.arduino.cli.commands.LoadSketchReq.prototype.setSketchPath = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.cc.arduino.cli.commands.LoadSketchResp.repeatedFields_ = [3,4]; + + + +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_, 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.LoadSketchResp.prototype.toObject = function(opt_includeInstance) { + return proto.cc.arduino.cli.commands.LoadSketchResp.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.LoadSketchResp} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.cc.arduino.cli.commands.LoadSketchResp.toObject = function(includeInstance, msg) { + var f, obj = { + mainFile: jspb.Message.getFieldWithDefault(msg, 1, ""), + locationPath: jspb.Message.getFieldWithDefault(msg, 2, ""), + otherSketchFilesList: (f = jspb.Message.getRepeatedField(msg, 3)) == null ? undefined : f, + additionalFilesList: (f = jspb.Message.getRepeatedField(msg, 4)) == null ? undefined : f + }; + + 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.LoadSketchResp} + */ +proto.cc.arduino.cli.commands.LoadSketchResp.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.cc.arduino.cli.commands.LoadSketchResp; + return proto.cc.arduino.cli.commands.LoadSketchResp.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.LoadSketchResp} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.cc.arduino.cli.commands.LoadSketchResp} + */ +proto.cc.arduino.cli.commands.LoadSketchResp.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.setMainFile(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setLocationPath(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.addOtherSketchFiles(value); + break; + case 4: + var value = /** @type {string} */ (reader.readString()); + msg.addAdditionalFiles(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.LoadSketchResp.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.cc.arduino.cli.commands.LoadSketchResp.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.LoadSketchResp} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.cc.arduino.cli.commands.LoadSketchResp.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getMainFile(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } + f = message.getLocationPath(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } + f = message.getOtherSketchFilesList(); + if (f.length > 0) { + writer.writeRepeatedString( + 3, + f + ); + } + f = message.getAdditionalFilesList(); + if (f.length > 0) { + writer.writeRepeatedString( + 4, + f + ); + } +}; + + +/** + * optional string main_file = 1; + * @return {string} + */ +proto.cc.arduino.cli.commands.LoadSketchResp.prototype.getMainFile = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.cc.arduino.cli.commands.LoadSketchResp} returns this + */ +proto.cc.arduino.cli.commands.LoadSketchResp.prototype.setMainFile = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * optional string location_path = 2; + * @return {string} + */ +proto.cc.arduino.cli.commands.LoadSketchResp.prototype.getLocationPath = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.cc.arduino.cli.commands.LoadSketchResp} returns this + */ +proto.cc.arduino.cli.commands.LoadSketchResp.prototype.setLocationPath = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; + + +/** + * repeated string other_sketch_files = 3; + * @return {!Array} + */ +proto.cc.arduino.cli.commands.LoadSketchResp.prototype.getOtherSketchFilesList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 3)); +}; + + +/** + * @param {!Array} value + * @return {!proto.cc.arduino.cli.commands.LoadSketchResp} returns this + */ +proto.cc.arduino.cli.commands.LoadSketchResp.prototype.setOtherSketchFilesList = function(value) { + return jspb.Message.setField(this, 3, value || []); +}; + + +/** + * @param {string} value + * @param {number=} opt_index + * @return {!proto.cc.arduino.cli.commands.LoadSketchResp} returns this + */ +proto.cc.arduino.cli.commands.LoadSketchResp.prototype.addOtherSketchFiles = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 3, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.cc.arduino.cli.commands.LoadSketchResp} returns this + */ +proto.cc.arduino.cli.commands.LoadSketchResp.prototype.clearOtherSketchFilesList = function() { + return this.setOtherSketchFilesList([]); +}; + + +/** + * repeated string additional_files = 4; + * @return {!Array} + */ +proto.cc.arduino.cli.commands.LoadSketchResp.prototype.getAdditionalFilesList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 4)); +}; + + +/** + * @param {!Array} value + * @return {!proto.cc.arduino.cli.commands.LoadSketchResp} returns this + */ +proto.cc.arduino.cli.commands.LoadSketchResp.prototype.setAdditionalFilesList = function(value) { + return jspb.Message.setField(this, 4, value || []); +}; + + +/** + * @param {string} value + * @param {number=} opt_index + * @return {!proto.cc.arduino.cli.commands.LoadSketchResp} returns this + */ +proto.cc.arduino.cli.commands.LoadSketchResp.prototype.addAdditionalFiles = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 4, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.cc.arduino.cli.commands.LoadSketchResp} returns this + */ +proto.cc.arduino.cli.commands.LoadSketchResp.prototype.clearAdditionalFilesList = function() { + return this.setAdditionalFilesList([]); +}; + + goog.object.extend(exports, proto.cc.arduino.cli.commands); diff --git a/arduino-ide-extension/src/node/cli-protocol/commands/common_pb.d.ts b/arduino-ide-extension/src/node/cli-protocol/commands/common_pb.d.ts index b26d75a3..2d4a7a01 100644 --- a/arduino-ide-extension/src/node/cli-protocol/commands/common_pb.d.ts +++ b/arduino-ide-extension/src/node/cli-protocol/commands/common_pb.d.ts @@ -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}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + 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, + } +} diff --git a/arduino-ide-extension/src/node/cli-protocol/commands/common_pb.js b/arduino-ide-extension/src/node/cli-protocol/commands/common_pb.js index 21142a98..10bab9eb 100644 --- a/arduino-ide-extension/src/node/cli-protocol/commands/common_pb.js +++ b/arduino-ide-extension/src/node/cli-protocol/commands/common_pb.js @@ -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_, 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); diff --git a/arduino-ide-extension/src/node/cli-protocol/commands/core_pb.d.ts b/arduino-ide-extension/src/node/cli-protocol/commands/core_pb.d.ts index 9dc6a9b4..5c5cdba0 100644 --- a/arduino-ide-extension/src/node/cli-protocol/commands/core_pb.d.ts +++ b/arduino-ide-extension/src/node/cli-protocol/commands/core_pb.d.ts @@ -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, } } diff --git a/arduino-ide-extension/src/node/cli-protocol/commands/core_pb.js b/arduino-ide-extension/src/node/cli-protocol/commands/core_pb.js index 88f25873..54eaa277 100644 --- a/arduino-ide-extension/src/node/cli-protocol/commands/core_pb.js +++ b/arduino-ide-extension/src/node/cli-protocol/commands/core_pb.js @@ -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); +}; + + diff --git a/arduino-ide-extension/src/node/cli-protocol/commands/lib_pb.d.ts b/arduino-ide-extension/src/node/cli-protocol/commands/lib_pb.d.ts index 3471822d..b77c7fe4 100644 --- a/arduino-ide-extension/src/node/cli-protocol/commands/lib_pb.d.ts +++ b/arduino-ide-extension/src/node/cli-protocol/commands/lib_pb.d.ts @@ -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; + setExamplesList(value: Array): 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, } } diff --git a/arduino-ide-extension/src/node/cli-protocol/commands/lib_pb.js b/arduino-ide-extension/src/node/cli-protocol/commands/lib_pb.js index b202da8d..522a070d 100644 --- a/arduino-ide-extension/src/node/cli-protocol/commands/lib_pb.js +++ b/arduino-ide-extension/src/node/cli-protocol/commands/lib_pb.js @@ -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} * @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} + */ +proto.cc.arduino.cli.commands.Library.prototype.getExamplesList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 26)); +}; + + +/** + * @param {!Array} 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} */ diff --git a/arduino-ide-extension/src/node/cli-protocol/commands/upload_pb.d.ts b/arduino-ide-extension/src/node/cli-protocol/commands/upload_pb.d.ts index 6a004981..548b2826 100644 --- a/arduino-ide-extension/src/node/cli-protocol/commands/upload_pb.d.ts +++ b/arduino-ide-extension/src/node/cli-protocol/commands/upload_pb.d.ts @@ -195,9 +195,9 @@ export namespace ListProgrammersAvailableForUploadReq { export class ListProgrammersAvailableForUploadResp extends jspb.Message { clearProgrammersList(): void; - getProgrammersList(): Array; - setProgrammersList(value: Array): ListProgrammersAvailableForUploadResp; - addProgrammers(value?: Programmer, index?: number): Programmer; + getProgrammersList(): Array; + setProgrammersList(value: Array): 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, - } -} - -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}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - 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, } } diff --git a/arduino-ide-extension/src/node/cli-protocol/commands/upload_pb.js b/arduino-ide-extension/src/node/cli-protocol/commands/upload_pb.js index ff16e620..c5767ae9 100644 --- a/arduino-ide-extension/src/node/cli-protocol/commands/upload_pb.js +++ b/arduino-ide-extension/src/node/cli-protocol/commands/upload_pb.js @@ -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} */ ( - 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_, 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); diff --git a/arduino-ide-extension/src/node/cli-protocol/monitor/monitor_grpc_pb.js b/arduino-ide-extension/src/node/cli-protocol/monitor/monitor_grpc_pb.js index d646ec33..d011f180 100644 --- a/arduino-ide-extension/src/node/cli-protocol/monitor/monitor_grpc_pb.js +++ b/arduino-ide-extension/src/node/cli-protocol/monitor/monitor_grpc_pb.js @@ -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. diff --git a/arduino-ide-extension/src/node/examples-service-impl.ts b/arduino-ide-extension/src/node/examples-service-impl.ts index e865ddca..98c89a6c 100644 --- a/arduino-ide-extension/src/node/examples-service-impl.ts +++ b/arduino-ide-extension/src/node/examples-service-impl.ts @@ -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 { + async builtIns(): Promise { 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 { + // 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 { + 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 { if (!await fs.exists(path)) { throw new Error('Examples are not available'); } diff --git a/arduino-ide-extension/src/node/library-service-impl.ts b/arduino-ide-extension/src/node/library-service-server-impl.ts similarity index 80% rename from arduino-ide-extension/src/node/library-service-impl.ts rename to arduino-ide-extension/src/node/library-service-server-impl.ts index 644e8b49..af77c7d4 100644 --- a/arduino-ide-extension/src/node/library-service-impl.ts +++ b/arduino-ide-extension/src/node/library-service-server-impl.ts @@ -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((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 { @@ -236,11 +212,14 @@ export class LibraryServiceImpl implements LibraryService { } -function toLibrary(tpl: Partial, release: LibraryRelease, availableVersions: string[]): LibraryPackage { +function toLibrary(pkg: Partial, release: LibraryRelease, availableVersions: string[]): LibraryPackage { return { name: '', + label: '', + exampleUris: [], installable: false, - ...tpl, + location: 0, + ...pkg, author: release.getAuthor(), availableVersions, diff --git a/arduino-ide-extension/src/test/browser/boards-service-client-impl.test.ts b/arduino-ide-extension/src/test/browser/boards-service-client-impl.test.ts index 992de377..b4f68e4b 100644 --- a/arduino-ide-extension/src/test/browser/boards-service-client-impl.test.ts +++ b/arduino-ide-extension/src/test/browser/boards-service-client-impl.test.ts @@ -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; }