tci-client-node 0.2.0 → 0.4.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.
Files changed (43) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +50 -6
  3. package/dist/audio/index.cjs +11 -0
  4. package/dist/audio/index.cjs.map +1 -1
  5. package/dist/audio/index.d.cts +4 -2
  6. package/dist/audio/index.d.ts +4 -2
  7. package/dist/audio/index.js +10 -0
  8. package/dist/audio/index.js.map +1 -1
  9. package/dist/dialect/index.cjs +193 -12
  10. package/dist/dialect/index.cjs.map +1 -1
  11. package/dist/dialect/index.d.cts +3 -2
  12. package/dist/dialect/index.d.ts +3 -2
  13. package/dist/dialect/index.js +193 -12
  14. package/dist/dialect/index.js.map +1 -1
  15. package/dist/errors-CT3b8LLw.d.cts +9 -0
  16. package/dist/errors-CT3b8LLw.d.ts +9 -0
  17. package/dist/index.cjs +606 -6
  18. package/dist/index.cjs.map +1 -1
  19. package/dist/index.d.cts +68 -6
  20. package/dist/index.d.ts +68 -6
  21. package/dist/index.js +599 -6
  22. package/dist/index.js.map +1 -1
  23. package/dist/meter/index.cjs +348 -0
  24. package/dist/meter/index.cjs.map +1 -0
  25. package/dist/meter/index.d.cts +78 -0
  26. package/dist/meter/index.d.ts +78 -0
  27. package/dist/meter/index.js +317 -0
  28. package/dist/meter/index.js.map +1 -0
  29. package/dist/protocol/index.d.cts +36 -2
  30. package/dist/protocol/index.d.ts +36 -2
  31. package/dist/testing/index.cjs +58 -0
  32. package/dist/testing/index.cjs.map +1 -1
  33. package/dist/testing/index.d.cts +23 -1
  34. package/dist/testing/index.d.ts +23 -1
  35. package/dist/testing/index.js +58 -0
  36. package/dist/testing/index.js.map +1 -1
  37. package/dist/types-C0qVJVSO.d.ts +74 -0
  38. package/dist/types-C4MtLKoy.d.cts +74 -0
  39. package/dist/{types-xRotf9gW.d.cts → types-CYK_NOTz.d.cts} +5 -1
  40. package/dist/{types-9seY9Th-.d.ts → types-DVIPU-VR.d.ts} +5 -1
  41. package/package.json +11 -2
  42. package/dist/index-lbK6NGY4.d.cts +0 -42
  43. package/dist/index-paj1AOJY.d.ts +0 -42
package/dist/index.d.cts CHANGED
@@ -1,17 +1,23 @@
1
- import { Q as QueueCommandOptions, T as TciError } from './index-lbK6NGY4.cjs';
2
- export { a as QueuedCommandResult, b as TciCommandMatcher, c as TciCommandQueue, d as TciCommandQueueOptions, e as TciErrorCode, t as toTciError } from './index-lbK6NGY4.cjs';
1
+ import { T as TciError } from './errors-CT3b8LLw.cjs';
2
+ export { a as TciErrorCode, t as toTciError } from './errors-CT3b8LLw.cjs';
3
3
  import { EventEmitter } from 'eventemitter3';
4
4
  import WebSocket from 'ws';
5
5
  import { TciSampleType, TciSampleTypeName, TciStreamFrame, BuildTxAudioFrameOptions } from './audio/index.cjs';
6
- export { BuildStreamFrameOptions, ParseStreamFrameOptions, TCI_STREAM_HEADER_BYTES, TciStreamType, buildStreamFrame, buildTxAudioFrame, deinterleaveChannels, float32ToPcm16, mixToMono, normalizeSampleType, normalizeStreamType, parseStreamFrame, payloadToFloat32, pcm16ToFloat32, sampleTypeBytes, sampleTypeName, samplesToPayload } from './audio/index.cjs';
6
+ export { BuildStreamFrameOptions, ParseStreamFrameOptions, TCI_STREAM_HEADER_BYTES, TciStreamType, buildStreamFrame, buildTxAudioFrame, decodeInterleavedIq, deinterleaveChannels, float32ToPcm16, mixToMono, normalizeSampleType, normalizeStreamType, parseStreamFrame, payloadToFloat32, pcm16ToFloat32, sampleTypeBytes, sampleTypeName, samplesToPayload } from './audio/index.cjs';
7
7
  import { T as TciCommand } from './text-BwCWY1k1.cjs';
