github.com/simpleiot/simpleiot@v0.18.3/frontend/lib/protobuf/serial_pb.js (about) 1 // source: serial.proto 2 /** 3 * @fileoverview 4 * @enhanceable 5 * @suppress {missingRequire} reports error on implicit type usages. 6 * @suppress {messageConventions} JS Compiler reports an error if a variable or 7 * field starts with 'MSG_' and isn't a translatable message. 8 * @public 9 */ 10 // GENERATED CODE -- DO NOT EDIT! 11 /* eslint-disable */ 12 // @ts-nocheck 13 14 var jspb = require('google-protobuf'); 15 var goog = jspb; 16 var global = 17 (typeof globalThis !== 'undefined' && globalThis) || 18 (typeof window !== 'undefined' && window) || 19 (typeof global !== 'undefined' && global) || 20 (typeof self !== 'undefined' && self) || 21 (function () { return this; }).call(null) || 22 Function('return this')(); 23 24 var point_pb = require('./point_pb.js'); 25 goog.object.extend(proto, point_pb); 26 goog.exportSymbol('proto.pb.Serial', null, global); 27 /** 28 * Generated by JsPbCodeGenerator. 29 * @param {Array=} opt_data Optional initial data array, typically from a 30 * server response, or constructed directly in Javascript. The array is used 31 * in place and becomes part of the constructed object. It is not cloned. 32 * If no data is provided, the constructed object will be empty, but still 33 * valid. 34 * @extends {jspb.Message} 35 * @constructor 36 */ 37 proto.pb.Serial = function(opt_data) { 38 jspb.Message.initialize(this, opt_data, 0, -1, proto.pb.Serial.repeatedFields_, null); 39 }; 40 goog.inherits(proto.pb.Serial, jspb.Message); 41 if (goog.DEBUG && !COMPILED) { 42 /** 43 * @public 44 * @override 45 */ 46 proto.pb.Serial.displayName = 'proto.pb.Serial'; 47 } 48 49 /** 50 * List of repeated fields within this message type. 51 * @private {!Array<number>} 52 * @const 53 */ 54 proto.pb.Serial.repeatedFields_ = [2]; 55 56 57 58 if (jspb.Message.GENERATE_TO_OBJECT) { 59 /** 60 * Creates an object representation of this proto. 61 * Field names that are reserved in JavaScript and will be renamed to pb_name. 62 * Optional fields that are not set will be set to undefined. 63 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. 64 * For the list of reserved names please see: 65 * net/proto2/compiler/js/internal/generator.cc#kKeyword. 66 * @param {boolean=} opt_includeInstance Deprecated. whether to include the 67 * JSPB instance for transitional soy proto support: 68 * http://goto/soy-param-migration 69 * @return {!Object} 70 */ 71 proto.pb.Serial.prototype.toObject = function(opt_includeInstance) { 72 return proto.pb.Serial.toObject(opt_includeInstance, this); 73 }; 74 75 76 /** 77 * Static version of the {@see toObject} method. 78 * @param {boolean|undefined} includeInstance Deprecated. Whether to include 79 * the JSPB instance for transitional soy proto support: 80 * http://goto/soy-param-migration 81 * @param {!proto.pb.Serial} msg The msg instance to transform. 82 * @return {!Object} 83 * @suppress {unusedLocalVariables} f is only used for nested messages 84 */ 85 proto.pb.Serial.toObject = function(includeInstance, msg) { 86 var f, obj = { 87 subject: jspb.Message.getFieldWithDefault(msg, 1, ""), 88 pointsList: jspb.Message.toObjectList(msg.getPointsList(), 89 point_pb.SerialPoint.toObject, includeInstance) 90 }; 91 92 if (includeInstance) { 93 obj.$jspbMessageInstance = msg; 94 } 95 return obj; 96 }; 97 } 98 99 100 /** 101 * Deserializes binary data (in protobuf wire format). 102 * @param {jspb.ByteSource} bytes The bytes to deserialize. 103 * @return {!proto.pb.Serial} 104 */ 105 proto.pb.Serial.deserializeBinary = function(bytes) { 106 var reader = new jspb.BinaryReader(bytes); 107 var msg = new proto.pb.Serial; 108 return proto.pb.Serial.deserializeBinaryFromReader(msg, reader); 109 }; 110 111 112 /** 113 * Deserializes binary data (in protobuf wire format) from the 114 * given reader into the given message object. 115 * @param {!proto.pb.Serial} msg The message object to deserialize into. 116 * @param {!jspb.BinaryReader} reader The BinaryReader to use. 117 * @return {!proto.pb.Serial} 118 */ 119 proto.pb.Serial.deserializeBinaryFromReader = function(msg, reader) { 120 while (reader.nextField()) { 121 if (reader.isEndGroup()) { 122 break; 123 } 124 var field = reader.getFieldNumber(); 125 switch (field) { 126 case 1: 127 var value = /** @type {string} */ (reader.readString()); 128 msg.setSubject(value); 129 break; 130 case 2: 131 var value = new point_pb.SerialPoint; 132 reader.readMessage(value,point_pb.SerialPoint.deserializeBinaryFromReader); 133 msg.addPoints(value); 134 break; 135 default: 136 reader.skipField(); 137 break; 138 } 139 } 140 return msg; 141 }; 142 143 144 /** 145 * Serializes the message to binary data (in protobuf wire format). 146 * @return {!Uint8Array} 147 */ 148 proto.pb.Serial.prototype.serializeBinary = function() { 149 var writer = new jspb.BinaryWriter(); 150 proto.pb.Serial.serializeBinaryToWriter(this, writer); 151 return writer.getResultBuffer(); 152 }; 153 154 155 /** 156 * Serializes the given message to binary data (in protobuf wire 157 * format), writing to the given BinaryWriter. 158 * @param {!proto.pb.Serial} message 159 * @param {!jspb.BinaryWriter} writer 160 * @suppress {unusedLocalVariables} f is only used for nested messages 161 */ 162 proto.pb.Serial.serializeBinaryToWriter = function(message, writer) { 163 var f = undefined; 164 f = message.getSubject(); 165 if (f.length > 0) { 166 writer.writeString( 167 1, 168 f 169 ); 170 } 171 f = message.getPointsList(); 172 if (f.length > 0) { 173 writer.writeRepeatedMessage( 174 2, 175 f, 176 point_pb.SerialPoint.serializeBinaryToWriter 177 ); 178 } 179 }; 180 181 182 /** 183 * optional string subject = 1; 184 * @return {string} 185 */ 186 proto.pb.Serial.prototype.getSubject = function() { 187 return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); 188 }; 189 190 191 /** 192 * @param {string} value 193 * @return {!proto.pb.Serial} returns this 194 */ 195 proto.pb.Serial.prototype.setSubject = function(value) { 196 return jspb.Message.setProto3StringField(this, 1, value); 197 }; 198 199 200 /** 201 * repeated SerialPoint points = 2; 202 * @return {!Array<!proto.pb.SerialPoint>} 203 */ 204 proto.pb.Serial.prototype.getPointsList = function() { 205 return /** @type{!Array<!proto.pb.SerialPoint>} */ ( 206 jspb.Message.getRepeatedWrapperField(this, point_pb.SerialPoint, 2)); 207 }; 208 209 210 /** 211 * @param {!Array<!proto.pb.SerialPoint>} value 212 * @return {!proto.pb.Serial} returns this 213 */ 214 proto.pb.Serial.prototype.setPointsList = function(value) { 215 return jspb.Message.setRepeatedWrapperField(this, 2, value); 216 }; 217 218 219 /** 220 * @param {!proto.pb.SerialPoint=} opt_value 221 * @param {number=} opt_index 222 * @return {!proto.pb.SerialPoint} 223 */ 224 proto.pb.Serial.prototype.addPoints = function(opt_value, opt_index) { 225 return jspb.Message.addToRepeatedWrapperField(this, 2, opt_value, proto.pb.SerialPoint, opt_index); 226 }; 227 228 229 /** 230 * Clears the list making it empty but non-null. 231 * @return {!proto.pb.Serial} returns this 232 */ 233 proto.pb.Serial.prototype.clearPointsList = function() { 234 return this.setPointsList([]); 235 }; 236 237 238 goog.object.extend(exports, proto.pb);