Updated the TS/JS API with the monitoring.

Signed-off-by: Akos Kitta <kittaakos@typefox.io>
This commit is contained in:
Akos Kitta 2019-07-30 10:57:23 +02:00
parent db78c8ac2d
commit 27dc6f9816
4 changed files with 870 additions and 0 deletions

View File

@ -0,0 +1,40 @@
// package: cc.arduino.cli.monitor
// file: monitor/monitor.proto
/* tslint:disable */
import * as grpc from "@grpc/grpc-js";
import * as monitor_monitor_pb from "../monitor/monitor_pb";
import * as google_protobuf_struct_pb from "google-protobuf/google/protobuf/struct_pb";
interface IMonitorService extends grpc.ServiceDefinition<grpc.UntypedServiceImplementation> {
streamingOpen: IMonitorService_IStreamingOpen;
}
interface IMonitorService_IStreamingOpen extends grpc.MethodDefinition<monitor_monitor_pb.StreamingOpenReq, monitor_monitor_pb.StreamingOpenResp> {
path: string; // "/cc.arduino.cli.monitor.Monitor/StreamingOpen"
requestStream: boolean; // true
responseStream: boolean; // true
requestSerialize: grpc.serialize<monitor_monitor_pb.StreamingOpenReq>;
requestDeserialize: grpc.deserialize<monitor_monitor_pb.StreamingOpenReq>;
responseSerialize: grpc.serialize<monitor_monitor_pb.StreamingOpenResp>;
responseDeserialize: grpc.deserialize<monitor_monitor_pb.StreamingOpenResp>;
}
export const MonitorService: IMonitorService;
export interface IMonitorServer {
streamingOpen: grpc.handleBidiStreamingCall<monitor_monitor_pb.StreamingOpenReq, monitor_monitor_pb.StreamingOpenResp>;
}
export interface IMonitorClient {
streamingOpen(): grpc.ClientDuplexStream<monitor_monitor_pb.StreamingOpenReq, monitor_monitor_pb.StreamingOpenResp>;
streamingOpen(options: Partial<grpc.CallOptions>): grpc.ClientDuplexStream<monitor_monitor_pb.StreamingOpenReq, monitor_monitor_pb.StreamingOpenResp>;
streamingOpen(metadata: grpc.Metadata, options?: Partial<grpc.CallOptions>): grpc.ClientDuplexStream<monitor_monitor_pb.StreamingOpenReq, monitor_monitor_pb.StreamingOpenResp>;
}
export class MonitorClient extends grpc.Client implements IMonitorClient {
constructor(address: string, credentials: grpc.ChannelCredentials, options?: object);
public streamingOpen(options?: Partial<grpc.CallOptions>): grpc.ClientDuplexStream<monitor_monitor_pb.StreamingOpenReq, monitor_monitor_pb.StreamingOpenResp>;
public streamingOpen(metadata?: grpc.Metadata, options?: Partial<grpc.CallOptions>): grpc.ClientDuplexStream<monitor_monitor_pb.StreamingOpenReq, monitor_monitor_pb.StreamingOpenResp>;
}

View File

