iobroker.e3oncan 0.6.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/codecs.js ADDED
@@ -0,0 +1,709 @@
1
+ class codecOpMode {
2
+ constructor(raw=true) {
3
+ this.raw = raw;
4
+ }
5
+
6
+ setOpMode(raw) {
7
+ this.raw = raw;
8
+ }
9
+ getOpMode() {
10
+ return this.raw;
11
+ }
12
+ }
13
+
14
+ const rawmode = new codecOpMode(true);
15
+
16
+ const enums = require('./enums');
17
+
18
+ function arr2Hex(arr) {
19
+ // Convert byte array to hex string
20
+ let hs = '';
21
+ for (const v in arr) { hs += toHex(arr[v],2); }
22
+ return hs;
23
+ }
24
+
25
+ function toHex(d, len) {
26
+ // Convert integer to hex string of length len
27
+ return (('00000000'+(Number(d).toString(16))).slice(-len));
28
+ }
29
+
30
+ function toByteArray(hs) {
31
+ // Convert hex string, e.g. '21A8' to byte array: [33,168]
32
+ const ba = [];
33
+ for (let i=0; i<hs.length/2; i++) {
34
+ ba.push(parseInt(hs.slice(2*i,2*i+2), 16));
35
+ }
36
+ return ba;
37
+ }
38
+
39
+ function uint08toVal(j, ofs=0) {
40
+ return j[ofs];
41
+ }
42
+
43
+ function sint08toVal(j, ofs=0) {
44
+ return (j[ofs]<128 ? j[ofs] : j[ofs]-256);
45
+ }
46
+
47
+ function uint16toVal(j, ofs=0) {
48
+ return Math.pow(2,8)*j[ofs+1]+j[ofs];
49
+ }
50
+
51
+ function sint16toVal(j, ofs=0) {
52
+ let v = Math.pow(2,8)*j[ofs+1]+j[ofs];
53
+ if (v >= Math.pow(2,15)) { v -= Math.pow(2,16); }
54
+ return v;
55
+ }
56
+
57
+ function uint32toVal(j, ofs=0) {
58
+ return Math.pow(2,24)*j[ofs+3]+Math.pow(2,16)*j[ofs+2]+Math.pow(2,8)*j[ofs+1]+j[ofs];
59
+ }
60
+
61
+ function sint32toVal(j, ofs=0) {
62
+ let v = Math.pow(2,24)*j[ofs+3]+Math.pow(2,16)*j[ofs+2]+Math.pow(2,8)*j[ofs+1]+j[ofs];
63
+ if (v >= Math.pow(2,31)) { v -= Math.pow(2,32); }
64
+ return v;
65
+ }
66
+
67
+ function int2val(j, ofs = 0, signed = false) {
68
+ // Convert byte array to int08, int16, int32. Signed or unsigned.
69
+ switch (j.length) {
70
+ case 1 :
71
+ return (signed ? sint08toVal(j,ofs) : uint08toVal(j,ofs) );
72
+ case 2 :
73
+ return (signed ? sint16toVal(j,ofs) : uint16toVal(j,ofs) );
74
+ case 4 :
75
+ return (signed ? sint32toVal(j,ofs) : uint32toVal(j,ofs) );
76
+ default:
77
+ return null;
78
+ }
79
+ }
80
+
81
+ function val2byteArr(v, byte_width, scale = 1, signed = false) {
82
+ // Convert int08, int16, int32 to byte array. Signed or unsigned.
83
+ let val = Math.round(eval(v) * scale);
84
+ if ( (signed) && (val < 0) ) { val += Math.pow(2,8*byte_width); }
85
+ const string_bin = toByteArray(toHex(val, byte_width*2));
86
+ return string_bin.reverse();
87
+ }
88
+
89
+ function RawEncode(data, len) {
90
+ const string_bin = toByteArray(data);
91
+ if (string_bin.length !== len) {
92
+ throw new Error(`String must be ${len} long`);
93
+ }
94
+ return string_bin;
95
+ }
96
+
97
+ function RawDecode(string_bin) {
98
+ return arr2Hex(string_bin);
99
+ }
100
+
101
+ class O3ERawCodec {
102
+ constructor(string_len, idStr, _args) {
103
+ this.string_len = string_len;
104
+ this.id = idStr;
105
+ }
106
+ encode(data) {
107
+ return RawEncode(data, this.string_len);
108
+ }
109
+ decode(string_bin) {
110
+ return RawDecode(string_bin);
111
+ }
112
+ __len__() {
113
+ return this.string_len;
114
+ }
115
+ }
116
+
117
+ class O3EInt {
118
+ constructor(string_len, idStr, byte_width, _args) {
119
+ this.string_len = string_len;
120
+ this.id = idStr;
121
+ this.byte_width = byte_width;
122
+ this.scale = _args.scale;
123
+ this.offset = _args.offset;
124
+ this.signed = _args.signed;
125
+ }
126
+ encode(data) {
127
+ if (rawmode.getOpMode()) {
128
+ return RawEncode(data, this.string_len);
129
+ } else {
130
+ if (this.offset != 0) {
131
+ throw new Error('O3EInt.encode(): offset!=0 not implemented yet');
132
+ }
133
+ return val2byteArr(data, this.byte_width, this.scale, this.signed);
134
+ }
135
+ }
136
+
137
+ decode(data) {
138
+ if (rawmode.getOpMode()) {
139
+ return RawDecode(data);
140
+ }
141
+ return int2val(data.slice(this.offset,this.offset+this.byte_width), 0, this.signed) / this.scale;
142
+ }
143
+
144
+ __len__() {
145
+ return this.string_len;
146
+ }
147
+ }
148
+
149
+ // Named parameters in Javascript: https://masteringjs.io/tutorials/fundamentals/parameters
150
+ // function (parg1, parg2, { narg1 = 1, narg2 = 2, narg3 = 3 } = {} ) {}
151
+
152
+ class O3EInt8 extends O3EInt {
153
+ constructor(string_len, idStr, _args) {
154
+ super(string_len, idStr, 1, _args);
155
+ }
156
+ }
157
+
158
+ class O3EInt16 extends O3EInt {
159
+ constructor(string_len, idStr, _args) {
160
+ super(string_len, idStr, 2, _args);
161
+ }
162
+ }
163
+
164
+ class O3EInt32 extends O3EInt {
165
+ constructor(string_len, idStr, _args) {
166
+ super(string_len, idStr, 4, _args);
167
+ }
168
+ }
169
+
170
+ class O3EByteVal {
171
+ constructor(string_len, idStr, _args) {
172
+ this.string_len = string_len;
173
+ this.id = idStr;
174
+ this.offset = _args.offset;
175
+ }
176
+ encode(data) {
177
+ if (rawmode.getOpMode()) {
178
+ return RawEncode(data, this.string_len);
179
+ } else {
180
+ if (this.offset != 0) {
181
+ throw new Error('O3EByteVal.encode(): offset!=0 not implemented yet');
182
+ }
183
+ return val2byteArr(data, this.string_len, 1, false);
184
+ }
185
+ }
186
+
187
+ decode(string_bin) {
188
+ if (rawmode.getOpMode()) {
189
+ return RawDecode(string_bin);
190
+ }
191
+ let val = 0;
192
+ for (let i = 0; i < this.string_len; i++) {
193
+ val += string_bin[i + this.offset] << (i * 8);
194
+ }
195
+ return val;
196
+ }
197
+
198
+ __len__() {
199
+ return this.string_len;
200
+ }
201
+ }
202
+
203
+ class O3EBool {
204
+ constructor(string_len, idStr, _args) {
205
+ this.string_len = string_len;
206
+ this.id = idStr;
207
+ this.offset = _args.offset;
208
+ }
209
+ encode(data) {
210
+ if (rawmode.getOpMode()) {
211
+ return RawEncode(data, this.string_len);
212
+ }
213
+ return (data == 'off' ? 0 : 1);
214
+ //throw new Error('O3EBool.encode(): not implemented yet');
215
+ }
216
+
217
+ decode(string_bin) {
218
+ if (rawmode.getOpMode()) {
219
+ return RawDecode(string_bin);
220
+ }
221
+ const val = string_bin[this.offset];
222
+ return (val == 0 ? 'off' : 'on' );
223
+ }
224
+
225
+ __len__() {
226
+ return this.string_len;
227
+ }
228
+ }
229
+
230
+ class O3EUtf8 {
231
+ constructor(string_len, idStr, _args) {
232
+ this.string_len = string_len;
233
+ this.id = idStr;
234
+ this.offset = _args.offset;
235
+ }
236
+ encode(data) {
237
+ if (rawmode.getOpMode()) {
238
+ return RawEncode(data, this.string_len);
239
+ }
240
+ const encoder = new TextEncoder();
241
+ const result = Object.values(encoder.encode(data));
242
+ if (result.length > this.string_len) throw new Error('O3EUtf8.encode() result too long: '+this.id+' - '+String(result.length)+' > '+String(this.string_len));
243
+ return result.concat(Array.from(Array(this.string_len-result.length), () => 0));
244
+
245
+ }
246
+ decode(string_bin) {
247
+ if (rawmode.getOpMode()) {
248
+ return RawDecode(string_bin);
249
+ }
250
+ let mystr = '';
251
+ for (let i=this.offset; i<this.offset+this.string_len;i++) { mystr += String.fromCharCode(string_bin[i]); }
252
+ // eslint-disable-next-line no-control-regex
253
+ return mystr.replace(/[\u0000-\u0008,\u000A-\u001F,\u007F-\u00A0]+/g, '');
254
+ }
255
+
256
+ __len__() {
257
+ return this.string_len;
258
+ }
259
+ }
260
+
261
+ class O3ESoftVers {
262
+ constructor(string_len, idStr, _args) {
263
+ this.string_len = string_len;
264
+ this.id = idStr;
265
+ }
266
+ encode(data) {
267
+ if (rawmode.getOpMode()) {
268
+ return RawEncode(data, this.string_len);
269
+ }
270
+ let result = [];
271
+ const arr = data.split('.');
272
+ for (const v of Object.values(arr)) result = result.concat(val2byteArr(v,2,1,false));
273
+ if (result.length > this.string_len) throw new Error('O3ESoftVers.encode() result too long: '+this.id+' - '+String(result.length)+' > '+String(this.string_len));
274
+ return result.concat(Array.from(Array(this.string_len-result.length), () => 0));
275
+ }
276
+ decode(string_bin) {
277
+ if (rawmode.getOpMode()) {
278
+ return RawDecode(string_bin);
279
+ }
280
+ const lstv = [];
281
+ for (let i = 0; i < this.string_len; i += 2) {
282
+ lstv.push(string_bin[i] + (string_bin[i+1] << 8));
283
+ }
284
+ return lstv.join('.');
285
+ }
286
+ __len__() {
287
+ return this.string_len;
288
+ }
289
+ }
290
+
291
+ class O3EMacAddr {
292
+ constructor(string_len, idStr, _args) {
293
+ this.string_len = string_len;
294
+ this.id = idStr;
295
+ }
296
+ encode(data) {
297
+ if (rawmode.getOpMode()) {
298
+ return RawEncode(data, this.string_len);
299
+ }
300
+ return(data.split('-').map(function(str) {return parseInt('0x'+str);}));
301
+
302
+ }
303
+ decode(string_bin) {
304
+ if (rawmode.getOpMode()) {
305
+ return RawDecode(string_bin);
306
+ }
307
+ const lstv = [];
308
+ for (let i = 0; i < this.string_len; i++) {
309
+ lstv.push(toHex(string_bin[i],2).toUpperCase());
310
+ }
311
+ return lstv.join('-');
312
+ }
313
+ __len__() {
314
+ return this.string_len;
315
+ }
316
+ }
317
+
318
+ class O3EIp4Addr {
319
+ constructor(string_len, idStr, _args) {
320
+ this.string_len = string_len;
321
+ this.id = idStr;
322
+ }
323
+ encode(data) {
324
+ if (rawmode.getOpMode()) {
325
+ return RawEncode(data, this.string_len);
326
+ }
327
+ return(data.split('.').map(function(str) {return parseInt(str);}));
328
+
329
+ }
330
+ decode(string_bin) {
331
+ if (rawmode.getOpMode()) {
332
+ return RawDecode(string_bin);
333
+ }
334
+ const lstv = [];
335
+ for (let i = 0; i < this.string_len; i++) {
336
+ lstv.push(string_bin[i].toString().padStart(3,'0'));
337
+ }
338
+ return lstv.join('.');
339
+ }
340
+ __len__() {
341
+ return this.string_len;
342
+ }
343
+ }
344
+
345
+ class O3ESdate {
346
+ constructor(string_len, idStr, _args) {
347
+ this.string_len = string_len;
348
+ this.id = idStr;
349
+ }
350
+ encode(data) {
351
+ if (rawmode.getOpMode()) {
352
+ return RawEncode(data, this.string_len);
353
+ }
354
+ const dt = new Date(data);
355
+ if (!dt.valueOf()) throw new Error('could not convert date value');
356
+ return [dt.getDate(),dt.getMonth()+1,dt.getFullYear()%100];
357
+
358
+ }
359
+ decode(string_bin) {
360
+ if (rawmode.getOpMode()) {
361
+ return RawDecode(string_bin);
362
+ }
363
+ const dt = new Date(
364
+ string_bin[2]+2000, // year
365
+ string_bin[1]-1, // month
366
+ string_bin[0] // day
367
+ );
368
+ return dt.toDateString();
369
+ }
370
+ __len__() {
371
+ return this.string_len;
372
+ }
373
+ }
374
+
375
+ class O3EStime {
376
+ constructor(string_len, idStr, _args) {
377
+ this.string_len = string_len;
378
+ this.id = idStr;
379
+ }
380
+ encode(data) {
381
+ if (rawmode.getOpMode()) {
382
+ return RawEncode(data, this.string_len);
383
+ }
384
+ if (this.string_len == 1) data += ':00'; // Date() needs at least hour:minute
385
+ const now = new Date();
386
+ const dt = new Date(now.toDateString()+' '+data);
387
+ if (!dt.valueOf()) throw new Error('could not convert time value');
388
+ const retVal = [dt.getHours(),dt.getMinutes(),dt.getSeconds()];
389
+ return retVal.slice(0,this.string_len);
390
+
391
+ }
392
+ decode(string_bin) {
393
+ if (rawmode.getOpMode()) {
394
+ return RawDecode(string_bin);
395
+ }
396
+ const now = new Date();
397
+ const dt = new Date(now.getFullYear(), now.getMonth(), now.getDate(),
398
+ string_bin[0], // hour
399
+ ((this.string_len >= 2) ? string_bin[1] : 0), // minute
400
+ ((this.string_len >= 3) ? string_bin[2] : 0) // second
401
+ );
402
+ return dt.toLocaleTimeString();
403
+ }
404
+ __len__() {
405
+ return this.string_len;
406
+ }
407
+ }
408
+
409
+ class O3EDateTime {
410
+ constructor(string_len, idStr, _args) {
411
+ this.string_len = string_len;
412
+ this.id = idStr;
413
+ this.timeformat = _args.timeformat;
414
+ }
415
+ encode(data) {
416
+ if (rawmode.getOpMode()) {
417
+ return RawEncode(data, this.string_len);
418
+ }
419
+ if (this.timeformat == 'VM') {
420
+ const dt = new Date(data.Timestamp);
421
+ if (!dt.valueOf()) throw new Error('could not convert datetime value');
422
+ const fill = 0x05; // Unknown byte between date and time. Known values are 0x05 and 0x06
423
+ return([Math.floor(dt.getFullYear()/100),dt.getFullYear()%100,dt.getMonth()+1,dt.getDate(),fill,
424
+ dt.getHours(),dt.getMinutes(),dt.getSeconds()]);
425
+ } else {
426
+ return(val2byteArr(data.Timestamp,this.string_len,0.001,false));
427
+ }
428
+
429
+ }
430
+ decode(string_bin) {
431
+ if (rawmode.getOpMode()) {
432
+ return RawDecode(string_bin);
433
+ }
434
+ let dt = new Date();
435
+ if (this.timeformat == 'VM') {
436
+ dt = new Date(
437
+ string_bin[0]*100+string_bin[1], // year
438
+ string_bin[2]-1, // month
439
+ string_bin[3], // day
440
+ string_bin[5], // hour
441
+ string_bin[6], // minute
442
+ string_bin[7] // second
443
+ );
444
+ }
445
+ if (this.timeformat == 'ts') {
446
+ dt = new Date(uint32toVal(string_bin.slice(0,4),0)*1000);
447
+ }
448
+ return { 'DateTime': dt.toLocaleString(),
449
+ 'Timestamp': Math.round(dt.getTime())
450
+ };
451
+ }
452
+ __len__() {
453
+ return this.string_len;
454
+ }
455
+ }
456
+
457
+ class O3EUtc {
458
+ constructor(string_len, idStr, _args) {
459
+ this.string_len = string_len;
460
+ this.id = idStr;
461
+ }
462
+ encode(data) {
463
+ if (rawmode.getOpMode()) {
464
+ return RawEncode(data, this.string_len);
465
+ }
466
+ const dt = new Date(data);
467
+ if (!dt) throw new Error('could not convert Utc date value');
468
+ return val2byteArr(dt.getTime(),this.string_len,0.001,false);
469
+
470
+ }
471
+ decode(string_bin) {
472
+ if (rawmode.getOpMode()) {
473
+ return RawDecode(string_bin);
474
+ }
475
+ const dt = new Date(uint32toVal(string_bin.slice(0,4),0)*1000);
476
+ return dt.toUTCString();
477
+ }
478
+ __len__() {
479
+ return this.string_len;
480
+ }
481
+ }
482
+
483
+ class O3EEnum {
484
+ constructor(string_len, idStr, _args) {
485
+ this.string_len = string_len;
486
+ this.id = idStr;
487
+ this.listStr = _args.listStr;
488
+ }
489
+ encode(data) {
490
+ if (rawmode.getOpMode()) {
491
+ return RawEncode(data, this.string_len);
492
+ }
493
+ return val2byteArr(data.ID, this.string_len, 1, false);
494
+
495
+ }
496
+ decode(string_bin) {
497
+ if (rawmode.getOpMode()) {
498
+ return RawDecode(string_bin);
499
+ }
500
+ const val = int2val(string_bin);
501
+ let txt = '';
502
+ if ( (this.listStr in enums.enums) && (String(val) in enums.enums[this.listStr]) ) {
503
+ txt = enums.enums[this.listStr][String(val)];
504
+ } else {
505
+ txt = 'Enum not found in ' + this.listStr;
506
+ }
507
+ return {'ID': val,
508
+ 'Text': txt };
509
+ }
510
+ __len__() {
511
+ return this.string_len;
512
+ }
513
+ }
514
+
515
+ class O3EList {
516
+ constructor(string_len, idStr, _args) {
517
+ this.string_len = string_len;
518
+ this.id = idStr;
519
+ this.subTypes = _args.subTypes;
520
+ }
521
+ encode(data) {
522
+ if (rawmode.getOpMode()) {
523
+ return RawEncode(data, this.string_len);
524
+ }
525
+ let result = [];
526
+ for (const cdi of Object.values(this.subTypes)) {
527
+ const subT = new O3Ecodecs[cdi.codec](cdi.len, cdi.id, cdi.args);
528
+
529
+ if (cdi.args.subTypes) {
530
+ for (const dataElement of Object.values(data[cdi.id])) {
531
+ result = result.concat(subT.encode(dataElement));
532
+ }
533
+ } else {
534
+ result = result.concat(subT.encode(data[cdi.id]));
535
+ }
536
+
537
+ }
538
+ if (result.length > this.string_len) throw new Error('O3EList.encode() result too long: '+String(result.length)+' > '+String(this.string_len));
539
+ return result.concat(Array.from(Array(this.string_len-result.length), () => 0));
540
+ }
541
+ decode(string_bin) {
542
+ if (rawmode.getOpMode()) {
543
+ return RawDecode(string_bin);
544
+ }
545
+ const result = {};
546
+ let index = 0;
547
+ let count = 0;
548
+ for (const cdi of Object.values(this.subTypes)) {
549
+ const subT = new O3Ecodecs[cdi.codec](cdi.len, cdi.id, cdi.args);
550
+ if (subT.id.toLowerCase() == 'count') {
551
+ count = subT.decode(string_bin.slice(index,index+subT.string_len));
552
+ result[subT.id]=count;
553
+ index += subT.string_len;
554
+ } else {
555
+ if (('subTypes' in subT)) {
556
+ // O3EComplexType
557
+ result[subT.id] = [];
558
+ if (count <= 100) {
559
+ for (let i=0; i<count; i++) {
560
+ result[subT.id].push(subT.decode(string_bin.slice(index,index+subT.string_len)));
561
+ index += subT.string_len;
562
+ }
563
+ } else {
564
+ result[subT.id] = ['Implausible number of elements. Decoding aborted.'];
565
+ }
566
+ } else {
567
+ result[subT.id] = subT.decode(string_bin.slice(index,index+subT.string_len));
568
+ index += subT.string_len;
569
+ }
570
+ }
571
+ }
572
+ return result;
573
+ }
574
+ __len__() {
575
+ return this.string_len;
576
+ }
577
+ }
578
+
579
+ class O3EArray {
580
+ constructor(string_len, idStr, _args) {
581
+ this.string_len = string_len;
582
+ this.id = idStr;
583
+ this.subTypes = _args.subTypes;
584
+ this.len = _args.arrayLength;
585
+ }
586
+ encode(data) {
587
+ if (rawmode.getOpMode()) {
588
+ return RawEncode(data, this.string_len);
589
+ }
590
+ throw new Error('not implemented yet');
591
+ }
592
+ decode(string_bin) {
593
+ if (rawmode.getOpMode()) {
594
+ return RawDecode(string_bin);
595
+ }
596
+ const result = {};
597
+ let index = 0;
598
+ const count = this.len;
599
+ for (const cdi of Object.values(this.subTypes)) {
600
+ const subT = new O3Ecodecs[cdi.codec](cdi.len, cdi.id, cdi.args);
601
+ result[subT.id]=[];
602
+ for (let i=0;i<count;i++) {
603
+ result[subT.id].push((subT.decode(string_bin.slice(index,index+subT.string_len))));
604
+ index += subT.string_len;
605
+ }
606
+ }
607
+ return result;
608
+ }
609
+ __len__() {
610
+ return this.string_len;
611
+ }
612
+ }
613
+
614
+ class O3EComplexType {
615
+ constructor(string_len, idStr, _args) {
616
+ this.string_len = string_len;
617
+ this.id = idStr;
618
+ this.subTypes = _args.subTypes;
619
+ }
620
+ encode(data) {
621
+ if (rawmode.getOpMode()) {
622
+ return RawEncode(data, this.string_len);
623
+ }
624
+
625
+ let result = [];
626
+ for (const cdi of Object.values(this.subTypes)) {
627
+ const subT = new O3Ecodecs[cdi.codec](cdi.len, cdi.id, cdi.args);
628
+ result = result.concat(subT.encode(data[cdi.id]));
629
+ }
630
+ if (result.length > this.string_len) throw new Error('O3EComplexType.encode() result too long: '+this.id+' - '+String(result.length)+' > '+String(this.string_len));
631
+ return result.concat(Array.from(Array(this.string_len-result.length), () => 0));
632
+ }
633
+ decode(string_bin) {
634
+ if (rawmode.getOpMode()) {
635
+ return RawDecode(string_bin);
636
+ }
637
+ const result = {};
638
+ let index = 0;
639
+ for (const cdi of Object.values(this.subTypes)) {
640
+ const subT = new O3Ecodecs[cdi.codec](cdi.len, cdi.id, cdi.args);
641
+ result[subT.id] = subT.decode(string_bin.slice(index,index+subT.string_len));
642
+ index+=subT.string_len;
643
+ }
644
+ return result;
645
+ }
646
+ __len__() {
647
+ return this.string_len;
648
+ }
649
+ }
650
+
651
+ class O3EcosPhi {
652
+ constructor(string_len, idStr, _args) {
653
+ this.string_len = string_len;
654
+ this.id = idStr;
655
+ this.offset = _args.offset;
656
+ this.scale = _args.scale;
657
+ }
658
+ encode(data) {
659
+ if (rawmode.getOpMode()) {
660
+ return RawEncode(data, this.string_len);
661
+ } else {
662
+ throw new Error('not implemented yet');
663
+ }
664
+ }
665
+
666
+ decode(string_bin) {
667
+ if (rawmode.getOpMode()) {
668
+ return RawDecode(string_bin);
669
+ }
670
+ let val = string_bin[1+this.offset];
671
+ if (string_bin[this.offset] == 0x04) {
672
+ val = -1.0*val;
673
+ }
674
+ return val/this.scale;
675
+ }
676
+
677
+ __len__() {
678
+ return this.string_len;
679
+ }
680
+ }
681
+
682
+ const O3Ecodecs = {
683
+ 'RawCodec':O3ERawCodec,
684
+ 'O3EInt8':O3EInt8,
685
+ 'O3EInt16':O3EInt16,
686
+ 'O3EInt32':O3EInt32,
687
+ 'O3EByteVal':O3EByteVal,
688
+ 'O3EBool':O3EBool,
689
+ 'O3EUtf8':O3EUtf8,
690
+ 'O3ESoftVers':O3ESoftVers,
691
+ 'O3EMacAddr':O3EMacAddr,
692
+ 'O3EIp4Addr':O3EIp4Addr,
693
+ 'O3ESdate':O3ESdate,
694
+ 'O3EStime':O3EStime,
695
+ 'O3EDateTime':O3EDateTime,
696
+ 'O3EUtc':O3EUtc,
697
+ 'O3EEnum':O3EEnum,
698
+ 'O3EList':O3EList,
699
+ 'O3EArray':O3EArray,
700
+ 'O3EComplexType':O3EComplexType,
701
+ 'O3EcosPhi':O3EcosPhi
702
+ };
703
+
704
+ module.exports = {
705
+ O3Ecodecs,
706
+ arr2Hex,
707
+ toByteArray,
708
+ rawmode
709
+ };