-
Notifications
You must be signed in to change notification settings - Fork 1
/
fk-data.js
10047 lines (9455 loc) · 477 KB
/
fk-data.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*eslint-disable block-scoped-var, no-redeclare, no-control-regex, no-prototype-builtins*/
(function(global, factory) { /* global define, require, module */
/* AMD */ if (typeof define === 'function' && define.amd)
define(["protobufjs/minimal"], factory);
/* CommonJS */ else if (typeof require === 'function' && typeof module === 'object' && module && module.exports)
module.exports = factory(require("protobufjs/minimal"));
})(this, function($protobuf) {
"use strict";
// Common aliases
var $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util;
// Exported root namespace
var $root = $protobuf.roots["default"] || ($protobuf.roots["default"] = {});
$root.fk_data = (function() {
/**
* Namespace fk_data.
* @exports fk_data
* @namespace
*/
var fk_data = {};
fk_data.DeviceLocation = (function() {
/**
* Properties of a DeviceLocation.
* @memberof fk_data
* @interface IDeviceLocation
* @property {number|null} [enabled] DeviceLocation enabled
* @property {number|null} [fix] DeviceLocation fix
* @property {number|Long|null} [time] DeviceLocation time
* @property {number|null} [longitude] DeviceLocation longitude
* @property {number|null} [latitude] DeviceLocation latitude
* @property {number|null} [altitude] DeviceLocation altitude
* @property {Array.<number>|null} [coordinates] DeviceLocation coordinates
* @property {number|null} [satellites] DeviceLocation satellites
* @property {number|null} [hdop] DeviceLocation hdop
*/
/**
* Constructs a new DeviceLocation.
* @memberof fk_data
* @classdesc Represents a DeviceLocation.
* @implements IDeviceLocation
* @constructor
* @param {fk_data.IDeviceLocation=} [properties] Properties to set
*/
function DeviceLocation(properties) {
this.coordinates = [];
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
}
/**
* DeviceLocation enabled.
* @member {number} enabled
* @memberof fk_data.DeviceLocation
* @instance
*/
DeviceLocation.prototype.enabled = 0;
/**
* DeviceLocation fix.
* @member {number} fix
* @memberof fk_data.DeviceLocation
* @instance
*/
DeviceLocation.prototype.fix = 0;
/**
* DeviceLocation time.
* @member {number|Long} time
* @memberof fk_data.DeviceLocation
* @instance
*/
DeviceLocation.prototype.time = $util.Long ? $util.Long.fromBits(0,0,false) : 0;
/**
* DeviceLocation longitude.
* @member {number} longitude
* @memberof fk_data.DeviceLocation
* @instance
*/
DeviceLocation.prototype.longitude = 0;
/**
* DeviceLocation latitude.
* @member {number} latitude
* @memberof fk_data.DeviceLocation
* @instance
*/
DeviceLocation.prototype.latitude = 0;
/**
* DeviceLocation altitude.
* @member {number} altitude
* @memberof fk_data.DeviceLocation
* @instance
*/
DeviceLocation.prototype.altitude = 0;
/**
* DeviceLocation coordinates.
* @member {Array.<number>} coordinates
* @memberof fk_data.DeviceLocation
* @instance
*/
DeviceLocation.prototype.coordinates = $util.emptyArray;
/**
* DeviceLocation satellites.
* @member {number} satellites
* @memberof fk_data.DeviceLocation
* @instance
*/
DeviceLocation.prototype.satellites = 0;
/**
* DeviceLocation hdop.
* @member {number} hdop
* @memberof fk_data.DeviceLocation
* @instance
*/
DeviceLocation.prototype.hdop = 0;
/**
* Creates a new DeviceLocation instance using the specified properties.
* @function create
* @memberof fk_data.DeviceLocation
* @static
* @param {fk_data.IDeviceLocation=} [properties] Properties to set
* @returns {fk_data.DeviceLocation} DeviceLocation instance
*/
DeviceLocation.create = function create(properties) {
return new DeviceLocation(properties);
};
/**
* Encodes the specified DeviceLocation message. Does not implicitly {@link fk_data.DeviceLocation.verify|verify} messages.
* @function encode
* @memberof fk_data.DeviceLocation
* @static
* @param {fk_data.IDeviceLocation} message DeviceLocation message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
DeviceLocation.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.fix != null && message.hasOwnProperty("fix"))
writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.fix);
if (message.time != null && message.hasOwnProperty("time"))
writer.uint32(/* id 2, wireType 0 =*/16).int64(message.time);
if (message.longitude != null && message.hasOwnProperty("longitude"))
writer.uint32(/* id 3, wireType 5 =*/29).float(message.longitude);
if (message.latitude != null && message.hasOwnProperty("latitude"))
writer.uint32(/* id 4, wireType 5 =*/37).float(message.latitude);
if (message.altitude != null && message.hasOwnProperty("altitude"))
writer.uint32(/* id 5, wireType 5 =*/45).float(message.altitude);
if (message.coordinates != null && message.coordinates.length) {
writer.uint32(/* id 6, wireType 2 =*/50).fork();
for (var i = 0; i < message.coordinates.length; ++i)
writer.float(message.coordinates[i]);
writer.ldelim();
}
if (message.enabled != null && message.hasOwnProperty("enabled"))
writer.uint32(/* id 7, wireType 0 =*/56).uint32(message.enabled);
if (message.satellites != null && message.hasOwnProperty("satellites"))
writer.uint32(/* id 8, wireType 0 =*/64).uint32(message.satellites);
if (message.hdop != null && message.hasOwnProperty("hdop"))
writer.uint32(/* id 9, wireType 0 =*/72).uint32(message.hdop);
return writer;
};
/**
* Encodes the specified DeviceLocation message, length delimited. Does not implicitly {@link fk_data.DeviceLocation.verify|verify} messages.
* @function encodeDelimited
* @memberof fk_data.DeviceLocation
* @static
* @param {fk_data.IDeviceLocation} message DeviceLocation message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
DeviceLocation.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes a DeviceLocation message from the specified reader or buffer.
* @function decode
* @memberof fk_data.DeviceLocation
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {fk_data.DeviceLocation} DeviceLocation
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
DeviceLocation.decode = function decode(reader, length) {
if (!(reader instanceof $Reader))
reader = $Reader.create(reader);
var end = length === undefined ? reader.len : reader.pos + length, message = new $root.fk_data.DeviceLocation();
while (reader.pos < end) {
var tag = reader.uint32();
switch (tag >>> 3) {
case 7:
message.enabled = reader.uint32();
break;
case 1:
message.fix = reader.uint32();
break;
case 2:
message.time = reader.int64();
break;
case 3:
message.longitude = reader.float();
break;
case 4:
message.latitude = reader.float();
break;
case 5:
message.altitude = reader.float();
break;
case 6:
if (!(message.coordinates && message.coordinates.length))
message.coordinates = [];
if ((tag & 7) === 2) {
var end2 = reader.uint32() + reader.pos;
while (reader.pos < end2)
message.coordinates.push(reader.float());
} else
message.coordinates.push(reader.float());
break;
case 8:
message.satellites = reader.uint32();
break;
case 9:
message.hdop = reader.uint32();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes a DeviceLocation message from the specified reader or buffer, length delimited.
* @function decodeDelimited
* @memberof fk_data.DeviceLocation
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {fk_data.DeviceLocation} DeviceLocation
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
DeviceLocation.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = new $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies a DeviceLocation message.
* @function verify
* @memberof fk_data.DeviceLocation
* @static
* @param {Object.<string,*>} message Plain object to verify
* @returns {string|null} `null` if valid, otherwise the reason why it is not
*/
DeviceLocation.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
if (message.enabled != null && message.hasOwnProperty("enabled"))
if (!$util.isInteger(message.enabled))
return "enabled: integer expected";
if (message.fix != null && message.hasOwnProperty("fix"))
if (!$util.isInteger(message.fix))
return "fix: integer expected";
if (message.time != null && message.hasOwnProperty("time"))
if (!$util.isInteger(message.time) && !(message.time && $util.isInteger(message.time.low) && $util.isInteger(message.time.high)))
return "time: integer|Long expected";
if (message.longitude != null && message.hasOwnProperty("longitude"))
if (typeof message.longitude !== "number")
return "longitude: number expected";
if (message.latitude != null && message.hasOwnProperty("latitude"))
if (typeof message.latitude !== "number")
return "latitude: number expected";
if (message.altitude != null && message.hasOwnProperty("altitude"))
if (typeof message.altitude !== "number")
return "altitude: number expected";
if (message.coordinates != null && message.hasOwnProperty("coordinates")) {
if (!Array.isArray(message.coordinates))
return "coordinates: array expected";
for (var i = 0; i < message.coordinates.length; ++i)
if (typeof message.coordinates[i] !== "number")
return "coordinates: number[] expected";
}
if (message.satellites != null && message.hasOwnProperty("satellites"))
if (!$util.isInteger(message.satellites))
return "satellites: integer expected";
if (message.hdop != null && message.hasOwnProperty("hdop"))
if (!$util.isInteger(message.hdop))
return "hdop: integer expected";
return null;
};
/**
* Creates a DeviceLocation message from a plain object. Also converts values to their respective internal types.
* @function fromObject
* @memberof fk_data.DeviceLocation
* @static
* @param {Object.<string,*>} object Plain object
* @returns {fk_data.DeviceLocation} DeviceLocation
*/
DeviceLocation.fromObject = function fromObject(object) {
if (object instanceof $root.fk_data.DeviceLocation)
return object;
var message = new $root.fk_data.DeviceLocation();
if (object.enabled != null)
message.enabled = object.enabled >>> 0;
if (object.fix != null)
message.fix = object.fix >>> 0;
if (object.time != null)
if ($util.Long)
(message.time = $util.Long.fromValue(object.time)).unsigned = false;
else if (typeof object.time === "string")
message.time = parseInt(object.time, 10);
else if (typeof object.time === "number")
message.time = object.time;
else if (typeof object.time === "object")
message.time = new $util.LongBits(object.time.low >>> 0, object.time.high >>> 0).toNumber();
if (object.longitude != null)
message.longitude = Number(object.longitude);
if (object.latitude != null)
message.latitude = Number(object.latitude);
if (object.altitude != null)
message.altitude = Number(object.altitude);
if (object.coordinates) {
if (!Array.isArray(object.coordinates))
throw TypeError(".fk_data.DeviceLocation.coordinates: array expected");
message.coordinates = [];
for (var i = 0; i < object.coordinates.length; ++i)
message.coordinates[i] = Number(object.coordinates[i]);
}
if (object.satellites != null)
message.satellites = object.satellites >>> 0;
if (object.hdop != null)
message.hdop = object.hdop >>> 0;
return message;
};
/**
* Creates a plain object from a DeviceLocation message. Also converts values to other types if specified.
* @function toObject
* @memberof fk_data.DeviceLocation
* @static
* @param {fk_data.DeviceLocation} message DeviceLocation
* @param {$protobuf.IConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
DeviceLocation.toObject = function toObject(message, options) {
if (!options)
options = {};
var object = {};
if (options.arrays || options.defaults)
object.coordinates = [];
if (options.defaults) {
object.fix = 0;
if ($util.Long) {
var long = new $util.Long(0, 0, false);
object.time = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
} else
object.time = options.longs === String ? "0" : 0;
object.longitude = 0;
object.latitude = 0;
object.altitude = 0;
object.enabled = 0;
object.satellites = 0;
object.hdop = 0;
}
if (message.fix != null && message.hasOwnProperty("fix"))
object.fix = message.fix;
if (message.time != null && message.hasOwnProperty("time"))
if (typeof message.time === "number")
object.time = options.longs === String ? String(message.time) : message.time;
else
object.time = options.longs === String ? $util.Long.prototype.toString.call(message.time) : options.longs === Number ? new $util.LongBits(message.time.low >>> 0, message.time.high >>> 0).toNumber() : message.time;
if (message.longitude != null && message.hasOwnProperty("longitude"))
object.longitude = options.json && !isFinite(message.longitude) ? String(message.longitude) : message.longitude;
if (message.latitude != null && message.hasOwnProperty("latitude"))
object.latitude = options.json && !isFinite(message.latitude) ? String(message.latitude) : message.latitude;
if (message.altitude != null && message.hasOwnProperty("altitude"))
object.altitude = options.json && !isFinite(message.altitude) ? String(message.altitude) : message.altitude;
if (message.coordinates && message.coordinates.length) {
object.coordinates = [];
for (var j = 0; j < message.coordinates.length; ++j)
object.coordinates[j] = options.json && !isFinite(message.coordinates[j]) ? String(message.coordinates[j]) : message.coordinates[j];
}
if (message.enabled != null && message.hasOwnProperty("enabled"))
object.enabled = message.enabled;
if (message.satellites != null && message.hasOwnProperty("satellites"))
object.satellites = message.satellites;
if (message.hdop != null && message.hasOwnProperty("hdop"))
object.hdop = message.hdop;
return object;
};
/**
* Converts this DeviceLocation to JSON.
* @function toJSON
* @memberof fk_data.DeviceLocation
* @instance
* @returns {Object.<string,*>} JSON object
*/
DeviceLocation.prototype.toJSON = function toJSON() {
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
};
return DeviceLocation;
})();
fk_data.SensorReading = (function() {
/**
* Properties of a SensorReading.
* @memberof fk_data
* @interface ISensorReading
* @property {number|Long|null} [reading] SensorReading reading
* @property {number|Long|null} [time] SensorReading time
* @property {number|null} [sensor] SensorReading sensor
* @property {number|null} [value] SensorReading value
*/
/**
* Constructs a new SensorReading.
* @memberof fk_data
* @classdesc Represents a SensorReading.
* @implements ISensorReading
* @constructor
* @param {fk_data.ISensorReading=} [properties] Properties to set
*/
function SensorReading(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
}
/**
* SensorReading reading.
* @member {number|Long} reading
* @memberof fk_data.SensorReading
* @instance
*/
SensorReading.prototype.reading = $util.Long ? $util.Long.fromBits(0,0,true) : 0;
/**
* SensorReading time.
* @member {number|Long} time
* @memberof fk_data.SensorReading
* @instance
*/
SensorReading.prototype.time = $util.Long ? $util.Long.fromBits(0,0,false) : 0;
/**
* SensorReading sensor.
* @member {number} sensor
* @memberof fk_data.SensorReading
* @instance
*/
SensorReading.prototype.sensor = 0;
/**
* SensorReading value.
* @member {number} value
* @memberof fk_data.SensorReading
* @instance
*/
SensorReading.prototype.value = 0;
/**
* Creates a new SensorReading instance using the specified properties.
* @function create
* @memberof fk_data.SensorReading
* @static
* @param {fk_data.ISensorReading=} [properties] Properties to set
* @returns {fk_data.SensorReading} SensorReading instance
*/
SensorReading.create = function create(properties) {
return new SensorReading(properties);
};
/**
* Encodes the specified SensorReading message. Does not implicitly {@link fk_data.SensorReading.verify|verify} messages.
* @function encode
* @memberof fk_data.SensorReading
* @static
* @param {fk_data.ISensorReading} message SensorReading message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
SensorReading.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.reading != null && message.hasOwnProperty("reading"))
writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.reading);
if (message.time != null && message.hasOwnProperty("time"))
writer.uint32(/* id 2, wireType 0 =*/16).int64(message.time);
if (message.sensor != null && message.hasOwnProperty("sensor"))
writer.uint32(/* id 3, wireType 0 =*/24).uint32(message.sensor);
if (message.value != null && message.hasOwnProperty("value"))
writer.uint32(/* id 4, wireType 5 =*/37).float(message.value);
return writer;
};
/**
* Encodes the specified SensorReading message, length delimited. Does not implicitly {@link fk_data.SensorReading.verify|verify} messages.
* @function encodeDelimited
* @memberof fk_data.SensorReading
* @static
* @param {fk_data.ISensorReading} message SensorReading message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
SensorReading.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes a SensorReading message from the specified reader or buffer.
* @function decode
* @memberof fk_data.SensorReading
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {fk_data.SensorReading} SensorReading
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
SensorReading.decode = function decode(reader, length) {
if (!(reader instanceof $Reader))
reader = $Reader.create(reader);
var end = length === undefined ? reader.len : reader.pos + length, message = new $root.fk_data.SensorReading();
while (reader.pos < end) {
var tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.reading = reader.uint64();
break;
case 2:
message.time = reader.int64();
break;
case 3:
message.sensor = reader.uint32();
break;
case 4:
message.value = reader.float();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes a SensorReading message from the specified reader or buffer, length delimited.
* @function decodeDelimited
* @memberof fk_data.SensorReading
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {fk_data.SensorReading} SensorReading
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
SensorReading.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = new $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies a SensorReading message.
* @function verify
* @memberof fk_data.SensorReading
* @static
* @param {Object.<string,*>} message Plain object to verify
* @returns {string|null} `null` if valid, otherwise the reason why it is not
*/
SensorReading.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
if (message.reading != null && message.hasOwnProperty("reading"))
if (!$util.isInteger(message.reading) && !(message.reading && $util.isInteger(message.reading.low) && $util.isInteger(message.reading.high)))
return "reading: integer|Long expected";
if (message.time != null && message.hasOwnProperty("time"))
if (!$util.isInteger(message.time) && !(message.time && $util.isInteger(message.time.low) && $util.isInteger(message.time.high)))
return "time: integer|Long expected";
if (message.sensor != null && message.hasOwnProperty("sensor"))
if (!$util.isInteger(message.sensor))
return "sensor: integer expected";
if (message.value != null && message.hasOwnProperty("value"))
if (typeof message.value !== "number")
return "value: number expected";
return null;
};
/**
* Creates a SensorReading message from a plain object. Also converts values to their respective internal types.
* @function fromObject
* @memberof fk_data.SensorReading
* @static
* @param {Object.<string,*>} object Plain object
* @returns {fk_data.SensorReading} SensorReading
*/
SensorReading.fromObject = function fromObject(object) {
if (object instanceof $root.fk_data.SensorReading)
return object;
var message = new $root.fk_data.SensorReading();
if (object.reading != null)
if ($util.Long)
(message.reading = $util.Long.fromValue(object.reading)).unsigned = true;
else if (typeof object.reading === "string")
message.reading = parseInt(object.reading, 10);
else if (typeof object.reading === "number")
message.reading = object.reading;
else if (typeof object.reading === "object")
message.reading = new $util.LongBits(object.reading.low >>> 0, object.reading.high >>> 0).toNumber(true);
if (object.time != null)
if ($util.Long)
(message.time = $util.Long.fromValue(object.time)).unsigned = false;
else if (typeof object.time === "string")
message.time = parseInt(object.time, 10);
else if (typeof object.time === "number")
message.time = object.time;
else if (typeof object.time === "object")
message.time = new $util.LongBits(object.time.low >>> 0, object.time.high >>> 0).toNumber();
if (object.sensor != null)
message.sensor = object.sensor >>> 0;
if (object.value != null)
message.value = Number(object.value);
return message;
};
/**
* Creates a plain object from a SensorReading message. Also converts values to other types if specified.
* @function toObject
* @memberof fk_data.SensorReading
* @static
* @param {fk_data.SensorReading} message SensorReading
* @param {$protobuf.IConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
SensorReading.toObject = function toObject(message, options) {
if (!options)
options = {};
var object = {};
if (options.defaults) {
if ($util.Long) {
var long = new $util.Long(0, 0, true);
object.reading = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
} else
object.reading = options.longs === String ? "0" : 0;
if ($util.Long) {
var long = new $util.Long(0, 0, false);
object.time = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
} else
object.time = options.longs === String ? "0" : 0;
object.sensor = 0;
object.value = 0;
}
if (message.reading != null && message.hasOwnProperty("reading"))
if (typeof message.reading === "number")
object.reading = options.longs === String ? String(message.reading) : message.reading;
else
object.reading = options.longs === String ? $util.Long.prototype.toString.call(message.reading) : options.longs === Number ? new $util.LongBits(message.reading.low >>> 0, message.reading.high >>> 0).toNumber(true) : message.reading;
if (message.time != null && message.hasOwnProperty("time"))
if (typeof message.time === "number")
object.time = options.longs === String ? String(message.time) : message.time;
else
object.time = options.longs === String ? $util.Long.prototype.toString.call(message.time) : options.longs === Number ? new $util.LongBits(message.time.low >>> 0, message.time.high >>> 0).toNumber() : message.time;
if (message.sensor != null && message.hasOwnProperty("sensor"))
object.sensor = message.sensor;
if (message.value != null && message.hasOwnProperty("value"))
object.value = options.json && !isFinite(message.value) ? String(message.value) : message.value;
return object;
};
/**
* Converts this SensorReading to JSON.
* @function toJSON
* @memberof fk_data.SensorReading
* @instance
* @returns {Object.<string,*>} JSON object
*/
SensorReading.prototype.toJSON = function toJSON() {
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
};
return SensorReading;
})();
fk_data.LoggedReading = (function() {
/**
* Properties of a LoggedReading.
* @memberof fk_data
* @interface ILoggedReading
* @property {number|null} [version] LoggedReading version
* @property {fk_data.IDeviceLocation|null} [location] LoggedReading location
* @property {fk_data.ISensorReading|null} [reading] LoggedReading reading
*/
/**
* Constructs a new LoggedReading.
* @memberof fk_data
* @classdesc Represents a LoggedReading.
* @implements ILoggedReading
* @constructor
* @param {fk_data.ILoggedReading=} [properties] Properties to set
*/
function LoggedReading(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
}
/**
* LoggedReading version.
* @member {number} version
* @memberof fk_data.LoggedReading
* @instance
*/
LoggedReading.prototype.version = 0;
/**
* LoggedReading location.
* @member {fk_data.IDeviceLocation|null|undefined} location
* @memberof fk_data.LoggedReading
* @instance
*/
LoggedReading.prototype.location = null;
/**
* LoggedReading reading.
* @member {fk_data.ISensorReading|null|undefined} reading
* @memberof fk_data.LoggedReading
* @instance
*/
LoggedReading.prototype.reading = null;
/**
* Creates a new LoggedReading instance using the specified properties.
* @function create
* @memberof fk_data.LoggedReading
* @static
* @param {fk_data.ILoggedReading=} [properties] Properties to set
* @returns {fk_data.LoggedReading} LoggedReading instance
*/
LoggedReading.create = function create(properties) {
return new LoggedReading(properties);
};
/**
* Encodes the specified LoggedReading message. Does not implicitly {@link fk_data.LoggedReading.verify|verify} messages.
* @function encode
* @memberof fk_data.LoggedReading
* @static
* @param {fk_data.ILoggedReading} message LoggedReading message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
LoggedReading.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.version != null && message.hasOwnProperty("version"))
writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.version);
if (message.location != null && message.hasOwnProperty("location"))
$root.fk_data.DeviceLocation.encode(message.location, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim();
if (message.reading != null && message.hasOwnProperty("reading"))
$root.fk_data.SensorReading.encode(message.reading, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim();
return writer;
};
/**
* Encodes the specified LoggedReading message, length delimited. Does not implicitly {@link fk_data.LoggedReading.verify|verify} messages.
* @function encodeDelimited
* @memberof fk_data.LoggedReading
* @static
* @param {fk_data.ILoggedReading} message LoggedReading message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
LoggedReading.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes a LoggedReading message from the specified reader or buffer.
* @function decode
* @memberof fk_data.LoggedReading
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {fk_data.LoggedReading} LoggedReading
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
LoggedReading.decode = function decode(reader, length) {
if (!(reader instanceof $Reader))
reader = $Reader.create(reader);
var end = length === undefined ? reader.len : reader.pos + length, message = new $root.fk_data.LoggedReading();
while (reader.pos < end) {
var tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.version = reader.uint32();
break;
case 2:
message.location = $root.fk_data.DeviceLocation.decode(reader, reader.uint32());
break;
case 3:
message.reading = $root.fk_data.SensorReading.decode(reader, reader.uint32());
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes a LoggedReading message from the specified reader or buffer, length delimited.
* @function decodeDelimited
* @memberof fk_data.LoggedReading
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {fk_data.LoggedReading} LoggedReading
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
LoggedReading.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = new $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies a LoggedReading message.
* @function verify
* @memberof fk_data.LoggedReading
* @static
* @param {Object.<string,*>} message Plain object to verify
* @returns {string|null} `null` if valid, otherwise the reason why it is not
*/
LoggedReading.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
if (message.version != null && message.hasOwnProperty("version"))
if (!$util.isInteger(message.version))
return "version: integer expected";
if (message.location != null && message.hasOwnProperty("location")) {
var error = $root.fk_data.DeviceLocation.verify(message.location);
if (error)
return "location." + error;
}
if (message.reading != null && message.hasOwnProperty("reading")) {
var error = $root.fk_data.SensorReading.verify(message.reading);
if (error)
return "reading." + error;
}
return null;
};
/**
* Creates a LoggedReading message from a plain object. Also converts values to their respective internal types.
* @function fromObject
* @memberof fk_data.LoggedReading
* @static
* @param {Object.<string,*>} object Plain object
* @returns {fk_data.LoggedReading} LoggedReading
*/
LoggedReading.fromObject = function fromObject(object) {
if (object instanceof $root.fk_data.LoggedReading)
return object;
var message = new $root.fk_data.LoggedReading();
if (object.version != null)
message.version = object.version >>> 0;
if (object.location != null) {
if (typeof object.location !== "object")
throw TypeError(".fk_data.LoggedReading.location: object expected");
message.location = $root.fk_data.DeviceLocation.fromObject(object.location);
}
if (object.reading != null) {
if (typeof object.reading !== "object")
throw TypeError(".fk_data.LoggedReading.reading: object expected");
message.reading = $root.fk_data.SensorReading.fromObject(object.reading);
}
return message;
};
/**
* Creates a plain object from a LoggedReading message. Also converts values to other types if specified.
* @function toObject
* @memberof fk_data.LoggedReading
* @static
* @param {fk_data.LoggedReading} message LoggedReading
* @param {$protobuf.IConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
LoggedReading.toObject = function toObject(message, options) {
if (!options)
options = {};
var object = {};
if (options.defaults) {
object.version = 0;
object.location = null;
object.reading = null;
}
if (message.version != null && message.hasOwnProperty("version"))
object.version = message.version;
if (message.location != null && message.hasOwnProperty("location"))
object.location = $root.fk_data.DeviceLocation.toObject(message.location, options);
if (message.reading != null && message.hasOwnProperty("reading"))
object.reading = $root.fk_data.SensorReading.toObject(message.reading, options);
return object;
};
/**
* Converts this LoggedReading to JSON.
* @function toJSON
* @memberof fk_data.LoggedReading
* @instance
* @returns {Object.<string,*>} JSON object
*/
LoggedReading.prototype.toJSON = function toJSON() {
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
};
return LoggedReading;
})();
fk_data.SensorAndValue = (function() {
/**
* Properties of a SensorAndValue.
* @memberof fk_data
* @interface ISensorAndValue
* @property {number|null} [sensor] SensorAndValue sensor
* @property {boolean|null} [calibratedNull] SensorAndValue calibratedNull
* @property {number|null} [calibratedValue] SensorAndValue calibratedValue
* @property {boolean|null} [uncalibratedNull] SensorAndValue uncalibratedNull
* @property {number|null} [uncalibratedValue] SensorAndValue uncalibratedValue
*/
/**
* Constructs a new SensorAndValue.
* @memberof fk_data
* @classdesc Represents a SensorAndValue.
* @implements ISensorAndValue
* @constructor
* @param {fk_data.ISensorAndValue=} [properties] Properties to set
*/
function SensorAndValue(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
}
/**
* SensorAndValue sensor.
* @member {number} sensor
* @memberof fk_data.SensorAndValue
* @instance
*/
SensorAndValue.prototype.sensor = 0;
/**
* SensorAndValue calibratedNull.
* @member {boolean} calibratedNull
* @memberof fk_data.SensorAndValue
* @instance
*/
SensorAndValue.prototype.calibratedNull = false;
/**
* SensorAndValue calibratedValue.