@kymoscope/sdk 0.26.0 → 0.27.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.
@@ -0,0 +1,18 @@
1
+ export interface SessionRecordingOptions {
2
+ /** The session's call to live-performance; throws with `status` on an HTTP error. */
3
+ post: (body: Record<string, unknown>) => Promise<{
4
+ url?: string;
5
+ ticket?: string;
6
+ }>;
7
+ /** PUT `bytes` to `url` with `Authorization: Bearer <ticket>`; throws with `status` on an HTTP error. */
8
+ put: (url: string, ticket: string, bytes: Uint8Array<ArrayBuffer>) => Promise<void>;
9
+ recordingId: string;
10
+ }
11
+ export type SessionRecording = ReturnType<typeof createSessionRecording>;
12
+ export declare function createSessionRecording(o: SessionRecordingOptions): {
13
+ add(at: number, bytes: Uint8Array): void;
14
+ /** Bytes held: the open chunk and the chunks waiting to upload. */
15
+ buffered: () => number;
16
+ /** Cuts the last chunk, waits for the uploads (at most 10 s), then rec_close (at most 3 s). Never throws. */
17
+ close(): Promise<void>;
18
+ };
@@ -0,0 +1,72 @@
1
+ /**
2
+ * MIL-STD-1553 (Chapter 10 data type 0x19, format 1) and ARINC-429 (0x38, format 0) bus data, as channels.
3
+ *
4
+ * Without a dictionary every data word is a raw channel: a 1553 message's words are `<channel> RT<rt> <T|R>
5
+ * SA<sa> W<k>` (mode codes with a data word `<channel> RT<rt> mode <code>`), an ARINC-429 word's data field (bits
6
+ * 11-29) is `<channel> bus <b> label <octal>` (` SDI <n>` when its SDI is not 0).
7
+ * With an ICD (a CSV, see `parseIcd`) only its measurements are read, by name, with their bits, type, scale and
8
+ * unit; messages and labels it does not name are counted and skipped.
9
+ * The collector's ch10 source (kymoscope_collector/ch10_source.py) reads both the same way: a recording opened as a
10
+ * file and the live stream have the same channel names.
11
+ */
12
+ export declare const MS1553 = 25;
13
+ export declare const ARINC429 = 56;
14
+ /** One measurement of the ICD. */
15
+ export interface IcdRow {
16
+ name: string;
17
+ unit: string;
18
+ /** Recorder channel id or name; null: any. */
19
+ channel: string | null;
20
+ kind: '1553' | '429';
21
+ rt: number;
22
+ tr: 'T' | 'R';
23
+ sa: number;
24
+ /** 1-based data words, most significant first (two for a 32-bit value). */
25
+ words: number[];
26
+ label: number;
27
+ sdi: number | null;
28
+ bus: number | null;
29
+ /** Lowest bit (0: LSB of the raw value: the word(s) for 1553, the whole 32-bit word for 429) and the bit count. */
30
+ bit: number;
31
+ bits: number;
32
+ type: 'u' | 's' | 'bcd' | 'f32';
33
+ scale: number;
34
+ add: number;
35
+ }
36
+ export declare class IcdError extends Error {
37
+ }
38
+ /**
39
+ * An ICD as CSV: a header row naming its columns (any order, case ignored): name, unit, channel, then for 1553 rt,
40
+ * tr (T or R), sa, word (1-based; `3+4` for a 32-bit value, high word first), for ARINC-429 label (octal), sdi, bus;
41
+ * and bit (lowest bit, 0 = LSB; 1553 default 0, 429 default 10, ARINC bit 11), bits (1553 default 16 per word, 429
42
+ * default 19), type (u unsigned, s two's complement, bcd, f32 IEEE float; default u), scale (default 1), add
43
+ * (default 0): value = raw × scale + add. A row with a label is ARINC-429, with an rt 1553.
44
+ */
45
+ export declare function parseIcd(text: string): IcdRow[];
46
+ /** A measurement's value from its raw integer (the word(s), or the whole ARINC word). */
47
+ export declare function icdValue(r: IcdRow, raw: number): number;
48
+ /** ARINC-429 label: bits 1-8 of the word, sent most significant first (the low byte reversed), in octal. */
49
+ export declare const labelOf: (w: number) => number;
50
+ export declare const octal: (n: number) => string;
51
+ /**
52
+ * A 1553 message's identity and its data words: the command's RT, T/R and SA (the transmitting side of an RT-to-RT
53
+ * transfer), its word count, and where its data words start among the message's words. A mode code (SA 0 or 31)
54
+ * has `mode` and at most one data word. Null when it holds no data or its words are short.
55
+ */
56
+ export declare function message1553(words: number[], rt2rt: boolean): {
57
+ rt: number;
58
+ tr: 'T' | 'R';
59
+ sa: number;
60
+ mode: number | null;
61
+ data: number[];
62
+ } | null;
63
+ /** Visits a 1553 format 1 packet's messages: (rtc of its time stamp, block status, data words). */
64
+ export declare function each1553(dv: DataView, at: number, dlen: number, ipts: (o: number) => number, on: (rtc: number, status: number, words: number[]) => void): number;
65
+ /** Visits an ARINC-429 format 0 packet's words: (rtc, bus, word); returns the words with a parity or format error. */
66
+ export declare function each429(dv: DataView, at: number, dlen: number, rtc: number, on: (rtc: number, bus: number, w: number) => void): number;
67
+ /** The raw channel name of a 1553 data word or mode code. */
68
+ export declare const raw1553: (ch: string, rt: number, tr: string, sa: number, mode: number | null, k: number) => string;
69
+ /** The raw channel name of an ARINC-429 label. */
70
+ export declare const raw429: (ch: string, bus: number, label: number, sdi: number) => string;
71
+ /** ICD rows that apply to a recorder channel (by id or name). */
72
+ export declare const rowsFor: (icd: IcdRow[], id: number, name: string) => IcdRow[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kymoscope/sdk",
3
- "version": "0.26.0",
3
+ "version": "0.27.0",
4
4
  "description": "The Kymoscope data engine and charts for the browser: import large measurement files, plot them, stream live data end-to-end encrypted.",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "homepage": "https://kymoscope.com/docs/introduction",