@microtronics/studio-cli 0.61.0 → 0.62.0

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/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@microtronics/studio-cli",
3
- "version": "0.61.0",
3
+ "version": "0.62.0",
4
4
  "description": "Microtronics Studio CLI Tool",
5
5
  "main": "./out/api.js",
6
- "typings": "./dist/studio-cli.d.ts",
6
+ "typings": "./out/studio-cli.d.ts",
7
7
  "bin": {
8
8
  "studio-cli": "studio-cli"
9
9
  },
@@ -15,7 +15,7 @@
15
15
  "compile": "npm run build:registryApiTypings && tsc",
16
16
  "build:cli": "node build.mjs",
17
17
  "api": "api-extractor run --local --verbose",
18
- "build": "npm run compile && npm run build:cli && npm run api",
18
+ "build": "npm run compile && npm run api && npm run build:cli",
19
19
  "watch:build": "npm run compile -- --watch",
20
20
  "test": "cross-env STUDIO_ENV=lucky mocha",
21
21
  "test-ci": "cross-env STUDIO_ENV=lucky mocha --reporter mocha-junit-reporter",
@@ -69,7 +69,7 @@
69
69
  "cross-env": "^7.0.3",
70
70
  "esbuild": "^0.27.3",
71
71
  "extract-zip": "^2.0.1",
72
- "uto-master": "bitbucket:microtronics-core/device-master#0.3.0",
72
+ "@microtronics/device-master": "bitbucket:microtronics-core/device-master#1.1.0",
73
73
  "mocha": "^10.8.2",
74
74
  "mocha-junit-reporter": "^2.2.1",
75
75
  "openapi-typescript": "^7.6.0",
