cantraceviewer 0.1.0-rc.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/LICENSE.md +19 -0
- package/README.md +131 -0
- package/dist/client.d.ts +21 -0
- package/dist/client.js +37 -0
- package/dist/direct.d.ts +39 -0
- package/dist/direct.js +143 -0
- package/dist/handles.d.ts +24 -0
- package/dist/handles.js +54 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +1 -0
- package/dist/node-transport.d.ts +12 -0
- package/dist/node-transport.js +38 -0
- package/dist/node-worker.d.ts +1 -0
- package/dist/node-worker.js +27 -0
- package/dist/node.d.ts +12 -0
- package/dist/node.js +25 -0
- package/dist/protocol.d.ts +73 -0
- package/dist/protocol.js +1 -0
- package/dist/rpc-client.d.ts +53 -0
- package/dist/rpc-client.js +177 -0
- package/dist/types.d.ts +99 -0
- package/dist/types.js +1 -0
- package/dist/wasm-bindgen/cantraceviewer.d.ts +95 -0
- package/dist/wasm-bindgen/cantraceviewer.js +588 -0
- package/dist/wasm-bindgen/cantraceviewer_bg.wasm +0 -0
- package/dist/wasm-bindgen/cantraceviewer_bg.wasm.d.ts +25 -0
- package/dist/worker-runtime.d.ts +23 -0
- package/dist/worker-runtime.js +152 -0
- package/dist/worker.d.ts +1 -0
- package/dist/worker.js +11 -0
- package/package.json +58 -0
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/** Private wire protocol between an asynchronous client and its worker. @internal */
|
|
2
|
+
import type { DbcMessageIdentity, EmbeddedDbc, Mf4SignalCatalog, ParsedDbc, TraceMetadata, TraceType } from './types.js';
|
|
3
|
+
/** Serializable error envelope. The client rebuilds an Error preserving name and message. */
|
|
4
|
+
export type WireError = {
|
|
5
|
+
name: string;
|
|
6
|
+
message: string;
|
|
7
|
+
};
|
|
8
|
+
/** Request bodies. The client stamps a monotonically increasing `id`; IDs are never recycled. */
|
|
9
|
+
export type WorkerRequestBody = {
|
|
10
|
+
op: 'openDbc';
|
|
11
|
+
text: string;
|
|
12
|
+
} | {
|
|
13
|
+
op: 'closeDbc';
|
|
14
|
+
dbcId: number;
|
|
15
|
+
} | {
|
|
16
|
+
op: 'openTrace';
|
|
17
|
+
traceType: TraceType;
|
|
18
|
+
buffer: ArrayBuffer;
|
|
19
|
+
} | {
|
|
20
|
+
op: 'closeTrace';
|
|
21
|
+
traceId: number;
|
|
22
|
+
} | {
|
|
23
|
+
op: 'getSignalValues';
|
|
24
|
+
dbcId: number;
|
|
25
|
+
traceId: number;
|
|
26
|
+
messageIdentity: DbcMessageIdentity;
|
|
27
|
+
signalName: string;
|
|
28
|
+
} | {
|
|
29
|
+
op: 'getMf4SignalValues';
|
|
30
|
+
traceId: number;
|
|
31
|
+
signalId: number;
|
|
32
|
+
} | {
|
|
33
|
+
op: 'closeClient';
|
|
34
|
+
};
|
|
35
|
+
export type WorkerRequest = WorkerRequestBody & {
|
|
36
|
+
id: number;
|
|
37
|
+
};
|
|
38
|
+
/** Wire form of `OpenDbcResult`: the opaque handle becomes a worker-local id. */
|
|
39
|
+
export type WireOpenDbc = {
|
|
40
|
+
dbcId: number;
|
|
41
|
+
catalog: ParsedDbc;
|
|
42
|
+
};
|
|
43
|
+
/** Wire form of `OpenTraceResult`: the opaque handle becomes a worker-local id. */
|
|
44
|
+
export type WireOpenTrace = {
|
|
45
|
+
traceId: number;
|
|
46
|
+
metadata: TraceMetadata;
|
|
47
|
+
hasRawFrames: boolean;
|
|
48
|
+
mf4Catalog: Mf4SignalCatalog | null;
|
|
49
|
+
embeddedDbcs: EmbeddedDbc[];
|
|
50
|
+
warnings: string[];
|
|
51
|
+
};
|
|
52
|
+
/** Two Float64Array views reconstructed over one transferred ArrayBuffer. */
|
|
53
|
+
export type SeriesPayload = {
|
|
54
|
+
buffer: ArrayBuffer;
|
|
55
|
+
timesByteOffset: number;
|
|
56
|
+
timesLength: number;
|
|
57
|
+
valuesByteOffset: number;
|
|
58
|
+
valuesLength: number;
|
|
59
|
+
};
|
|
60
|
+
export type WorkerResponse = {
|
|
61
|
+
type: 'ready';
|
|
62
|
+
} | {
|
|
63
|
+
type: 'boot-error';
|
|
64
|
+
error: WireError;
|
|
65
|
+
} | {
|
|
66
|
+
type: 'ok';
|
|
67
|
+
id: number;
|
|
68
|
+
result: unknown;
|
|
69
|
+
} | {
|
|
70
|
+
type: 'error';
|
|
71
|
+
id: number;
|
|
72
|
+
error: WireError;
|
|
73
|
+
};
|
package/dist/protocol.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { WorkerRequest } from './protocol.js';
|
|
2
|
+
import type { DbcHandle, DbcMessageIdentity, DecodedSignalSeries, OpenDbcResult, OpenTraceResult, TraceHandle, TraceType } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Asynchronous CAN trace client backed by one dedicated worker. The browser entry and the Node
|
|
5
|
+
* entry expose exactly this interface over their own transport.
|
|
6
|
+
*
|
|
7
|
+
* Every method is genuine worker RPC; the worker runs requests strictly serially in call order.
|
|
8
|
+
* Worker startup failure, a crash, or an unexpected exit is fatal for the client: every pending and
|
|
9
|
+
* future operation rejects, every handle is invalidated, and the worker is terminated without
|
|
10
|
+
* restart. Create a new client to recover.
|
|
11
|
+
*/
|
|
12
|
+
export type CanTraceClient = {
|
|
13
|
+
openDbc(text: string): Promise<OpenDbcResult>;
|
|
14
|
+
/** Idempotent for handles this client issued; repeat calls resolve without effect. */
|
|
15
|
+
closeDbc(handle: DbcHandle): Promise<void>;
|
|
16
|
+
/**
|
|
17
|
+
* Parse one trace. `buffer` must be the exact ArrayBuffer holding the file bytes: it is
|
|
18
|
+
* transferred to the worker and detached in the caller, and it stays consumed even when
|
|
19
|
+
* parsing fails. Typed-array views are rejected rather than silently copied.
|
|
20
|
+
*/
|
|
21
|
+
openTrace(traceType: TraceType, buffer: ArrayBuffer): Promise<OpenTraceResult>;
|
|
22
|
+
/** Idempotent for handles this client issued; repeat calls resolve without effect. */
|
|
23
|
+
closeTrace(handle: TraceHandle): Promise<void>;
|
|
24
|
+
/** Both returned arrays are views over one ArrayBuffer transferred out of the worker. */
|
|
25
|
+
getSignalValues(dbcHandle: DbcHandle, traceHandle: TraceHandle, messageIdentity: DbcMessageIdentity, signalName: string): Promise<DecodedSignalSeries>;
|
|
26
|
+
getMf4SignalValues(traceHandle: TraceHandle, signalId: number): Promise<DecodedSignalSeries>;
|
|
27
|
+
/**
|
|
28
|
+
* Idempotent. Queues worker-side cleanup behind every previously posted operation, waits for
|
|
29
|
+
* its acknowledgement, invalidates every handle, then terminates the worker.
|
|
30
|
+
*/
|
|
31
|
+
close(): Promise<void>;
|
|
32
|
+
};
|
|
33
|
+
/** Events a transport reports to the shared client core. @internal */
|
|
34
|
+
export type RpcTransportHandlers = {
|
|
35
|
+
/** One structured-clone payload received from the worker. */
|
|
36
|
+
message(data: unknown): void;
|
|
37
|
+
/** Unrecoverable transport failure: crash, exit, or undeliverable message. */
|
|
38
|
+
fail(error: Error): void;
|
|
39
|
+
};
|
|
40
|
+
/** Worker transport the shared client core drives. @internal */
|
|
41
|
+
export type RpcTransport = {
|
|
42
|
+
postMessage(message: WorkerRequest, transfer: ArrayBuffer[]): void;
|
|
43
|
+
/** Stop the worker. Resolves once it is gone; called at most once. */
|
|
44
|
+
terminate(): Promise<void>;
|
|
45
|
+
};
|
|
46
|
+
/** @internal */
|
|
47
|
+
export type RpcTransportFactory = (handlers: RpcTransportHandlers) => RpcTransport;
|
|
48
|
+
/**
|
|
49
|
+
* Shared asynchronous client core: request ids, the pending-request table, handle ownership,
|
|
50
|
+
* fatal-failure handling, and close semantics. It knows nothing about Web Workers or worker
|
|
51
|
+
* threads; a transport supplies those. @internal
|
|
52
|
+
*/
|
|
53
|
+
export declare function createRpcClient(createTransport: RpcTransportFactory): Promise<CanTraceClient>;
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { createHandleRegistry } from "./handles.js";
|
|
2
|
+
/**
|
|
3
|
+
* Shared asynchronous client core: request ids, the pending-request table, handle ownership,
|
|
4
|
+
* fatal-failure handling, and close semantics. It knows nothing about Web Workers or worker
|
|
5
|
+
* threads; a transport supplies those. @internal
|
|
6
|
+
*/
|
|
7
|
+
export async function createRpcClient(createTransport) {
|
|
8
|
+
const handles = createHandleRegistry();
|
|
9
|
+
const pending = new Map();
|
|
10
|
+
// Request IDs are never recycled.
|
|
11
|
+
let nextRequestId = 1;
|
|
12
|
+
let fatalError = null;
|
|
13
|
+
let closePromise = null;
|
|
14
|
+
let termination = null;
|
|
15
|
+
// Assigned below, once the handlers it reports to exist.
|
|
16
|
+
let transport = null;
|
|
17
|
+
let ready;
|
|
18
|
+
const readyPromise = new Promise((resolve, reject) => {
|
|
19
|
+
ready = { resolve, reject };
|
|
20
|
+
});
|
|
21
|
+
function receive(data) {
|
|
22
|
+
const response = data;
|
|
23
|
+
if (response.type === 'ready') {
|
|
24
|
+
ready.resolve();
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
if (response.type === 'boot-error') {
|
|
28
|
+
fail(fromWireError(response.error));
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
const entry = pending.get(response.id);
|
|
32
|
+
if (!entry)
|
|
33
|
+
return;
|
|
34
|
+
pending.delete(response.id);
|
|
35
|
+
if (response.type === 'ok')
|
|
36
|
+
entry.resolve(response.result);
|
|
37
|
+
else
|
|
38
|
+
entry.reject(fromWireError(response.error));
|
|
39
|
+
}
|
|
40
|
+
/** Worker failure is terminal for this client: nothing ever restarts the worker. */
|
|
41
|
+
function fail(error) {
|
|
42
|
+
if (fatalError)
|
|
43
|
+
return;
|
|
44
|
+
fatalError = error;
|
|
45
|
+
handles.releaseAll();
|
|
46
|
+
const entries = [...pending.values()];
|
|
47
|
+
pending.clear();
|
|
48
|
+
for (const entry of entries)
|
|
49
|
+
entry.reject(error);
|
|
50
|
+
void terminate().catch(() => undefined);
|
|
51
|
+
ready.reject(error);
|
|
52
|
+
}
|
|
53
|
+
function terminate() {
|
|
54
|
+
// A transport that reports failure while it is still being created has nothing to stop yet.
|
|
55
|
+
if (!transport)
|
|
56
|
+
return Promise.resolve();
|
|
57
|
+
termination ??= transport.terminate();
|
|
58
|
+
return termination;
|
|
59
|
+
}
|
|
60
|
+
function send(body, transfer) {
|
|
61
|
+
const active = transport;
|
|
62
|
+
if (fatalError || !active) {
|
|
63
|
+
return Promise.reject(fatalError ?? new Error('client transport is unavailable'));
|
|
64
|
+
}
|
|
65
|
+
const id = nextRequestId++;
|
|
66
|
+
return new Promise((resolve, reject) => {
|
|
67
|
+
pending.set(id, { resolve: resolve, reject });
|
|
68
|
+
try {
|
|
69
|
+
active.postMessage({ ...body, id }, transfer);
|
|
70
|
+
}
|
|
71
|
+
catch (error) {
|
|
72
|
+
pending.delete(id);
|
|
73
|
+
reject(error);
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
transport = createTransport({ message: receive, fail });
|
|
78
|
+
if (fatalError)
|
|
79
|
+
void terminate().catch(() => undefined);
|
|
80
|
+
function assertOpen() {
|
|
81
|
+
if (fatalError)
|
|
82
|
+
throw fatalError;
|
|
83
|
+
if (closePromise)
|
|
84
|
+
throw new Error('client is closed');
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* After a fatal failure or client close, worker-side cleanup already happened or the whole
|
|
88
|
+
* direct client is being torn down; only the local handle mark is needed.
|
|
89
|
+
*/
|
|
90
|
+
async function sendClose(body) {
|
|
91
|
+
if (fatalError || closePromise)
|
|
92
|
+
return;
|
|
93
|
+
await send(body, []);
|
|
94
|
+
}
|
|
95
|
+
await readyPromise;
|
|
96
|
+
return {
|
|
97
|
+
async openDbc(text) {
|
|
98
|
+
assertOpen();
|
|
99
|
+
const { dbcId, catalog } = await send({ op: 'openDbc', text }, []);
|
|
100
|
+
return { handle: handles.issue('dbc', dbcId), catalog };
|
|
101
|
+
},
|
|
102
|
+
async closeDbc(handle) {
|
|
103
|
+
const dbcId = handles.release('dbc', handle);
|
|
104
|
+
if (dbcId === null)
|
|
105
|
+
return;
|
|
106
|
+
await sendClose({ op: 'closeDbc', dbcId });
|
|
107
|
+
},
|
|
108
|
+
async openTrace(traceType, buffer) {
|
|
109
|
+
assertOpen();
|
|
110
|
+
if (!(buffer instanceof ArrayBuffer)) {
|
|
111
|
+
throw new Error('openTrace requires the exact ArrayBuffer to transfer; pass the underlying buffer, not a typed-array view');
|
|
112
|
+
}
|
|
113
|
+
const opened = await send({ op: 'openTrace', traceType, buffer }, [buffer]);
|
|
114
|
+
return {
|
|
115
|
+
handle: handles.issue('trace', opened.traceId),
|
|
116
|
+
metadata: opened.metadata,
|
|
117
|
+
hasRawFrames: opened.hasRawFrames,
|
|
118
|
+
mf4Catalog: opened.mf4Catalog,
|
|
119
|
+
embeddedDbcs: opened.embeddedDbcs,
|
|
120
|
+
warnings: opened.warnings
|
|
121
|
+
};
|
|
122
|
+
},
|
|
123
|
+
async closeTrace(handle) {
|
|
124
|
+
const traceId = handles.release('trace', handle);
|
|
125
|
+
if (traceId === null)
|
|
126
|
+
return;
|
|
127
|
+
await sendClose({ op: 'closeTrace', traceId });
|
|
128
|
+
},
|
|
129
|
+
async getSignalValues(dbcHandle, traceHandle, messageIdentity, signalName) {
|
|
130
|
+
assertOpen();
|
|
131
|
+
const dbcId = handles.payload('dbc', dbcHandle);
|
|
132
|
+
const traceId = handles.payload('trace', traceHandle);
|
|
133
|
+
return unpackSeries(await send({ op: 'getSignalValues', dbcId, traceId, messageIdentity, signalName }, []));
|
|
134
|
+
},
|
|
135
|
+
async getMf4SignalValues(traceHandle, signalId) {
|
|
136
|
+
assertOpen();
|
|
137
|
+
const traceId = handles.payload('trace', traceHandle);
|
|
138
|
+
return unpackSeries(await send({ op: 'getMf4SignalValues', traceId, signalId }, []));
|
|
139
|
+
},
|
|
140
|
+
close() {
|
|
141
|
+
closePromise ??= (async () => {
|
|
142
|
+
let cleanupError = null;
|
|
143
|
+
if (!fatalError) {
|
|
144
|
+
try {
|
|
145
|
+
// Runs after every previously posted request via the worker's serial queue.
|
|
146
|
+
await send({ op: 'closeClient' }, []);
|
|
147
|
+
}
|
|
148
|
+
catch (error) {
|
|
149
|
+
// A fatal crash mid-close still terminates cleanly below.
|
|
150
|
+
if (error !== fatalError)
|
|
151
|
+
cleanupError = error;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
handles.releaseAll();
|
|
155
|
+
await terminate();
|
|
156
|
+
if (cleanupError)
|
|
157
|
+
throw cleanupError;
|
|
158
|
+
})();
|
|
159
|
+
return closePromise;
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
function unpackSeries(payload) {
|
|
164
|
+
return {
|
|
165
|
+
timesMs: new Float64Array(payload.buffer, payload.timesByteOffset, payload.timesLength),
|
|
166
|
+
values: new Float64Array(payload.buffer, payload.valuesByteOffset, payload.valuesLength)
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Errors keep their diagnostic name and message across the wire. Neither is a stable contract:
|
|
171
|
+
* treat them as diagnostics, not as values to branch on.
|
|
172
|
+
*/
|
|
173
|
+
function fromWireError(error) {
|
|
174
|
+
const rebuilt = new Error(error.message);
|
|
175
|
+
rebuilt.name = error.name;
|
|
176
|
+
return rebuilt;
|
|
177
|
+
}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
export type DbcValueDescription = {
|
|
2
|
+
rawValue: number;
|
|
3
|
+
label: string;
|
|
4
|
+
};
|
|
5
|
+
/** Bit order of a DBC signal, as declared by `@1` (intel) or `@0` (motorola). */
|
|
6
|
+
export type DbcEndianness = 'intel' | 'motorola';
|
|
7
|
+
export type DbcSignedness = 'signed' | 'unsigned';
|
|
8
|
+
export type DbcValueType = 'integer' | 'float32' | 'float64';
|
|
9
|
+
export type DbcSignal = {
|
|
10
|
+
name: string;
|
|
11
|
+
startBit: number;
|
|
12
|
+
bitLength: number;
|
|
13
|
+
endianness: DbcEndianness;
|
|
14
|
+
signedness: DbcSignedness;
|
|
15
|
+
factor: number;
|
|
16
|
+
offset: number;
|
|
17
|
+
minimum: number;
|
|
18
|
+
maximum: number;
|
|
19
|
+
unit: string;
|
|
20
|
+
valueType: DbcValueType;
|
|
21
|
+
unsupportedMux: boolean;
|
|
22
|
+
receivers: string[];
|
|
23
|
+
valueDescriptions: DbcValueDescription[];
|
|
24
|
+
};
|
|
25
|
+
export type DbcMessage = {
|
|
26
|
+
name: string;
|
|
27
|
+
dbcId: number;
|
|
28
|
+
canId: number;
|
|
29
|
+
isExtended: boolean;
|
|
30
|
+
isFd: boolean;
|
|
31
|
+
sizeBytes: number;
|
|
32
|
+
transmitter: string;
|
|
33
|
+
signals: DbcSignal[];
|
|
34
|
+
};
|
|
35
|
+
/** Shape pinned by the `serializes_parsed_catalog` test in wasm/src/dbc/catalog.rs. */
|
|
36
|
+
export type ParsedDbc = {
|
|
37
|
+
messages: DbcMessage[];
|
|
38
|
+
};
|
|
39
|
+
export type TraceMetadata = {
|
|
40
|
+
measurementStartMs: number | null;
|
|
41
|
+
validMessageCount: number;
|
|
42
|
+
skippedLineCount: number;
|
|
43
|
+
durationNs: number | null;
|
|
44
|
+
};
|
|
45
|
+
export type DecodedSignalSeries = {
|
|
46
|
+
timesMs: Float64Array;
|
|
47
|
+
values: Float64Array;
|
|
48
|
+
};
|
|
49
|
+
export type Mf4Signal = {
|
|
50
|
+
id: number;
|
|
51
|
+
name: string;
|
|
52
|
+
unit: string;
|
|
53
|
+
};
|
|
54
|
+
export type Mf4SignalGroup = {
|
|
55
|
+
name: string;
|
|
56
|
+
signals: Mf4Signal[];
|
|
57
|
+
};
|
|
58
|
+
export type Mf4SignalCatalog = {
|
|
59
|
+
groups: Mf4SignalGroup[];
|
|
60
|
+
};
|
|
61
|
+
export type EmbeddedDbc = {
|
|
62
|
+
name: string;
|
|
63
|
+
text: string;
|
|
64
|
+
};
|
|
65
|
+
export type TraceType = 'asc' | 'trc' | 'blf' | 'mf4';
|
|
66
|
+
declare const DbcHandleBrand: unique symbol;
|
|
67
|
+
declare const TraceHandleBrand: unique symbol;
|
|
68
|
+
/**
|
|
69
|
+
* Opaque DBC handle. It has no readable fields: it only identifies one parsed DBC inside the
|
|
70
|
+
* client that issued it, until that handle or its client is closed. Handles are safe to spread and
|
|
71
|
+
* to store in deep-reactive stores, and every copy shares one lifetime.
|
|
72
|
+
*/
|
|
73
|
+
export type DbcHandle = {
|
|
74
|
+
readonly [DbcHandleBrand]: true;
|
|
75
|
+
};
|
|
76
|
+
/** Opaque trace handle, with the same identity and lifetime rules as {@link DbcHandle}. */
|
|
77
|
+
export type TraceHandle = {
|
|
78
|
+
readonly [TraceHandleBrand]: true;
|
|
79
|
+
};
|
|
80
|
+
/** Everything one `openDbc` call produces. The catalog is plain data and outlives the handle. */
|
|
81
|
+
export type OpenDbcResult = {
|
|
82
|
+
handle: DbcHandle;
|
|
83
|
+
catalog: ParsedDbc;
|
|
84
|
+
};
|
|
85
|
+
/** Everything one `openTrace` call produces. Every field except `handle` is plain data. */
|
|
86
|
+
export type OpenTraceResult = {
|
|
87
|
+
handle: TraceHandle;
|
|
88
|
+
metadata: TraceMetadata;
|
|
89
|
+
/** True when the trace carries raw CAN frames that a DBC can decode. */
|
|
90
|
+
hasRawFrames: boolean;
|
|
91
|
+
/** Signals the trace itself already carries decoded; MF4 only, otherwise null. */
|
|
92
|
+
mf4Catalog: Mf4SignalCatalog | null;
|
|
93
|
+
/** DBC sources embedded in the trace file; MF4 only, otherwise empty. */
|
|
94
|
+
embeddedDbcs: EmbeddedDbc[];
|
|
95
|
+
/** Non-fatal parse diagnostics; MF4 only, otherwise empty. */
|
|
96
|
+
warnings: string[];
|
|
97
|
+
};
|
|
98
|
+
export type DbcMessageIdentity = Pick<DbcMessage, 'canId' | 'isExtended' | 'sizeBytes'>;
|
|
99
|
+
export {};
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Parsed DBC model owned by WebAssembly.
|
|
6
|
+
*/
|
|
7
|
+
export class Dbc {
|
|
8
|
+
private constructor();
|
|
9
|
+
free(): void;
|
|
10
|
+
[Symbol.dispose](): void;
|
|
11
|
+
/**
|
|
12
|
+
* Return the browser catalog projection as JSON.
|
|
13
|
+
*/
|
|
14
|
+
catalogJson(): string;
|
|
15
|
+
/**
|
|
16
|
+
* Decode one selected signal as packed parallel time/value arrays.
|
|
17
|
+
*/
|
|
18
|
+
decodeSignal(trace: Trace, can_id: number, is_extended: boolean, size_bytes: number, signal_name: string): Float64Array;
|
|
19
|
+
/**
|
|
20
|
+
* Parse DBC text and retain the decoded model for subsequent signal work.
|
|
21
|
+
*/
|
|
22
|
+
static parse(input: string): Dbc;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Parsed trace model owned by WebAssembly.
|
|
27
|
+
*/
|
|
28
|
+
export class Trace {
|
|
29
|
+
private constructor();
|
|
30
|
+
free(): void;
|
|
31
|
+
[Symbol.dispose](): void;
|
|
32
|
+
decodeMf4Signal(signal_id: number): Float64Array;
|
|
33
|
+
mf4CatalogJson(): string;
|
|
34
|
+
mf4EmbeddedDbcsJson(): string;
|
|
35
|
+
mf4WarningsJson(): string;
|
|
36
|
+
static parseAsc(input: Uint8Array): Trace;
|
|
37
|
+
static parseBlf(input: Uint8Array): Trace;
|
|
38
|
+
static parseMf4(input: Uint8Array): Trace;
|
|
39
|
+
static parseTrc(input: Uint8Array): Trace;
|
|
40
|
+
readonly durationNs: number | undefined;
|
|
41
|
+
readonly hasRawFrames: boolean;
|
|
42
|
+
readonly measurementStartMs: number | undefined;
|
|
43
|
+
readonly skippedLineCount: number;
|
|
44
|
+
readonly validMessageCount: number;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
48
|
+
|
|
49
|
+
export interface InitOutput {
|
|
50
|
+
readonly memory: WebAssembly.Memory;
|
|
51
|
+
readonly __wbg_dbc_free: (a: number, b: number) => void;
|
|
52
|
+
readonly __wbg_trace_free: (a: number, b: number) => void;
|
|
53
|
+
readonly wasmdbc_catalogJson: (a: number, b: number) => void;
|
|
54
|
+
readonly wasmdbc_decodeSignal: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
|
|
55
|
+
readonly wasmdbc_parse: (a: number, b: number, c: number) => void;
|
|
56
|
+
readonly wasmtrace_decodeMf4Signal: (a: number, b: number, c: number) => void;
|
|
57
|
+
readonly wasmtrace_durationNs: (a: number, b: number) => void;
|
|
58
|
+
readonly wasmtrace_hasRawFrames: (a: number) => number;
|
|
59
|
+
readonly wasmtrace_measurementStartMs: (a: number, b: number) => void;
|
|
60
|
+
readonly wasmtrace_mf4CatalogJson: (a: number, b: number) => void;
|
|
61
|
+
readonly wasmtrace_mf4EmbeddedDbcsJson: (a: number, b: number) => void;
|
|
62
|
+
readonly wasmtrace_mf4WarningsJson: (a: number, b: number) => void;
|
|
63
|
+
readonly wasmtrace_parseAsc: (a: number, b: number, c: number) => void;
|
|
64
|
+
readonly wasmtrace_parseBlf: (a: number, b: number, c: number) => void;
|
|
65
|
+
readonly wasmtrace_parseMf4: (a: number, b: number, c: number) => void;
|
|
66
|
+
readonly wasmtrace_parseTrc: (a: number, b: number, c: number) => void;
|
|
67
|
+
readonly wasmtrace_skippedLineCount: (a: number) => number;
|
|
68
|
+
readonly wasmtrace_validMessageCount: (a: number) => number;
|
|
69
|
+
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
|
|
70
|
+
readonly __wbindgen_export: (a: number, b: number, c: number) => void;
|
|
71
|
+
readonly __wbindgen_export2: (a: number, b: number) => number;
|
|
72
|
+
readonly __wbindgen_export3: (a: number, b: number, c: number, d: number) => number;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Instantiates the given `module`, which can either be bytes or
|
|
79
|
+
* a precompiled `WebAssembly.Module`.
|
|
80
|
+
*
|
|
81
|
+
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
82
|
+
*
|
|
83
|
+
* @returns {InitOutput}
|
|
84
|
+
*/
|
|
85
|
+
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
89
|
+
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
90
|
+
*
|
|
91
|
+
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
92
|
+
*
|
|
93
|
+
* @returns {Promise<InitOutput>}
|
|
94
|
+
*/
|
|
95
|
+
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
|