@ -0,0 +1,62 @@
// GENERATED CODE -- DO NOT EDIT!
// Original file comments:
// This file is part of arduino-cli.
//
// Copyright 2019 ARDUINO SA (http://www.arduino.cc/)
//
// This software is released under the GNU General Public License version 3,
// which covers the main part of arduino-cli.
// The terms of this license can be found at:
// https://www.gnu.org/licenses/gpl-3.0.en.html
//
// You can be released from the requirements of the above licenses by purchasing
// a commercial license. Buying such a license is mandatory if you want to
// modify or otherwise use the software for commercial activities involving the
// Arduino software without disclosing the source code of your own applications.
// To purchase a commercial license, send an email to license@arduino.cc.
//
'use strict';
var grpc = require('@grpc/grpc-js');
var monitor_monitor_pb = require('../monitor/monitor_pb.js');
var google_protobuf_struct_pb = require('google-protobuf/google/protobuf/struct_pb.js');
function serialize_cc_arduino_cli_monitor_StreamingOpenReq(arg) {
if (!(arg instanceof monitor_monitor_pb.StreamingOpenReq)) {
throw new Error('Expected argument of type cc.arduino.cli.monitor.StreamingOpenReq');
}
return Buffer.from(arg.serializeBinary());
}
function deserialize_cc_arduino_cli_monitor_StreamingOpenReq(buffer_arg) {
return monitor_monitor_pb.StreamingOpenReq.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_cc_arduino_cli_monitor_StreamingOpenResp(arg) {
if (!(arg instanceof monitor_monitor_pb.StreamingOpenResp)) {
throw new Error('Expected argument of type cc.arduino.cli.monitor.StreamingOpenResp');
}
return Buffer.from(arg.serializeBinary());
}
function deserialize_cc_arduino_cli_monitor_StreamingOpenResp(buffer_arg) {
return monitor_monitor_pb.StreamingOpenResp.deserializeBinary(new Uint8Array(buffer_arg));
}
// Service that abstract a Monitor usage
var MonitorService = exports.MonitorService = {
streamingOpen: {
path: '/cc.arduino.cli.monitor.Monitor/StreamingOpen',
requestStream: true,
responseStream: true,
requestType: monitor_monitor_pb.StreamingOpenReq,
responseType: monitor_monitor_pb.StreamingOpenResp,
requestSerialize: serialize_cc_arduino_cli_monitor_StreamingOpenReq,
requestDeserialize: deserialize_cc_arduino_cli_monitor_StreamingOpenReq,
responseSerialize: serialize_cc_arduino_cli_monitor_StreamingOpenResp,
responseDeserialize: deserialize_cc_arduino_cli_monitor_StreamingOpenResp,
},
};
exports.MonitorClient = grpc.makeGenericClientConstructor(MonitorService);

View File

@ -0,0 +1,112 @@
// package: cc.arduino.cli.monitor
// file: monitor/monitor.proto
/* tslint:disable */
import * as jspb from "google-protobuf";
import * as google_protobuf_struct_pb from "google-protobuf/google/protobuf/struct_pb";
export class StreamingOpenReq extends jspb.Message {
hasMonitorconfig(): boolean;
clearMonitorconfig(): void;
getMonitorconfig(): MonitorConfig | undefined;
setMonitorconfig(value?: MonitorConfig): void;
hasData(): boolean;
clearData(): void;
getData(): Uint8Array | string;
getData_asU8(): Uint8Array;
getData_asB64(): string;
setData(value: Uint8Array | string): void;
getContentCase(): StreamingOpenReq.ContentCase;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): StreamingOpenReq.AsObject;
static toObject(includeInstance: boolean, msg: StreamingOpenReq): StreamingOpenReq.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: StreamingOpenReq, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): StreamingOpenReq;
static deserializeBinaryFromReader(message: StreamingOpenReq, reader: jspb.BinaryReader): StreamingOpenReq;
}
export namespace StreamingOpenReq {
export type AsObject = {
monitorconfig?: MonitorConfig.AsObject,
data: Uint8Array | string,
}
export enum ContentCase {
CONTENT_NOT_SET = 0,
MONITORCONFIG = 1,
DATA = 2,
}
}
export class MonitorConfig extends jspb.Message {
getTarget(): string;
setTarget(value: string): void;
getType(): MonitorConfig.TargetType;
setType(value: MonitorConfig.TargetType): void;
hasAdditionalconfig(): boolean;
clearAdditionalconfig(): void;
getAdditionalconfig(): google_protobuf_struct_pb.Struct | undefined;
setAdditionalconfig(value?: google_protobuf_struct_pb.Struct): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): MonitorConfig.AsObject;
static toObject(includeInstance: boolean, msg: MonitorConfig): MonitorConfig.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: MonitorConfig, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): MonitorConfig;
static deserializeBinaryFromReader(message: MonitorConfig, reader: jspb.BinaryReader): MonitorConfig;
}
export namespace MonitorConfig {
export type AsObject = {
target: string,
type: MonitorConfig.TargetType,
additionalconfig?: google_protobuf_struct_pb.Struct.AsObject,
}
export enum TargetType {
SERIAL = 0,
}
}
export class StreamingOpenResp extends jspb.Message {
getData(): Uint8Array | string;
getData_asU8(): Uint8Array;
getData_asB64(): string;
setData(value: Uint8Array | string): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): StreamingOpenResp.AsObject;
static toObject(includeInstance: boolean, msg: StreamingOpenResp): StreamingOpenResp.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: StreamingOpenResp, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): StreamingOpenResp;
static deserializeBinaryFromReader(message: StreamingOpenResp, reader: jspb.BinaryReader): StreamingOpenResp;
}
export namespace StreamingOpenResp {
export type AsObject = {
data: Uint8Array | string,
}
}