@@ -1,436 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DeviceProfiles = void 0;
4
- /***********************************************************************************************************************
5
- DEVICE_PROFILES
6
- ************************************************************************************************************************/
7
- // these props are automatically added to ~auto.inc files
8
- const auto_inc_default = {
9
- DP_registry_sz: 1024,
10
- DP_config_sz: 4000,
11
- DP_histdata_sz: 1024,
12
- DP_DISPLAY_CNT: 0, // display interfaces
13
- // DP_DISPLAY_TYPE "xc", // extra compact, predefined functionality
14
- DP_LED_CNT: 0, // system leds
15
- DP_BUTTON_CNT: 0, // system buttons
16
- DP_GPIO_CNT: 0, // digital in-/outputs
17
- DP_IRQ_CNT: 0, // digital interrupt inputs
18
- DP_DIGOUT_CNT: 0, // digital outputs
19
- DP_UIN_CNT: 0, // analogue universal inputs
20
- DP_TEMP_CNT: 0, // temperature sensors
21
- DP_I2C_CNT: 0, // I2C ports
22
- DP_SPI_CNT: 0, // SPI ports
23
- DP_UART_CNT: 0, // TTL uart ports
24
- DP_RS485_CNT: 0, // RS485 uart ports
25
- DP_RS232_CNT: 0, // RS232 uart ports
26
- DP_WIFI_CNT: 0, // wifi interfaces
27
- DP_BLE_CNT: 0, // BLE interfaces
28
- DP_LORA_CNT: 0, // LORA interfaces
29
- DP_NBIOT_CNT: 0 // NB-IoT interfaces
30
- };
31
- const CONTDEF_Nk_1k = { max_size: 100000, max_fields: 1000 };
32
- const CONTDEF_4k_1k = { max_size: 4000, max_fields: 1000 };
33
- const CONTDEF_1k_1k = { max_size: 1024, max_fields: 1000 };
34
- // max size/fields for configA..C, config0..9, histdata0..9
35
- const DDE_CONFIG_Nk1k_4k1k_HISTDATA_1k1k = {
36
- configA: CONTDEF_Nk_1k,
37
- configB: CONTDEF_Nk_1k,
38
- configC: CONTDEF_Nk_1k,
39
- config0: CONTDEF_4k_1k,
40
- config1: CONTDEF_4k_1k,
41
- config2: CONTDEF_4k_1k,
42
- config3: CONTDEF_4k_1k,
43
- config4: CONTDEF_4k_1k,
44
- config5: CONTDEF_4k_1k,
45
- config6: CONTDEF_4k_1k,
46
- config7: CONTDEF_4k_1k,
47
- config8: CONTDEF_4k_1k,
48
- config9: CONTDEF_4k_1k,
49
- histdata0: CONTDEF_1k_1k,
50
- histdata1: CONTDEF_1k_1k,
51
- histdata2: CONTDEF_1k_1k,
52
- histdata3: CONTDEF_1k_1k,
53
- histdata4: CONTDEF_1k_1k,
54
- histdata5: CONTDEF_1k_1k,
55
- histdata6: CONTDEF_1k_1k,
56
- histdata7: CONTDEF_1k_1k,
57
- histdata8: CONTDEF_1k_1k,
58
- histdata9: CONTDEF_1k_1k,
59
- aloha: { ...CONTDEF_1k_1k, warn_fields: 10 },
60
- // max_fields:0 - fields are declared implicitly and NOT by DDE
61
- alerts: { max_size: 13, max_fields: 0, exact_match: true }, // exact_match: do not allow shorter container (nor var length)
62
- applog: { max_size: 125, max_fields: 0, exact_match: false } // exact_match: do not allow shorter container (nor var length)
63
- };
64
- // --- sources, datasheets -> ~stdilib project, _deviceprofile.inc files ---
65
- exports.DeviceProfiles = {
66
- // M22x
67
- m22x: {
68
- name: 'M22x',
69
- dpid: 'm22x',
70
- interface: {
71
- type: 'usb',
72
- filter: {
73
- // filter used by client's navigator.usb.requestDevice to scan USB for compatible devices
74
- vendorId: 0x2544
75
- // productId: 32777
76
- // classCode: 0xFF ... deviceClass: 255
77
- // protocolCode: 0x01 ... deviceProtocol: 0
78
- // productName: "rapidM2M IoT-Box HW1.1"
79
- // serialNumber: "861694037822xxxx"
80
- },
81
- fileChunk: 4096 //chunk size of a transmitting file part
82
- },
83
- usb_ids: ['rapidM2M M2 HW1.0'], // primary USB ID's assigned to this DP
84
- alt_ids: [], // 'rapidM2M IoT-Box HW1.1' - alternative USB ID's on which this DP works too because hw is a super-set of primary hw
85
- generation: 'M2',
86
- prog_mem: 256 * 1024, // max. memory available for prog
87
- data_mem: 64 * 1024, // max. memory available for data+stack+heap
88
- total_mem: 256 * 1024, // total memory available for prog+data
89
- hw_reqd: false, // truthy: can choose this DP only when hw listed in usb_ids is present (otherwise:anytime)
90
- dde: DDE_CONFIG_Nk1k_4k1k_HISTDATA_1k1k,
91
- auto_inc: {
92
- ...auto_inc_default,
93
- DP_LED_CNT: 1,
94
- DP_GPIO_CNT: 6,
95
- DP_IRQ_CNT: 2,
96
- DP_I2C_CNT: 1,
97
- DP_SPI_CNT: 1,
98
- DP_UART_CNT: 2,
99
- DP_WIFI_CNT: 1 // optional
100
- },
101
- // usb dbg itf supports a certain cap since fw version XXvXXX (99v999 = not supported yet)
102
- // applies to hw listed in .usb_ids, only!
103
- usbcaps: {
104
- // todo rem - replaced by auto detection - rm2mstate_x10:'01v014' // \x10rm2mstate (instead at+rm2mstate)
105
- },
106
- dlo: {
107
- compileRestrictions: {
108
- '-z': 0
109
- }
110
- }
111
- },
112
- // M23x
113
- m23x: {
114
- name: 'M23x',
115
- dpid: 'm23x',
116
- interface: {
117
- type: 'usb',
118
- filter: {
119
- // filter used by client's navigator.usb.requestDevice to scan USB for compatible devices
120
- vendorId: 0x0483
121
- },
122
- fileChunk: 4096 //chunk size of a transmitting file part
123
- },
124
- usb_ids: ['rapidM2M M23 HW2.0', 'rapidM2M M23 HW1.0'],
125
- alt_ids: [],
126
- generation: 'M23',
127
- prog_mem: 8 * 1024 * 1024,
128
- data_mem: 8 * 1024 * 1024,
129
- total_mem: 8 * 1024 * 1024,
130
- hw_reqd: false,
131
- dde: DDE_CONFIG_Nk1k_4k1k_HISTDATA_1k1k,
132
- auto_inc: {
133
- ...auto_inc_default,
134
- DP_LED_CNT: 1,
135
- DP_GPIO_CNT: 6,
136
- DP_IRQ_CNT: 2,
137
- DP_I2C_CNT: 1,
138
- DP_SPI_CNT: 1,
139
- DP_UART_CNT: 1,
140
- DP_WIFI_CNT: 1
141
- },
142
- usbcaps: {
143
- // todo rem - replaced by auto detection - rm2mstate_x10:'99v999'
144
- // dbg itf (console) - usb chunks may hang, timeouts are only applicable if device sends a heartbeat
145
- dbgItfMayHangFixed: '99v999' // lowest version with fix (bug last seen on 01v005)
146
- // ^^^^^ !!!! hardcoded implementation !!!! search for dbgItfMayHangFixed !!!!!
147
- },
148
- dlo: {
149
- compileRestrictions: {}
150
- }
151
- },
152
- // NRF91
153
- nrf91: {
154
- name: 'NRF91',
155
- dpid: 'nrf91',
156
- interface: {
157
- type: 'usb',
158
- filter: {
159
- // filter used by client's navigator.usb.requestDevice to scan USB for compatible devices
160
- vendorId: 0x2544
161
- // productId: 32777
162
- // classCode: 0xFF ... deviceClass: 255
163
- // protocolCode: 0x01 ... deviceProtocol: 0
164
- // productName: "rapidM2M IoT-Box HW1.1"
165
- // serialNumber: "861694037822xxxx"
166
- },
167
- fileChunk: 2048 //chunk size of a transmitting file part
168
- },
169
- usb_ids: ['rapidM2M NRF91 HW1.0', 'ONE NRF91 HW1.0', 'rapidM2M Evolve HW1.0'], // primary USB ID's assigned to this DP
170
- alt_ids: [], // 'rapidM2M IoT-Box HW1.1' - alternative USB ID's on which this DP works too because hw is a super-set of primary hw
171
- generation: 'NRF91',
172
- prog_mem: 256 * 1024, // max. memory available for prog
173
- data_mem: 64 * 1024, // max. memory available for data+stack+heap
174
- total_mem: 256 * 1024, // total memory available for prog+data
175
- hw_reqd: false, // truthy: can choose this DP only when hw listed in usb_ids is present (otherwise:anytime)
176
- dde: DDE_CONFIG_Nk1k_4k1k_HISTDATA_1k1k,
177
- auto_inc: {
178
- ...auto_inc_default,
179
- DP_LED_CNT: 1,
180
- DP_GPIO_CNT: 32,
181
- DP_IRQ_CNT: 6,
182
- DP_I2C_CNT: 2,
183
- DP_SPI_CNT: 2,
184
- DP_UART_CNT: 2,
185
- DP_AIN_CNT: 8,
186
- DP_PWM_CNT: 3
187
- },
188
- // usb dbg itf supports a certain cap since fw version XXvXXX (99v999 = not supported yet)
189
- // applies to hw listed in .usb_ids, only!
190
- usbcaps: {
191
- // todo rem - replaced by auto detection - rm2mstate_x10:'01v014' // \x10rm2mstate (instead at+rm2mstate)
192
- }
193
- },
194
- // M2 BLE-GW
195
- m2blegw: {
196
- name: 'BLE Gateway',
197
- dpid: 'm2blegw',
198
- interface: {
199
- type: 'usb',
200
- filter: {
201
- // filter used by client's navigator.usb.requestDevice to scan USB for compatible devices
202
- vendorId: 0x2544
203
- // productId: 32777
204
- // classCode: 0xFF ... deviceClass: 255
205
- // protocolCode: 0x01 ... deviceProtocol: 0
206
- // productName: "rapidM2M IoT-Box HW1.1"
207
- // serialNumber: "861694037822xxxx"
208
- },
209
- fileChunk: 4096 //chunk size of a transmitting file part
210
- },
211
- usb_ids: ['rapidM2M BLEGW HW1.0'], // primary USB ID's assigned to this DP
212
- alt_ids: [], // 'rapidM2M IoT-Box HW1.1' - alternative USB ID's on which this DP works too because hw is a super-set of primary hw
213
- generation: 'M2',
214
- prog_mem: 256 * 1024, // max. memory available for prog
215
- data_mem: 256 * 1024, // max. memory available for data+stack+heap
216
- total_mem: 256 * 1024, // total memory available for prog+data
217
- hw_reqd: false, // truthy: can choose this DP only when hw listed in usb_ids is present (otherwise:anytime)
218
- dde: DDE_CONFIG_Nk1k_4k1k_HISTDATA_1k1k,
219
- auto_inc: {
220
- ...auto_inc_default,
221
- DP_DISPLAY_CNT: 1, // display interfaces
222
- DP_DISPLAY_TYPE: 'xc', // extra compact, predefined functionality
223
- DP_BUTTON_CNT: 1, // system buttons
224
- DP_BLE_CNT: 1 // BLE interfaces
225
- },
226
- // usb dbg itf supports a certain cap since fw version XXvXXX (99v999 = not supported yet)
227
- // applies to hw listed in .usb_ids, only!
228
- usbcaps: {
229
- // todo rem - replaced by auto detection - rm2mstate_x10:'01v014' // \x10rm2mstate (instead at+rm2mstate)
230
- },
231
- dlo: {
232
- compileRestrictions: {
233
- '-z': 0
234
- }
235
- }
236
- },
237
- // M2 myDatalogEASY v3
238
- m2easyv3: {
239
- name: 'myDatalogEasy V3',
240
- dpid: 'm2easyv3',
241
- interface: {
242
- type: 'usb',
243
- filter: {
244
- // filter used by client's navigator.usb.requestDevice to scan USB for compatible devices
245
- vendorId: 0x2544
246
- },
247
- fileChunk: 4096 //chunk size of a transmitting file part
248
- },
249
- usb_ids: ['rapidM2M Easy HW3.0'],
250
- alt_ids: ['rapidM2M EasyIoT HW1.0', 'rapidM2M M220 HW1.0'],
251
- generation: 'M2',
252
- prog_mem: 256 * 1024,
253
- data_mem: 256 * 1024,
254
- total_mem: 256 * 1024,
255
- hw_reqd: false,
256
- dde: DDE_CONFIG_Nk1k_4k1k_HISTDATA_1k1k,
257
- auto_inc: {
258
- ...auto_inc_default,
259
- DP_LED_CNT: 1,
260
- DP_BUTTON_CNT: 1,
261
- DP_DIGOUT_CNT: 1,
262
- DP_UIN_CNT: 4,
263
- DP_TEMP_CNT: 1,
264
- DP_RS485_CNT: 1,
265
- DP_RS232_CNT: 1,
266
- DP_BLE_CNT: 1,
267
- DP_LORA_CNT: 1
268
- },
269
- usbcaps: {
270
- // todo rem - replaced by auto detection - rm2mstate_x10:'99v999'
271
- },
272
- dlo: {
273
- compileRestrictions: {
274
- '-z': 0
275
- }
276
- }
277
- },
278
- // M2 myDatalogEASY IoT
279
- m2easyiot: {
280
- name: 'myDatalogEasy IoT',
281
- dpid: 'm2easyiot',
282
- interface: {
283
- type: 'usb',
284
- filter: {
285
- // filter used by client's navigator.usb.requestDevice to scan USB for compatible devices
286
- vendorId: 0x2544
287
- },
288
- fileChunk: 4096 //chunk size of a transmitting file part
289
- },
290
- usb_ids: ['rapidM2M EasyIoT HW1.0'],
291
- alt_ids: [],
292
- generation: 'M2',
293
- prog_mem: 256 * 1024,
294
- data_mem: 256 * 1024,
295
- total_mem: 256 * 1024,
296
- hw_reqd: false,
297
- dde: DDE_CONFIG_Nk1k_4k1k_HISTDATA_1k1k,
298
- auto_inc: {
299
- ...auto_inc_default,
300
- DP_LED_CNT: 1,
301
- DP_BUTTON_CNT: 1,
302
- DP_DIGOUT_CNT: 1,
303
- DP_UIN_CNT: 4,
304
- DP_TEMP_CNT: 1,
305
- DP_RS485_CNT: 1,
306
- DP_RS232_CNT: 1,
307
- DP_BLE_CNT: 1,
308
- DP_LORA_CNT: 1
309
- },
310
- usbcaps: {
311
- // todo rem - replaced by auto detection - rm2mstate_x10:'99v999'
312
- },
313
- dlo: {
314
- compileRestrictions: {
315
- '-z': 0
316
- }
317
- }
318
- }
319
- // M3 IoT-Box
320
- /*m3iotbox: {
321
- name: 'IoT-Box',
322
- dpid: 'm3iotbox',
323
- interface: {
324
- type: 'usb',
325
- filter: {
326
- // filter used by client's navigator.usb.requestDevice to scan USB for compatible devices
327
- vendorId: 0x2544
328
- },
329
- fileChunk: 4096 //chunk size of a transmitting file part
330
- },
331
- usb_ids: ['rapidM2M IoT-Box HW1.0'],
332
- alt_ids: [],
333
- generation: 'M3',
334
- prog_mem: 256 * 1024,
335
- data_mem: 256 * 1024,
336
- total_mem: 256 * 1024,
337
- hw_reqd: false,
338
- dde: DDE_CONFIG_Nk1k_4k1k_HISTDATA_1k1k,
339
- auto_inc: {
340
- ...auto_inc_default,
341
- DP_LED_CNT: 1,
342
- DP_BUTTON_CNT: 1,
343
- DP_GPIO_CNT: 6,
344
- DP_UIN_CNT: 2,
345
- DP_I2C_CNT: 2,
346
- DP_SPI_CNT: 1,
347
- DP_UART_CNT: 2,
348
- DP_BLE_CNT: 1
349
- },
350
- usbcaps: {
351
- // todo rem - replaced by auto detection - rm2mstate_x10:'99v999'
352
- }
353
- },*/
354
- // T32x
355
- /*t32x: {
356
- name: 'T32x',
357
- dpid: 't32x',
358
- interface: {
359
- type: 'usb',
360
- filter: {
361
- // filter used by client's navigator.usb.requestDevice to scan USB for compatible devices
362
- vendorId: 0x2544
363
- },
364
- fileChunk: 4096 //chunk size of a transmitting file part
365
- },
366
- usb_ids: ['rapidM2M T32 HW1.0'],
367
- alt_ids: [],
368
- generation: 'M23',
369
- prog_mem: 256 * 1024, // max. memory available for prog
370
- data_mem: 256 * 1024, // max. memory available for data+stack+heap
371
- total_mem: 256 * 1024, // total memory available for prog+data
372
- hw_reqd: false,
373
- dde: DDE_CONFIG_Nk1k_4k1k_HISTDATA_1k1k,
374
- auto_inc: {
375
- ...auto_inc_default,
376
- DP_LED_CNT: 1,
377
- DP_GPIO_CNT: 2,
378
- DP_I2C_CNT: 1,
379
- DP_UART_CNT: 1,
380
- DP_BLE_CNT: 1,
381
- DP_NBIOT_CNT: 1
382
- },
383
- usbcaps: {
384
- // todo rem - replaced by auto detection - rm2mstate_x10:'99v999'
385
- },
386
- dlo: {
387
- compileRestrictions: {
388
- '-z': 0
389
- }
390
- }
391
- },*/
392
- // M22xs - serial communication
393
- /*m22xs: {
394
- name: 'M22x Serial',
395
- dpid: 'm22x',
396
- interface: {
397
- type: 'serial',
398
- filter: {
399
- // filter used by client's navigator.usb.requestDevice to scan USB for compatible devices
400
- //todo serial device vendor id's like ftdi or so...
401
- },
402
- baudrate: 115200,
403
- rxBuffer: 1024, //receive buffer of the device.
404
- fileChunk: 256 //chunk size of a transmitting file part
405
- },
406
- usb_ids: ['rapidM2M M2 HW1.0'], // primary USB ID's assigned to this DP
407
- alt_ids: [], // 'rapidM2M IoT-Box HW1.1' - alternative USB ID's on which this DP works too because hw is a super-set of primary hw
408
- generation: 'M2',
409
- prog_mem: 256 * 1024, // max. memory available for prog
410
- data_mem: 64 * 1024, // max. memory available for data+stack+heap
411
- total_mem: 256 * 1024, // total memory available for prog+data
412
- hw_reqd: false, // truthy: can choose this DP only when hw listed in usb_ids is present (otherwise:anytime)
413
- dde: DDE_CONFIG_Nk1k_4k1k_HISTDATA_1k1k,
414
- auto_inc: {
415
- ...auto_inc_default,
416
- DP_LED_CNT: 1,
417
- DP_GPIO_CNT: 6,
418
- DP_IRQ_CNT: 2,
419
- DP_I2C_CNT: 1,
420
- DP_SPI_CNT: 1,
421
- DP_UART_CNT: 2,
422
- DP_WIFI_CNT: 1 // optional
423
- },
424
- // usb dbg itf supports a certain cap since fw version XXvXXX (99v999 = not supported yet)
425
- // applies to hw listed in .usb_ids, only!
426
- usbcaps: {
427
- // todo rem - replaced by auto detection - rm2mstate_x10:'01v014' // \x10rm2mstate (instead at+rm2mstate)
428
- },
429
- dlo: {
430
- compileRestrictions: {
431
- '-z': 0
432
- }
433
- }
434
- },*/
435
- };
436
- //# sourceMappingURL=DeviceProfiles.js.map
package/out/FS.js DELETED
@@ -1,43 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FilePermission = exports.FileType = void 0;
4
- /**
5
- * Enumeration of file types. The types `File` and `Directory` can also be
6
- * a symbolic links, in that case use `FileType.File | FileType.SymbolicLink` and
7
- * `FileType.Directory | FileType.SymbolicLink`.
8
- */
9
- var FileType;
10
- (function (FileType) {
11
- /**
12
- * The file type is unknown.
13
- */
14
- FileType[FileType["Unknown"] = 0] = "Unknown";
15
- /**
16
- * A regular file.
17
- */
18
- FileType[FileType["File"] = 1] = "File";
19
- /**
20
- * A directory.
21
- */
22
- FileType[FileType["Directory"] = 2] = "Directory";
23
- /**
24
- * A symbolic link to a file.
25
- */
26
- FileType[FileType["SymbolicLink"] = 64] = "SymbolicLink";
27
- })(FileType || (exports.FileType = FileType = {}));
28
- /**
29
- * Permissions of a file.
30
- */
31
- var FilePermission;
32
- (function (FilePermission) {
33
- /**
34
- * The file is readonly.
35
- *
36
- * *Note:* All `FileStat` from a `FileSystemProvider` that is registered with
37
- * the option `isReadonly: true` will be implicitly handled as if `FilePermission.Readonly`
38
- * is set. As a consequence, it is not possible to have a readonly file system provider
39
- * registered where some `FileStat` are not readonly.
40
- */
41
- FilePermission[FilePermission["Readonly"] = 1] = "Readonly";
42
- })(FilePermission || (exports.FilePermission = FilePermission = {}));
43
- //# sourceMappingURL=FS.js.map
package/out/crc.js DELETED
@@ -1,93 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.crc32_ethernet = crc32_ethernet;
4
- exports.crc16_modbus = crc16_modbus;
5
- const au32_crc_ethernet = new Uint32Array([
6
- 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832,
7
- 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2,
8
- 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856, 0x646ba8c0, 0xfd62f97a,
9
- 0x8a65c9ec, 0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172,
10
- 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3,
11
- 0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423,
12
- 0xcfba9599, 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, 0x2f6f7c87, 0x58684c11, 0xc1611dab,
13
- 0xb6662d3d, 0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433,
14
- 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01, 0x6b6b51f4,
15
- 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950,
16
- 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074,
17
- 0xd4bb30e2, 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0,
18
- 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086, 0x5768b525,
19
- 0x206f85b3, 0xb966d409, 0xce61e49f, 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81,
20
- 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615,
21
- 0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1,
22
- 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7, 0xfed41b76,
23
- 0x89d32be0, 0x10da7a5a, 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8, 0xa1d1937e,
24
- 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c, 0x36034af6,
25
- 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
26
- 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7,
27
- 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f,
28
- 0x72076785, 0x05005713, 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7,
29
- 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777,
30
- 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278,
31
- 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc,
32
- 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, 0xbdbdf21c, 0xcabac28a, 0x53b39330,
33
- 0x24b4a3a6, 0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94,
34
- 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d
35
- ]);
36
- function crc32_ethernet(au8, previous = 0) {
37
- let u32 = ~~previous ^ -1; // todo rem? 0xFFFFFFFF>>>0; // >>> 0 forces result of bitwise ops to u32 (instead of js's default s32)
38
- for (let i = 0; i < au8.length; i++) {
39
- u32 = (u32 >>> 8) ^ au32_crc_ethernet[(u32 ^ au8[i]) & 0xff];
40
- }
41
- return (u32 ^ -1) >>> 0;
42
- }
43
- // Modbus CRC16: High-Order Byte Table
44
- const bCRCHi_table = new Uint8Array([
45
- 0x00, 0xc1, 0x81, 0x40, 0x01, 0xc0, 0x80, 0x41, 0x01, 0xc0, 0x80, 0x41, 0x00, 0xc1, 0x81, 0x40, 0x01, 0xc0, 0x80,
46
- 0x41, 0x00, 0xc1, 0x81, 0x40, 0x00, 0xc1, 0x81, 0x40, 0x01, 0xc0, 0x80, 0x41, 0x01, 0xc0, 0x80, 0x41, 0x00, 0xc1,
47
- 0x81, 0x40, 0x00, 0xc1, 0x81, 0x40, 0x01, 0xc0, 0x80, 0x41, 0x00, 0xc1, 0x81, 0x40, 0x01, 0xc0, 0x80, 0x41, 0x01,
48
- 0xc0, 0x80, 0x41, 0x00, 0xc1, 0x81, 0x40, 0x01, 0xc0, 0x80, 0x41, 0x00, 0xc1, 0x81, 0x40, 0x00, 0xc1, 0x81, 0x40,
49
- 0x01, 0xc0, 0x80, 0x41, 0x00, 0xc1, 0x81, 0x40, 0x01, 0xc0, 0x80, 0x41, 0x01, 0xc0, 0x80, 0x41, 0x00, 0xc1, 0x81,
50
- 0x40, 0x00, 0xc1, 0x81, 0x40, 0x01, 0xc0, 0x80, 0x41, 0x01, 0xc0, 0x80, 0x41, 0x00, 0xc1, 0x81, 0x40, 0x01, 0xc0,
51
- 0x80, 0x41, 0x00, 0xc1, 0x81, 0x40, 0x00, 0xc1, 0x81, 0x40, 0x01, 0xc0, 0x80, 0x41, 0x01, 0xc0, 0x80, 0x41, 0x00,
52
- 0xc1, 0x81, 0x40, 0x00, 0xc1, 0x81, 0x40, 0x01, 0xc0, 0x80, 0x41, 0x00, 0xc1, 0x81, 0x40, 0x01, 0xc0, 0x80, 0x41,
53
- 0x01, 0xc0, 0x80, 0x41, 0x00, 0xc1, 0x81, 0x40, 0x00, 0xc1, 0x81, 0x40, 0x01, 0xc0, 0x80, 0x41, 0x01, 0xc0, 0x80,
54
- 0x41, 0x00, 0xc1, 0x81, 0x40, 0x01, 0xc0, 0x80, 0x41, 0x00, 0xc1, 0x81, 0x40, 0x00, 0xc1, 0x81, 0x40, 0x01, 0xc0,
55
- 0x80, 0x41, 0x00, 0xc1, 0x81, 0x40, 0x01, 0xc0, 0x80, 0x41, 0x01, 0xc0, 0x80, 0x41, 0x00, 0xc1, 0x81, 0x40, 0x01,
56
- 0xc0, 0x80, 0x41, 0x00, 0xc1, 0x81, 0x40, 0x00, 0xc1, 0x81, 0x40, 0x01, 0xc0, 0x80, 0x41, 0x01, 0xc0, 0x80, 0x41,
57
- 0x00, 0xc1, 0x81, 0x40, 0x00, 0xc1, 0x81, 0x40, 0x01, 0xc0, 0x80, 0x41, 0x00, 0xc1, 0x81, 0x40, 0x01, 0xc0, 0x80,
58
- 0x41, 0x01, 0xc0, 0x80, 0x41, 0x00, 0xc1, 0x81, 0x40
59
- ]);
60
- // Modbus CRC16: Low-Order Byte Table
61
- const bCRCLo_table = new Uint8Array([
62
- 0x00, 0xc0, 0xc1, 0x01, 0xc3, 0x03, 0x02, 0xc2, 0xc6, 0x06, 0x07, 0xc7, 0x05, 0xc5, 0xc4, 0x04, 0xcc, 0x0c, 0x0d,
63
- 0xcd, 0x0f, 0xcf, 0xce, 0x0e, 0x0a, 0xca, 0xcb, 0x0b, 0xc9, 0x09, 0x08, 0xc8, 0xd8, 0x18, 0x19, 0xd9, 0x1b, 0xdb,
64
- 0xda, 0x1a, 0x1e, 0xde, 0xdf, 0x1f, 0xdd, 0x1d, 0x1c, 0xdc, 0x14, 0xd4, 0xd5, 0x15, 0xd7, 0x17, 0x16, 0xd6, 0xd2,
65
- 0x12, 0x13, 0xd3, 0x11, 0xd1, 0xd0, 0x10, 0xf0, 0x30, 0x31, 0xf1, 0x33, 0xf3, 0xf2, 0x32, 0x36, 0xf6, 0xf7, 0x37,
66
- 0xf5, 0x35, 0x34, 0xf4, 0x3c, 0xfc, 0xfd, 0x3d, 0xff, 0x3f, 0x3e, 0xfe, 0xfa, 0x3a, 0x3b, 0xfb, 0x39, 0xf9, 0xf8,
67
- 0x38, 0x28, 0xe8, 0xe9, 0x29, 0xeb, 0x2b, 0x2a, 0xea, 0xee, 0x2e, 0x2f, 0xef, 0x2d, 0xed, 0xec, 0x2c, 0xe4, 0x24,
68
- 0x25, 0xe5, 0x27, 0xe7, 0xe6, 0x26, 0x22, 0xe2, 0xe3, 0x23, 0xe1, 0x21, 0x20, 0xe0, 0xa0, 0x60, 0x61, 0xa1, 0x63,
69
- 0xa3, 0xa2, 0x62, 0x66, 0xa6, 0xa7, 0x67, 0xa5, 0x65, 0x64, 0xa4, 0x6c, 0xac, 0xad, 0x6d, 0xaf, 0x6f, 0x6e, 0xae,
70
- 0xaa, 0x6a, 0x6b, 0xab, 0x69, 0xa9, 0xa8, 0x68, 0x78, 0xb8, 0xb9, 0x79, 0xbb, 0x7b, 0x7a, 0xba, 0xbe, 0x7e, 0x7f,
71
- 0xbf, 0x7d, 0xbd, 0xbc, 0x7c, 0xb4, 0x74, 0x75, 0xb5, 0x77, 0xb7, 0xb6, 0x76, 0x72, 0xb2, 0xb3, 0x73, 0xb1, 0x71,
72
- 0x70, 0xb0, 0x50, 0x90, 0x91, 0x51, 0x93, 0x53, 0x52, 0x92, 0x96, 0x56, 0x57, 0x97, 0x55, 0x95, 0x94, 0x54, 0x9c,
73
- 0x5c, 0x5d, 0x9d, 0x5f, 0x9f, 0x9e, 0x5e, 0x5a, 0x9a, 0x9b, 0x5b, 0x99, 0x59, 0x58, 0x98, 0x88, 0x48, 0x49, 0x89,
74
- 0x4b, 0x8b, 0x8a, 0x4a, 0x4e, 0x8e, 0x8f, 0x4f, 0x8d, 0x4d, 0x4c, 0x8c, 0x44, 0x84, 0x85, 0x45, 0x87, 0x47, 0x46,
75
- 0x86, 0x82, 0x42, 0x43, 0x83, 0x41, 0x81, 0x80, 0x40
76
- ]);
77
- /**
78
- * @param buf:Uint8Array|ArrayBuffer - byteLength indicates number of bytes
79
- * @returns:number - crc16 over <au8>
80
- */
81
- function crc16_modbus(au8) {
82
- const len = au8.length;
83
- let bCRCHi = 0xff; // high byte of CRC initialized
84
- let bCRCLo = 0xff; // low byte of CRC initialized
85
- for (let i = 0; i < len; i++) {
86
- // go over buffer
87
- const bIndex = (bCRCLo ^ au8[i]) & 0xff; // calculate the CRC
88
- bCRCLo = (bCRCHi ^ bCRCHi_table[bIndex]) & 0xff;
89
- bCRCHi = bCRCLo_table[bIndex];
90
- }
91
- return (0x100 * bCRCHi) | bCRCLo;
92
- }
93
- //# sourceMappingURL=crc.js.map