8
8
  export { a as TciCommandInput, c as commandKey, e as escapeTciText, f as formatTciCommand, i as isCommandReplyTo, n as normalizeCommandName, p as parseTciCommand, b as parseTciText, u as unescapeTciText } from './text-BwCWY1k1.cjs';
9
- import { T as TciDialectId, a as TciHandshakeResult, b as TciDialectSelection, c as TciWriteResult } from './types-xRotf9gW.cjs';
10
- export { B as BuiltInTciDialectId, d as TciDialect, e as TciDialectDetection, f as TciDialectDetectionContext, g as TciDialectScore, h as TciDriveState, i as TciProtocolIdentity, j as TciStreamLengthSemantics } from './types-xRotf9gW.cjs';
9
+ import { QueueCommandOptions } from './protocol/index.cjs';
10
+ export { QueuedCommandResult, TciCommandMatcher, TciCommandQueue, TciCommandQueueOptions } from './protocol/index.cjs';
11
+ import { T as TciWriteResult, a as TciDialectId, b as TciHandshakeResult, c as TciDialectSelection } from './types-CYK_NOTz.cjs';
12
+ export { B as BuiltInTciDialectId, d as TciDialect, e as TciDialectDetection, f as TciDialectDetectionContext, g as TciDialectScore, h as TciDriveState, i as TciProtocolIdentity, j as TciStreamLengthSemantics } from './types-CYK_NOTz.cjs';
11
13
  import { TciDialectRegistry } from './dialect/index.cjs';
12
14
  export { aetherSdrDialect, assertValidTciHandshake, builtInDialects, compareTciVersion, defaultTciDialectRegistry, expertSdr14Dialect, expertSdrLegacyDialect, expertSdrModernDialect, genericObservedDialect, parseProtocolIdentity, parseTciVersion, thetisDialect } from './dialect/index.cjs';
13
15
  import { TciTransportFactory } from './transport/index.cjs';
14
16
  export { TciTransport, TciTransportEvents, WebSocketTciTransport } from './transport/index.cjs';
17
+ import { T as TciMeterCapabilities, a as TciMeterStreamOptions } from './types-C4MtLKoy.cjs';
18
+ export { b as TciMeterAdapter, c as TciMeterCommand, d as TciMeterDecodeResult, e as TciMeterDecodedFrame, f as TciMeterInterval, g as TciMeterSupport, h as TciRxMeterFrame, i as TciRxMeterSource, j as TciTxMeterFrame, U as UNKNOWN_TCI_METER_CAPABILITIES, k as cloneMeterCapabilities } from './types-C4MtLKoy.cjs';
19
+ import { TciMeterStreamSession } from './meter/index.cjs';
20
+ export { StandardTciMeterAdapter, TciMeterStreamEvents, createUnknownTciMeterAdapter } from './meter/index.cjs';
15
21
 