View File

@ -0,0 +1,656 @@
/**
* @fileoverview
* @enhanceable
* @suppress {messageConventions} JS Compiler reports an error if a variable or
* field starts with 'MSG_' and isn't a translatable message.
* @public
*/
// GENERATED CODE -- DO NOT EDIT!
var jspb = require('google-protobuf');
var goog = jspb;
var global = Function('return this')();
var google_protobuf_struct_pb = require('google-protobuf/google/protobuf/struct_pb.js');
goog.object.extend(proto, google_protobuf_struct_pb);
goog.exportSymbol('proto.cc.arduino.cli.monitor.MonitorConfig', null, global);
goog.exportSymbol('proto.cc.arduino.cli.monitor.MonitorConfig.TargetType', null, global);
goog.exportSymbol('proto.cc.arduino.cli.monitor.StreamingOpenReq', null, global);
goog.exportSymbol('proto.cc.arduino.cli.monitor.StreamingOpenResp', null, global);
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
* server response, or constructed directly in Javascript. The array is used
* in place and becomes part of the constructed object. It is not cloned.
* If no data is provided, the constructed object will be empty, but still
* valid.
* @extends {jspb.Message}
* @constructor
*/
proto.cc.arduino.cli.monitor.StreamingOpenReq = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, proto.cc.arduino.cli.monitor.StreamingOpenReq.oneofGroups_);
};
goog.inherits(proto.cc.arduino.cli.monitor.StreamingOpenReq, jspb.Message);
if (goog.DEBUG && !COMPILED) {
proto.cc.arduino.cli.monitor.StreamingOpenReq.displayName = 'proto.cc.arduino.cli.monitor.StreamingOpenReq';
}
/**
* Oneof group definitions for this message. Each group defines the field
* numbers belonging to that group. When of these fields' value is set, all
* other fields in the group are cleared. During deserialization, if multiple
* fields are encountered for a group, only the last value seen will be kept.
* @private {!Array<!Array<number>>}
* @const
*/
proto.cc.arduino.cli.monitor.StreamingOpenReq.oneofGroups_ = [[1,2]];
/**
* @enum {number}
*/
proto.cc.arduino.cli.monitor.StreamingOpenReq.ContentCase = {
CONTENT_NOT_SET: 0,
MONITORCONFIG: 1,
DATA: 2
};
/**
* @return {proto.cc.arduino.cli.monitor.StreamingOpenReq.ContentCase}
*/
proto.cc.arduino.cli.monitor.StreamingOpenReq.prototype.getContentCase = function() {
return /** @type {proto.cc.arduino.cli.monitor.StreamingOpenReq.ContentCase} */(jspb.Message.computeOneofCase(this, proto.cc.arduino.cli.monitor.StreamingOpenReq.oneofGroups_[0]));
};
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.cc.arduino.cli.monitor.StreamingOpenReq.prototype.toObject = function(opt_includeInstance) {
return proto.cc.arduino.cli.monitor.StreamingOpenReq.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.cc.arduino.cli.monitor.StreamingOpenReq} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.cc.arduino.cli.monitor.StreamingOpenReq.toObject = function(includeInstance, msg) {
var f, obj = {
monitorconfig: (f = msg.getMonitorconfig()) && proto.cc.arduino.cli.monitor.MonitorConfig.toObject(includeInstance, f),
data: msg.getData_asB64()
};
if (includeInstance) {
obj.$jspbMessageInstance = msg;
}
return obj;
};
}
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.cc.arduino.cli.monitor.StreamingOpenReq}
*/
proto.cc.arduino.cli.monitor.StreamingOpenReq.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.cc.arduino.cli.monitor.StreamingOpenReq;
return proto.cc.arduino.cli.monitor.StreamingOpenReq.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.cc.arduino.cli.monitor.StreamingOpenReq} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.cc.arduino.cli.monitor.StreamingOpenReq}
*/
proto.cc.arduino.cli.monitor.StreamingOpenReq.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = new proto.cc.arduino.cli.monitor.MonitorConfig;
reader.readMessage(value,proto.cc.arduino.cli.monitor.MonitorConfig.deserializeBinaryFromReader);
msg.setMonitorconfig(value);
break;
case 2:
var value = /** @type {!Uint8Array} */ (reader.readBytes());
msg.setData(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.cc.arduino.cli.monitor.StreamingOpenReq.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.cc.arduino.cli.monitor.StreamingOpenReq.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.cc.arduino.cli.monitor.StreamingOpenReq} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.cc.arduino.cli.monitor.StreamingOpenReq.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getMonitorconfig();
if (f != null) {
writer.writeMessage(
1,
f,
proto.cc.arduino.cli.monitor.MonitorConfig.serializeBinaryToWriter
);
}
f = /** @type {!(string|Uint8Array)} */ (jspb.Message.getField(message, 2));
if (f != null) {
writer.writeBytes(
2,
f
);
}
};
/**
* optional MonitorConfig monitorConfig = 1;
* @return {?proto.cc.arduino.cli.monitor.MonitorConfig}
*/
proto.cc.arduino.cli.monitor.StreamingOpenReq.prototype.getMonitorconfig = function() {
return /** @type{?proto.cc.arduino.cli.monitor.MonitorConfig} */ (
jspb.Message.getWrapperField(this, proto.cc.arduino.cli.monitor.MonitorConfig, 1));
};
/** @param {?proto.cc.arduino.cli.monitor.MonitorConfig|undefined} value */
proto.cc.arduino.cli.monitor.StreamingOpenReq.prototype.setMonitorconfig = function(value) {
jspb.Message.setOneofWrapperField(this, 1, proto.cc.arduino.cli.monitor.StreamingOpenReq.oneofGroups_[0], value);
};
proto.cc.arduino.cli.monitor.StreamingOpenReq.prototype.clearMonitorconfig = function() {
this.setMonitorconfig(undefined);
};
/**
* Returns whether this field is set.
* @return {boolean}
*/
proto.cc.arduino.cli.monitor.StreamingOpenReq.prototype.hasMonitorconfig = function() {
return jspb.Message.getField(this, 1) != null;
};
/**
* optional bytes data = 2;
* @return {!(string|Uint8Array)}
*/
proto.cc.arduino.cli.monitor.StreamingOpenReq.prototype.getData = function() {
return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 2, ""));
};
/**
* optional bytes data = 2;
* This is a type-conversion wrapper around `getData()`
* @return {string}
*/
proto.cc.arduino.cli.monitor.StreamingOpenReq.prototype.getData_asB64 = function() {
return /** @type {string} */ (jspb.Message.bytesAsB64(
this.getData()));
};
/**
* optional bytes data = 2;
* Note that Uint8Array is not supported on all browsers.
* @see http://caniuse.com/Uint8Array
* This is a type-conversion wrapper around `getData()`
* @return {!Uint8Array}
*/
proto.cc.arduino.cli.monitor.StreamingOpenReq.prototype.getData_asU8 = function() {
return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8(
this.getData()));
};
/** @param {!(string|Uint8Array)} value */
proto.cc.arduino.cli.monitor.StreamingOpenReq.prototype.setData = function(value) {
jspb.Message.setOneofField(this, 2, proto.cc.arduino.cli.monitor.StreamingOpenReq.oneofGroups_[0], value);
};
proto.cc.arduino.cli.monitor.StreamingOpenReq.prototype.clearData = function() {
jspb.Message.setOneofField(this, 2, proto.cc.arduino.cli.monitor.StreamingOpenReq.oneofGroups_[0], undefined);
};
/**
* Returns whether this field is set.
* @return {boolean}
*/
proto.cc.arduino.cli.monitor.StreamingOpenReq.prototype.hasData = function() {
return jspb.Message.getField(this, 2) != 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.cc.arduino.cli.monitor.MonitorConfig = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.cc.arduino.cli.monitor.MonitorConfig, jspb.Message);
if (goog.DEBUG && !COMPILED) {
proto.cc.arduino.cli.monitor.MonitorConfig.displayName = 'proto.cc.arduino.cli.monitor.MonitorConfig';
}
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.cc.arduino.cli.monitor.MonitorConfig.prototype.toObject = function(opt_includeInstance) {
return proto.cc.arduino.cli.monitor.MonitorConfig.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.cc.arduino.cli.monitor.MonitorConfig} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.cc.arduino.cli.monitor.MonitorConfig.toObject = function(includeInstance, msg) {
var f, obj = {
target: jspb.Message.getFieldWithDefault(msg, 1, ""),
type: jspb.Message.getFieldWithDefault(msg, 2, 0),
additionalconfig: (f = msg.getAdditionalconfig()) && google_protobuf_struct_pb.Struct.toObject(includeInstance, f)
};
if (includeInstance) {
obj.$jspbMessageInstance = msg;
}
return obj;
};
}
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.cc.arduino.cli.monitor.MonitorConfig}
*/
proto.cc.arduino.cli.monitor.MonitorConfig.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.cc.arduino.cli.monitor.MonitorConfig;
return proto.cc.arduino.cli.monitor.MonitorConfig.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.cc.arduino.cli.monitor.MonitorConfig} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.cc.arduino.cli.monitor.MonitorConfig}
*/
proto.cc.arduino.cli.monitor.MonitorConfig.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = /** @type {string} */ (reader.readString());
msg.setTarget(value);
break;
case 2:
var value = /** @type {!proto.cc.arduino.cli.monitor.MonitorConfig.TargetType} */ (reader.readEnum());
msg.setType(value);
break;
case 3:
var value = new google_protobuf_struct_pb.Struct;
reader.readMessage(value,google_protobuf_struct_pb.Struct.deserializeBinaryFromReader);
msg.setAdditionalconfig(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.cc.arduino.cli.monitor.MonitorConfig.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.cc.arduino.cli.monitor.MonitorConfig.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.cc.arduino.cli.monitor.MonitorConfig} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.cc.arduino.cli.monitor.MonitorConfig.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getTarget();
if (f.length > 0) {
writer.writeString(
1,
f
);
}
f = message.getType();
if (f !== 0.0) {
writer.writeEnum(
2,
f
);
}
f = message.getAdditionalconfig();
if (f != null) {
writer.writeMessage(
3,
f,
google_protobuf_struct_pb.Struct.serializeBinaryToWriter
);
}
};
/**
* @enum {number}
*/
proto.cc.arduino.cli.monitor.MonitorConfig.TargetType = {
SERIAL: 0
};
/**
* optional string target = 1;
* @return {string}
*/
proto.cc.arduino.cli.monitor.MonitorConfig.prototype.getTarget = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
};
/** @param {string} value */
proto.cc.arduino.cli.monitor.MonitorConfig.prototype.setTarget = function(value) {
jspb.Message.setProto3StringField(this, 1, value);
};
/**
* optional TargetType type = 2;
* @return {!proto.cc.arduino.cli.monitor.MonitorConfig.TargetType}
*/
proto.cc.arduino.cli.monitor.MonitorConfig.prototype.getType = function() {
return /** @type {!proto.cc.arduino.cli.monitor.MonitorConfig.TargetType} */ (jspb.Message.getFieldWithDefault(this, 2, 0));
};
/** @param {!proto.cc.arduino.cli.monitor.MonitorConfig.TargetType} value */
proto.cc.arduino.cli.monitor.MonitorConfig.prototype.setType = function(value) {
jspb.Message.setProto3EnumField(this, 2, value);
};
/**
* optional google.protobuf.Struct additionalConfig = 3;
* @return {?proto.google.protobuf.Struct}
*/
proto.cc.arduino.cli.monitor.MonitorConfig.prototype.getAdditionalconfig = function() {
return /** @type{?proto.google.protobuf.Struct} */ (
jspb.Message.getWrapperField(this, google_protobuf_struct_pb.Struct, 3));
};
/** @param {?proto.google.protobuf.Struct|undefined} value */
proto.cc.arduino.cli.monitor.MonitorConfig.prototype.setAdditionalconfig = function(value) {
jspb.Message.setWrapperField(this, 3, value);
};
proto.cc.arduino.cli.monitor.MonitorConfig.prototype.clearAdditionalconfig = function() {
this.setAdditionalconfig(undefined);
};
/**
* Returns whether this field is set.
* @return {boolean}
*/
proto.cc.arduino.cli.monitor.MonitorConfig.prototype.hasAdditionalconfig = function() {
return jspb.Message.getField(this, 3) != 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.cc.arduino.cli.monitor.StreamingOpenResp = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.cc.arduino.cli.monitor.StreamingOpenResp, jspb.Message);
if (goog.DEBUG && !COMPILED) {
proto.cc.arduino.cli.monitor.StreamingOpenResp.displayName = 'proto.cc.arduino.cli.monitor.StreamingOpenResp';
}
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.cc.arduino.cli.monitor.StreamingOpenResp.prototype.toObject = function(opt_includeInstance) {
return proto.cc.arduino.cli.monitor.StreamingOpenResp.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.cc.arduino.cli.monitor.StreamingOpenResp} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.cc.arduino.cli.monitor.StreamingOpenResp.toObject = function(includeInstance, msg) {
var f, obj = {
data: msg.getData_asB64()
};
if (includeInstance) {
obj.$jspbMessageInstance = msg;
}
return obj;
};
}
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.cc.arduino.cli.monitor.StreamingOpenResp}
*/
proto.cc.arduino.cli.monitor.StreamingOpenResp.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.cc.arduino.cli.monitor.StreamingOpenResp;
return proto.cc.arduino.cli.monitor.StreamingOpenResp.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.cc.arduino.cli.monitor.StreamingOpenResp} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.cc.arduino.cli.monitor.StreamingOpenResp}
*/
proto.cc.arduino.cli.monitor.StreamingOpenResp.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = /** @type {!Uint8Array} */ (reader.readBytes());
msg.setData(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.cc.arduino.cli.monitor.StreamingOpenResp.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.cc.arduino.cli.monitor.StreamingOpenResp.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.cc.arduino.cli.monitor.StreamingOpenResp} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.cc.arduino.cli.monitor.StreamingOpenResp.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getData_asU8();
if (f.length > 0) {
writer.writeBytes(
1,
f
);
}
};
/**
* optional bytes data = 1;
* @return {!(string|Uint8Array)}
*/
proto.cc.arduino.cli.monitor.StreamingOpenResp.prototype.getData = function() {
return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
};
/**
* optional bytes data = 1;
* This is a type-conversion wrapper around `getData()`
* @return {string}
*/
proto.cc.arduino.cli.monitor.StreamingOpenResp.prototype.getData_asB64 = function() {
return /** @type {string} */ (jspb.Message.bytesAsB64(
this.getData()));
};
/**
* optional bytes data = 1;
* Note that Uint8Array is not supported on all browsers.
* @see http://caniuse.com/Uint8Array
* This is a type-conversion wrapper around `getData()`
* @return {!Uint8Array}
*/
proto.cc.arduino.cli.monitor.StreamingOpenResp.prototype.getData_asU8 = function() {
return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8(
this.getData()));
};
/** @param {!(string|Uint8Array)} value */
proto.cc.arduino.cli.monitor.StreamingOpenResp.prototype.setData = function(value) {
jspb.Message.setProto3BytesField(this, 1, value);
};
goog.object.extend(exports, proto.cc.arduino.cli.monitor);