modbus-rs-wasm 0.12.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/README.md +68 -0
- package/dist/bundler/modbus-rs.d.ts +645 -0
- package/dist/bundler/modbus-rs.js +9 -0
- package/dist/bundler/modbus-rs_bg.wasm +0 -0
- package/dist/web/modbus-rs.d.ts +800 -0
- package/dist/web/modbus-rs.js +2040 -0
- package/dist/web/modbus-rs_bg.wasm +0 -0
- package/package.json +52 -0
|
@@ -0,0 +1,2040 @@
|
|
|
1
|
+
/* @ts-self-types="./modbus-rs.d.ts" */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Browser-facing Modbus client that communicates over a WebSocket transport.
|
|
5
|
+
*/
|
|
6
|
+
export class WasmModbusClient {
|
|
7
|
+
__destroy_into_raw() {
|
|
8
|
+
const ptr = this.__wbg_ptr;
|
|
9
|
+
this.__wbg_ptr = 0;
|
|
10
|
+
WasmModbusClientFinalization.unregister(this);
|
|
11
|
+
return ptr;
|
|
12
|
+
}
|
|
13
|
+
free() {
|
|
14
|
+
const ptr = this.__destroy_into_raw();
|
|
15
|
+
wasm.__wbg_wasmmodbusclient_free(ptr, 0);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Send a Diagnostics request (FC 8).
|
|
19
|
+
*
|
|
20
|
+
* `sub_function` is one of the `DiagnosticSubFunction` u16 codes.
|
|
21
|
+
* Returns a `Promise` resolving with `{ subFunction, data: Uint16Array }` or rejects on error.
|
|
22
|
+
* @param {number} sub_function
|
|
23
|
+
* @param {Uint16Array} data
|
|
24
|
+
* @returns {Promise<any>}
|
|
25
|
+
*/
|
|
26
|
+
diagnostics(sub_function, data) {
|
|
27
|
+
const ptr0 = passArray16ToWasm0(data, wasm.__wbindgen_malloc);
|
|
28
|
+
const len0 = WASM_VECTOR_LEN;
|
|
29
|
+
const ret = wasm.wasmmodbusclient_diagnostics(this.__wbg_ptr, sub_function, ptr0, len0);
|
|
30
|
+
return ret;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Read the communication event counter (FC 11).
|
|
34
|
+
*
|
|
35
|
+
* Returns a `Promise` resolving with `{ status, eventCount }` or rejects on error.
|
|
36
|
+
* @returns {Promise<any>}
|
|
37
|
+
*/
|
|
38
|
+
get_comm_event_counter() {
|
|
39
|
+
const ret = wasm.wasmmodbusclient_get_comm_event_counter(this.__wbg_ptr);
|
|
40
|
+
return ret;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Read the communication event log (FC 12).
|
|
44
|
+
*
|
|
45
|
+
* Returns a `Promise` resolving with `{ status, eventCount, messageCount, events: Uint8Array }`
|
|
46
|
+
* or rejects on error.
|
|
47
|
+
* @returns {Promise<any>}
|
|
48
|
+
*/
|
|
49
|
+
get_comm_event_log() {
|
|
50
|
+
const ret = wasm.wasmmodbusclient_get_comm_event_log(this.__wbg_ptr);
|
|
51
|
+
return ret;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Returns `true` if there are in-flight Modbus requests waiting for
|
|
55
|
+
* response/timeout resolution.
|
|
56
|
+
* @returns {boolean}
|
|
57
|
+
*/
|
|
58
|
+
has_pending_requests() {
|
|
59
|
+
const ret = wasm.wasmmodbusclient_has_pending_requests(this.__wbg_ptr);
|
|
60
|
+
return ret !== 0;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Returns `true` when the underlying WebSocket is open and the transport
|
|
64
|
+
* considers itself connected.
|
|
65
|
+
* @returns {boolean}
|
|
66
|
+
*/
|
|
67
|
+
is_connected() {
|
|
68
|
+
const ret = wasm.wasmmodbusclient_is_connected(this.__wbg_ptr);
|
|
69
|
+
return ret !== 0;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Apply an AND/OR mask to a holding register at `address` (FC 22).
|
|
73
|
+
*
|
|
74
|
+
* Result register = (current & and_mask) | (or_mask & !and_mask).
|
|
75
|
+
* Returns a `Promise` resolving with `true` or rejects on error.
|
|
76
|
+
* @param {number} address
|
|
77
|
+
* @param {number} and_mask
|
|
78
|
+
* @param {number} or_mask
|
|
79
|
+
* @returns {Promise<any>}
|
|
80
|
+
*/
|
|
81
|
+
mask_write_register(address, and_mask, or_mask) {
|
|
82
|
+
const ret = wasm.wasmmodbusclient_mask_write_register(this.__wbg_ptr, address, and_mask, or_mask);
|
|
83
|
+
return ret;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Create a new Modbus master client and immediately start the background tick loop.
|
|
87
|
+
*
|
|
88
|
+
* # Arguments
|
|
89
|
+
* - `ws_url` — WebSocket URL of the Modbus/TCP gateway (e.g. `"ws://192.168.1.1:8502"`).
|
|
90
|
+
* - `unit_id` — Modbus unit ID / slave address of the target device (1–247).
|
|
91
|
+
* - `response_timeout_ms` — How long (ms) to wait before retrying or failing a request.
|
|
92
|
+
* - `retry_attempts` — Number of retries before reporting an error to JS.
|
|
93
|
+
* - `tick_interval_ms` — How often (ms) the tick loop calls `poll()`. 20 ms is a safe default.
|
|
94
|
+
* @param {string} ws_url
|
|
95
|
+
* @param {number} unit_id
|
|
96
|
+
* @param {number} response_timeout_ms
|
|
97
|
+
* @param {number} retry_attempts
|
|
98
|
+
* @param {number} tick_interval_ms
|
|
99
|
+
*/
|
|
100
|
+
constructor(ws_url, unit_id, response_timeout_ms, retry_attempts, tick_interval_ms) {
|
|
101
|
+
const ptr0 = passStringToWasm0(ws_url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
102
|
+
const len0 = WASM_VECTOR_LEN;
|
|
103
|
+
const ret = wasm.wasmmodbusclient_new(ptr0, len0, unit_id, response_timeout_ms, retry_attempts, tick_interval_ms);
|
|
104
|
+
if (ret[2]) {
|
|
105
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
106
|
+
}
|
|
107
|
+
this.__wbg_ptr = ret[0];
|
|
108
|
+
WasmModbusClientFinalization.register(this, this.__wbg_ptr, this);
|
|
109
|
+
return this;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Read `quantity` coils starting at `address`.
|
|
113
|
+
*
|
|
114
|
+
* Returns a `Promise` that resolves with a `Uint8Array` (bit-packed coil bytes)
|
|
115
|
+
* or rejects with an error string on failure.
|
|
116
|
+
* @param {number} address
|
|
117
|
+
* @param {number} quantity
|
|
118
|
+
* @returns {Promise<any>}
|
|
119
|
+
*/
|
|
120
|
+
read_coils(address, quantity) {
|
|
121
|
+
const ret = wasm.wasmmodbusclient_read_coils(this.__wbg_ptr, address, quantity);
|
|
122
|
+
return ret;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Read Device Identification (FC 43 / MEI 0x0E).
|
|
126
|
+
*
|
|
127
|
+
* `read_device_id_code`: 1=Basic, 2=Regular, 3=Extended, 4=Specific.
|
|
128
|
+
* `object_id`: 0x00=VendorName, 0x01=ProductCode, 0x02=Revision, 0x03=VendorURL, etc.
|
|
129
|
+
* Returns a `Promise` resolving with `{ readDeviceIdCode, conformityLevel, moreFollows, objects }`
|
|
130
|
+
* or rejects on error.
|
|
131
|
+
* @param {number} read_device_id_code
|
|
132
|
+
* @param {number} object_id
|
|
133
|
+
* @returns {Promise<any>}
|
|
134
|
+
*/
|
|
135
|
+
read_device_identification(read_device_id_code, object_id) {
|
|
136
|
+
const ret = wasm.wasmmodbusclient_read_device_identification(this.__wbg_ptr, read_device_id_code, object_id);
|
|
137
|
+
return ret;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Read `quantity` discrete inputs starting at `address`.
|
|
141
|
+
*
|
|
142
|
+
* Returns a `Promise` that resolves with a `Uint8Array` (bit-packed)
|
|
143
|
+
* or rejects on error.
|
|
144
|
+
* @param {number} address
|
|
145
|
+
* @param {number} quantity
|
|
146
|
+
* @returns {Promise<any>}
|
|
147
|
+
*/
|
|
148
|
+
read_discrete_inputs(address, quantity) {
|
|
149
|
+
const ret = wasm.wasmmodbusclient_read_discrete_inputs(this.__wbg_ptr, address, quantity);
|
|
150
|
+
return ret;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Read the exception status (FC 7) — serial-line only on most devices.
|
|
154
|
+
*
|
|
155
|
+
* Returns a `Promise` resolving with a status `number` or rejects on error.
|
|
156
|
+
* @returns {Promise<any>}
|
|
157
|
+
*/
|
|
158
|
+
read_exception_status() {
|
|
159
|
+
const ret = wasm.wasmmodbusclient_read_exception_status(this.__wbg_ptr);
|
|
160
|
+
return ret;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Read the FIFO queue pointed to by `address` (FC 24).
|
|
164
|
+
*
|
|
165
|
+
* Returns a `Promise` resolving with a `Uint16Array` or rejects on error.
|
|
166
|
+
* @param {number} address
|
|
167
|
+
* @returns {Promise<any>}
|
|
168
|
+
*/
|
|
169
|
+
read_fifo_queue(address) {
|
|
170
|
+
const ret = wasm.wasmmodbusclient_read_fifo_queue(this.__wbg_ptr, address);
|
|
171
|
+
return ret;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Read a file record (FC 20).
|
|
175
|
+
*
|
|
176
|
+
* Returns a `Promise` resolving with `Array<{ fileNumber, recordNumber, data: Uint16Array }>`
|
|
177
|
+
* or rejects on error.
|
|
178
|
+
* @param {number} file_number
|
|
179
|
+
* @param {number} record_number
|
|
180
|
+
* @param {number} record_length
|
|
181
|
+
* @returns {Promise<any>}
|
|
182
|
+
*/
|
|
183
|
+
read_file_record(file_number, record_number, record_length) {
|
|
184
|
+
const ret = wasm.wasmmodbusclient_read_file_record(this.__wbg_ptr, file_number, record_number, record_length);
|
|
185
|
+
return ret;
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Read `quantity` holding registers starting at `address`.
|
|
189
|
+
*
|
|
190
|
+
* Returns a `Promise` that resolves with a `Uint16Array` (register values)
|
|
191
|
+
* or rejects with an error string on failure.
|
|
192
|
+
* @param {number} address
|
|
193
|
+
* @param {number} quantity
|
|
194
|
+
* @returns {Promise<any>}
|
|
195
|
+
*/
|
|
196
|
+
read_holding_registers(address, quantity) {
|
|
197
|
+
const ret = wasm.wasmmodbusclient_read_holding_registers(this.__wbg_ptr, address, quantity);
|
|
198
|
+
return ret;
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Read `quantity` input registers starting at `address`.
|
|
202
|
+
*
|
|
203
|
+
* Returns a `Promise` that resolves with a `Uint16Array` or rejects on error.
|
|
204
|
+
* @param {number} address
|
|
205
|
+
* @param {number} quantity
|
|
206
|
+
* @returns {Promise<any>}
|
|
207
|
+
*/
|
|
208
|
+
read_input_registers(address, quantity) {
|
|
209
|
+
const ret = wasm.wasmmodbusclient_read_input_registers(this.__wbg_ptr, address, quantity);
|
|
210
|
+
return ret;
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Read a single coil at `address`.
|
|
214
|
+
*
|
|
215
|
+
* Returns a `Promise` that resolves with a `boolean` or rejects on error.
|
|
216
|
+
* @param {number} address
|
|
217
|
+
* @returns {Promise<any>}
|
|
218
|
+
*/
|
|
219
|
+
read_single_coil(address) {
|
|
220
|
+
const ret = wasm.wasmmodbusclient_read_single_coil(this.__wbg_ptr, address);
|
|
221
|
+
return ret;
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Read a single discrete input at `address`.
|
|
225
|
+
*
|
|
226
|
+
* Returns a `Promise` resolving with a `boolean` or rejects on error.
|
|
227
|
+
* @param {number} address
|
|
228
|
+
* @returns {Promise<any>}
|
|
229
|
+
*/
|
|
230
|
+
read_single_discrete_input(address) {
|
|
231
|
+
const ret = wasm.wasmmodbusclient_read_single_discrete_input(this.__wbg_ptr, address);
|
|
232
|
+
return ret;
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Read a single holding register at `address`.
|
|
236
|
+
*
|
|
237
|
+
* Returns a `Promise` that resolves with a `number` or rejects on error.
|
|
238
|
+
* @param {number} address
|
|
239
|
+
* @returns {Promise<any>}
|
|
240
|
+
*/
|
|
241
|
+
read_single_holding_register(address) {
|
|
242
|
+
const ret = wasm.wasmmodbusclient_read_single_holding_register(this.__wbg_ptr, address);
|
|
243
|
+
return ret;
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Read a single input register at `address`.
|
|
247
|
+
*
|
|
248
|
+
* Returns a `Promise` that resolves with a `number` or rejects on error.
|
|
249
|
+
* @param {number} address
|
|
250
|
+
* @returns {Promise<any>}
|
|
251
|
+
*/
|
|
252
|
+
read_single_input_register(address) {
|
|
253
|
+
const ret = wasm.wasmmodbusclient_read_single_input_register(this.__wbg_ptr, address);
|
|
254
|
+
return ret;
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Perform an atomic read-then-write on holding registers.
|
|
258
|
+
*
|
|
259
|
+
* Reads `read_quantity` registers from `read_address`, then writes `values` to `write_address`.
|
|
260
|
+
* `write_quantity` is ignored — the quantity written is derived from `values.length`.
|
|
261
|
+
* Returns a `Promise` resolving with a `Uint16Array` (the values read) or rejects on error.
|
|
262
|
+
* @param {number} read_address
|
|
263
|
+
* @param {number} read_quantity
|
|
264
|
+
* @param {number} write_address
|
|
265
|
+
* @param {number} _write_quantity
|
|
266
|
+
* @param {Uint16Array} values
|
|
267
|
+
* @returns {Promise<any>}
|
|
268
|
+
*/
|
|
269
|
+
read_write_multiple_registers(read_address, read_quantity, write_address, _write_quantity, values) {
|
|
270
|
+
const ptr0 = passArray16ToWasm0(values, wasm.__wbindgen_malloc);
|
|
271
|
+
const len0 = WASM_VECTOR_LEN;
|
|
272
|
+
const ret = wasm.wasmmodbusclient_read_write_multiple_registers(this.__wbg_ptr, read_address, read_quantity, write_address, _write_quantity, ptr0, len0);
|
|
273
|
+
return ret;
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* Drop all pending in-flight requests and attempt to reconnect the WebSocket.
|
|
277
|
+
* Outstanding Promises for dropped requests will be rejected with `"ConnectionLost"`.
|
|
278
|
+
* @returns {boolean}
|
|
279
|
+
*/
|
|
280
|
+
reconnect() {
|
|
281
|
+
const ret = wasm.wasmmodbusclient_reconnect(this.__wbg_ptr);
|
|
282
|
+
return ret !== 0;
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* Report Server ID (FC 17).
|
|
286
|
+
*
|
|
287
|
+
* Returns a `Promise` resolving with a `Uint8Array` (raw server ID data) or rejects on error.
|
|
288
|
+
* @returns {Promise<any>}
|
|
289
|
+
*/
|
|
290
|
+
report_server_id() {
|
|
291
|
+
const ret = wasm.wasmmodbusclient_report_server_id(this.__wbg_ptr);
|
|
292
|
+
return ret;
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* Write a file record (FC 21).
|
|
296
|
+
*
|
|
297
|
+
* `values` is a `Uint16Array` of register values to write.
|
|
298
|
+
* Returns a `Promise` resolving with `true` or rejects on error.
|
|
299
|
+
* @param {number} file_number
|
|
300
|
+
* @param {number} record_number
|
|
301
|
+
* @param {Uint16Array} values
|
|
302
|
+
* @returns {Promise<any>}
|
|
303
|
+
*/
|
|
304
|
+
write_file_record(file_number, record_number, values) {
|
|
305
|
+
const ptr0 = passArray16ToWasm0(values, wasm.__wbindgen_malloc);
|
|
306
|
+
const len0 = WASM_VECTOR_LEN;
|
|
307
|
+
const ret = wasm.wasmmodbusclient_write_file_record(this.__wbg_ptr, file_number, record_number, ptr0, len0);
|
|
308
|
+
return ret;
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* Write multiple coils starting at `address`.
|
|
312
|
+
*
|
|
313
|
+
* `packed_bytes` is a bit-packed `Uint8Array` (LSB of byte 0 = coil at `address`).
|
|
314
|
+
* Returns a `Promise` that resolves with `{ address, quantity }` or rejects on error.
|
|
315
|
+
* @param {number} address
|
|
316
|
+
* @param {number} quantity
|
|
317
|
+
* @param {Uint8Array} packed_bytes
|
|
318
|
+
* @returns {Promise<any>}
|
|
319
|
+
*/
|
|
320
|
+
write_multiple_coils(address, quantity, packed_bytes) {
|
|
321
|
+
const ptr0 = passArray8ToWasm0(packed_bytes, wasm.__wbindgen_malloc);
|
|
322
|
+
const len0 = WASM_VECTOR_LEN;
|
|
323
|
+
const ret = wasm.wasmmodbusclient_write_multiple_coils(this.__wbg_ptr, address, quantity, ptr0, len0);
|
|
324
|
+
return ret;
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* Write `values` to multiple consecutive holding registers starting at `address`.
|
|
328
|
+
*
|
|
329
|
+
* Returns a `Promise` that resolves with `{ address, quantity }` or rejects on error.
|
|
330
|
+
* @param {number} address
|
|
331
|
+
* @param {number} quantity
|
|
332
|
+
* @param {Uint16Array} values
|
|
333
|
+
* @returns {Promise<any>}
|
|
334
|
+
*/
|
|
335
|
+
write_multiple_registers(address, quantity, values) {
|
|
336
|
+
const ptr0 = passArray16ToWasm0(values, wasm.__wbindgen_malloc);
|
|
337
|
+
const len0 = WASM_VECTOR_LEN;
|
|
338
|
+
const ret = wasm.wasmmodbusclient_write_multiple_registers(this.__wbg_ptr, address, quantity, ptr0, len0);
|
|
339
|
+
return ret;
|
|
340
|
+
}
|
|
341
|
+
/**
|
|
342
|
+
* Write a single coil at `address` to `value` (true = ON, false = OFF).
|
|
343
|
+
*
|
|
344
|
+
* Returns a `Promise` that resolves with `{ address, value }` or rejects on error.
|
|
345
|
+
* @param {number} address
|
|
346
|
+
* @param {boolean} value
|
|
347
|
+
* @returns {Promise<any>}
|
|
348
|
+
*/
|
|
349
|
+
write_single_coil(address, value) {
|
|
350
|
+
const ret = wasm.wasmmodbusclient_write_single_coil(this.__wbg_ptr, address, value);
|
|
351
|
+
return ret;
|
|
352
|
+
}
|
|
353
|
+
/**
|
|
354
|
+
* Write `value` to a single holding register at `address`.
|
|
355
|
+
*
|
|
356
|
+
* Returns a `Promise` that resolves with `{ address, value }` or rejects on error.
|
|
357
|
+
* @param {number} address
|
|
358
|
+
* @param {number} value
|
|
359
|
+
* @returns {Promise<any>}
|
|
360
|
+
*/
|
|
361
|
+
write_single_register(address, value) {
|
|
362
|
+
const ret = wasm.wasmmodbusclient_write_single_register(this.__wbg_ptr, address, value);
|
|
363
|
+
return ret;
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
if (Symbol.dispose) WasmModbusClient.prototype[Symbol.dispose] = WasmModbusClient.prototype.free;
|
|
367
|
+
|
|
368
|
+
/**
|
|
369
|
+
* Browser-facing Modbus client that communicates over Web Serial RTU or ASCII.
|
|
370
|
+
*/
|
|
371
|
+
export class WasmSerialModbusClient {
|
|
372
|
+
__destroy_into_raw() {
|
|
373
|
+
const ptr = this.__wbg_ptr;
|
|
374
|
+
this.__wbg_ptr = 0;
|
|
375
|
+
WasmSerialModbusClientFinalization.unregister(this);
|
|
376
|
+
return ptr;
|
|
377
|
+
}
|
|
378
|
+
free() {
|
|
379
|
+
const ptr = this.__destroy_into_raw();
|
|
380
|
+
wasm.__wbg_wasmserialmodbusclient_free(ptr, 0);
|
|
381
|
+
}
|
|
382
|
+
/**
|
|
383
|
+
* Send a Diagnostics request (FC 8).
|
|
384
|
+
*
|
|
385
|
+
* `sub_function` is one of the `DiagnosticSubFunction` u16 codes.
|
|
386
|
+
* Returns a `Promise` resolving with `{ subFunction, data: Uint16Array }` or rejects on error.
|
|
387
|
+
* @param {number} sub_function
|
|
388
|
+
* @param {Uint16Array} data
|
|
389
|
+
* @returns {Promise<any>}
|
|
390
|
+
*/
|
|
391
|
+
diagnostics(sub_function, data) {
|
|
392
|
+
const ptr0 = passArray16ToWasm0(data, wasm.__wbindgen_malloc);
|
|
393
|
+
const len0 = WASM_VECTOR_LEN;
|
|
394
|
+
const ret = wasm.wasmserialmodbusclient_diagnostics(this.__wbg_ptr, sub_function, ptr0, len0);
|
|
395
|
+
return ret;
|
|
396
|
+
}
|
|
397
|
+
/**
|
|
398
|
+
* Read the communication event counter (FC 11).
|
|
399
|
+
*
|
|
400
|
+
* Returns a `Promise` resolving with `{ status, eventCount }` or rejects on error.
|
|
401
|
+
* @returns {Promise<any>}
|
|
402
|
+
*/
|
|
403
|
+
get_comm_event_counter() {
|
|
404
|
+
const ret = wasm.wasmserialmodbusclient_get_comm_event_counter(this.__wbg_ptr);
|
|
405
|
+
return ret;
|
|
406
|
+
}
|
|
407
|
+
/**
|
|
408
|
+
* Read the communication event log (FC 12).
|
|
409
|
+
*
|
|
410
|
+
* Returns a `Promise` resolving with `{ status, eventCount, messageCount, events: Uint8Array }`
|
|
411
|
+
* or rejects on error.
|
|
412
|
+
* @returns {Promise<any>}
|
|
413
|
+
*/
|
|
414
|
+
get_comm_event_log() {
|
|
415
|
+
const ret = wasm.wasmserialmodbusclient_get_comm_event_log(this.__wbg_ptr);
|
|
416
|
+
return ret;
|
|
417
|
+
}
|
|
418
|
+
/**
|
|
419
|
+
* Returns `true` if there are in-flight Modbus requests waiting for
|
|
420
|
+
* response/timeout resolution.
|
|
421
|
+
* @returns {boolean}
|
|
422
|
+
*/
|
|
423
|
+
has_pending_requests() {
|
|
424
|
+
const ret = wasm.wasmserialmodbusclient_has_pending_requests(this.__wbg_ptr);
|
|
425
|
+
return ret !== 0;
|
|
426
|
+
}
|
|
427
|
+
/**
|
|
428
|
+
* Returns `true` when the serial port is open and the transport considers itself connected.
|
|
429
|
+
* @returns {boolean}
|
|
430
|
+
*/
|
|
431
|
+
is_connected() {
|
|
432
|
+
const ret = wasm.wasmserialmodbusclient_is_connected(this.__wbg_ptr);
|
|
433
|
+
return ret !== 0;
|
|
434
|
+
}
|
|
435
|
+
/**
|
|
436
|
+
* Apply an AND/OR mask to a holding register at `address` (FC 22).
|
|
437
|
+
*
|
|
438
|
+
* Result register = (current & and_mask) | (or_mask & !and_mask).
|
|
439
|
+
* Returns a `Promise` resolving with `true` or rejects on error.
|
|
440
|
+
* @param {number} address
|
|
441
|
+
* @param {number} and_mask
|
|
442
|
+
* @param {number} or_mask
|
|
443
|
+
* @returns {Promise<any>}
|
|
444
|
+
*/
|
|
445
|
+
mask_write_register(address, and_mask, or_mask) {
|
|
446
|
+
const ret = wasm.wasmserialmodbusclient_mask_write_register(this.__wbg_ptr, address, and_mask, or_mask);
|
|
447
|
+
return ret;
|
|
448
|
+
}
|
|
449
|
+
/**
|
|
450
|
+
* Creates a Modbus serial client over browser Web Serial.
|
|
451
|
+
*
|
|
452
|
+
* `mode` accepts "rtu" or "ascii" (case-insensitive).
|
|
453
|
+
* `parity` accepts "none", "even", or "odd".
|
|
454
|
+
* @param {WasmSerialPortHandle} port_handle
|
|
455
|
+
* @param {number} unit_id
|
|
456
|
+
* @param {string} mode
|
|
457
|
+
* @param {number} baud_rate
|
|
458
|
+
* @param {number} data_bits
|
|
459
|
+
* @param {number} stop_bits
|
|
460
|
+
* @param {string} parity
|
|
461
|
+
* @param {number} response_timeout_ms
|
|
462
|
+
* @param {number} retry_attempts
|
|
463
|
+
* @param {number} tick_interval_ms
|
|
464
|
+
*/
|
|
465
|
+
constructor(port_handle, unit_id, mode, baud_rate, data_bits, stop_bits, parity, response_timeout_ms, retry_attempts, tick_interval_ms) {
|
|
466
|
+
_assertClass(port_handle, WasmSerialPortHandle);
|
|
467
|
+
const ptr0 = passStringToWasm0(mode, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
468
|
+
const len0 = WASM_VECTOR_LEN;
|
|
469
|
+
const ptr1 = passStringToWasm0(parity, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
470
|
+
const len1 = WASM_VECTOR_LEN;
|
|
471
|
+
const ret = wasm.wasmserialmodbusclient_new(port_handle.__wbg_ptr, unit_id, ptr0, len0, baud_rate, data_bits, stop_bits, ptr1, len1, response_timeout_ms, retry_attempts, tick_interval_ms);
|
|
472
|
+
if (ret[2]) {
|
|
473
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
474
|
+
}
|
|
475
|
+
this.__wbg_ptr = ret[0];
|
|
476
|
+
WasmSerialModbusClientFinalization.register(this, this.__wbg_ptr, this);
|
|
477
|
+
return this;
|
|
478
|
+
}
|
|
479
|
+
/**
|
|
480
|
+
* Read `quantity` coils starting at `address`.
|
|
481
|
+
*
|
|
482
|
+
* Returns a `Promise` resolving with a `Uint8Array` (bit-packed coil bytes) or rejects on error.
|
|
483
|
+
* @param {number} address
|
|
484
|
+
* @param {number} quantity
|
|
485
|
+
* @returns {Promise<any>}
|
|
486
|
+
*/
|
|
487
|
+
read_coils(address, quantity) {
|
|
488
|
+
const ret = wasm.wasmserialmodbusclient_read_coils(this.__wbg_ptr, address, quantity);
|
|
489
|
+
return ret;
|
|
490
|
+
}
|
|
491
|
+
/**
|
|
492
|
+
* Read Device Identification (FC 43 / MEI 0x0E).
|
|
493
|
+
*
|
|
494
|
+
* `read_device_id_code`: 1=Basic, 2=Regular, 3=Extended, 4=Specific.
|
|
495
|
+
* `object_id`: 0x00=VendorName, 0x01=ProductCode, 0x02=Revision, etc.
|
|
496
|
+
* Returns a `Promise` resolving with `{ readDeviceIdCode, conformityLevel, moreFollows, objects }`
|
|
497
|
+
* or rejects on error.
|
|
498
|
+
* @param {number} read_device_id_code
|
|
499
|
+
* @param {number} object_id
|
|
500
|
+
* @returns {Promise<any>}
|
|
501
|
+
*/
|
|
502
|
+
read_device_identification(read_device_id_code, object_id) {
|
|
503
|
+
const ret = wasm.wasmserialmodbusclient_read_device_identification(this.__wbg_ptr, read_device_id_code, object_id);
|
|
504
|
+
return ret;
|
|
505
|
+
}
|
|
506
|
+
/**
|
|
507
|
+
* Read `quantity` discrete inputs starting at `address`.
|
|
508
|
+
*
|
|
509
|
+
* Returns a `Promise` resolving with a `Uint8Array` (bit-packed) or rejects on error.
|
|
510
|
+
* @param {number} address
|
|
511
|
+
* @param {number} quantity
|
|
512
|
+
* @returns {Promise<any>}
|
|
513
|
+
*/
|
|
514
|
+
read_discrete_inputs(address, quantity) {
|
|
515
|
+
const ret = wasm.wasmserialmodbusclient_read_discrete_inputs(this.__wbg_ptr, address, quantity);
|
|
516
|
+
return ret;
|
|
517
|
+
}
|
|
518
|
+
/**
|
|
519
|
+
* Read the exception status (FC 7).
|
|
520
|
+
*
|
|
521
|
+
* Returns a `Promise` resolving with a status `number` or rejects on error.
|
|
522
|
+
* @returns {Promise<any>}
|
|
523
|
+
*/
|
|
524
|
+
read_exception_status() {
|
|
525
|
+
const ret = wasm.wasmserialmodbusclient_read_exception_status(this.__wbg_ptr);
|
|
526
|
+
return ret;
|
|
527
|
+
}
|
|
528
|
+
/**
|
|
529
|
+
* Read the FIFO queue pointed to by `address` (FC 24).
|
|
530
|
+
*
|
|
531
|
+
* Returns a `Promise` resolving with a `Uint16Array` or rejects on error.
|
|
532
|
+
* @param {number} address
|
|
533
|
+
* @returns {Promise<any>}
|
|
534
|
+
*/
|
|
535
|
+
read_fifo_queue(address) {
|
|
536
|
+
const ret = wasm.wasmserialmodbusclient_read_fifo_queue(this.__wbg_ptr, address);
|
|
537
|
+
return ret;
|
|
538
|
+
}
|
|
539
|
+
/**
|
|
540
|
+
* Read a file record (FC 20).
|
|
541
|
+
*
|
|
542
|
+
* Returns a `Promise` resolving with `Array<{ fileNumber, recordNumber, data: Uint16Array }>`
|
|
543
|
+
* or rejects on error.
|
|
544
|
+
* @param {number} file_number
|
|
545
|
+
* @param {number} record_number
|
|
546
|
+
* @param {number} record_length
|
|
547
|
+
* @returns {Promise<any>}
|
|
548
|
+
*/
|
|
549
|
+
read_file_record(file_number, record_number, record_length) {
|
|
550
|
+
const ret = wasm.wasmserialmodbusclient_read_file_record(this.__wbg_ptr, file_number, record_number, record_length);
|
|
551
|
+
return ret;
|
|
552
|
+
}
|
|
553
|
+
/**
|
|
554
|
+
* Read `quantity` holding registers starting at `address`.
|
|
555
|
+
*
|
|
556
|
+
* Returns a `Promise` resolving with a `Uint16Array` (register values) or rejects on error.
|
|
557
|
+
* @param {number} address
|
|
558
|
+
* @param {number} quantity
|
|
559
|
+
* @returns {Promise<any>}
|
|
560
|
+
*/
|
|
561
|
+
read_holding_registers(address, quantity) {
|
|
562
|
+
const ret = wasm.wasmserialmodbusclient_read_holding_registers(this.__wbg_ptr, address, quantity);
|
|
563
|
+
return ret;
|
|
564
|
+
}
|
|
565
|
+
/**
|
|
566
|
+
* Read `quantity` input registers starting at `address`.
|
|
567
|
+
*
|
|
568
|
+
* Returns a `Promise` resolving with a `Uint16Array` or rejects on error.
|
|
569
|
+
* @param {number} address
|
|
570
|
+
* @param {number} quantity
|
|
571
|
+
* @returns {Promise<any>}
|
|
572
|
+
*/
|
|
573
|
+
read_input_registers(address, quantity) {
|
|
574
|
+
const ret = wasm.wasmserialmodbusclient_read_input_registers(this.__wbg_ptr, address, quantity);
|
|
575
|
+
return ret;
|
|
576
|
+
}
|
|
577
|
+
/**
|
|
578
|
+
* Read a single coil at `address`.
|
|
579
|
+
*
|
|
580
|
+
* Returns a `Promise` resolving with a `boolean` or rejects on error.
|
|
581
|
+
* @param {number} address
|
|
582
|
+
* @returns {Promise<any>}
|
|
583
|
+
*/
|
|
584
|
+
read_single_coil(address) {
|
|
585
|
+
const ret = wasm.wasmserialmodbusclient_read_single_coil(this.__wbg_ptr, address);
|
|
586
|
+
return ret;
|
|
587
|
+
}
|
|
588
|
+
/**
|
|
589
|
+
* Read a single discrete input at `address`.
|
|
590
|
+
*
|
|
591
|
+
* Returns a `Promise` resolving with a `boolean` or rejects on error.
|
|
592
|
+
* @param {number} address
|
|
593
|
+
* @returns {Promise<any>}
|
|
594
|
+
*/
|
|
595
|
+
read_single_discrete_input(address) {
|
|
596
|
+
const ret = wasm.wasmserialmodbusclient_read_single_discrete_input(this.__wbg_ptr, address);
|
|
597
|
+
return ret;
|
|
598
|
+
}
|
|
599
|
+
/**
|
|
600
|
+
* Read a single holding register at `address`.
|
|
601
|
+
*
|
|
602
|
+
* Returns a `Promise` resolving with a `number` or rejects on error.
|
|
603
|
+
* @param {number} address
|
|
604
|
+
* @returns {Promise<any>}
|
|
605
|
+
*/
|
|
606
|
+
read_single_holding_register(address) {
|
|
607
|
+
const ret = wasm.wasmserialmodbusclient_read_single_holding_register(this.__wbg_ptr, address);
|
|
608
|
+
return ret;
|
|
609
|
+
}
|
|
610
|
+
/**
|
|
611
|
+
* Read a single input register at `address`.
|
|
612
|
+
*
|
|
613
|
+
* Returns a `Promise` resolving with a `number` or rejects on error.
|
|
614
|
+
* @param {number} address
|
|
615
|
+
* @returns {Promise<any>}
|
|
616
|
+
*/
|
|
617
|
+
read_single_input_register(address) {
|
|
618
|
+
const ret = wasm.wasmserialmodbusclient_read_single_input_register(this.__wbg_ptr, address);
|
|
619
|
+
return ret;
|
|
620
|
+
}
|
|
621
|
+
/**
|
|
622
|
+
* Perform an atomic read-then-write on holding registers.
|
|
623
|
+
*
|
|
624
|
+
* Reads `read_quantity` registers from `read_address`, then writes `values` to `write_address`.
|
|
625
|
+
* `write_quantity` is ignored — the quantity written is derived from `values.length`.
|
|
626
|
+
* Returns a `Promise` resolving with a `Uint16Array` (the values read) or rejects on error.
|
|
627
|
+
* @param {number} read_address
|
|
628
|
+
* @param {number} read_quantity
|
|
629
|
+
* @param {number} write_address
|
|
630
|
+
* @param {number} _write_quantity
|
|
631
|
+
* @param {Uint16Array} values
|
|
632
|
+
* @returns {Promise<any>}
|
|
633
|
+
*/
|
|
634
|
+
read_write_multiple_registers(read_address, read_quantity, write_address, _write_quantity, values) {
|
|
635
|
+
const ptr0 = passArray16ToWasm0(values, wasm.__wbindgen_malloc);
|
|
636
|
+
const len0 = WASM_VECTOR_LEN;
|
|
637
|
+
const ret = wasm.wasmserialmodbusclient_read_write_multiple_registers(this.__wbg_ptr, read_address, read_quantity, write_address, _write_quantity, ptr0, len0);
|
|
638
|
+
return ret;
|
|
639
|
+
}
|
|
640
|
+
/**
|
|
641
|
+
* Drop all pending in-flight requests and attempt to reopen the serial port.
|
|
642
|
+
* Outstanding Promises for dropped requests will be rejected with `"ConnectionLost"`.
|
|
643
|
+
* @returns {boolean}
|
|
644
|
+
*/
|
|
645
|
+
reconnect() {
|
|
646
|
+
const ret = wasm.wasmserialmodbusclient_reconnect(this.__wbg_ptr);
|
|
647
|
+
return ret !== 0;
|
|
648
|
+
}
|
|
649
|
+
/**
|
|
650
|
+
* Report Server ID (FC 17).
|
|
651
|
+
*
|
|
652
|
+
* Returns a `Promise` resolving with a `Uint8Array` (raw server ID data) or rejects on error.
|
|
653
|
+
* @returns {Promise<any>}
|
|
654
|
+
*/
|
|
655
|
+
report_server_id() {
|
|
656
|
+
const ret = wasm.wasmserialmodbusclient_report_server_id(this.__wbg_ptr);
|
|
657
|
+
return ret;
|
|
658
|
+
}
|
|
659
|
+
/**
|
|
660
|
+
* Write a file record (FC 21).
|
|
661
|
+
*
|
|
662
|
+
* `values` is a `Uint16Array` of register values to write.
|
|
663
|
+
* Returns a `Promise` resolving with `true` or rejects on error.
|
|
664
|
+
* @param {number} file_number
|
|
665
|
+
* @param {number} record_number
|
|
666
|
+
* @param {Uint16Array} values
|
|
667
|
+
* @returns {Promise<any>}
|
|
668
|
+
*/
|
|
669
|
+
write_file_record(file_number, record_number, values) {
|
|
670
|
+
const ptr0 = passArray16ToWasm0(values, wasm.__wbindgen_malloc);
|
|
671
|
+
const len0 = WASM_VECTOR_LEN;
|
|
672
|
+
const ret = wasm.wasmserialmodbusclient_write_file_record(this.__wbg_ptr, file_number, record_number, ptr0, len0);
|
|
673
|
+
return ret;
|
|
674
|
+
}
|
|
675
|
+
/**
|
|
676
|
+
* Write multiple coils starting at `address`.
|
|
677
|
+
*
|
|
678
|
+
* `packed_bytes` is a bit-packed `Uint8Array` (LSB of byte 0 = coil at `address`).
|
|
679
|
+
* Returns a `Promise` resolving with `{ address, quantity }` or rejects on error.
|
|
680
|
+
* @param {number} address
|
|
681
|
+
* @param {number} quantity
|
|
682
|
+
* @param {Uint8Array} packed_bytes
|
|
683
|
+
* @returns {Promise<any>}
|
|
684
|
+
*/
|
|
685
|
+
write_multiple_coils(address, quantity, packed_bytes) {
|
|
686
|
+
const ptr0 = passArray8ToWasm0(packed_bytes, wasm.__wbindgen_malloc);
|
|
687
|
+
const len0 = WASM_VECTOR_LEN;
|
|
688
|
+
const ret = wasm.wasmserialmodbusclient_write_multiple_coils(this.__wbg_ptr, address, quantity, ptr0, len0);
|
|
689
|
+
return ret;
|
|
690
|
+
}
|
|
691
|
+
/**
|
|
692
|
+
* Write `values` to multiple consecutive holding registers starting at `address`.
|
|
693
|
+
*
|
|
694
|
+
* Returns a `Promise` resolving with `{ address, quantity }` or rejects on error.
|
|
695
|
+
* @param {number} address
|
|
696
|
+
* @param {number} quantity
|
|
697
|
+
* @param {Uint16Array} values
|
|
698
|
+
* @returns {Promise<any>}
|
|
699
|
+
*/
|
|
700
|
+
write_multiple_registers(address, quantity, values) {
|
|
701
|
+
const ptr0 = passArray16ToWasm0(values, wasm.__wbindgen_malloc);
|
|
702
|
+
const len0 = WASM_VECTOR_LEN;
|
|
703
|
+
const ret = wasm.wasmserialmodbusclient_write_multiple_registers(this.__wbg_ptr, address, quantity, ptr0, len0);
|
|
704
|
+
return ret;
|
|
705
|
+
}
|
|
706
|
+
/**
|
|
707
|
+
* Write a single coil at `address` to `value` (true = ON, false = OFF).
|
|
708
|
+
*
|
|
709
|
+
* Returns a `Promise` resolving with `{ address, value }` or rejects on error.
|
|
710
|
+
* @param {number} address
|
|
711
|
+
* @param {boolean} value
|
|
712
|
+
* @returns {Promise<any>}
|
|
713
|
+
*/
|
|
714
|
+
write_single_coil(address, value) {
|
|
715
|
+
const ret = wasm.wasmserialmodbusclient_write_single_coil(this.__wbg_ptr, address, value);
|
|
716
|
+
return ret;
|
|
717
|
+
}
|
|
718
|
+
/**
|
|
719
|
+
* Write `value` to a single holding register at `address`.
|
|
720
|
+
*
|
|
721
|
+
* Returns a `Promise` resolving with `{ address, value }` or rejects on error.
|
|
722
|
+
* @param {number} address
|
|
723
|
+
* @param {number} value
|
|
724
|
+
* @returns {Promise<any>}
|
|
725
|
+
*/
|
|
726
|
+
write_single_register(address, value) {
|
|
727
|
+
const ret = wasm.wasmserialmodbusclient_write_single_register(this.__wbg_ptr, address, value);
|
|
728
|
+
return ret;
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
if (Symbol.dispose) WasmSerialModbusClient.prototype[Symbol.dispose] = WasmSerialModbusClient.prototype.free;
|
|
732
|
+
|
|
733
|
+
/**
|
|
734
|
+
* Opaque handle around a browser `SerialPort` object granted by Web Serial.
|
|
735
|
+
*/
|
|
736
|
+
export class WasmSerialPortHandle {
|
|
737
|
+
static __wrap(ptr) {
|
|
738
|
+
const obj = Object.create(WasmSerialPortHandle.prototype);
|
|
739
|
+
obj.__wbg_ptr = ptr;
|
|
740
|
+
WasmSerialPortHandleFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
741
|
+
return obj;
|
|
742
|
+
}
|
|
743
|
+
__destroy_into_raw() {
|
|
744
|
+
const ptr = this.__wbg_ptr;
|
|
745
|
+
this.__wbg_ptr = 0;
|
|
746
|
+
WasmSerialPortHandleFinalization.unregister(this);
|
|
747
|
+
return ptr;
|
|
748
|
+
}
|
|
749
|
+
free() {
|
|
750
|
+
const ptr = this.__destroy_into_raw();
|
|
751
|
+
wasm.__wbg_wasmserialporthandle_free(ptr, 0);
|
|
752
|
+
}
|
|
753
|
+
/**
|
|
754
|
+
* Returns true if the wrapped JS value still looks like a valid SerialPort object.
|
|
755
|
+
* @returns {boolean}
|
|
756
|
+
*/
|
|
757
|
+
is_valid() {
|
|
758
|
+
const ret = wasm.wasmserialporthandle_is_valid(this.__wbg_ptr);
|
|
759
|
+
return ret !== 0;
|
|
760
|
+
}
|
|
761
|
+
}
|
|
762
|
+
if (Symbol.dispose) WasmSerialPortHandle.prototype[Symbol.dispose] = WasmSerialPortHandle.prototype.free;
|
|
763
|
+
|
|
764
|
+
/**
|
|
765
|
+
* Browser-facing Modbus server endpoint for Web Serial traffic.
|
|
766
|
+
*/
|
|
767
|
+
export class WasmSerialServer {
|
|
768
|
+
__destroy_into_raw() {
|
|
769
|
+
const ptr = this.__wbg_ptr;
|
|
770
|
+
this.__wbg_ptr = 0;
|
|
771
|
+
WasmSerialServerFinalization.unregister(this);
|
|
772
|
+
return ptr;
|
|
773
|
+
}
|
|
774
|
+
free() {
|
|
775
|
+
const ptr = this.__destroy_into_raw();
|
|
776
|
+
wasm.__wbg_wasmserialserver_free(ptr, 0);
|
|
777
|
+
}
|
|
778
|
+
/**
|
|
779
|
+
* Attach browser SerialPort object delegated to mbus-serial transport.
|
|
780
|
+
* @param {any} port
|
|
781
|
+
*/
|
|
782
|
+
attach_serial_port(port) {
|
|
783
|
+
wasm.wasmserialserver_attach_serial_port(this.__wbg_ptr, port);
|
|
784
|
+
}
|
|
785
|
+
/**
|
|
786
|
+
* Clears the stored last-error message.
|
|
787
|
+
*/
|
|
788
|
+
clear_last_error() {
|
|
789
|
+
wasm.wasmserialserver_clear_last_error(this.__wbg_ptr);
|
|
790
|
+
}
|
|
791
|
+
/**
|
|
792
|
+
* Dispatch a request object into JS app handler.
|
|
793
|
+
* @param {any} request
|
|
794
|
+
* @returns {Promise<any>}
|
|
795
|
+
*/
|
|
796
|
+
dispatch_request(request) {
|
|
797
|
+
const ret = wasm.wasmserialserver_dispatch_request(this.__wbg_ptr, request);
|
|
798
|
+
return ret;
|
|
799
|
+
}
|
|
800
|
+
/**
|
|
801
|
+
* Whether server lifecycle is currently active.
|
|
802
|
+
* @returns {boolean}
|
|
803
|
+
*/
|
|
804
|
+
is_running() {
|
|
805
|
+
const ret = wasm.wasmserialserver_is_running(this.__wbg_ptr);
|
|
806
|
+
return ret !== 0;
|
|
807
|
+
}
|
|
808
|
+
/**
|
|
809
|
+
* Returns the last captured binding-layer error message, if any.
|
|
810
|
+
* @returns {string | undefined}
|
|
811
|
+
*/
|
|
812
|
+
last_error_message() {
|
|
813
|
+
const ret = wasm.wasmserialserver_last_error_message(this.__wbg_ptr);
|
|
814
|
+
let v1;
|
|
815
|
+
if (ret[0] !== 0) {
|
|
816
|
+
v1 = getStringFromWasm0(ret[0], ret[1]).slice();
|
|
817
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
818
|
+
}
|
|
819
|
+
return v1;
|
|
820
|
+
}
|
|
821
|
+
/**
|
|
822
|
+
* Selected serial mode as numeric enum.
|
|
823
|
+
* @returns {WasmServerTransportKind}
|
|
824
|
+
*/
|
|
825
|
+
mode() {
|
|
826
|
+
const ret = wasm.wasmserialserver_mode(this.__wbg_ptr);
|
|
827
|
+
return ret;
|
|
828
|
+
}
|
|
829
|
+
/**
|
|
830
|
+
* Create a serial server with a JS request handler callback.
|
|
831
|
+
*
|
|
832
|
+
* `on_request` receives one request object and may return a direct value or Promise.
|
|
833
|
+
* @param {WasmSerialServerConfig} config
|
|
834
|
+
* @param {Function} on_request
|
|
835
|
+
*/
|
|
836
|
+
constructor(config, on_request) {
|
|
837
|
+
_assertClass(config, WasmSerialServerConfig);
|
|
838
|
+
var ptr0 = config.__destroy_into_raw();
|
|
839
|
+
const ret = wasm.wasmserialserver_new(ptr0, on_request);
|
|
840
|
+
if (ret[2]) {
|
|
841
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
842
|
+
}
|
|
843
|
+
this.__wbg_ptr = ret[0];
|
|
844
|
+
WasmSerialServerFinalization.register(this, this.__wbg_ptr, this);
|
|
845
|
+
return this;
|
|
846
|
+
}
|
|
847
|
+
/**
|
|
848
|
+
* Try receiving one frame from delegated serial transport.
|
|
849
|
+
* @returns {Uint8Array}
|
|
850
|
+
*/
|
|
851
|
+
recv_frame() {
|
|
852
|
+
const ret = wasm.wasmserialserver_recv_frame(this.__wbg_ptr);
|
|
853
|
+
if (ret[3]) {
|
|
854
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
855
|
+
}
|
|
856
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
857
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
858
|
+
return v1;
|
|
859
|
+
}
|
|
860
|
+
/**
|
|
861
|
+
* Send one encoded frame through delegated serial transport.
|
|
862
|
+
* @param {Uint8Array} frame
|
|
863
|
+
*/
|
|
864
|
+
send_frame(frame) {
|
|
865
|
+
const ptr0 = passArray8ToWasm0(frame, wasm.__wbindgen_malloc);
|
|
866
|
+
const len0 = WASM_VECTOR_LEN;
|
|
867
|
+
const ret = wasm.wasmserialserver_send_frame(this.__wbg_ptr, ptr0, len0);
|
|
868
|
+
if (ret[1]) {
|
|
869
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
870
|
+
}
|
|
871
|
+
}
|
|
872
|
+
/**
|
|
873
|
+
* Start server lifecycle.
|
|
874
|
+
*/
|
|
875
|
+
start() {
|
|
876
|
+
const ret = wasm.wasmserialserver_start(this.__wbg_ptr);
|
|
877
|
+
if (ret[1]) {
|
|
878
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
879
|
+
}
|
|
880
|
+
}
|
|
881
|
+
/**
|
|
882
|
+
* Returns a point-in-time status snapshot for diagnostics/observability.
|
|
883
|
+
* @returns {WasmServerStatusSnapshot}
|
|
884
|
+
*/
|
|
885
|
+
status_snapshot() {
|
|
886
|
+
const ret = wasm.wasmserialserver_status_snapshot(this.__wbg_ptr);
|
|
887
|
+
return WasmServerStatusSnapshot.__wrap(ret);
|
|
888
|
+
}
|
|
889
|
+
/**
|
|
890
|
+
* Stop server lifecycle.
|
|
891
|
+
*/
|
|
892
|
+
stop() {
|
|
893
|
+
const ret = wasm.wasmserialserver_stop(this.__wbg_ptr);
|
|
894
|
+
if (ret[1]) {
|
|
895
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
896
|
+
}
|
|
897
|
+
}
|
|
898
|
+
/**
|
|
899
|
+
* Whether delegated serial transport currently reports connected.
|
|
900
|
+
* @returns {boolean}
|
|
901
|
+
*/
|
|
902
|
+
transport_connected() {
|
|
903
|
+
const ret = wasm.wasmserialserver_transport_connected(this.__wbg_ptr);
|
|
904
|
+
return ret !== 0;
|
|
905
|
+
}
|
|
906
|
+
}
|
|
907
|
+
if (Symbol.dispose) WasmSerialServer.prototype[Symbol.dispose] = WasmSerialServer.prototype.free;
|
|
908
|
+
|
|
909
|
+
/**
|
|
910
|
+
* Configuration for Web Serial server bindings.
|
|
911
|
+
*/
|
|
912
|
+
export class WasmSerialServerConfig {
|
|
913
|
+
static __wrap(ptr) {
|
|
914
|
+
const obj = Object.create(WasmSerialServerConfig.prototype);
|
|
915
|
+
obj.__wbg_ptr = ptr;
|
|
916
|
+
WasmSerialServerConfigFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
917
|
+
return obj;
|
|
918
|
+
}
|
|
919
|
+
__destroy_into_raw() {
|
|
920
|
+
const ptr = this.__wbg_ptr;
|
|
921
|
+
this.__wbg_ptr = 0;
|
|
922
|
+
WasmSerialServerConfigFinalization.unregister(this);
|
|
923
|
+
return ptr;
|
|
924
|
+
}
|
|
925
|
+
free() {
|
|
926
|
+
const ptr = this.__destroy_into_raw();
|
|
927
|
+
wasm.__wbg_wasmserialserverconfig_free(ptr, 0);
|
|
928
|
+
}
|
|
929
|
+
/**
|
|
930
|
+
* Create ASCII serial server config.
|
|
931
|
+
* @returns {WasmSerialServerConfig}
|
|
932
|
+
*/
|
|
933
|
+
static ascii() {
|
|
934
|
+
const ret = wasm.wasmserialserverconfig_ascii();
|
|
935
|
+
return WasmSerialServerConfig.__wrap(ret);
|
|
936
|
+
}
|
|
937
|
+
/**
|
|
938
|
+
* Selected serial mode.
|
|
939
|
+
* @returns {WasmServerTransportKind}
|
|
940
|
+
*/
|
|
941
|
+
mode() {
|
|
942
|
+
const ret = wasm.wasmserialserverconfig_mode(this.__wbg_ptr);
|
|
943
|
+
return ret;
|
|
944
|
+
}
|
|
945
|
+
/**
|
|
946
|
+
* Create RTU serial server config.
|
|
947
|
+
* @returns {WasmSerialServerConfig}
|
|
948
|
+
*/
|
|
949
|
+
static rtu() {
|
|
950
|
+
const ret = wasm.wasmserialserverconfig_rtu();
|
|
951
|
+
return WasmSerialServerConfig.__wrap(ret);
|
|
952
|
+
}
|
|
953
|
+
}
|
|
954
|
+
if (Symbol.dispose) WasmSerialServerConfig.prototype[Symbol.dispose] = WasmSerialServerConfig.prototype.free;
|
|
955
|
+
|
|
956
|
+
/**
|
|
957
|
+
* High-level design descriptor for phased server binding rollout.
|
|
958
|
+
*/
|
|
959
|
+
export class WasmServerBindingPlan {
|
|
960
|
+
static __wrap(ptr) {
|
|
961
|
+
const obj = Object.create(WasmServerBindingPlan.prototype);
|
|
962
|
+
obj.__wbg_ptr = ptr;
|
|
963
|
+
WasmServerBindingPlanFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
964
|
+
return obj;
|
|
965
|
+
}
|
|
966
|
+
__destroy_into_raw() {
|
|
967
|
+
const ptr = this.__wbg_ptr;
|
|
968
|
+
this.__wbg_ptr = 0;
|
|
969
|
+
WasmServerBindingPlanFinalization.unregister(this);
|
|
970
|
+
return ptr;
|
|
971
|
+
}
|
|
972
|
+
free() {
|
|
973
|
+
const ptr = this.__destroy_into_raw();
|
|
974
|
+
wasm.__wbg_wasmserverbindingplan_free(ptr, 0);
|
|
975
|
+
}
|
|
976
|
+
/**
|
|
977
|
+
* Whether JS app callbacks are required for request dispatch.
|
|
978
|
+
* @returns {boolean}
|
|
979
|
+
*/
|
|
980
|
+
app_callbacks_required() {
|
|
981
|
+
const ret = wasm.wasmserverbindingplan_app_callbacks_required(this.__wbg_ptr);
|
|
982
|
+
return ret !== 0;
|
|
983
|
+
}
|
|
984
|
+
/**
|
|
985
|
+
* Whether lifecycle includes managed start/stop semantics.
|
|
986
|
+
* @returns {boolean}
|
|
987
|
+
*/
|
|
988
|
+
lifecycle_managed() {
|
|
989
|
+
const ret = wasm.wasmserverbindingplan_lifecycle_managed(this.__wbg_ptr);
|
|
990
|
+
return ret !== 0;
|
|
991
|
+
}
|
|
992
|
+
/**
|
|
993
|
+
* Plan for Web Serial ASCII based server bindings.
|
|
994
|
+
* @returns {WasmServerBindingPlan}
|
|
995
|
+
*/
|
|
996
|
+
static serial_ascii() {
|
|
997
|
+
const ret = wasm.wasmserverbindingplan_serial_ascii();
|
|
998
|
+
return WasmServerBindingPlan.__wrap(ret);
|
|
999
|
+
}
|
|
1000
|
+
/**
|
|
1001
|
+
* Plan for Web Serial RTU based server bindings.
|
|
1002
|
+
* @returns {WasmServerBindingPlan}
|
|
1003
|
+
*/
|
|
1004
|
+
static serial_rtu() {
|
|
1005
|
+
const ret = wasm.wasmserverbindingplan_serial_rtu();
|
|
1006
|
+
return WasmServerBindingPlan.__wrap(ret);
|
|
1007
|
+
}
|
|
1008
|
+
/**
|
|
1009
|
+
* Whether diagnostics counters are part of the plan.
|
|
1010
|
+
* @returns {boolean}
|
|
1011
|
+
*/
|
|
1012
|
+
supports_diagnostics_stats() {
|
|
1013
|
+
const ret = wasm.wasmserverbindingplan_supports_diagnostics_stats(this.__wbg_ptr);
|
|
1014
|
+
return ret !== 0;
|
|
1015
|
+
}
|
|
1016
|
+
/**
|
|
1017
|
+
* Whether traffic hook callbacks are part of the plan.
|
|
1018
|
+
* @returns {boolean}
|
|
1019
|
+
*/
|
|
1020
|
+
supports_traffic_hooks() {
|
|
1021
|
+
const ret = wasm.wasmserverbindingplan_supports_traffic_hooks(this.__wbg_ptr);
|
|
1022
|
+
return ret !== 0;
|
|
1023
|
+
}
|
|
1024
|
+
/**
|
|
1025
|
+
* Plan for WebSocket-gateway based server bindings.
|
|
1026
|
+
* @returns {WasmServerBindingPlan}
|
|
1027
|
+
*/
|
|
1028
|
+
static tcp_gateway() {
|
|
1029
|
+
const ret = wasm.wasmserverbindingplan_tcp_gateway();
|
|
1030
|
+
return WasmServerBindingPlan.__wrap(ret);
|
|
1031
|
+
}
|
|
1032
|
+
/**
|
|
1033
|
+
* Selected transport family.
|
|
1034
|
+
* @returns {WasmServerTransportKind}
|
|
1035
|
+
*/
|
|
1036
|
+
transport() {
|
|
1037
|
+
const ret = wasm.wasmserverbindingplan_transport(this.__wbg_ptr);
|
|
1038
|
+
return ret;
|
|
1039
|
+
}
|
|
1040
|
+
}
|
|
1041
|
+
if (Symbol.dispose) WasmServerBindingPlan.prototype[Symbol.dispose] = WasmServerBindingPlan.prototype.free;
|
|
1042
|
+
|
|
1043
|
+
/**
|
|
1044
|
+
* Lightweight runtime status snapshot for browser-side server observability.
|
|
1045
|
+
*/
|
|
1046
|
+
export class WasmServerStatusSnapshot {
|
|
1047
|
+
static __wrap(ptr) {
|
|
1048
|
+
const obj = Object.create(WasmServerStatusSnapshot.prototype);
|
|
1049
|
+
obj.__wbg_ptr = ptr;
|
|
1050
|
+
WasmServerStatusSnapshotFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
1051
|
+
return obj;
|
|
1052
|
+
}
|
|
1053
|
+
__destroy_into_raw() {
|
|
1054
|
+
const ptr = this.__wbg_ptr;
|
|
1055
|
+
this.__wbg_ptr = 0;
|
|
1056
|
+
WasmServerStatusSnapshotFinalization.unregister(this);
|
|
1057
|
+
return ptr;
|
|
1058
|
+
}
|
|
1059
|
+
free() {
|
|
1060
|
+
const ptr = this.__destroy_into_raw();
|
|
1061
|
+
wasm.__wbg_wasmserverstatussnapshot_free(ptr, 0);
|
|
1062
|
+
}
|
|
1063
|
+
/**
|
|
1064
|
+
* Number of successful `dispatch_request(...)` calls completed.
|
|
1065
|
+
* @returns {number}
|
|
1066
|
+
*/
|
|
1067
|
+
dispatched_requests() {
|
|
1068
|
+
const ret = wasm.wasmserverstatussnapshot_dispatched_requests(this.__wbg_ptr);
|
|
1069
|
+
return ret >>> 0;
|
|
1070
|
+
}
|
|
1071
|
+
/**
|
|
1072
|
+
* Whether a last error message is currently stored.
|
|
1073
|
+
* @returns {boolean}
|
|
1074
|
+
*/
|
|
1075
|
+
last_error_present() {
|
|
1076
|
+
const ret = wasm.wasmserverstatussnapshot_last_error_present(this.__wbg_ptr);
|
|
1077
|
+
return ret !== 0;
|
|
1078
|
+
}
|
|
1079
|
+
/**
|
|
1080
|
+
* Number of successful `recv_frame(...)` calls.
|
|
1081
|
+
* @returns {number}
|
|
1082
|
+
*/
|
|
1083
|
+
received_frames() {
|
|
1084
|
+
const ret = wasm.wasmserverstatussnapshot_received_frames(this.__wbg_ptr);
|
|
1085
|
+
return ret >>> 0;
|
|
1086
|
+
}
|
|
1087
|
+
/**
|
|
1088
|
+
* Whether server lifecycle is running.
|
|
1089
|
+
* @returns {boolean}
|
|
1090
|
+
*/
|
|
1091
|
+
running() {
|
|
1092
|
+
const ret = wasm.wasmserverstatussnapshot_running(this.__wbg_ptr);
|
|
1093
|
+
return ret !== 0;
|
|
1094
|
+
}
|
|
1095
|
+
/**
|
|
1096
|
+
* Number of successful `send_frame(...)` calls.
|
|
1097
|
+
* @returns {number}
|
|
1098
|
+
*/
|
|
1099
|
+
sent_frames() {
|
|
1100
|
+
const ret = wasm.wasmserverstatussnapshot_sent_frames(this.__wbg_ptr);
|
|
1101
|
+
return ret >>> 0;
|
|
1102
|
+
}
|
|
1103
|
+
/**
|
|
1104
|
+
* Transport family of this server snapshot.
|
|
1105
|
+
* @returns {WasmServerTransportKind}
|
|
1106
|
+
*/
|
|
1107
|
+
transport() {
|
|
1108
|
+
const ret = wasm.wasmserverstatussnapshot_transport(this.__wbg_ptr);
|
|
1109
|
+
return ret;
|
|
1110
|
+
}
|
|
1111
|
+
/**
|
|
1112
|
+
* Whether delegated transport reports connected.
|
|
1113
|
+
* @returns {boolean}
|
|
1114
|
+
*/
|
|
1115
|
+
transport_connected() {
|
|
1116
|
+
const ret = wasm.wasmserverstatussnapshot_transport_connected(this.__wbg_ptr);
|
|
1117
|
+
return ret !== 0;
|
|
1118
|
+
}
|
|
1119
|
+
}
|
|
1120
|
+
if (Symbol.dispose) WasmServerStatusSnapshot.prototype[Symbol.dispose] = WasmServerStatusSnapshot.prototype.free;
|
|
1121
|
+
|
|
1122
|
+
/**
|
|
1123
|
+
* Transport families planned for browser-side server bindings.
|
|
1124
|
+
* @enum {0 | 1 | 2}
|
|
1125
|
+
*/
|
|
1126
|
+
export const WasmServerTransportKind = Object.freeze({
|
|
1127
|
+
/**
|
|
1128
|
+
* Server loop receives requests via a WebSocket gateway.
|
|
1129
|
+
*/
|
|
1130
|
+
TcpGateway: 0, "0": "TcpGateway",
|
|
1131
|
+
/**
|
|
1132
|
+
* Server loop receives RTU frames via Web Serial.
|
|
1133
|
+
*/
|
|
1134
|
+
SerialRtu: 1, "1": "SerialRtu",
|
|
1135
|
+
/**
|
|
1136
|
+
* Server loop receives ASCII frames via Web Serial.
|
|
1137
|
+
*/
|
|
1138
|
+
SerialAscii: 2, "2": "SerialAscii",
|
|
1139
|
+
});
|
|
1140
|
+
|
|
1141
|
+
/**
|
|
1142
|
+
* Configuration for TCP gateway server bindings.
|
|
1143
|
+
*/
|
|
1144
|
+
export class WasmTcpGatewayConfig {
|
|
1145
|
+
__destroy_into_raw() {
|
|
1146
|
+
const ptr = this.__wbg_ptr;
|
|
1147
|
+
this.__wbg_ptr = 0;
|
|
1148
|
+
WasmTcpGatewayConfigFinalization.unregister(this);
|
|
1149
|
+
return ptr;
|
|
1150
|
+
}
|
|
1151
|
+
free() {
|
|
1152
|
+
const ptr = this.__destroy_into_raw();
|
|
1153
|
+
wasm.__wbg_wasmtcpgatewayconfig_free(ptr, 0);
|
|
1154
|
+
}
|
|
1155
|
+
/**
|
|
1156
|
+
* Create a new TCP-gateway config from a websocket URL.
|
|
1157
|
+
* @param {string} ws_url
|
|
1158
|
+
*/
|
|
1159
|
+
constructor(ws_url) {
|
|
1160
|
+
const ptr0 = passStringToWasm0(ws_url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1161
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1162
|
+
const ret = wasm.wasmtcpgatewayconfig_new(ptr0, len0);
|
|
1163
|
+
this.__wbg_ptr = ret;
|
|
1164
|
+
WasmTcpGatewayConfigFinalization.register(this, this.__wbg_ptr, this);
|
|
1165
|
+
return this;
|
|
1166
|
+
}
|
|
1167
|
+
/**
|
|
1168
|
+
* WebSocket endpoint URL.
|
|
1169
|
+
* @returns {string}
|
|
1170
|
+
*/
|
|
1171
|
+
ws_url() {
|
|
1172
|
+
let deferred1_0;
|
|
1173
|
+
let deferred1_1;
|
|
1174
|
+
try {
|
|
1175
|
+
const ret = wasm.wasmtcpgatewayconfig_ws_url(this.__wbg_ptr);
|
|
1176
|
+
deferred1_0 = ret[0];
|
|
1177
|
+
deferred1_1 = ret[1];
|
|
1178
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
1179
|
+
} finally {
|
|
1180
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1181
|
+
}
|
|
1182
|
+
}
|
|
1183
|
+
}
|
|
1184
|
+
if (Symbol.dispose) WasmTcpGatewayConfig.prototype[Symbol.dispose] = WasmTcpGatewayConfig.prototype.free;
|
|
1185
|
+
|
|
1186
|
+
/**
|
|
1187
|
+
* Browser-facing Modbus server endpoint for WebSocket gateway traffic.
|
|
1188
|
+
*/
|
|
1189
|
+
export class WasmTcpServer {
|
|
1190
|
+
__destroy_into_raw() {
|
|
1191
|
+
const ptr = this.__wbg_ptr;
|
|
1192
|
+
this.__wbg_ptr = 0;
|
|
1193
|
+
WasmTcpServerFinalization.unregister(this);
|
|
1194
|
+
return ptr;
|
|
1195
|
+
}
|
|
1196
|
+
free() {
|
|
1197
|
+
const ptr = this.__destroy_into_raw();
|
|
1198
|
+
wasm.__wbg_wasmtcpserver_free(ptr, 0);
|
|
1199
|
+
}
|
|
1200
|
+
/**
|
|
1201
|
+
* Clears the stored last-error message.
|
|
1202
|
+
*/
|
|
1203
|
+
clear_last_error() {
|
|
1204
|
+
wasm.wasmtcpserver_clear_last_error(this.__wbg_ptr);
|
|
1205
|
+
}
|
|
1206
|
+
/**
|
|
1207
|
+
* Dispatch a request object into JS app handler.
|
|
1208
|
+
*
|
|
1209
|
+
* This is the phase-1 execution path used before transport loops are added.
|
|
1210
|
+
* @param {any} request
|
|
1211
|
+
* @returns {Promise<any>}
|
|
1212
|
+
*/
|
|
1213
|
+
dispatch_request(request) {
|
|
1214
|
+
const ret = wasm.wasmtcpserver_dispatch_request(this.__wbg_ptr, request);
|
|
1215
|
+
return ret;
|
|
1216
|
+
}
|
|
1217
|
+
/**
|
|
1218
|
+
* Whether server lifecycle is currently active.
|
|
1219
|
+
* @returns {boolean}
|
|
1220
|
+
*/
|
|
1221
|
+
is_running() {
|
|
1222
|
+
const ret = wasm.wasmtcpserver_is_running(this.__wbg_ptr);
|
|
1223
|
+
return ret !== 0;
|
|
1224
|
+
}
|
|
1225
|
+
/**
|
|
1226
|
+
* Returns the last captured binding-layer error message, if any.
|
|
1227
|
+
* @returns {string | undefined}
|
|
1228
|
+
*/
|
|
1229
|
+
last_error_message() {
|
|
1230
|
+
const ret = wasm.wasmtcpserver_last_error_message(this.__wbg_ptr);
|
|
1231
|
+
let v1;
|
|
1232
|
+
if (ret[0] !== 0) {
|
|
1233
|
+
v1 = getStringFromWasm0(ret[0], ret[1]).slice();
|
|
1234
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
1235
|
+
}
|
|
1236
|
+
return v1;
|
|
1237
|
+
}
|
|
1238
|
+
/**
|
|
1239
|
+
* Create a server from gateway config and a JS request handler.
|
|
1240
|
+
*
|
|
1241
|
+
* `on_request` receives one request object and may return a direct value or Promise.
|
|
1242
|
+
* @param {WasmTcpGatewayConfig} config
|
|
1243
|
+
* @param {Function} on_request
|
|
1244
|
+
*/
|
|
1245
|
+
constructor(config, on_request) {
|
|
1246
|
+
_assertClass(config, WasmTcpGatewayConfig);
|
|
1247
|
+
var ptr0 = config.__destroy_into_raw();
|
|
1248
|
+
const ret = wasm.wasmtcpserver_new(ptr0, on_request);
|
|
1249
|
+
if (ret[2]) {
|
|
1250
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1251
|
+
}
|
|
1252
|
+
this.__wbg_ptr = ret[0];
|
|
1253
|
+
WasmTcpServerFinalization.register(this, this.__wbg_ptr, this);
|
|
1254
|
+
return this;
|
|
1255
|
+
}
|
|
1256
|
+
/**
|
|
1257
|
+
* Try receiving one frame from delegated network transport.
|
|
1258
|
+
* @returns {Uint8Array}
|
|
1259
|
+
*/
|
|
1260
|
+
recv_frame() {
|
|
1261
|
+
const ret = wasm.wasmtcpserver_recv_frame(this.__wbg_ptr);
|
|
1262
|
+
if (ret[3]) {
|
|
1263
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1264
|
+
}
|
|
1265
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
1266
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
1267
|
+
return v1;
|
|
1268
|
+
}
|
|
1269
|
+
/**
|
|
1270
|
+
* Send one encoded response/request frame through delegated network transport.
|
|
1271
|
+
* @param {Uint8Array} frame
|
|
1272
|
+
*/
|
|
1273
|
+
send_frame(frame) {
|
|
1274
|
+
const ptr0 = passArray8ToWasm0(frame, wasm.__wbindgen_malloc);
|
|
1275
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1276
|
+
const ret = wasm.wasmtcpserver_send_frame(this.__wbg_ptr, ptr0, len0);
|
|
1277
|
+
if (ret[1]) {
|
|
1278
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
1279
|
+
}
|
|
1280
|
+
}
|
|
1281
|
+
/**
|
|
1282
|
+
* Start server lifecycle.
|
|
1283
|
+
*/
|
|
1284
|
+
start() {
|
|
1285
|
+
const ret = wasm.wasmtcpserver_start(this.__wbg_ptr);
|
|
1286
|
+
if (ret[1]) {
|
|
1287
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
1288
|
+
}
|
|
1289
|
+
}
|
|
1290
|
+
/**
|
|
1291
|
+
* Returns a point-in-time status snapshot for diagnostics/observability.
|
|
1292
|
+
* @returns {WasmServerStatusSnapshot}
|
|
1293
|
+
*/
|
|
1294
|
+
status_snapshot() {
|
|
1295
|
+
const ret = wasm.wasmtcpserver_status_snapshot(this.__wbg_ptr);
|
|
1296
|
+
return WasmServerStatusSnapshot.__wrap(ret);
|
|
1297
|
+
}
|
|
1298
|
+
/**
|
|
1299
|
+
* Stop server lifecycle.
|
|
1300
|
+
*/
|
|
1301
|
+
stop() {
|
|
1302
|
+
const ret = wasm.wasmtcpserver_stop(this.__wbg_ptr);
|
|
1303
|
+
if (ret[1]) {
|
|
1304
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
1305
|
+
}
|
|
1306
|
+
}
|
|
1307
|
+
/**
|
|
1308
|
+
* Whether the delegated websocket transport is fully open and ready.
|
|
1309
|
+
* @returns {boolean}
|
|
1310
|
+
*/
|
|
1311
|
+
transport_connected() {
|
|
1312
|
+
const ret = wasm.wasmtcpserver_transport_connected(this.__wbg_ptr);
|
|
1313
|
+
return ret !== 0;
|
|
1314
|
+
}
|
|
1315
|
+
/**
|
|
1316
|
+
* Whether the delegated websocket transport handshake is still in progress.
|
|
1317
|
+
* @returns {boolean}
|
|
1318
|
+
*/
|
|
1319
|
+
transport_connecting() {
|
|
1320
|
+
const ret = wasm.wasmtcpserver_transport_connecting(this.__wbg_ptr);
|
|
1321
|
+
return ret !== 0;
|
|
1322
|
+
}
|
|
1323
|
+
/**
|
|
1324
|
+
* Gateway URL this server is configured to use.
|
|
1325
|
+
* @returns {string}
|
|
1326
|
+
*/
|
|
1327
|
+
ws_url() {
|
|
1328
|
+
let deferred1_0;
|
|
1329
|
+
let deferred1_1;
|
|
1330
|
+
try {
|
|
1331
|
+
const ret = wasm.wasmtcpserver_ws_url(this.__wbg_ptr);
|
|
1332
|
+
deferred1_0 = ret[0];
|
|
1333
|
+
deferred1_1 = ret[1];
|
|
1334
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
1335
|
+
} finally {
|
|
1336
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1337
|
+
}
|
|
1338
|
+
}
|
|
1339
|
+
}
|
|
1340
|
+
if (Symbol.dispose) WasmTcpServer.prototype[Symbol.dispose] = WasmTcpServer.prototype.free;
|
|
1341
|
+
|
|
1342
|
+
/**
|
|
1343
|
+
* Requests a browser serial port from `navigator.serial.requestPort()`.
|
|
1344
|
+
*
|
|
1345
|
+
* Must be invoked from a user-gesture context (e.g. click handler).
|
|
1346
|
+
* @returns {Promise<WasmSerialPortHandle>}
|
|
1347
|
+
*/
|
|
1348
|
+
export function request_serial_port() {
|
|
1349
|
+
const ret = wasm.request_serial_port();
|
|
1350
|
+
return ret;
|
|
1351
|
+
}
|
|
1352
|
+
function __wbg_get_imports() {
|
|
1353
|
+
const import0 = {
|
|
1354
|
+
__proto__: null,
|
|
1355
|
+
__wbg___wbindgen_boolean_get_1a45e2c38d4d41b9: function(arg0) {
|
|
1356
|
+
const v = arg0;
|
|
1357
|
+
const ret = typeof(v) === 'boolean' ? v : undefined;
|
|
1358
|
+
return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
|
|
1359
|
+
},
|
|
1360
|
+
__wbg___wbindgen_debug_string_0accd80f45e5faa2: function(arg0, arg1) {
|
|
1361
|
+
const ret = debugString(arg1);
|
|
1362
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1363
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1364
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
1365
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
1366
|
+
},
|
|
1367
|
+
__wbg___wbindgen_is_function_754e9f305ff6029e: function(arg0) {
|
|
1368
|
+
const ret = typeof(arg0) === 'function';
|
|
1369
|
+
return ret;
|
|
1370
|
+
},
|
|
1371
|
+
__wbg___wbindgen_is_null_87c3bfe968c6a5ad: function(arg0) {
|
|
1372
|
+
const ret = arg0 === null;
|
|
1373
|
+
return ret;
|
|
1374
|
+
},
|
|
1375
|
+
__wbg___wbindgen_is_undefined_67b456be8673d3d7: function(arg0) {
|
|
1376
|
+
const ret = arg0 === undefined;
|
|
1377
|
+
return ret;
|
|
1378
|
+
},
|
|
1379
|
+
__wbg___wbindgen_string_get_72bdf95d3ae505b1: function(arg0, arg1) {
|
|
1380
|
+
const obj = arg1;
|
|
1381
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
1382
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1383
|
+
var len1 = WASM_VECTOR_LEN;
|
|
1384
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
1385
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
1386
|
+
},
|
|
1387
|
+
__wbg___wbindgen_throw_1506f2235d1bdba0: function(arg0, arg1) {
|
|
1388
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
1389
|
+
},
|
|
1390
|
+
__wbg__wbg_cb_unref_61db23ac97f16c31: function(arg0) {
|
|
1391
|
+
arg0._wbg_cb_unref();
|
|
1392
|
+
},
|
|
1393
|
+
__wbg_call_8a89609d89f6608a: function() { return handleError(function (arg0, arg1) {
|
|
1394
|
+
const ret = arg0.call(arg1);
|
|
1395
|
+
return ret;
|
|
1396
|
+
}, arguments); },
|
|
1397
|
+
__wbg_call_9c758de292015997: function() { return handleError(function (arg0, arg1, arg2) {
|
|
1398
|
+
const ret = arg0.call(arg1, arg2);
|
|
1399
|
+
return ret;
|
|
1400
|
+
}, arguments); },
|
|
1401
|
+
__wbg_clearTimeout_113b1cde814ec762: function(arg0) {
|
|
1402
|
+
const ret = clearTimeout(arg0);
|
|
1403
|
+
return ret;
|
|
1404
|
+
},
|
|
1405
|
+
__wbg_close_9acc00cbca310439: function() { return handleError(function (arg0) {
|
|
1406
|
+
arg0.close();
|
|
1407
|
+
}, arguments); },
|
|
1408
|
+
__wbg_data_bd354b70c783c66e: function(arg0) {
|
|
1409
|
+
const ret = arg0.data;
|
|
1410
|
+
return ret;
|
|
1411
|
+
},
|
|
1412
|
+
__wbg_get_de6a0f7d4d18a304: function() { return handleError(function (arg0, arg1) {
|
|
1413
|
+
const ret = Reflect.get(arg0, arg1);
|
|
1414
|
+
return ret;
|
|
1415
|
+
}, arguments); },
|
|
1416
|
+
__wbg_instanceof_ArrayBuffer_8f49811467741499: function(arg0) {
|
|
1417
|
+
let result;
|
|
1418
|
+
try {
|
|
1419
|
+
result = arg0 instanceof ArrayBuffer;
|
|
1420
|
+
} catch (_) {
|
|
1421
|
+
result = false;
|
|
1422
|
+
}
|
|
1423
|
+
const ret = result;
|
|
1424
|
+
return ret;
|
|
1425
|
+
},
|
|
1426
|
+
__wbg_instanceof_Promise_d0db99486956c8e8: function(arg0) {
|
|
1427
|
+
let result;
|
|
1428
|
+
try {
|
|
1429
|
+
result = arg0 instanceof Promise;
|
|
1430
|
+
} catch (_) {
|
|
1431
|
+
result = false;
|
|
1432
|
+
}
|
|
1433
|
+
const ret = result;
|
|
1434
|
+
return ret;
|
|
1435
|
+
},
|
|
1436
|
+
__wbg_length_4a591ecaa01354d9: function(arg0) {
|
|
1437
|
+
const ret = arg0.length;
|
|
1438
|
+
return ret;
|
|
1439
|
+
},
|
|
1440
|
+
__wbg_new_578aeef4b6b94378: function(arg0) {
|
|
1441
|
+
const ret = new Uint8Array(arg0);
|
|
1442
|
+
return ret;
|
|
1443
|
+
},
|
|
1444
|
+
__wbg_new_b682b81e8eaaf027: function(arg0, arg1) {
|
|
1445
|
+
try {
|
|
1446
|
+
var state0 = {a: arg0, b: arg1};
|
|
1447
|
+
var cb0 = (arg0, arg1) => {
|
|
1448
|
+
const a = state0.a;
|
|
1449
|
+
state0.a = 0;
|
|
1450
|
+
try {
|
|
1451
|
+
return wasm_bindgen__convert__closures_____invoke__h4f85ea5e4844fd49(a, state0.b, arg0, arg1);
|
|
1452
|
+
} finally {
|
|
1453
|
+
state0.a = a;
|
|
1454
|
+
}
|
|
1455
|
+
};
|
|
1456
|
+
const ret = new Promise(cb0);
|
|
1457
|
+
return ret;
|
|
1458
|
+
} finally {
|
|
1459
|
+
state0.a = 0;
|
|
1460
|
+
}
|
|
1461
|
+
},
|
|
1462
|
+
__wbg_new_ce1ab61c1c2b300d: function() {
|
|
1463
|
+
const ret = new Object();
|
|
1464
|
+
return ret;
|
|
1465
|
+
},
|
|
1466
|
+
__wbg_new_d7e476b433a26bea: function() { return handleError(function (arg0, arg1) {
|
|
1467
|
+
const ret = new WebSocket(getStringFromWasm0(arg0, arg1));
|
|
1468
|
+
return ret;
|
|
1469
|
+
}, arguments); },
|
|
1470
|
+
__wbg_new_d90091b82fdf5b91: function() {
|
|
1471
|
+
const ret = new Array();
|
|
1472
|
+
return ret;
|
|
1473
|
+
},
|
|
1474
|
+
__wbg_new_from_slice_18fa1f71286d66b8: function(arg0, arg1) {
|
|
1475
|
+
const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
|
|
1476
|
+
return ret;
|
|
1477
|
+
},
|
|
1478
|
+
__wbg_new_from_slice_a0009695698d1671: function(arg0, arg1) {
|
|
1479
|
+
const ret = new Uint16Array(getArrayU16FromWasm0(arg0, arg1));
|
|
1480
|
+
return ret;
|
|
1481
|
+
},
|
|
1482
|
+
__wbg_new_typed_bf31d18f92484486: function(arg0, arg1) {
|
|
1483
|
+
try {
|
|
1484
|
+
var state0 = {a: arg0, b: arg1};
|
|
1485
|
+
var cb0 = (arg0, arg1) => {
|
|
1486
|
+
const a = state0.a;
|
|
1487
|
+
state0.a = 0;
|
|
1488
|
+
try {
|
|
1489
|
+
return wasm_bindgen__convert__closures_____invoke__h4f85ea5e4844fd49(a, state0.b, arg0, arg1);
|
|
1490
|
+
} finally {
|
|
1491
|
+
state0.a = a;
|
|
1492
|
+
}
|
|
1493
|
+
};
|
|
1494
|
+
const ret = new Promise(cb0);
|
|
1495
|
+
return ret;
|
|
1496
|
+
} finally {
|
|
1497
|
+
state0.a = 0;
|
|
1498
|
+
}
|
|
1499
|
+
},
|
|
1500
|
+
__wbg_new_with_length_8f9278dbad0d5670: function(arg0) {
|
|
1501
|
+
const ret = new Uint16Array(arg0 >>> 0);
|
|
1502
|
+
return ret;
|
|
1503
|
+
},
|
|
1504
|
+
__wbg_now_190933fa139cc119: function() {
|
|
1505
|
+
const ret = Date.now();
|
|
1506
|
+
return ret;
|
|
1507
|
+
},
|
|
1508
|
+
__wbg_prototypesetcall_3249fc62a0fafa30: function(arg0, arg1, arg2) {
|
|
1509
|
+
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
|
|
1510
|
+
},
|
|
1511
|
+
__wbg_push_a6822215aa43e71c: function(arg0, arg1) {
|
|
1512
|
+
const ret = arg0.push(arg1);
|
|
1513
|
+
return ret;
|
|
1514
|
+
},
|
|
1515
|
+
__wbg_queueMicrotask_35c611f4a14830b2: function(arg0) {
|
|
1516
|
+
queueMicrotask(arg0);
|
|
1517
|
+
},
|
|
1518
|
+
__wbg_queueMicrotask_404ed0a58e0b63cc: function(arg0) {
|
|
1519
|
+
const ret = arg0.queueMicrotask;
|
|
1520
|
+
return ret;
|
|
1521
|
+
},
|
|
1522
|
+
__wbg_readyState_490503c1fa8f8dd6: function(arg0) {
|
|
1523
|
+
const ret = arg0.readyState;
|
|
1524
|
+
return ret;
|
|
1525
|
+
},
|
|
1526
|
+
__wbg_resolve_25a7e548d5881dca: function(arg0) {
|
|
1527
|
+
const ret = Promise.resolve(arg0);
|
|
1528
|
+
return ret;
|
|
1529
|
+
},
|
|
1530
|
+
__wbg_send_4a773f523104d75e: function() { return handleError(function (arg0, arg1, arg2) {
|
|
1531
|
+
arg0.send(getArrayU8FromWasm0(arg1, arg2));
|
|
1532
|
+
}, arguments); },
|
|
1533
|
+
__wbg_setTimeout_ef24d2fc3ad97385: function() { return handleError(function (arg0, arg1) {
|
|
1534
|
+
const ret = setTimeout(arg0, arg1);
|
|
1535
|
+
return ret;
|
|
1536
|
+
}, arguments); },
|
|
1537
|
+
__wbg_set_6e30c9374c26414c: function() { return handleError(function (arg0, arg1, arg2) {
|
|
1538
|
+
const ret = Reflect.set(arg0, arg1, arg2);
|
|
1539
|
+
return ret;
|
|
1540
|
+
}, arguments); },
|
|
1541
|
+
__wbg_set_binaryType_41994c453b95bdd2: function(arg0, arg1) {
|
|
1542
|
+
arg0.binaryType = __wbindgen_enum_BinaryType[arg1];
|
|
1543
|
+
},
|
|
1544
|
+
__wbg_set_onclose_13787fb31ae8aefd: function(arg0, arg1) {
|
|
1545
|
+
arg0.onclose = arg1;
|
|
1546
|
+
},
|
|
1547
|
+
__wbg_set_onerror_5a45265839edf1b1: function(arg0, arg1) {
|
|
1548
|
+
arg0.onerror = arg1;
|
|
1549
|
+
},
|
|
1550
|
+
__wbg_set_onmessage_9c6b4cb14e244b7f: function(arg0, arg1) {
|
|
1551
|
+
arg0.onmessage = arg1;
|
|
1552
|
+
},
|
|
1553
|
+
__wbg_set_onopen_db452f4233e99d7d: function(arg0, arg1) {
|
|
1554
|
+
arg0.onopen = arg1;
|
|
1555
|
+
},
|
|
1556
|
+
__wbg_static_accessor_GLOBAL_9d53f2689e622ca1: function() {
|
|
1557
|
+
const ret = typeof global === 'undefined' ? null : global;
|
|
1558
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
1559
|
+
},
|
|
1560
|
+
__wbg_static_accessor_GLOBAL_THIS_a1a35cec07001a8a: function() {
|
|
1561
|
+
const ret = typeof globalThis === 'undefined' ? null : globalThis;
|
|
1562
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
1563
|
+
},
|
|
1564
|
+
__wbg_static_accessor_SELF_4c59f6c7ea29a144: function() {
|
|
1565
|
+
const ret = typeof self === 'undefined' ? null : self;
|
|
1566
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
1567
|
+
},
|
|
1568
|
+
__wbg_static_accessor_WINDOW_e70ae9f2eb052253: function() {
|
|
1569
|
+
const ret = typeof window === 'undefined' ? null : window;
|
|
1570
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
1571
|
+
},
|
|
1572
|
+
__wbg_then_18f476d590e58992: function(arg0, arg1, arg2) {
|
|
1573
|
+
const ret = arg0.then(arg1, arg2);
|
|
1574
|
+
return ret;
|
|
1575
|
+
},
|
|
1576
|
+
__wbg_then_ac7b025999b52837: function(arg0, arg1) {
|
|
1577
|
+
const ret = arg0.then(arg1);
|
|
1578
|
+
return ret;
|
|
1579
|
+
},
|
|
1580
|
+
__wbg_wasmserialporthandle_new: function(arg0) {
|
|
1581
|
+
const ret = WasmSerialPortHandle.__wrap(arg0);
|
|
1582
|
+
return ret;
|
|
1583
|
+
},
|
|
1584
|
+
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
1585
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 103, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
1586
|
+
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__he928e7e1c8da304e);
|
|
1587
|
+
return ret;
|
|
1588
|
+
},
|
|
1589
|
+
__wbindgen_cast_0000000000000002: function(arg0, arg1) {
|
|
1590
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("CloseEvent")], shim_idx: 84, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1591
|
+
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h258b1f08e5552ea5);
|
|
1592
|
+
return ret;
|
|
1593
|
+
},
|
|
1594
|
+
__wbindgen_cast_0000000000000003: function(arg0, arg1) {
|
|
1595
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("ErrorEvent")], shim_idx: 84, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1596
|
+
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h258b1f08e5552ea5_2);
|
|
1597
|
+
return ret;
|
|
1598
|
+
},
|
|
1599
|
+
__wbindgen_cast_0000000000000004: function(arg0, arg1) {
|
|
1600
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Event")], shim_idx: 84, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1601
|
+
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h258b1f08e5552ea5_3);
|
|
1602
|
+
return ret;
|
|
1603
|
+
},
|
|
1604
|
+
__wbindgen_cast_0000000000000005: function(arg0, arg1) {
|
|
1605
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 84, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1606
|
+
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h258b1f08e5552ea5_4);
|
|
1607
|
+
return ret;
|
|
1608
|
+
},
|
|
1609
|
+
__wbindgen_cast_0000000000000006: function(arg0, arg1) {
|
|
1610
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 98, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1611
|
+
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__hb8062e98139a7b2f);
|
|
1612
|
+
return ret;
|
|
1613
|
+
},
|
|
1614
|
+
__wbindgen_cast_0000000000000007: function(arg0) {
|
|
1615
|
+
// Cast intrinsic for `F64 -> Externref`.
|
|
1616
|
+
const ret = arg0;
|
|
1617
|
+
return ret;
|
|
1618
|
+
},
|
|
1619
|
+
__wbindgen_cast_0000000000000008: function(arg0, arg1) {
|
|
1620
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
1621
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
1622
|
+
return ret;
|
|
1623
|
+
},
|
|
1624
|
+
__wbindgen_init_externref_table: function() {
|
|
1625
|
+
const table = wasm.__wbindgen_externrefs;
|
|
1626
|
+
const offset = table.grow(4);
|
|
1627
|
+
table.set(0, undefined);
|
|
1628
|
+
table.set(offset + 0, undefined);
|
|
1629
|
+
table.set(offset + 1, null);
|
|
1630
|
+
table.set(offset + 2, true);
|
|
1631
|
+
table.set(offset + 3, false);
|
|
1632
|
+
},
|
|
1633
|
+
};
|
|
1634
|
+
return {
|
|
1635
|
+
__proto__: null,
|
|
1636
|
+
"./modbus-rs_bg.js": import0,
|
|
1637
|
+
};
|
|
1638
|
+
}
|
|
1639
|
+
|
|
1640
|
+
function wasm_bindgen__convert__closures_____invoke__hb8062e98139a7b2f(arg0, arg1) {
|
|
1641
|
+
wasm.wasm_bindgen__convert__closures_____invoke__hb8062e98139a7b2f(arg0, arg1);
|
|
1642
|
+
}
|
|
1643
|
+
|
|
1644
|
+
function wasm_bindgen__convert__closures_____invoke__h258b1f08e5552ea5(arg0, arg1, arg2) {
|
|
1645
|
+
wasm.wasm_bindgen__convert__closures_____invoke__h258b1f08e5552ea5(arg0, arg1, arg2);
|
|
1646
|
+
}
|
|
1647
|
+
|
|
1648
|
+
function wasm_bindgen__convert__closures_____invoke__h258b1f08e5552ea5_2(arg0, arg1, arg2) {
|
|
1649
|
+
wasm.wasm_bindgen__convert__closures_____invoke__h258b1f08e5552ea5_2(arg0, arg1, arg2);
|
|
1650
|
+
}
|
|
1651
|
+
|
|
1652
|
+
function wasm_bindgen__convert__closures_____invoke__h258b1f08e5552ea5_3(arg0, arg1, arg2) {
|
|
1653
|
+
wasm.wasm_bindgen__convert__closures_____invoke__h258b1f08e5552ea5_3(arg0, arg1, arg2);
|
|
1654
|
+
}
|
|
1655
|
+
|
|
1656
|
+
function wasm_bindgen__convert__closures_____invoke__h258b1f08e5552ea5_4(arg0, arg1, arg2) {
|
|
1657
|
+
wasm.wasm_bindgen__convert__closures_____invoke__h258b1f08e5552ea5_4(arg0, arg1, arg2);
|
|
1658
|
+
}
|
|
1659
|
+
|
|
1660
|
+
function wasm_bindgen__convert__closures_____invoke__he928e7e1c8da304e(arg0, arg1, arg2) {
|
|
1661
|
+
const ret = wasm.wasm_bindgen__convert__closures_____invoke__he928e7e1c8da304e(arg0, arg1, arg2);
|
|
1662
|
+
if (ret[1]) {
|
|
1663
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
1664
|
+
}
|
|
1665
|
+
}
|
|
1666
|
+
|
|
1667
|
+
function wasm_bindgen__convert__closures_____invoke__h4f85ea5e4844fd49(arg0, arg1, arg2, arg3) {
|
|
1668
|
+
wasm.wasm_bindgen__convert__closures_____invoke__h4f85ea5e4844fd49(arg0, arg1, arg2, arg3);
|
|
1669
|
+
}
|
|
1670
|
+
|
|
1671
|
+
|
|
1672
|
+
const __wbindgen_enum_BinaryType = ["blob", "arraybuffer"];
|
|
1673
|
+
const WasmModbusClientFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1674
|
+
? { register: () => {}, unregister: () => {} }
|
|
1675
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_wasmmodbusclient_free(ptr, 1));
|
|
1676
|
+
const WasmSerialModbusClientFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1677
|
+
? { register: () => {}, unregister: () => {} }
|
|
1678
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_wasmserialmodbusclient_free(ptr, 1));
|
|
1679
|
+
const WasmSerialPortHandleFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1680
|
+
? { register: () => {}, unregister: () => {} }
|
|
1681
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_wasmserialporthandle_free(ptr, 1));
|
|
1682
|
+
const WasmSerialServerFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1683
|
+
? { register: () => {}, unregister: () => {} }
|
|
1684
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_wasmserialserver_free(ptr, 1));
|
|
1685
|
+
const WasmSerialServerConfigFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1686
|
+
? { register: () => {}, unregister: () => {} }
|
|
1687
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_wasmserialserverconfig_free(ptr, 1));
|
|
1688
|
+
const WasmServerBindingPlanFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1689
|
+
? { register: () => {}, unregister: () => {} }
|
|
1690
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_wasmserverbindingplan_free(ptr, 1));
|
|
1691
|
+
const WasmServerStatusSnapshotFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1692
|
+
? { register: () => {}, unregister: () => {} }
|
|
1693
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_wasmserverstatussnapshot_free(ptr, 1));
|
|
1694
|
+
const WasmTcpGatewayConfigFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1695
|
+
? { register: () => {}, unregister: () => {} }
|
|
1696
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_wasmtcpgatewayconfig_free(ptr, 1));
|
|
1697
|
+
const WasmTcpServerFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1698
|
+
? { register: () => {}, unregister: () => {} }
|
|
1699
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_wasmtcpserver_free(ptr, 1));
|
|
1700
|
+
|
|
1701
|
+
function addToExternrefTable0(obj) {
|
|
1702
|
+
const idx = wasm.__externref_table_alloc();
|
|
1703
|
+
wasm.__wbindgen_externrefs.set(idx, obj);
|
|
1704
|
+
return idx;
|
|
1705
|
+
}
|
|
1706
|
+
|
|
1707
|
+
function _assertClass(instance, klass) {
|
|
1708
|
+
if (!(instance instanceof klass)) {
|
|
1709
|
+
throw new Error(`expected instance of ${klass.name}`);
|
|
1710
|
+
}
|
|
1711
|
+
}
|
|
1712
|
+
|
|
1713
|
+
const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
|
|
1714
|
+
? { register: () => {}, unregister: () => {} }
|
|
1715
|
+
: new FinalizationRegistry(state => wasm.__wbindgen_destroy_closure(state.a, state.b));
|
|
1716
|
+
|
|
1717
|
+
function debugString(val) {
|
|
1718
|
+
// primitive types
|
|
1719
|
+
const type = typeof val;
|
|
1720
|
+
if (type == 'number' || type == 'boolean' || val == null) {
|
|
1721
|
+
return `${val}`;
|
|
1722
|
+
}
|
|
1723
|
+
if (type == 'string') {
|
|
1724
|
+
return `"${val}"`;
|
|
1725
|
+
}
|
|
1726
|
+
if (type == 'symbol') {
|
|
1727
|
+
const description = val.description;
|
|
1728
|
+
if (description == null) {
|
|
1729
|
+
return 'Symbol';
|
|
1730
|
+
} else {
|
|
1731
|
+
return `Symbol(${description})`;
|
|
1732
|
+
}
|
|
1733
|
+
}
|
|
1734
|
+
if (type == 'function') {
|
|
1735
|
+
const name = val.name;
|
|
1736
|
+
if (typeof name == 'string' && name.length > 0) {
|
|
1737
|
+
return `Function(${name})`;
|
|
1738
|
+
} else {
|
|
1739
|
+
return 'Function';
|
|
1740
|
+
}
|
|
1741
|
+
}
|
|
1742
|
+
// objects
|
|
1743
|
+
if (Array.isArray(val)) {
|
|
1744
|
+
const length = val.length;
|
|
1745
|
+
let debug = '[';
|
|
1746
|
+
if (length > 0) {
|
|
1747
|
+
debug += debugString(val[0]);
|
|
1748
|
+
}
|
|
1749
|
+
for(let i = 1; i < length; i++) {
|
|
1750
|
+
debug += ', ' + debugString(val[i]);
|
|
1751
|
+
}
|
|
1752
|
+
debug += ']';
|
|
1753
|
+
return debug;
|
|
1754
|
+
}
|
|
1755
|
+
// Test for built-in
|
|
1756
|
+
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
1757
|
+
let className;
|
|
1758
|
+
if (builtInMatches && builtInMatches.length > 1) {
|
|
1759
|
+
className = builtInMatches[1];
|
|
1760
|
+
} else {
|
|
1761
|
+
// Failed to match the standard '[object ClassName]'
|
|
1762
|
+
return toString.call(val);
|
|
1763
|
+
}
|
|
1764
|
+
if (className == 'Object') {
|
|
1765
|
+
// we're a user defined class or Object
|
|
1766
|
+
// JSON.stringify avoids problems with cycles, and is generally much
|
|
1767
|
+
// easier than looping through ownProperties of `val`.
|
|
1768
|
+
try {
|
|
1769
|
+
return 'Object(' + JSON.stringify(val) + ')';
|
|
1770
|
+
} catch (_) {
|
|
1771
|
+
return 'Object';
|
|
1772
|
+
}
|
|
1773
|
+
}
|
|
1774
|
+
// errors
|
|
1775
|
+
if (val instanceof Error) {
|
|
1776
|
+
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
1777
|
+
}
|
|
1778
|
+
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
1779
|
+
return className;
|
|
1780
|
+
}
|
|
1781
|
+
|
|
1782
|
+
function getArrayU16FromWasm0(ptr, len) {
|
|
1783
|
+
ptr = ptr >>> 0;
|
|
1784
|
+
return getUint16ArrayMemory0().subarray(ptr / 2, ptr / 2 + len);
|
|
1785
|
+
}
|
|
1786
|
+
|
|
1787
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
1788
|
+
ptr = ptr >>> 0;
|
|
1789
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
1790
|
+
}
|
|
1791
|
+
|
|
1792
|
+
let cachedDataViewMemory0 = null;
|
|
1793
|
+
function getDataViewMemory0() {
|
|
1794
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
1795
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
1796
|
+
}
|
|
1797
|
+
return cachedDataViewMemory0;
|
|
1798
|
+
}
|
|
1799
|
+
|
|
1800
|
+
function getStringFromWasm0(ptr, len) {
|
|
1801
|
+
return decodeText(ptr >>> 0, len);
|
|
1802
|
+
}
|
|
1803
|
+
|
|
1804
|
+
let cachedUint16ArrayMemory0 = null;
|
|
1805
|
+
function getUint16ArrayMemory0() {
|
|
1806
|
+
if (cachedUint16ArrayMemory0 === null || cachedUint16ArrayMemory0.byteLength === 0) {
|
|
1807
|
+
cachedUint16ArrayMemory0 = new Uint16Array(wasm.memory.buffer);
|
|
1808
|
+
}
|
|
1809
|
+
return cachedUint16ArrayMemory0;
|
|
1810
|
+
}
|
|
1811
|
+
|
|
1812
|
+
let cachedUint8ArrayMemory0 = null;
|
|
1813
|
+
function getUint8ArrayMemory0() {
|
|
1814
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
1815
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
1816
|
+
}
|
|
1817
|
+
return cachedUint8ArrayMemory0;
|
|
1818
|
+
}
|
|
1819
|
+
|
|
1820
|
+
function handleError(f, args) {
|
|
1821
|
+
try {
|
|
1822
|
+
return f.apply(this, args);
|
|
1823
|
+
} catch (e) {
|
|
1824
|
+
const idx = addToExternrefTable0(e);
|
|
1825
|
+
wasm.__wbindgen_exn_store(idx);
|
|
1826
|
+
}
|
|
1827
|
+
}
|
|
1828
|
+
|
|
1829
|
+
function isLikeNone(x) {
|
|
1830
|
+
return x === undefined || x === null;
|
|
1831
|
+
}
|
|
1832
|
+
|
|
1833
|
+
function makeMutClosure(arg0, arg1, f) {
|
|
1834
|
+
const state = { a: arg0, b: arg1, cnt: 1 };
|
|
1835
|
+
const real = (...args) => {
|
|
1836
|
+
|
|
1837
|
+
// First up with a closure we increment the internal reference
|
|
1838
|
+
// count. This ensures that the Rust closure environment won't
|
|
1839
|
+
// be deallocated while we're invoking it.
|
|
1840
|
+
state.cnt++;
|
|
1841
|
+
const a = state.a;
|
|
1842
|
+
state.a = 0;
|
|
1843
|
+
try {
|
|
1844
|
+
return f(a, state.b, ...args);
|
|
1845
|
+
} finally {
|
|
1846
|
+
state.a = a;
|
|
1847
|
+
real._wbg_cb_unref();
|
|
1848
|
+
}
|
|
1849
|
+
};
|
|
1850
|
+
real._wbg_cb_unref = () => {
|
|
1851
|
+
if (--state.cnt === 0) {
|
|
1852
|
+
wasm.__wbindgen_destroy_closure(state.a, state.b);
|
|
1853
|
+
state.a = 0;
|
|
1854
|
+
CLOSURE_DTORS.unregister(state);
|
|
1855
|
+
}
|
|
1856
|
+
};
|
|
1857
|
+
CLOSURE_DTORS.register(real, state, state);
|
|
1858
|
+
return real;
|
|
1859
|
+
}
|
|
1860
|
+
|
|
1861
|
+
function passArray16ToWasm0(arg, malloc) {
|
|
1862
|
+
const ptr = malloc(arg.length * 2, 2) >>> 0;
|
|
1863
|
+
getUint16ArrayMemory0().set(arg, ptr / 2);
|
|
1864
|
+
WASM_VECTOR_LEN = arg.length;
|
|
1865
|
+
return ptr;
|
|
1866
|
+
}
|
|
1867
|
+
|
|
1868
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
1869
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
1870
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
1871
|
+
WASM_VECTOR_LEN = arg.length;
|
|
1872
|
+
return ptr;
|
|
1873
|
+
}
|
|
1874
|
+
|
|
1875
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
1876
|
+
if (realloc === undefined) {
|
|
1877
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
1878
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
1879
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
1880
|
+
WASM_VECTOR_LEN = buf.length;
|
|
1881
|
+
return ptr;
|
|
1882
|
+
}
|
|
1883
|
+
|
|
1884
|
+
let len = arg.length;
|
|
1885
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
1886
|
+
|
|
1887
|
+
const mem = getUint8ArrayMemory0();
|
|
1888
|
+
|
|
1889
|
+
let offset = 0;
|
|
1890
|
+
|
|
1891
|
+
for (; offset < len; offset++) {
|
|
1892
|
+
const code = arg.charCodeAt(offset);
|
|
1893
|
+
if (code > 0x7F) break;
|
|
1894
|
+
mem[ptr + offset] = code;
|
|
1895
|
+
}
|
|
1896
|
+
if (offset !== len) {
|
|
1897
|
+
if (offset !== 0) {
|
|
1898
|
+
arg = arg.slice(offset);
|
|
1899
|
+
}
|
|
1900
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
1901
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
1902
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
1903
|
+
|
|
1904
|
+
offset += ret.written;
|
|
1905
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
1906
|
+
}
|
|
1907
|
+
|
|
1908
|
+
WASM_VECTOR_LEN = offset;
|
|
1909
|
+
return ptr;
|
|
1910
|
+
}
|
|
1911
|
+
|
|
1912
|
+
function takeFromExternrefTable0(idx) {
|
|
1913
|
+
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
1914
|
+
wasm.__externref_table_dealloc(idx);
|
|
1915
|
+
return value;
|
|
1916
|
+
}
|
|
1917
|
+
|
|
1918
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
1919
|
+
cachedTextDecoder.decode();
|
|
1920
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
1921
|
+
let numBytesDecoded = 0;
|
|
1922
|
+
function decodeText(ptr, len) {
|
|
1923
|
+
numBytesDecoded += len;
|
|
1924
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
1925
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
1926
|
+
cachedTextDecoder.decode();
|
|
1927
|
+
numBytesDecoded = len;
|
|
1928
|
+
}
|
|
1929
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
1930
|
+
}
|
|
1931
|
+
|
|
1932
|
+
const cachedTextEncoder = new TextEncoder();
|
|
1933
|
+
|
|
1934
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
1935
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
1936
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
1937
|
+
view.set(buf);
|
|
1938
|
+
return {
|
|
1939
|
+
read: arg.length,
|
|
1940
|
+
written: buf.length
|
|
1941
|
+
};
|
|
1942
|
+
};
|
|
1943
|
+
}
|
|
1944
|
+
|
|
1945
|
+
let WASM_VECTOR_LEN = 0;
|
|
1946
|
+
|
|
1947
|
+
let wasmModule, wasmInstance, wasm;
|
|
1948
|
+
function __wbg_finalize_init(instance, module) {
|
|
1949
|
+
wasmInstance = instance;
|
|
1950
|
+
wasm = instance.exports;
|
|
1951
|
+
wasmModule = module;
|
|
1952
|
+
cachedDataViewMemory0 = null;
|
|
1953
|
+
cachedUint16ArrayMemory0 = null;
|
|
1954
|
+
cachedUint8ArrayMemory0 = null;
|
|
1955
|
+
wasm.__wbindgen_start();
|
|
1956
|
+
return wasm;
|
|
1957
|
+
}
|
|
1958
|
+
|
|
1959
|
+
async function __wbg_load(module, imports) {
|
|
1960
|
+
if (typeof Response === 'function' && module instanceof Response) {
|
|
1961
|
+
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
1962
|
+
try {
|
|
1963
|
+
return await WebAssembly.instantiateStreaming(module, imports);
|
|
1964
|
+
} catch (e) {
|
|
1965
|
+
const validResponse = module.ok && expectedResponseType(module.type);
|
|
1966
|
+
|
|
1967
|
+
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
|
|
1968
|
+
console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
|
|
1969
|
+
|
|
1970
|
+
} else { throw e; }
|
|
1971
|
+
}
|
|
1972
|
+
}
|
|
1973
|
+
|
|
1974
|
+
const bytes = await module.arrayBuffer();
|
|
1975
|
+
return await WebAssembly.instantiate(bytes, imports);
|
|
1976
|
+
} else {
|
|
1977
|
+
const instance = await WebAssembly.instantiate(module, imports);
|
|
1978
|
+
|
|
1979
|
+
if (instance instanceof WebAssembly.Instance) {
|
|
1980
|
+
return { instance, module };
|
|
1981
|
+
} else {
|
|
1982
|
+
return instance;
|
|
1983
|
+
}
|
|
1984
|
+
}
|
|
1985
|
+
|
|
1986
|
+
function expectedResponseType(type) {
|
|
1987
|
+
switch (type) {
|
|
1988
|
+
case 'basic': case 'cors': case 'default': return true;
|
|
1989
|
+
}
|
|
1990
|
+
return false;
|
|
1991
|
+
}
|
|
1992
|
+
}
|
|
1993
|
+
|
|
1994
|
+
function initSync(module) {
|
|
1995
|
+
if (wasm !== undefined) return wasm;
|
|
1996
|
+
|
|
1997
|
+
|
|
1998
|
+
if (module !== undefined) {
|
|
1999
|
+
if (Object.getPrototypeOf(module) === Object.prototype) {
|
|
2000
|
+
({module} = module)
|
|
2001
|
+
} else {
|
|
2002
|
+
console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
|
|
2003
|
+
}
|
|
2004
|
+
}
|
|
2005
|
+
|
|
2006
|
+
const imports = __wbg_get_imports();
|
|
2007
|
+
if (!(module instanceof WebAssembly.Module)) {
|
|
2008
|
+
module = new WebAssembly.Module(module);
|
|
2009
|
+
}
|
|
2010
|
+
const instance = new WebAssembly.Instance(module, imports);
|
|
2011
|
+
return __wbg_finalize_init(instance, module);
|
|
2012
|
+
}
|
|
2013
|
+
|
|
2014
|
+
async function __wbg_init(module_or_path) {
|
|
2015
|
+
if (wasm !== undefined) return wasm;
|
|
2016
|
+
|
|
2017
|
+
|
|
2018
|
+
if (module_or_path !== undefined) {
|
|
2019
|
+
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
2020
|
+
({module_or_path} = module_or_path)
|
|
2021
|
+
} else {
|
|
2022
|
+
console.warn('using deprecated parameters for the initialization function; pass a single object instead')
|
|
2023
|
+
}
|
|
2024
|
+
}
|
|
2025
|
+
|
|
2026
|
+
if (module_or_path === undefined) {
|
|
2027
|
+
module_or_path = new URL('modbus-rs_bg.wasm', import.meta.url);
|
|
2028
|
+
}
|
|
2029
|
+
const imports = __wbg_get_imports();
|
|
2030
|
+
|
|
2031
|
+
if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
|
|
2032
|
+
module_or_path = fetch(module_or_path);
|
|
2033
|
+
}
|
|
2034
|
+
|
|
2035
|
+
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
|
2036
|
+
|
|
2037
|
+
return __wbg_finalize_init(instance, module);
|
|
2038
|
+
}
|
|
2039
|
+
|
|
2040
|
+
export { initSync, __wbg_init as default };
|