16
22
  interface TciClientOptions {
17
23
  url: string;
@@ -59,6 +65,49 @@ interface TciTxChronoRequest {
59
65
  sampleCount: number;
60
66
  frameCount: number;
61
67
  }
68
+ interface TciIqCapabilities {
69
+ supported: boolean;
70
+ currentSampleRate?: number;
71
+ supportedSampleRates: readonly number[];
72
+ }
73
+ interface TciIqFrame {
74
+ frame: TciStreamFrame;
75
+ receiver: number;
76
+ sampleRate: number;
77
+ centerFrequency?: number;
78
+ complexSampleCount: number;
79
+ }
80
+ interface TciIqStreamOptions {
81
+ receiver?: number;
82
+ sampleRate?: number;
83
+ firstFrameTimeoutMs?: number;
84
+ }
85
+ interface IqSampleRateResult extends TciWriteResult<number> {
86
+ }
87
+ interface TciIqStreamEvents {
88
+ frame: (frame: TciIqFrame) => void;
89
+ error: (error: TciError) => void;
90
+ closed: () => void;
91
+ }
92
+ interface TciIqStreamCallbacks {
93
+ setSampleRate: (sampleRate: number) => Promise<IqSampleRateResult>;
94
+ close: () => Promise<void>;
95
+ }
96
+ declare class TciIqStreamSession extends EventEmitter<TciIqStreamEvents> {
97
+ readonly receiver: number;
98
+ private _appliedSampleRate;
99
+ private readonly callbacks;
100
+ private closed;
101
+ private firstFrame?;
102
+ constructor(receiver: number, appliedSampleRate: number, callbacks: TciIqStreamCallbacks);
103
+ get appliedSampleRate(): number;
104
+ setSampleRate(sampleRate: number): Promise<IqSampleRateResult>;
105
+ close(): Promise<void>;
106
+ waitForFirstFrame(timeoutMs: number): Promise<TciIqFrame>;
107
+ _acceptFrame(frame: TciIqFrame): void;
108
+ _fail(error: TciError): void;
109
+ private rejectFirstFrame;
110
+ }
62
111
  interface TciClientState {
63
112
  connected: boolean;
64
113
  ready: boolean;
@@ -89,6 +138,11 @@ interface TciClientState {
89
138
  txBufferingMs?: number;
90
139
  running: boolean;
91
140
  };
141
+ iq: {
142
+ sampleRate?: number;
143
+ activeReceivers: Record<string, boolean>;
144
+ };
145
+ dds: Record<string, number>;
92
146
  }
93
147
  interface TciClientEvents {
94
148
  connected: () => void;
@@ -102,6 +156,7 @@ interface TciClientEvents {
102
156
  'tci:rx': (raw: string, commands: TciCommand[]) => void;
103
157
  'tci:binary': (frame: TciStreamFrame) => void;
104
158
  rxAudioFrame: (frame: TciStreamFrame) => void;
159
+ iqFrame: (frame: TciIqFrame) => void;
105
160
  lineoutAudioFrame: (frame: TciStreamFrame) => void;
106
161
  txChrono: (request: TciTxChronoRequest) => void;
107
162
  error: (error: TciError) => void;
@@ -125,12 +180,19 @@ declare class TciClient extends EventEmitter<TciClientEvents> {
125
180
  private handshakeError?;
126
181
  private initializationCommands;
127
182
  private handshakeWaiter?;
183
+ private activeIqSession?;
184
+ private activeMeterSession?;
128
185
  constructor(options: TciClientOptions);
129
186
  connect(): Promise<TciHandshakeResult>;
130
187
  disconnect(code?: number, reason?: string): Promise<void>;
131
188
  isConnected(): boolean;
132
189
  getState(): TciClientState;
133
190
  getHandshakeResult(): TciHandshakeResult | undefined;
191
+ getIqCapabilities(): TciIqCapabilities;
192
+ getMeterCapabilities(): TciMeterCapabilities;
193
+ openMeterStream(options?: TciMeterStreamOptions): Promise<TciMeterStreamSession>;
194
+ setIqSampleRate(sampleRate: number, timeoutMs?: number): Promise<IqSampleRateResult>;
195
+ openIqStream(options?: TciIqStreamOptions): Promise<TciIqStreamSession>;
134
196
  sendCommand(name: string, args?: readonly unknown[], options?: SendCommandOptions): Promise<TciCommand | undefined>;
135
197
  request(name: string, args?: readonly unknown[], options?: QueueCommandOptions): Promise<TciCommand>;
136
198
  sendStateWrite(name: string, args: readonly unknown[], isApplied: (state: TciClientState) => boolean, description?: string, options?: TciWriteOptions): Promise<void>;
@@ -187,4 +249,4 @@ declare class TciClient extends EventEmitter<TciClientEvents> {
187
249
  }
188
250
  declare function createTciClient(options: TciClientOptions): TciClient;
189
251
 
190
- export { BuildTxAudioFrameOptions, QueueCommandOptions, type SendCommandOptions, type TciAudioConfig, TciClient, type TciClientEvents, type TciClientOptions, type TciClientState, TciCommand, TciDialectId, TciDialectRegistry, TciDialectSelection, TciError, TciHandshakeResult, type TciPttOptions, TciSampleType, TciSampleTypeName, TciStreamFrame, TciTransportFactory, type TciTxChronoRequest, type TciWriteAckMode, type TciWriteOptions, TciWriteResult, createTciClient };
252
+ export { BuildTxAudioFrameOptions, type IqSampleRateResult, QueueCommandOptions, type SendCommandOptions, type TciAudioConfig, TciClient, type TciClientEvents, type TciClientOptions, type TciClientState, TciCommand, TciDialectId, TciDialectRegistry, TciDialectSelection, TciError, TciHandshakeResult, type TciIqCapabilities, type TciIqFrame, type TciIqStreamEvents, type TciIqStreamOptions, TciIqStreamSession, TciMeterCapabilities, TciMeterStreamOptions, TciMeterStreamSession, type TciPttOptions, TciSampleType, TciSampleTypeName, TciStreamFrame, TciTransportFactory, type TciTxChronoRequest, type TciWriteAckMode, type TciWriteOptions, TciWriteResult, createTciClient };
package/dist/index.d.ts CHANGED
@@ -1,17 +1,23 @@
1
- import { Q as QueueCommandOptions, T as TciError } from './index-paj1AOJY.js';
2
- export { a as QueuedCommandResult, b as TciCommandMatcher, c as TciCommandQueue, d as TciCommandQueueOptions, e as TciErrorCode, t as toTciError } from './index-paj1AOJY.js';
1
+ import { T as TciError } from './errors-CT3b8LLw.js';
2
+ export { a as TciErrorCode, t as toTciError } from './errors-CT3b8LLw.js';
3
3
  import { EventEmitter } from 'eventemitter3';
4
4
  import WebSocket from 'ws';
5
5
  import { TciSampleType, TciSampleTypeName, TciStreamFrame, BuildTxAudioFrameOptions } from './audio/index.js';
6
- export { BuildStreamFrameOptions, ParseStreamFrameOptions, TCI_STREAM_HEADER_BYTES, TciStreamType, buildStreamFrame, buildTxAudioFrame, deinterleaveChannels, float32ToPcm16, mixToMono, normalizeSampleType, normalizeStreamType, parseStreamFrame, payloadToFloat32, pcm16ToFloat32, sampleTypeBytes, sampleTypeName, samplesToPayload } from './audio/index.js';
6
+ export { BuildStreamFrameOptions, ParseStreamFrameOptions, TCI_STREAM_HEADER_BYTES, TciStreamType, buildStreamFrame, buildTxAudioFrame, decodeInterleavedIq, deinterleaveChannels, float32ToPcm16, mixToMono, normalizeSampleType, normalizeStreamType, parseStreamFrame, payloadToFloat32, pcm16ToFloat32, sampleTypeBytes, sampleTypeName, samplesToPayload } from './audio/index.js';
7
7
  import { T as TciCommand } from './text-BwCWY1k1.js';
8
8
  export { a as TciCommandInput, c as commandKey, e as escapeTciText, f as formatTciCommand, i as isCommandReplyTo, n as normalizeCommandName, p as parseTciCommand, b as parseTciText, u as unescapeTciText } from './text-BwCWY1k1.js';
9
- import { T as TciDialectId, a as TciHandshakeResult, b as TciDialectSelection, c as TciWriteResult } from './types-9seY9Th-.js';
10
- export { B as BuiltInTciDialectId, d as TciDialect, e as TciDialectDetection, f as TciDialectDetectionContext, g as TciDialectScore, h as TciDriveState, i as TciProtocolIdentity, j as TciStreamLengthSemantics } from './types-9seY9Th-.js';
9
+ import { QueueCommandOptions } from './protocol/index.js';
10
+ export { QueuedCommandResult, TciCommandMatcher, TciCommandQueue, TciCommandQueueOptions } from './protocol/index.js';
11
+ import { T as TciWriteResult, a as TciDialectId, b as TciHandshakeResult, c as TciDialectSelection } from './types-DVIPU-VR.js';
12
+ export { B as BuiltInTciDialectId, d as TciDialect, e as TciDialectDetection, f as TciDialectDetectionContext, g as TciDialectScore, h as TciDriveState, i as TciProtocolIdentity, j as TciStreamLengthSemantics } from './types-DVIPU-VR.js';
11
13
  import { TciDialectRegistry } from './dialect/index.js';
12
14
  export { aetherSdrDialect, assertValidTciHandshake, builtInDialects, compareTciVersion, defaultTciDialectRegistry, expertSdr14Dialect, expertSdrLegacyDialect, expertSdrModernDialect, genericObservedDialect, parseProtocolIdentity, parseTciVersion, thetisDialect } from './dialect/index.js';
13
15
  import { TciTransportFactory } from './transport/index.js';
14
16
  export { TciTransport, TciTransportEvents, WebSocketTciTransport } from './transport/index.js';
17
+ import { T as TciMeterCapabilities, a as TciMeterStreamOptions } from './types-C0qVJVSO.js';
18
+ export { b as TciMeterAdapter, c as TciMeterCommand, d as TciMeterDecodeResult, e as TciMeterDecodedFrame, f as TciMeterInterval, g as TciMeterSupport, h as TciRxMeterFrame, i as TciRxMeterSource, j as TciTxMeterFrame, U as UNKNOWN_TCI_METER_CAPABILITIES, k as cloneMeterCapabilities } from './types-C0qVJVSO.js';
19
+ import { TciMeterStreamSession } from './meter/index.js';
20
+ export { StandardTciMeterAdapter, TciMeterStreamEvents, createUnknownTciMeterAdapter } from './meter/index.js';
15
21
 
16
22
  interface TciClientOptions {
17
23
  url: string;
@@ -59,6 +65,49 @@ interface TciTxChronoRequest {
59
65
  sampleCount: number;
60
66
  frameCount: number;
61
67
  }
68
+ interface TciIqCapabilities {
69
+ supported: boolean;
70
+ currentSampleRate?: number;
71
+ supportedSampleRates: readonly number[];
72
+ }
73
+ interface TciIqFrame {
74
+ frame: TciStreamFrame;
75
+ receiver: number;
76
+ sampleRate: number;
77
+ centerFrequency?: number;
78
+ complexSampleCount: number;
79
+ }
80
+ interface TciIqStreamOptions {
81
+ receiver?: number;
82
+ sampleRate?: number;
83
+ firstFrameTimeoutMs?: number;
84
+ }
85
+ interface IqSampleRateResult extends TciWriteResult<number> {
86
+ }
87
+ interface TciIqStreamEvents {
88
+ frame: (frame: TciIqFrame) => void;
89
+ error: (error: TciError) => void;
90
+ closed: () => void;
91
+ }
92
+ interface TciIqStreamCallbacks {
93
+ setSampleRate: (sampleRate: number) => Promise<IqSampleRateResult>;
94
+ close: () => Promise<void>;
95
+ }
96
+ declare class TciIqStreamSession extends EventEmitter<TciIqStreamEvents> {
97
+ readonly receiver: number;
98
+ private _appliedSampleRate;
99
+ private readonly callbacks;
100
+ private closed;
101
+ private firstFrame?;
102
+ constructor(receiver: number, appliedSampleRate: number, callbacks: TciIqStreamCallbacks);
103
+ get appliedSampleRate(): number;
104
+ setSampleRate(sampleRate: number): Promise<IqSampleRateResult>;
105
+ close(): Promise<void>;
106
+ waitForFirstFrame(timeoutMs: number): Promise<TciIqFrame>;
107
+ _acceptFrame(frame: TciIqFrame): void;
108
+ _fail(error: TciError): void;
109
+ private rejectFirstFrame;
110
+ }
62
111
  interface TciClientState {
63
112
  connected: boolean;
64
113
  ready: boolean;
@@ -89,6 +138,11 @@ interface TciClientState {
89
138
  txBufferingMs?: number;
90
139
  running: boolean;
91
140
  };
141
+ iq: {
142
+ sampleRate?: number;
143
+ activeReceivers: Record<string, boolean>;
144
+ };
145
+ dds: Record<string, number>;
92
146
  }
93
147
  interface TciClientEvents {
94
148
  connected: () => void;
@@ -102,6 +156,7 @@ interface TciClientEvents {
102
156
  'tci:rx': (raw: string, commands: TciCommand[]) => void;
103
157
  'tci:binary': (frame: TciStreamFrame) => void;
104
158
  rxAudioFrame: (frame: TciStreamFrame) => void;
159
+ iqFrame: (frame: TciIqFrame) => void;
105
160
  lineoutAudioFrame: (frame: TciStreamFrame) => void;
106
161
  txChrono: (request: TciTxChronoRequest) => void;
107
162
  error: (error: TciError) => void;
@@ -125,12 +180,19 @@ declare class TciClient extends EventEmitter<TciClientEvents> {
125
180
  private handshakeError?;
126
181
  private initializationCommands;
127
182
  private handshakeWaiter?;
183
+ private activeIqSession?;
184
+ private activeMeterSession?;
128
185
  constructor(options: TciClientOptions);
129
186
  connect(): Promise<TciHandshakeResult>;
130
187
  disconnect(code?: number, reason?: string): Promise<void>;
131
188
  isConnected(): boolean;
132
189
  getState(): TciClientState;
133
190
  getHandshakeResult(): TciHandshakeResult | undefined;
191
+ getIqCapabilities(): TciIqCapabilities;
192
+ getMeterCapabilities(): TciMeterCapabilities;
193
+ openMeterStream(options?: TciMeterStreamOptions): Promise<TciMeterStreamSession>;
194
+ setIqSampleRate(sampleRate: number, timeoutMs?: number): Promise<IqSampleRateResult>;
195
+ openIqStream(options?: TciIqStreamOptions): Promise<TciIqStreamSession>;
134
196
  sendCommand(name: string, args?: readonly unknown[], options?: SendCommandOptions): Promise<TciCommand | undefined>;
135
197
  request(name: string, args?: readonly unknown[], options?: QueueCommandOptions): Promise<TciCommand>;
136
198
  sendStateWrite(name: string, args: readonly unknown[], isApplied: (state: TciClientState) => boolean, description?: string, options?: TciWriteOptions): Promise<void>;
@@ -187,4 +249,4 @@ declare class TciClient extends EventEmitter<TciClientEvents> {
187
249
  }
188
250
  declare function createTciClient(options: TciClientOptions): TciClient;
189
251
 
190
- export { BuildTxAudioFrameOptions, QueueCommandOptions, type SendCommandOptions, type TciAudioConfig, TciClient, type TciClientEvents, type TciClientOptions, type TciClientState, TciCommand, TciDialectId, TciDialectRegistry, TciDialectSelection, TciError, TciHandshakeResult, type TciPttOptions, TciSampleType, TciSampleTypeName, TciStreamFrame, TciTransportFactory, type TciTxChronoRequest, type TciWriteAckMode, type TciWriteOptions, TciWriteResult, createTciClient };
252
+ export { BuildTxAudioFrameOptions, type IqSampleRateResult, QueueCommandOptions, type SendCommandOptions, type TciAudioConfig, TciClient, type TciClientEvents, type TciClientOptions, type TciClientState, TciCommand, TciDialectId, TciDialectRegistry, TciDialectSelection, TciError, TciHandshakeResult, type TciIqCapabilities, type TciIqFrame, type TciIqStreamEvents, type TciIqStreamOptions, TciIqStreamSession, TciMeterCapabilities, TciMeterStreamOptions, TciMeterStreamSession, type TciPttOptions, TciSampleType, TciSampleTypeName, TciStreamFrame, TciTransportFactory, type TciTxChronoRequest, type TciWriteAckMode, type TciWriteOptions, TciWriteResult, createTciClient };