Implemented library search and installation

This commit is contained in:
Christian Weichel
2019-05-07 17:04:37 +02:00
parent 50c1c7dcb2
commit 2f7d26ded9
13 changed files with 738 additions and 94 deletions

View File

@@ -32,6 +32,7 @@ interface IArduinoCoreService extends grpc.ServiceDefinition<grpc.UntypedService
libraryUninstall: IArduinoCoreService_ILibraryUninstall;
libraryUpgradeAll: IArduinoCoreService_ILibraryUpgradeAll;
librarySearch: IArduinoCoreService_ILibrarySearch;
libraryList: IArduinoCoreService_ILibraryList;
}
interface IArduinoCoreService_IInit extends grpc.MethodDefinition<commands_pb.InitReq, commands_pb.InitResp> {
@@ -205,6 +206,15 @@ interface IArduinoCoreService_ILibrarySearch extends grpc.MethodDefinition<lib_p
responseSerialize: grpc.serialize<lib_pb.LibrarySearchResp>;
responseDeserialize: grpc.deserialize<lib_pb.LibrarySearchResp>;
}
interface IArduinoCoreService_ILibraryList extends grpc.MethodDefinition<lib_pb.LibraryListReq, lib_pb.LibraryListResp> {
path: string; // "/arduino.ArduinoCore/LibraryList"
requestStream: boolean; // false
responseStream: boolean; // false
requestSerialize: grpc.serialize<lib_pb.LibraryListReq>;
requestDeserialize: grpc.deserialize<lib_pb.LibraryListReq>;
responseSerialize: grpc.serialize<lib_pb.LibraryListResp>;
responseDeserialize: grpc.deserialize<lib_pb.LibraryListResp>;
}
export const ArduinoCoreService: IArduinoCoreService;
@@ -228,6 +238,7 @@ export interface IArduinoCoreServer {
libraryUninstall: grpc.handleServerStreamingCall<lib_pb.LibraryUninstallReq, lib_pb.LibraryUninstallResp>;
libraryUpgradeAll: grpc.handleServerStreamingCall<lib_pb.LibraryUpgradeAllReq, lib_pb.LibraryUpgradeAllResp>;
librarySearch: grpc.handleUnaryCall<lib_pb.LibrarySearchReq, lib_pb.LibrarySearchResp>;
libraryList: grpc.handleUnaryCall<lib_pb.LibraryListReq, lib_pb.LibraryListResp>;
}
export interface IArduinoCoreClient {
@@ -277,6 +288,9 @@ export interface IArduinoCoreClient {
librarySearch(request: lib_pb.LibrarySearchReq, callback: (error: grpc.ServiceError | null, response: lib_pb.LibrarySearchResp) => void): grpc.ClientUnaryCall;
librarySearch(request: lib_pb.LibrarySearchReq, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: lib_pb.LibrarySearchResp) => void): grpc.ClientUnaryCall;
librarySearch(request: lib_pb.LibrarySearchReq, metadata: grpc.Metadata, options: Partial<grpc.CallOptions>, callback: (error: grpc.ServiceError | null, response: lib_pb.LibrarySearchResp) => void): grpc.ClientUnaryCall;
libraryList(request: lib_pb.LibraryListReq, callback: (error: grpc.ServiceError | null, response: lib_pb.LibraryListResp) => void): grpc.ClientUnaryCall;
libraryList(request: lib_pb.LibraryListReq, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: lib_pb.LibraryListResp) => void): grpc.ClientUnaryCall;
libraryList(request: lib_pb.LibraryListReq, metadata: grpc.Metadata, options: Partial<grpc.CallOptions>, callback: (error: grpc.ServiceError | null, response: lib_pb.LibraryListResp) => void): grpc.ClientUnaryCall;
}
export class ArduinoCoreClient extends grpc.Client implements IArduinoCoreClient {
@@ -327,4 +341,7 @@ export class ArduinoCoreClient extends grpc.Client implements IArduinoCoreClient
public librarySearch(request: lib_pb.LibrarySearchReq, callback: (error: grpc.ServiceError | null, response: lib_pb.LibrarySearchResp) => void): grpc.ClientUnaryCall;
public librarySearch(request: lib_pb.LibrarySearchReq, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: lib_pb.LibrarySearchResp) => void): grpc.ClientUnaryCall;
public librarySearch(request: lib_pb.LibrarySearchReq, metadata: grpc.Metadata, options: Partial<grpc.CallOptions>, callback: (error: grpc.ServiceError | null, response: lib_pb.LibrarySearchResp) => void): grpc.ClientUnaryCall;
public libraryList(request: lib_pb.LibraryListReq, callback: (error: grpc.ServiceError | null, response: lib_pb.LibraryListResp) => void): grpc.ClientUnaryCall;
public libraryList(request: lib_pb.LibraryListReq, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: lib_pb.LibraryListResp) => void): grpc.ClientUnaryCall;
public libraryList(request: lib_pb.LibraryListReq, metadata: grpc.Metadata, options: Partial<grpc.CallOptions>, callback: (error: grpc.ServiceError | null, response: lib_pb.LibraryListResp) => void): grpc.ClientUnaryCall;
}

