@kymoscope/sdk 0.20.0 → 0.22.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/dist/assets/importer.worker-jzXF4fDD.js +1040 -0
- package/dist/importer-DhJq-CnQ.js +12 -0
- package/dist/importers-C8Byhb42.js +1036 -0
- package/dist/kymoscope-embed.js +128 -96
- package/dist/kymoscope-sdk.js +86 -86
- package/dist/styles/charts.css +409 -403
- package/dist/types/analysis/aiCheck.d.ts +14 -0
- package/dist/types/analysis/index.d.ts +1 -1
- package/dist/types/analysis/presets.d.ts +1 -1
- package/dist/types/charts/runtime.d.ts +4 -0
- package/dist/types/charts/touchGestures.d.ts +1 -0
- package/dist/types/charts/useWorksheetData.d.ts +7 -0
- package/dist/types/components/HistogramChart.d.ts +2 -0
- package/dist/types/components/MultiBandCanvasChart.d.ts +23 -0
- package/dist/types/components/SpectrogramChart.d.ts +19 -1
- package/dist/types/components/dashboardGridLayout.d.ts +5 -2
- package/dist/types/engine/createEngine.d.ts +2 -0
- package/dist/types/engine/types.d.ts +2 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/lib/beacon.d.ts +6 -0
- package/dist/types/lib/data/xyColumns.d.ts +8 -1
- package/dist/types/lib/importers/ccsds/format.d.ts +2 -0
- package/dist/types/lib/importers/ccsds/frames.d.ts +67 -0
- package/dist/types/lib/importers/ccsds/importer.d.ts +2 -0
- package/dist/types/lib/importers/ccsds/packets.d.ts +49 -0
- package/dist/types/lib/importers/ccsds/xtce.d.ts +79 -0
- package/dist/types/lib/importers/ch10/format.d.ts +10 -0
- package/dist/types/lib/importers/ch10/importer.d.ts +2 -0
- package/dist/types/lib/importers/ch10/packets.d.ts +46 -0
- package/dist/types/lib/importers/ch10/pcm.d.ts +59 -0
- package/dist/types/lib/importers/ch10/tmats.d.ts +93 -0
- package/dist/types/lib/importers/combine.d.ts +2 -1
- package/dist/types/lib/importers/formats.d.ts +2 -0
- package/dist/types/lib/importers/iena/format.d.ts +9 -0
- package/dist/types/lib/importers/iena/importer.d.ts +2 -0
- package/dist/types/lib/importers/iena/layout.d.ts +58 -0
- package/dist/types/lib/importers/iena/pcap.d.ts +48 -0
- package/dist/types/lib/importers/iena/xidml.d.ts +29 -0
- package/dist/types/lib/importers/pqdif/records.d.ts +29 -9
- package/dist/types/lib/importers/table/long.d.ts +7 -0
- package/dist/types/lib/importers/table/table.d.ts +7 -0
- package/dist/types/lib/importers/types.d.ts +7 -1
- package/dist/types/lib/render/offscreenLineRenderer.d.ts +2 -0
- package/dist/types/types/loadedDataset.d.ts +4 -0
- package/package.json +3 -1
- package/dist/assets/importer.worker-B4rzpZKn.js +0 -1006
- package/dist/importer-D_Rxf-9b.js +0 -12
- package/dist/importers-D4cCElZQ.js +0 -1004
|
@@ -92,3 +92,17 @@ export declare const REVIEW_ACTIONS = 5, REVIEW_SUMMARY = 3;
|
|
|
92
92
|
* sentences citing findings or results. Every number written must be in what it rests on (an action: its own text and
|
|
93
93
|
* what it cites; a reason: any finding or result). Malformed input never throws. */
|
|
94
94
|
export declare function checkReview(input: ReviewCheckInput, ai: unknown): ReviewChecked;
|
|
95
|
+
/** A sentence of a handover or of an answer to a question, as checked: kept even when it fails, marked unverified. */
|
|
96
|
+
export interface CitedSentence extends AiSentence {
|
|
97
|
+
verified: boolean;
|
|
98
|
+
}
|
|
99
|
+
/** Most characters of a cited sentence kept (a longer one is cut, and unverified). */
|
|
100
|
+
export declare const CITED_CHARS = 600;
|
|
101
|
+
/** Sentences that each cite the items they rest on (`items`: an id and the item's text, usually its JSON): verified
|
|
102
|
+
* when the sentence cites at least one item, every cite exists, it fits the sentence caps and states no number its
|
|
103
|
+
* cited items don't (an item's negative number also counts unsigned). A sentence that fails is kept with `verified`
|
|
104
|
+
* false, so the reader sees it marked; one with no text is dropped. At most `max`. Malformed input never throws. */
|
|
105
|
+
export declare function checkCited(sentences: unknown, items: Array<{
|
|
106
|
+
id: string;
|
|
107
|
+
text: string;
|
|
108
|
+
}>, max: number): CitedSentence[];
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* namespace, plus the few names the app's viewer and PDF use. */
|
|
4
4
|
export { buildReport, listedFindings, viewSections } from './report';
|
|
5
5
|
export { AI_NOTE, AI_SENTENCES, AI_WORDS, aiInput, applyAi, type AiInput, type AiSentence, type AiText } from './ai';
|
|
6
|
-
export { checkReview, type ReviewChecked } from './aiCheck';
|
|
6
|
+
export { checkCited, checkReview, type CitedSentence, type ReviewChecked } from './aiCheck';
|
|
7
7
|
export { KNOWN_GROWTH, KNOWN_MAX, KNOWN_REASONS, KNOWN_REASON_TEXT, applyKnown, findingSignature, grew, type KnownFinding, type KnownReason } from './known';
|
|
8
8
|
export { REVIEW_CHECKS, applyReview, parseChecks, reviewPack, runChecks, type Check, type CheckResult, type ReportReview, type ReviewPack, type ReviewVerdict } from './review';
|
|
9
9
|
export { CHANNEL_ROLES, CHANNEL_ROLE_TEXT, PROCESS_MAX, completeness, confirmAll, confirmed, contextGaps, moneyGaps, emptyChannel, emptyContext, energyChannel, parseContext, roleOf, shiftOf, stopSpans, suggestedCount, type PlannedStop, type ChannelContext, type ChannelRole, type ContextGap, type ProcessContext, type Shift, } from './context';
|
|
@@ -17,7 +17,7 @@ export interface Preset {
|
|
|
17
17
|
roles: Partial<Record<SectionId, ReportRole[]>>;
|
|
18
18
|
/** The report's words in this industry, lower case, whole words or phrases ("batches" → "parts"). */
|
|
19
19
|
terms: Record<string, string>;
|
|
20
|
-
/** A regulated industry (pharma, food):
|
|
20
|
+
/** A regulated industry (pharma, food): reports in this style are worded from the fixed templates, never by the AI. */
|
|
21
21
|
regulated?: true;
|
|
22
22
|
}
|
|
23
23
|
export declare const PRESETS: Record<PresetId, Preset>;
|
|
@@ -2,6 +2,7 @@ import { type KymoscopeEngine } from '../engine/createEngine';
|
|
|
2
2
|
import { type ChartStatus, type ContextMenuEvent } from './ChartBody';
|
|
3
3
|
import { type AnnotationTool, type ChartAnnotation } from '../lib/annotations';
|
|
4
4
|
import type { ChartMark } from '../engine/alerts';
|
|
5
|
+
import { type PanelChartSettings } from '../lib/panelChartSettings';
|
|
5
6
|
import { type PlotFrame } from '../lib/render/plotFrame';
|
|
6
7
|
export interface ChartStyle {
|
|
7
8
|
/** Plot background (overrides the chart's own background setting). */
|
|
@@ -69,6 +70,9 @@ export declare function disposeCharts(engine: KymoscopeEngine): void;
|
|
|
69
70
|
* The alert marks a chart shows: those of a plotted dataset or stream whose rule ran on the chart's X key (D6: a chart
|
|
70
71
|
* on another axis has no time relation). Memoised on its inputs so charts don't redraw for nothing.
|
|
71
72
|
*/
|
|
73
|
+
/** The column a chart's X axis plots, for its alert marks: the worksheet's X on a multiband, the X column on an
|
|
74
|
+
* X-Y scatter; '' on charts whose X is no column (spectrum frequency, histogram bins, categories…). */
|
|
75
|
+
export declare function chartTimeX(settings: PanelChartSettings | undefined, worksheetX: string): string;
|
|
72
76
|
export declare const chartMarks: (a: ChartMark[], b: string[], c: string) => ChartMark[];
|
|
73
77
|
/** What PNG export paints: the alert marks (under) and the chart's annotations; open marks end at the plot's edge. */
|
|
74
78
|
export declare function exportNotes(notes: ChartAnnotation[], marks: ChartMark[], frame: PlotFrame | null): ChartAnnotation[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function attachTouchGestures(root: HTMLElement): () => void;
|
|
@@ -28,6 +28,12 @@ import type { GanttTask } from '../components/GanttChart';
|
|
|
28
28
|
import { type XYColumns } from '../lib/data/xyColumns';
|
|
29
29
|
import { type Dataset, type DatasetRow } from '../lib/parseDataset';
|
|
30
30
|
import type { DuckDbLayerSpec } from '../components/DuckDbMultiBandPanel';
|
|
31
|
+
/** The first plotted source that has `col`, as a column of its own or a math channel it evaluates (`okByPart`). */
|
|
32
|
+
export declare function firstWithColumn(sources: {
|
|
33
|
+
data: {
|
|
34
|
+
columnNames: string[];
|
|
35
|
+
};
|
|
36
|
+
}[], okByPart: string[][] | undefined, col: string): number;
|
|
31
37
|
export interface WorksheetDataInput {
|
|
32
38
|
worksheet: Worksheet;
|
|
33
39
|
viewXRange: [number, number] | null;
|
|
@@ -104,6 +110,7 @@ export declare function useWorksheetData(input: WorksheetDataInput): {
|
|
|
104
110
|
spectrogramDataByPanel: Record<string, {
|
|
105
111
|
signal: Float64Array;
|
|
106
112
|
rate: number;
|
|
113
|
+
times?: Float64Array;
|
|
107
114
|
}>;
|
|
108
115
|
heatmapDataByPanel: Record<string, {
|
|
109
116
|
cells: HeatmapCell[];
|
|
@@ -12,4 +12,6 @@ export interface HistogramChartProps {
|
|
|
12
12
|
clientY: number;
|
|
13
13
|
}) => void;
|
|
14
14
|
}
|
|
15
|
+
/** Y tick values, in counts: 1, 10, 100… up to yMax on a log axis (yMax is in decades there), else nice steps. */
|
|
16
|
+
export declare function histogramYTicks(maxCount: number, yMax: number, logY: boolean): number[];
|
|
15
17
|
export declare function HistogramChart({ values, label, bins: binsProp, color, showNormal, logY, height, backgroundToken, onPlotContextMenu, }: HistogramChartProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -52,6 +52,28 @@ export interface LiveChartSource {
|
|
|
52
52
|
/** The stream's id: charts showing the same stream share one playout (see streamPlayout), so they show one instant. */
|
|
53
53
|
id?: string;
|
|
54
54
|
}
|
|
55
|
+
interface LegendGroup {
|
|
56
|
+
/** Display name (base channel name, `__N` stripped). */
|
|
57
|
+
base: string;
|
|
58
|
+
/** First member — determines band position and anchor. */
|
|
59
|
+
leader: PlotSeries;
|
|
60
|
+
/** All members in their original series order. */
|
|
61
|
+
members: PlotSeries[];
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Which series draw a Y axis column: one per distinct band + scale. Legend groups (the same channel of several
|
|
65
|
+
* datasets) draw their leader's; other series on the same band with the same scale and ticks (same unit, same
|
|
66
|
+
* scale) share the first one's axis. `shared`: every series whose axis column stands for more than one series.
|
|
67
|
+
*/
|
|
68
|
+
/**
|
|
69
|
+
* Where a band's tick label sits on its tick: one at a band edge that touches another band is drawn inside its own
|
|
70
|
+
* band (above a bottom edge, below a top edge), so it never lands on the next band's label ("0" over "150").
|
|
71
|
+
*/
|
|
72
|
+
export declare function bandTickBaseline(y: number, bandTop: number, bandBottom: number, plotTop: number, plotBottom: number): CanvasTextBaseline;
|
|
73
|
+
export declare function axisLeaders(groups: Pick<LegendGroup, 'leader'>[]): {
|
|
74
|
+
leaders: Set<string>;
|
|
75
|
+
shared: Set<string>;
|
|
76
|
+
};
|
|
55
77
|
/**
|
|
56
78
|
* Per-series X gap threshold: consecutive valid points farther apart than this
|
|
57
79
|
* are not joined by a line. Derived from the series' OWN mean spacing so a
|
|
@@ -164,3 +186,4 @@ export interface MultiBandCanvasChartProps {
|
|
|
164
186
|
onCursorX?: (x: number | null) => void;
|
|
165
187
|
}
|
|
166
188
|
export declare function MultiBandCanvasChart({ xLabel, series, points, columnUnits, height, onPlotContextMenu, backgroundToken, viewXRange, onViewXRangeChange, liveZoom, liveZoomId, fullXRange, shiftMode, xAxisLine, yAxisLine, gridLine, lineWidth, envelopes, showLatestValues, liveSource, liveWindowSeconds, onLiveWindowChange, liveZoomMode, onPlotWidthCss, onCursorX, }: MultiBandCanvasChartProps): import("react/jsx-runtime").JSX.Element;
|
|
189
|
+
export {};
|
|
@@ -6,6 +6,9 @@ export interface SpectrogramChartProps {
|
|
|
6
6
|
winFunc?: 'hann' | 'rectangular';
|
|
7
7
|
yMode?: 'amplitude' | 'db';
|
|
8
8
|
logFreq?: boolean;
|
|
9
|
+
/** The time of each sample of `signal`, ascending: the time axis reads them, so a signal recorded at several rates
|
|
10
|
+
* (a recorder's fast window in a slow track) reads in its file's seconds. Omitted: samples / sampleRate from 0. */
|
|
11
|
+
times?: ArrayLike<number>;
|
|
9
12
|
label?: string;
|
|
10
13
|
backgroundToken?: string;
|
|
11
14
|
onPlotContextMenu?: (e: {
|
|
@@ -36,4 +39,19 @@ export interface SpectrogramLive {
|
|
|
36
39
|
/** Seconds shown, ending now (the worksheet's live window); null: everything buffered. */
|
|
37
40
|
windowSeconds: number | null;
|
|
38
41
|
}
|
|
39
|
-
|
|
42
|
+
/**
|
|
43
|
+
* The time axis over `n` samples: its ends, and where (0..1 of the width) a time sits. With the samples' times the
|
|
44
|
+
* columns stay one per window (the picture is in samples), so a time is placed at its sample: a slow stretch of a
|
|
45
|
+
* multi-rate signal is narrow, a fast one wide. Without them the axis is linear from `t0` to `t1`.
|
|
46
|
+
*/
|
|
47
|
+
export declare function timeAxis(times: ArrayLike<number> | null | undefined, n: number, t0: number, t1: number): {
|
|
48
|
+
t0: number;
|
|
49
|
+
t1: number;
|
|
50
|
+
at: (t: number) => number;
|
|
51
|
+
};
|
|
52
|
+
/** Display height (0..1) of a frequency on the log axis, and back: decades from `min` (the first bin above DC) to
|
|
53
|
+
* `max` (Nyquist), as the spectrum's log axis. */
|
|
54
|
+
export declare const logFreqY: (f: number, min: number, max: number) => number;
|
|
55
|
+
/** Ticks of the log frequency axis: 1, 2 and 5 of each decade in [min, max]. */
|
|
56
|
+
export declare function logFreqTicks(min: number, max: number): number[];
|
|
57
|
+
export declare function SpectrogramChart({ signal, sampleRate, windowSize, overlap, winFunc, yMode, logFreq, times, label, backgroundToken, onPlotContextMenu, live, }: SpectrogramChartProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -36,13 +36,16 @@ export declare function rectsOverlap(a: DashboardGridRect, b: DashboardGridRect)
|
|
|
36
36
|
export declare function clampRectForKind(kind: DashboardPanelKind, r: DashboardGridRect, cols: number, rows?: number): DashboardGridRect;
|
|
37
37
|
/**
|
|
38
38
|
* A chart's grid rectangle after a pointer drag of (dxPx, dyPx) on a board of
|
|
39
|
-
* `board` CSS pixels: 'move' shifts it
|
|
39
|
+
* `board` CSS pixels: 'move' shifts it; 'resize' moves its bottom-right corner,
|
|
40
|
+
* and an edge or corner ('n', 'e', 's', 'w', 'ne', 'nw', 'se', 'sw') moves that
|
|
41
|
+
* one, the opposite side staying put.
|
|
40
42
|
* The result stays on the grid and never shrinks below the kind's minimum; a
|
|
41
43
|
* move past an edge trims the chart rather than stopping it. Call
|
|
42
44
|
* it on pointermove with the rectangle from pointerdown, then store the result
|
|
43
45
|
* with `charts.setLayout`.
|
|
44
46
|
*/
|
|
45
|
-
export
|
|
47
|
+
export type ResizeEdge = 'n' | 'e' | 's' | 'w' | 'ne' | 'nw' | 'se' | 'sw';
|
|
48
|
+
export declare function dragLayout(kind: DashboardPanelKind, start: DashboardGridRect, mode: 'move' | 'resize' | ResizeEdge, dxPx: number, dyPx: number, board: {
|
|
46
49
|
width: number;
|
|
47
50
|
height: number;
|
|
48
51
|
}, cols?: number, rows?: number): DashboardGridRect;
|
|
@@ -140,6 +140,8 @@ export declare function createEngine(options?: EngineOptions): {
|
|
|
140
140
|
combine(id: string): Promise<string>;
|
|
141
141
|
/** A file opened with one channel per tag (one row per sample) opened again as the table it is. Returns the new ids. */
|
|
142
142
|
openAsTable(id: string): Promise<string[]>;
|
|
143
|
+
/** A long-form file opened as a table (`openAsTable`) opened again as one channel per tag. Returns the new ids. */
|
|
144
|
+
openAsChannels(id: string): Promise<string[]>;
|
|
143
145
|
/**
|
|
144
146
|
* A cloud recording as a dataset: its encrypted chunks (KRC1, in order) decrypted with `keys` in the import
|
|
145
147
|
* worker, in memory or out of core like a file. Returns the id.
|
|
@@ -112,6 +112,8 @@ export interface DatasetInfo {
|
|
|
112
112
|
parseConfig: DatasetParseConfig | null;
|
|
113
113
|
/** Binary files: format, start time, groups (with rates), events; null for text. */
|
|
114
114
|
fileInfo: DatasetFileInfo | null;
|
|
115
|
+
/** A long-form file opened as a table (datasets.openAsTable): datasets.openAsChannels opens it again as one channel per tag. */
|
|
116
|
+
fromLong: boolean;
|
|
115
117
|
beacon: BeaconConfig | null;
|
|
116
118
|
/** The rule a dataset is cut by (datasets.cut), or null. */
|
|
117
119
|
cut: {
|
package/dist/types/index.d.ts
CHANGED
|
@@ -30,7 +30,7 @@ export { ANNOTATION_CONTROLS_ATTR } from './charts/AnnotationLayer';
|
|
|
30
30
|
export { colorAt, colorsCss, presetStops, type GaugeColorMode, type GaugeColorStop, type GaugePreset } from './lib/gaugeColors';
|
|
31
31
|
export type { PlotSeries, AlarmLine, AlarmStyle } from './types/plotSeries';
|
|
32
32
|
export { newSeriesId, clampPct } from './types/plotSeries';
|
|
33
|
-
export type { DashboardPanel, DashboardPanelKind } from './components/dashboardGridLayout';
|
|
33
|
+
export type { DashboardPanel, DashboardPanelKind, ResizeEdge } from './components/dashboardGridLayout';
|
|
34
34
|
export { DASHBOARD_GRID_COLS, DASHBOARD_GRID_ROWS, DASHBOARD_GRID_GAP_PX, MIN_PANEL_W, MIN_PANEL_H, clampRectForKind, dragLayout, newPanel, arrangeAutoLayout } from './components/dashboardGridLayout';
|
|
35
35
|
export type { Worksheet } from './lib/savedLayout';
|
|
36
36
|
export { DEFAULT_XY_POINT_RADIUS, DEFAULT_XYZ_POINT_RADIUS } from './lib/savedLayout';
|
|
@@ -47,6 +47,12 @@ export declare function guessBeaconChannel(rows: DatasetRow[], cols: string[]):
|
|
|
47
47
|
* time channel (the lap time) when there is one, else by its own span.
|
|
48
48
|
*/
|
|
49
49
|
export declare function suggestBeacon(rows: DatasetRow[], cols: string[], preferred?: BeaconConfig | null): BeaconConfig | null;
|
|
50
|
+
/**
|
|
51
|
+
* Counters by name: sequence counters, timestamps' fields (`header.stamp.nanosec`, a
|
|
52
|
+
* leaf named `sec`) and raw words or bytes (`RAW_W`, `… w3`, `raw/b12`). They wrap,
|
|
53
|
+
* so they look like cycles, but splitting on them means nothing.
|
|
54
|
+
*/
|
|
55
|
+
export declare function counterName(col: string): boolean;
|
|
50
56
|
/** `stat` of the numeric values of `col` in rows[start, end); null if none. */
|
|
51
57
|
export declare function lapMetric(rows: DatasetRow[], lap: LapRange, col: string, stat: BeaconStat): number | null;
|
|
52
58
|
/**
|
|
@@ -26,6 +26,12 @@ export declare function xyPointAt(cols: XYColumns, i: number): XYPoint;
|
|
|
26
26
|
export declare function rowsColumn(rows: DatasetRow[], name: string, full?: ReadonlyMap<string, Float64Array>): Float64Array | undefined;
|
|
27
27
|
/** The finite values of a column, in order: the column itself when it has none missing. */
|
|
28
28
|
export declare function finiteValues(rows: DatasetRow[], name: string, full?: ReadonlyMap<string, Float64Array>): Float64Array | undefined;
|
|
29
|
+
/** The finite values of a column and the time of each (from `timeCol`); undefined without that time column, or when
|
|
30
|
+
* a time is missing where a value is not. */
|
|
31
|
+
export declare function finiteWithTimes(rows: DatasetRow[], name: string, timeCol: string, full?: ReadonlyMap<string, Float64Array>): {
|
|
32
|
+
signal: Float64Array;
|
|
33
|
+
times: Float64Array;
|
|
34
|
+
} | undefined;
|
|
29
35
|
/**
|
|
30
36
|
* The finite values of `valueCol` split by the value of `groupCol`, groups in
|
|
31
37
|
* order of first appearance (label 'unknown' for a missing group); without a
|
|
@@ -65,7 +71,8 @@ export declare function buildXyColumns(src: XySource, xCol: string, yCol: string
|
|
|
65
71
|
max: number;
|
|
66
72
|
};
|
|
67
73
|
} | null;
|
|
68
|
-
/** Several datasets on one scatter, each point carrying its dataset index and colour.
|
|
74
|
+
/** Several datasets on one scatter, each point carrying its dataset index and colour. Only the datasets on the
|
|
75
|
+
* worksheet's X (`xKey`), as on its multiband charts: another file plotted beside them is not on this worksheet. */
|
|
69
76
|
export declare function buildMultiDatasetXyColumns(sources: XySource[], xCol: string, yCol: string, opts: {
|
|
70
77
|
xKey: string;
|
|
71
78
|
viewXRange: [number, number] | null;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { type Segments } from './packets';
|
|
2
|
+
/**
|
|
3
|
+
* CCSDS TM Transfer Frames (132.0-B-3) after their attached sync marker (131.0-B-4, 9.3: 0x1ACFFC1D), optionally
|
|
4
|
+
* pseudo-randomized (131.0-B-4, 10: h(x) = x^8 + x^7 + x^5 + x^3 + 1, all ones at each frame's start; first bytes
|
|
5
|
+
* FF 48 0E C0 9A). Primary header: version (2 bits, 0), spacecraft id (10), VC id (3), OCF flag (1), master channel
|
|
6
|
+
* frame count (8), VC frame count (8), data field status (secondary header flag, sync flag, packet order flag, segment
|
|
7
|
+
* length id (2), first header pointer (11; 0x7FF no packet starts here, 0x7FE idle data)); an optional secondary header
|
|
8
|
+
* (its first byte: version (2), length − 1 (6)); the data field; the OCF (4 bytes); the FECF (2, CRC-16-CCITT).
|
|
9
|
+
* Reed-Solomon check symbols are not corrected (a CADU of 255·I + 4 bytes is read as a frame of 223·I or 239·I when
|
|
10
|
+
* its FECF or its first header pointers say so).
|
|
11
|
+
*/
|
|
12
|
+
export declare const ASM: Uint8Array<ArrayBuffer>;
|
|
13
|
+
export declare const MIN_FRAME = 7;
|
|
14
|
+
export declare const MAX_FRAME = 65536;
|
|
15
|
+
export declare const PN: Uint8Array<ArrayBuffer>;
|
|
16
|
+
/** CRC-16-CCITT (polynomial 0x1021, initial 0xFFFF, no final XOR) over b[o, o + n); 0 over a frame with its FECF. */
|
|
17
|
+
export declare function crc16(b: Uint8Array, o: number, n: number): number;
|
|
18
|
+
export declare const asmAt: (b: Uint8Array, o: number) => boolean;
|
|
19
|
+
/** The next ASM at or after `from`, or -1. */
|
|
20
|
+
export declare function nextAsm(b: Uint8Array, from: number): number;
|
|
21
|
+
export interface Shape {
|
|
22
|
+
/** First ASM in the file. */
|
|
23
|
+
start: number;
|
|
24
|
+
cadu: number;
|
|
25
|
+
frame: number;
|
|
26
|
+
randomized: boolean;
|
|
27
|
+
fecf: boolean;
|
|
28
|
+
/** The transfer frame version the headers carry (0: TM; 1: AOS; 12 (4 bits): USLP). */
|
|
29
|
+
version: number;
|
|
30
|
+
scid: number;
|
|
31
|
+
}
|
|
32
|
+
/** An ASM at b[o] with at most 2 bits wrong. */
|
|
33
|
+
export declare function asmNear(b: Uint8Array, o: number): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* A CADU stream: ASMs at one spacing (the smallest at which 90 % of the head's CADUs, three at least, carry one, a
|
|
36
|
+
* few bits wrong allowed); its frames plain or randomized, whichever gives TM headers of one spacecraft with frame
|
|
37
|
+
* counts stepping by one (or else AOS or USLP headers throughout, named to be refused); the frame length (spacing − 4,
|
|
38
|
+
* or 223·I or 239·I inside a Reed-Solomon CADU of 255·I + 4 bytes) the one whose FECF checks, else (Reed-Solomon
|
|
39
|
+
* sizes) the one whose first header pointers agree with the packets of the frame before, 223·I if none tells.
|
|
40
|
+
*/
|
|
41
|
+
export declare function frameShape(head: Uint8Array): Shape | null;
|
|
42
|
+
export interface FrameStats {
|
|
43
|
+
frames: number;
|
|
44
|
+
vcs: Set<number>;
|
|
45
|
+
badFecf: number;
|
|
46
|
+
/** Frame-count gaps per VC: [gaps, frames missing]. */
|
|
47
|
+
gaps: Map<number, [number, number]>;
|
|
48
|
+
idleFrames: number;
|
|
49
|
+
/** Partial packets dropped (a gap, a frame skipped, a first header pointer that disagrees). */
|
|
50
|
+
partial: number;
|
|
51
|
+
/** Frames whose header or data field status cannot be right (another spacecraft or version, a pointer past the data). */
|
|
52
|
+
damaged: number;
|
|
53
|
+
/** Frames carrying VCA data (sync flag) rather than packets. */
|
|
54
|
+
notPackets: number;
|
|
55
|
+
/** Bytes between CADUs where no ASM was (sync lost). */
|
|
56
|
+
outOfSync: number;
|
|
57
|
+
/** Frames skipped for a damaged ASM (a few bits wrong where one should be). */
|
|
58
|
+
badSync: number;
|
|
59
|
+
}
|
|
60
|
+
export declare const newFrameStats: () => FrameStats;
|
|
61
|
+
/** Packets out of the frames of one spacecraft, reassembled per virtual channel. */
|
|
62
|
+
export declare class Frames {
|
|
63
|
+
#private;
|
|
64
|
+
constructor(shape: Shape, seg: Segments, stats: FrameStats);
|
|
65
|
+
/** One frame f[0, frame) (derandomized). */
|
|
66
|
+
frame(f: Uint8Array): void;
|
|
67
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CCSDS Space Packets (CCSDS 133.0-B-2, 4.1): a 6-byte primary header, big-endian — version (3 bits, 0), type (1),
|
|
3
|
+
* secondary header flag (1), APID (11), sequence flags (2: 01 first, 00 continuation, 10 last, 11 unsegmented),
|
|
4
|
+
* sequence count (14), packet data length − 1 (16) — then the data field. APID 0x7FF: idle packets.
|
|
5
|
+
*/
|
|
6
|
+
export declare const HEADER = 6;
|
|
7
|
+
/** 6 header bytes and at most 65,536 data bytes. */
|
|
8
|
+
export declare const MAX_PACKET = 65542;
|
|
9
|
+
export declare const IDLE_APID = 2047;
|
|
10
|
+
export declare const versionOk: (b: Uint8Array, o: number) => boolean;
|
|
11
|
+
export declare const apidOf: (b: Uint8Array, o: number) => number;
|
|
12
|
+
export declare const flagsOf: (b: Uint8Array, o: number) => number;
|
|
13
|
+
export declare const countOf: (b: Uint8Array, o: number) => number;
|
|
14
|
+
/** The whole packet's length in bytes. */
|
|
15
|
+
export declare const lengthOf: (b: Uint8Array, o: number) => number;
|
|
16
|
+
/** A complete packet b[o, o + n): its header from the first segment, its data field all segments' data fields. */
|
|
17
|
+
export type PacketSink = (b: Uint8Array, o: number, n: number) => void;
|
|
18
|
+
export interface PacketStats {
|
|
19
|
+
idle: number;
|
|
20
|
+
/** Segments that arrived out of order (a continuation with no first segment, a first one while one is open). */
|
|
21
|
+
segments: number;
|
|
22
|
+
/** Bytes of a packet file that hold no packet (skipped to resynchronise). */
|
|
23
|
+
skipped: number;
|
|
24
|
+
/** The file ends inside a packet or frame. */
|
|
25
|
+
cut: boolean;
|
|
26
|
+
}
|
|
27
|
+
export declare const newPacketStats: () => PacketStats;
|
|
28
|
+
/**
|
|
29
|
+
* Idle packets dropped, segmented packets reassembled per APID (bounded by 65,542 bytes each, so by the bytes read),
|
|
30
|
+
* every other packet handed on as it is.
|
|
31
|
+
*/
|
|
32
|
+
export declare class Segments {
|
|
33
|
+
#private;
|
|
34
|
+
constructor(sink: PacketSink, stats: PacketStats);
|
|
35
|
+
push(b: Uint8Array, o: number, n: number): void;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Packets of a packet file's bytes b[0, end): consecutive headers chained by their lengths. A byte that cannot start
|
|
39
|
+
* a packet (version not 0) is skipped (counted); after a skip a header is trusted only when the next one chains too.
|
|
40
|
+
* Returns where it stopped: a packet that does not end inside b waits for more bytes (`last`: the file ends there).
|
|
41
|
+
*/
|
|
42
|
+
export declare function splitPackets(b: Uint8Array, seg: Segments, stats: PacketStats, last: boolean, resync: {
|
|
43
|
+
on: boolean;
|
|
44
|
+
}): number;
|
|
45
|
+
/**
|
|
46
|
+
* At least `min` headers chained from b[0] through `b`'s first 4 KB (or its first `min` packets; version 0, each length leading to the next); and some APID's sequence count stepping by one, so zeros or a table of small
|
|
47
|
+
* records do not pass.
|
|
48
|
+
*/
|
|
49
|
+
export declare function packetChain(b: Uint8Array, min?: number): boolean;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* XTCE (OMG XML Telemetric and Command Exchange 1.2, also 1.1) as a packet dictionary — the subset read here:
|
|
3
|
+
* the SpaceSystem tree (references by path, relative or absolute, else by name); SequenceContainers with base
|
|
4
|
+
* containers and RestrictionCriteria (Comparison, ComparisonList, BooleanExpression of Conditions ANDed and ORed;
|
|
5
|
+
* a packet's container found depth-first, backing out of dead ends); ParameterRefEntry and ContainerRefEntry, at
|
|
6
|
+
* LocationInContainerInBits from the previous entry or the container start, with simple IncludeConditions;
|
|
7
|
+
* IntegerDataEncoding (unsigned, twosComplement (also spelt twosCompliment), signMagnitude, onesComplement; byte order), FloatDataEncoding (IEEE
|
|
8
|
+
* 754, 32 and 64 bits); Integer, Float, Boolean, Enumerated (numeric values) and AbsoluteTime / RelativeTime parameter
|
|
9
|
+
* types; units; Polynomial and Spline calibrators. Positions count from the packet's first bit (the root container
|
|
10
|
+
* describes the primary header); inherited entries share their container start, a ContainerRefEntry starts its own.
|
|
11
|
+
* Anything else is named in a note: a parameter it cannot decode but whose size is fixed is stepped over; one of no
|
|
12
|
+
* fixed size (or an entry it does not read) ends what the container's following entries can locate: those up to the
|
|
13
|
+
* next containerStart location are not channels (named in a note).
|
|
14
|
+
*/
|
|
15
|
+
export declare class XtceError extends Error {
|
|
16
|
+
}
|
|
17
|
+
type Read = (b: Uint8Array, bit: number) => number;
|
|
18
|
+
export interface Param {
|
|
19
|
+
name: string;
|
|
20
|
+
unit: string;
|
|
21
|
+
/** Bits it takes; -1 when it has no fixed size. */
|
|
22
|
+
bits: number;
|
|
23
|
+
/** null: not decoded (stepped over when its size is fixed). */
|
|
24
|
+
read: Read | null;
|
|
25
|
+
cal: ((x: number) => number) | null;
|
|
26
|
+
kind: 'number' | 'enum' | 'bool' | 'time';
|
|
27
|
+
/** Enum labels; for a boolean its zero and one strings. */
|
|
28
|
+
labels: [string, number][];
|
|
29
|
+
/** An absolute time's seconds → Unix seconds (UTC). */
|
|
30
|
+
time: ((s: number) => number) | null;
|
|
31
|
+
}
|
|
32
|
+
interface Cmp {
|
|
33
|
+
p: number;
|
|
34
|
+
cal: boolean;
|
|
35
|
+
op: string;
|
|
36
|
+
v: number;
|
|
37
|
+
}
|
|
38
|
+
/** A comparison, or comparisons all (and) or any (not and) of which hold. */
|
|
39
|
+
type Cond = Cmp | {
|
|
40
|
+
and: boolean;
|
|
41
|
+
of: Cond[];
|
|
42
|
+
};
|
|
43
|
+
interface Entry {
|
|
44
|
+
p: number;
|
|
45
|
+
c: number;
|
|
46
|
+
abs: number;
|
|
47
|
+
rel: number;
|
|
48
|
+
cond: Cond | null;
|
|
49
|
+
stop: boolean;
|
|
50
|
+
}
|
|
51
|
+
export interface Container {
|
|
52
|
+
name: string;
|
|
53
|
+
abstract: boolean;
|
|
54
|
+
base: number;
|
|
55
|
+
never: boolean;
|
|
56
|
+
restrict: Cond | null;
|
|
57
|
+
entries: Entry[];
|
|
58
|
+
kids: number[];
|
|
59
|
+
}
|
|
60
|
+
export declare class Xtce {
|
|
61
|
+
#private;
|
|
62
|
+
params: Param[];
|
|
63
|
+
containers: Container[];
|
|
64
|
+
roots: number[];
|
|
65
|
+
/** Per container: its channels (parameter indices, the time parameter left out) and its time parameter (-1: none). */
|
|
66
|
+
chans: number[][];
|
|
67
|
+
timeParam: number[];
|
|
68
|
+
notes: string[];
|
|
69
|
+
/** The last packet ran past its end inside its container. */
|
|
70
|
+
short: boolean;
|
|
71
|
+
constructor(xml: string);
|
|
72
|
+
/** The concrete container a packet b[o, o + n) matches (its values decoded), or -1. */
|
|
73
|
+
decode(b: Uint8Array, o: number, n: number): number;
|
|
74
|
+
/** A parameter's value in the packet just decoded (calibrated; enums and booleans as numbers), NaN when absent. */
|
|
75
|
+
value(p: number): number;
|
|
76
|
+
/** The packet's time (Unix seconds) for container `c`; NaN without one. */
|
|
77
|
+
time(c: number): number;
|
|
78
|
+
}
|
|
79
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { FormatInfo } from '../formats';
|
|
2
|
+
/** Packet length bound (IRIG 106-17 11.2.1.1.d): 524,288 bytes; TMATS (data type 0x01) up to 128 MB. */
|
|
3
|
+
export declare const MAX_PACKET = 524288;
|
|
4
|
+
export declare const MAX_TMATS_PACKET: number;
|
|
5
|
+
/**
|
|
6
|
+
* A plausible packet header at `o` (IRIG 106-17 11.2.1.1): sync 0xEB25, the 16-bit sum of its first 11 words in
|
|
7
|
+
* the 12th, a packet length holding its headers and data.
|
|
8
|
+
*/
|
|
9
|
+
export declare function headerAt(b: Uint8Array, o: number): boolean;
|
|
10
|
+
export declare const CH10_FORMAT: FormatInfo;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { BlobReader } from '../blobReader';
|
|
2
|
+
/**
|
|
3
|
+
* Packets of a Chapter 10 file in file order (IRIG 106-17 11.2.1), read through 16 MB windows. A header that
|
|
4
|
+
* fails its checksum is skipped by resynchronising on the next sync with a valid header; a packet whose
|
|
5
|
+
* secondary header or data checksum fails is skipped whole. Both are counted. A valid header whose packet runs
|
|
6
|
+
* past the end of the file ends the walk (the file was cut).
|
|
7
|
+
* Deterministic: plan and stream see the same packets.
|
|
8
|
+
*/
|
|
9
|
+
/** One packet; the object is reused, `b` valid only during the callback. */
|
|
10
|
+
export interface Packet {
|
|
11
|
+
b: Uint8Array;
|
|
12
|
+
dv: DataView;
|
|
13
|
+
/** Packet start in `b`; its body (channel-specific data word first) is at `o + hdr`. */
|
|
14
|
+
o: number;
|
|
15
|
+
at: number;
|
|
16
|
+
ch: number;
|
|
17
|
+
type: number;
|
|
18
|
+
flags: number;
|
|
19
|
+
rtc: number;
|
|
20
|
+
hdr: number;
|
|
21
|
+
dlen: number;
|
|
22
|
+
}
|
|
23
|
+
export interface WalkStats {
|
|
24
|
+
/** Header resynchronisations (damaged headers) and packets failing a checksum. */
|
|
25
|
+
damaged: number;
|
|
26
|
+
/** Bytes at the end that are not a whole packet. */
|
|
27
|
+
cut: boolean;
|
|
28
|
+
}
|
|
29
|
+
export declare function walk(io: BlobReader, on: (p: Packet) => void, stats: WalkStats, signal?: AbortSignal): AsyncGenerator<void>;
|
|
30
|
+
/**
|
|
31
|
+
* An intra-packet time stamp at `at` as a 10 MHz RTC value: the RTC itself, or (packet flags bit 6) the
|
|
32
|
+
* secondary-header time format, mapped through the packet's own secondary header time and RTC.
|
|
33
|
+
*/
|
|
34
|
+
export declare function iptsRtc(p: Packet, at: number): number;
|
|
35
|
+
/**
|
|
36
|
+
* A time packet (data type 0x11, format 1): its clock time as ms since 1970, or null when its payload is not a
|
|
37
|
+
* time (format or source NONE, digits that are not BCD). Day-of-year time has no year: `doy.year` (from TMATS)
|
|
38
|
+
* is used, and the next one from the day the days start again at 1 after 365 or 366 (`doy.day`: the last day).
|
|
39
|
+
*/
|
|
40
|
+
export declare function timeOf(p: Packet, doy: {
|
|
41
|
+
year: number;
|
|
42
|
+
day: number;
|
|
43
|
+
}): {
|
|
44
|
+
ms: number;
|
|
45
|
+
hasYear: boolean;
|
|
46
|
+
} | null;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { type Conversion, type Param, type PcmFormat } from './tmats';
|
|
2
|
+
/**
|
|
3
|
+
* PCM minor frames (IRIG 106-17 11.2.2.2, Chapter 4): where each word is in a frame for each packing mode,
|
|
4
|
+
* frames found by their sync pattern in throughput mode, the minor frame number from the subframe ID counter,
|
|
5
|
+
* a parameter's value from its fragments.
|
|
6
|
+
*
|
|
7
|
+
* Bits are read msb first. Packet data is 16-bit (or 32-bit) little-endian words whose msb is the first bit
|
|
8
|
+
* sent, so the n-th byte of the bit stream is at `base + (n ^ xor)` (xor 1 or 3).
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Bit offset of each word (sync first) in a frame, and the frame's bytes in the packet. Packed frames: the bits
|
|
12
|
+
* from `tail` on (the frame's last bits, short of a whole 16- or 32-bit unit) are `fill` bits further on.
|
|
13
|
+
*/
|
|
14
|
+
export interface Layout {
|
|
15
|
+
offsets: number[];
|
|
16
|
+
frameBytes: number;
|
|
17
|
+
tail: number;
|
|
18
|
+
fill: number;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Packed (and throughput): words back to back. A frame that is not a whole number of 16- or 32-bit units ends
|
|
22
|
+
* in a unit holding its last bits in the low bits, filler in the high bits (IRIG 106-17 Tables 11-8, 11-9).
|
|
23
|
+
*/
|
|
24
|
+
export declare function packedLayout(f: PcmFormat, align: number): Layout;
|
|
25
|
+
/**
|
|
26
|
+
* Unpacked: each word lsb-aligned in 16-bit units (a sync over 16 bits split in two words, over 32 in
|
|
27
|
+
* 16- or 32-bit words); in 32-bit alignment a zero 16-bit word makes the count even.
|
|
28
|
+
*/
|
|
29
|
+
export declare function unpackedLayout(f: PcmFormat, align: number): Layout;
|
|
30
|
+
/** `n` (≤ 64) bits from bit `bit` of the stream, msb first; above 53 bits the lowest are lost. */
|
|
31
|
+
export declare function readBits(b: Uint8Array, base: number, xor: number, bit: number, n: number): number;
|
|
32
|
+
/** Little-endian bit field (analog packing, lsb first). */
|
|
33
|
+
export declare function readLE(b: Uint8Array, base: number, bit: number, n: number): number;
|
|
34
|
+
/** One frame in a buffer: its stream starts at `bit0` of `base` (bytes at `base + (n ^ xor)`); `Layout` tail. */
|
|
35
|
+
export interface Frame {
|
|
36
|
+
b: Uint8Array;
|
|
37
|
+
base: number;
|
|
38
|
+
xor: number;
|
|
39
|
+
bit0: number;
|
|
40
|
+
offsets: number[];
|
|
41
|
+
tail: number;
|
|
42
|
+
fill: number;
|
|
43
|
+
}
|
|
44
|
+
/** Word `w` (`n` bits) of a frame; a word running into a packed frame's tail is read in two parts. */
|
|
45
|
+
export declare function wordBits(fr: Frame, w: number, n: number): number;
|
|
46
|
+
/** A parameter compiled for reading: value of occurrence words → engineering units. */
|
|
47
|
+
export declare function paramReader(f: PcmFormat, p: Param, conv: Conversion | undefined): (fr: Frame, words: number[]) => number;
|
|
48
|
+
/** The minor frame number (1..mfn) from the subframe ID counter; 0 when the count is not one of the frame's. */
|
|
49
|
+
export declare function counterFrame(f: PcmFormat, fr: Frame): number;
|
|
50
|
+
/**
|
|
51
|
+
* Throughput mode: the bit stream of a channel across packets, minor frames found by their sync pattern
|
|
52
|
+
* (fixed pattern, 'X' bits not compared) and followed frame to frame while it repeats; a frame's time is its
|
|
53
|
+
* packet's time plus its bit offset over the bit rate.
|
|
54
|
+
*/
|
|
55
|
+
export declare class Framer {
|
|
56
|
+
#private;
|
|
57
|
+
constructor(f: PcmFormat);
|
|
58
|
+
push(b: Uint8Array, base: number, nbytes: number, xor: number, sec: number, emit: (fr: Frame, sec: number) => void): void;
|
|
59
|
+
}
|