View File

@@ -182,6 +182,28 @@ function deserialize_arduino_LibraryInstallResp(buffer_arg) {
return lib_pb.LibraryInstallResp.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_arduino_LibraryListReq(arg) {
if (!(arg instanceof lib_pb.LibraryListReq)) {
throw new Error('Expected argument of type arduino.LibraryListReq');
}
return Buffer.from(arg.serializeBinary());
}
function deserialize_arduino_LibraryListReq(buffer_arg) {
return lib_pb.LibraryListReq.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_arduino_LibraryListResp(arg) {
if (!(arg instanceof lib_pb.LibraryListResp)) {
throw new Error('Expected argument of type arduino.LibraryListResp');
}
return Buffer.from(arg.serializeBinary());
}
function deserialize_arduino_LibraryListResp(buffer_arg) {
return lib_pb.LibraryListResp.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_arduino_LibrarySearchReq(arg) {
if (!(arg instanceof lib_pb.LibrarySearchReq)) {
throw new Error('Expected argument of type arduino.LibrarySearchReq');
@@ -666,6 +688,17 @@ var ArduinoCoreService = exports.ArduinoCoreService = {
responseSerialize: serialize_arduino_LibrarySearchResp,
responseDeserialize: deserialize_arduino_LibrarySearchResp,
},
libraryList: {
path: '/arduino.ArduinoCore/LibraryList',
requestStream: false,
responseStream: false,
requestType: lib_pb.LibraryListReq,
responseType: lib_pb.LibraryListResp,
requestSerialize: serialize_arduino_LibraryListReq,
requestDeserialize: deserialize_arduino_LibraryListReq,
responseSerialize: serialize_arduino_LibraryListResp,
responseDeserialize: deserialize_arduino_LibraryListResp,
},
};
exports.ArduinoCoreClient = grpc.makeGenericClientConstructor(ArduinoCoreService);

View File

@@ -325,6 +325,81 @@ export namespace SearchLibraryOutput {
}
}
export class LibraryListReq extends jspb.Message {
hasInstance(): boolean;
clearInstance(): void;
getInstance(): common_pb.Instance | undefined;
setInstance(value?: common_pb.Instance): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): LibraryListReq.AsObject;
static toObject(includeInstance: boolean, msg: LibraryListReq): LibraryListReq.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: LibraryListReq, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): LibraryListReq;
static deserializeBinaryFromReader(message: LibraryListReq, reader: jspb.BinaryReader): LibraryListReq;
}
export namespace LibraryListReq {
export type AsObject = {
instance?: common_pb.Instance.AsObject,
}
}
export class LibraryListResp extends jspb.Message {
clearLibrariesList(): void;
getLibrariesList(): Array<InstalledLibrary>;
setLibrariesList(value: Array<InstalledLibrary>): void;
addLibraries(value?: InstalledLibrary, index?: number): InstalledLibrary;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): LibraryListResp.AsObject;
static toObject(includeInstance: boolean, msg: LibraryListResp): LibraryListResp.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: LibraryListResp, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): LibraryListResp;
static deserializeBinaryFromReader(message: LibraryListResp, reader: jspb.BinaryReader): LibraryListResp;
}
export namespace LibraryListResp {
export type AsObject = {
librariesList: Array<InstalledLibrary.AsObject>,
}
}
export class InstalledLibrary extends jspb.Message {
getName(): string;
setName(value: string): void;
hasInstalled(): boolean;
clearInstalled(): void;
getInstalled(): LibraryRelease | undefined;
setInstalled(value?: LibraryRelease): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): InstalledLibrary.AsObject;
static toObject(includeInstance: boolean, msg: InstalledLibrary): InstalledLibrary.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: InstalledLibrary, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): InstalledLibrary;
static deserializeBinaryFromReader(message: InstalledLibrary, reader: jspb.BinaryReader): InstalledLibrary;
}
export namespace InstalledLibrary {
export type AsObject = {
name: string,
installed?: LibraryRelease.AsObject,
}
}
export class LibraryRelease extends jspb.Message {
getAuthor(): string;
setAuthor(value: string): void;

View File

@@ -14,10 +14,13 @@ var global = Function('return this')();
var common_pb = require('./common_pb.js');
goog.object.extend(proto, common_pb);
goog.exportSymbol('proto.arduino.DownloadResource', null, global);
goog.exportSymbol('proto.arduino.InstalledLibrary', null, global);
goog.exportSymbol('proto.arduino.LibraryDownloadReq', null, global);
goog.exportSymbol('proto.arduino.LibraryDownloadResp', null, global);
goog.exportSymbol('proto.arduino.LibraryInstallReq', null, global);
goog.exportSymbol('proto.arduino.LibraryInstallResp', null, global);
goog.exportSymbol('proto.arduino.LibraryListReq', null, global);
goog.exportSymbol('proto.arduino.LibraryListResp', null, global);
goog.exportSymbol('proto.arduino.LibraryRelease', null, global);
goog.exportSymbol('proto.arduino.LibrarySearchReq', null, global);
goog.exportSymbol('proto.arduino.LibrarySearchResp', null, global);
@@ -2147,6 +2150,519 @@ proto.arduino.SearchLibraryOutput.prototype.hasLatest = function() {
/**
* 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.arduino.LibraryListReq = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.arduino.LibraryListReq, jspb.Message);
if (goog.DEBUG && !COMPILED) {
proto.arduino.LibraryListReq.displayName = 'proto.arduino.LibraryListReq';
}
if (jspb.Message.GENERATE_TO_OBJECT) {
/**
* Creates an object representation of this proto suitable for use in Soy templates.
* Field names that are reserved in JavaScript and will be renamed to pb_name.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS.
* @param {boolean=} opt_includeInstance Whether to include the JSPB instance
* for transitional soy proto support: http://goto/soy-param-migration
* @return {!Object}
*/
proto.arduino.LibraryListReq.prototype.toObject = function(opt_includeInstance) {
return proto.arduino.LibraryListReq.toObject(opt_includeInstance, this);
};
/**
* Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Whether to include the JSPB
* instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.arduino.LibraryListReq} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.arduino.LibraryListReq.toObject = function(includeInstance, msg) {
var f, obj = {
instance: (f = msg.getInstance()) && 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.arduino.LibraryListReq}
*/
proto.arduino.LibraryListReq.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.arduino.LibraryListReq;
return proto.arduino.LibraryListReq.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.arduino.LibraryListReq} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.arduino.LibraryListReq}
*/
proto.arduino.LibraryListReq.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = new common_pb.Instance;
reader.readMessage(value,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.arduino.LibraryListReq.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.arduino.LibraryListReq.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.arduino.LibraryListReq} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.arduino.LibraryListReq.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getInstance();
if (f != null) {
writer.writeMessage(
1,
f,
common_pb.Instance.serializeBinaryToWriter
);
}
};
/**
* optional Instance instance = 1;
* @return {?proto.arduino.Instance}
*/
proto.arduino.LibraryListReq.prototype.getInstance = function() {
return /** @type{?proto.arduino.Instance} */ (
jspb.Message.getWrapperField(this, common_pb.Instance, 1));
};
/** @param {?proto.arduino.Instance|undefined} value */
proto.arduino.LibraryListReq.prototype.setInstance = function(value) {
jspb.Message.setWrapperField(this, 1, value);
};
proto.arduino.LibraryListReq.prototype.clearInstance = function() {
this.setInstance(undefined);
};
/**
* Returns whether this field is set.
* @return {boolean}
*/
proto.arduino.LibraryListReq.prototype.hasInstance = function() {
return jspb.Message.getField(this, 1) != null;
};
/**
* 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.arduino.LibraryListResp = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, proto.arduino.LibraryListResp.repeatedFields_, null);
};
goog.inherits(proto.arduino.LibraryListResp, jspb.Message);
if (goog.DEBUG && !COMPILED) {
proto.arduino.LibraryListResp.displayName = 'proto.arduino.LibraryListResp';
}
/**
* List of repeated fields within this message type.
* @private {!Array<number>}
* @const
*/
proto.arduino.LibraryListResp.repeatedFields_ = [1];
if (jspb.Message.GENERATE_TO_OBJECT) {
/**
* Creates an object representation of this proto suitable for use in Soy templates.
* Field names that are reserved in JavaScript and will be renamed to pb_name.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS.
* @param {boolean=} opt_includeInstance Whether to include the JSPB instance
* for transitional soy proto support: http://goto/soy-param-migration
* @return {!Object}
*/
proto.arduino.LibraryListResp.prototype.toObject = function(opt_includeInstance) {
return proto.arduino.LibraryListResp.toObject(opt_includeInstance, this);
};
/**
* Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Whether to include the JSPB
* instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.arduino.LibraryListResp} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.arduino.LibraryListResp.toObject = function(includeInstance, msg) {
var f, obj = {
librariesList: jspb.Message.toObjectList(msg.getLibrariesList(),
proto.arduino.InstalledLibrary.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.arduino.LibraryListResp}
*/
proto.arduino.LibraryListResp.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.arduino.LibraryListResp;
return proto.arduino.LibraryListResp.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.arduino.LibraryListResp} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.arduino.LibraryListResp}
*/
proto.arduino.LibraryListResp.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = new proto.arduino.InstalledLibrary;
reader.readMessage(value,proto.arduino.InstalledLibrary.deserializeBinaryFromReader);
msg.addLibraries(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.arduino.LibraryListResp.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.arduino.LibraryListResp.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.arduino.LibraryListResp} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.arduino.LibraryListResp.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getLibrariesList();
if (f.length > 0) {
writer.writeRepeatedMessage(
1,
f,
proto.arduino.InstalledLibrary.serializeBinaryToWriter
);
}
};
/**
* repeated InstalledLibrary libraries = 1;
* @return {!Array<!proto.arduino.InstalledLibrary>}
*/
proto.arduino.LibraryListResp.prototype.getLibrariesList = function() {
return /** @type{!Array<!proto.arduino.InstalledLibrary>} */ (
jspb.Message.getRepeatedWrapperField(this, proto.arduino.InstalledLibrary, 1));
};
/** @param {!Array<!proto.arduino.InstalledLibrary>} value */
proto.arduino.LibraryListResp.prototype.setLibrariesList = function(value) {
jspb.Message.setRepeatedWrapperField(this, 1, value);
};
/**
* @param {!proto.arduino.InstalledLibrary=} opt_value
* @param {number=} opt_index
* @return {!proto.arduino.InstalledLibrary}
*/
proto.arduino.LibraryListResp.prototype.addLibraries = function(opt_value, opt_index) {
return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.arduino.InstalledLibrary, opt_index);
};
proto.arduino.LibraryListResp.prototype.clearLibrariesList = function() {
this.setLibrariesList([]);
};
/**
* 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.arduino.InstalledLibrary = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.arduino.InstalledLibrary, jspb.Message);
if (goog.DEBUG && !COMPILED) {
proto.arduino.InstalledLibrary.displayName = 'proto.arduino.InstalledLibrary';
}
if (jspb.Message.GENERATE_TO_OBJECT) {
/**
* Creates an object representation of this proto suitable for use in Soy templates.
* Field names that are reserved in JavaScript and will be renamed to pb_name.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS.
* @param {boolean=} opt_includeInstance Whether to include the JSPB instance
* for transitional soy proto support: http://goto/soy-param-migration
* @return {!Object}
*/
proto.arduino.InstalledLibrary.prototype.toObject = function(opt_includeInstance) {
return proto.arduino.InstalledLibrary.toObject(opt_includeInstance, this);
};
/**
* Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Whether to include the JSPB
* instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.arduino.InstalledLibrary} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.arduino.InstalledLibrary.toObject = function(includeInstance, msg) {
var f, obj = {
name: jspb.Message.getFieldWithDefault(msg, 1, ""),
installed: (f = msg.getInstalled()) && proto.arduino.LibraryRelease.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.arduino.InstalledLibrary}
*/
proto.arduino.InstalledLibrary.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.arduino.InstalledLibrary;
return proto.arduino.InstalledLibrary.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.arduino.InstalledLibrary} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.arduino.InstalledLibrary}
*/
proto.arduino.InstalledLibrary.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.setName(value);
break;
case 2:
var value = new proto.arduino.LibraryRelease;
reader.readMessage(value,proto.arduino.LibraryRelease.deserializeBinaryFromReader);
msg.setInstalled(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.arduino.InstalledLibrary.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.arduino.InstalledLibrary.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.arduino.InstalledLibrary} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.arduino.InstalledLibrary.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getName();
if (f.length > 0) {
writer.writeString(
1,
f
);
}
f = message.getInstalled();
if (f != null) {
writer.writeMessage(
2,
f,
proto.arduino.LibraryRelease.serializeBinaryToWriter
);
}
};
/**
* optional string name = 1;
* @return {string}
*/
proto.arduino.InstalledLibrary.prototype.getName = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
};
/** @param {string} value */
proto.arduino.InstalledLibrary.prototype.setName = function(value) {
jspb.Message.setProto3StringField(this, 1, value);
};
/**
* optional LibraryRelease installed = 2;
* @return {?proto.arduino.LibraryRelease}
*/
proto.arduino.InstalledLibrary.prototype.getInstalled = function() {
return /** @type{?proto.arduino.LibraryRelease} */ (
jspb.Message.getWrapperField(this, proto.arduino.LibraryRelease, 2));
};
/** @param {?proto.arduino.LibraryRelease|undefined} value */
proto.arduino.InstalledLibrary.prototype.setInstalled = function(value) {
jspb.Message.setWrapperField(this, 2, value);
};
proto.arduino.InstalledLibrary.prototype.clearInstalled = function() {
this.setInstalled(undefined);
};
/**
* Returns whether this field is set.
* @return {boolean}
*/
proto.arduino.InstalledLibrary.prototype.hasInstalled = function() {
return jspb.Message.getField(this, 2) != null;
};
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a