tci-client-node 0.1.2 → 0.3.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/CHANGELOG.md +17 -0
- package/README.md +57 -11
- package/dist/audio/index.cjs +52 -11
- package/dist/audio/index.cjs.map +1 -1
- package/dist/audio/index.d.cts +17 -3
- package/dist/audio/index.d.ts +17 -3
- package/dist/audio/index.js +51 -11
- package/dist/audio/index.js.map +1 -1
- package/dist/dialect/index.cjs +349 -0
- package/dist/dialect/index.cjs.map +1 -0
- package/dist/dialect/index.d.cts +29 -0
- package/dist/dialect/index.d.ts +29 -0
- package/dist/dialect/index.js +310 -0
- package/dist/dialect/index.js.map +1 -0
- package/dist/{index-CK3XdXP3.d.cts → index-lbK6NGY4.d.cts} +1 -1
- package/dist/{index-Dfmrk2MR.d.ts → index-paj1AOJY.d.ts} +1 -1
- package/dist/index.cjs +1057 -217
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +106 -12
- package/dist/index.d.ts +106 -12
- package/dist/index.js +1041 -217
- package/dist/index.js.map +1 -1
- package/dist/protocol/index.cjs.map +1 -1
- package/dist/protocol/index.d.cts +1 -1
- package/dist/protocol/index.d.ts +1 -1
- package/dist/protocol/index.js.map +1 -1
- package/dist/testing/index.cjs +79 -14
- package/dist/testing/index.cjs.map +1 -1
- package/dist/testing/index.d.cts +6 -0
- package/dist/testing/index.d.ts +6 -0
- package/dist/testing/index.js +79 -14
- package/dist/testing/index.js.map +1 -1
- package/dist/transport/index.cjs +175 -0
- package/dist/transport/index.cjs.map +1 -0
- package/dist/transport/index.d.cts +37 -0
- package/dist/transport/index.d.ts +37 -0
- package/dist/transport/index.js +138 -0
- package/dist/transport/index.js.map +1 -0
- package/dist/types-1YXGwrgI.d.cts +65 -0
- package/dist/types-BtPh4Dbd.d.ts +65 -0
- package/package.json +15 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,11 +1,17 @@
|
|
|
1
|
-
import { Q as QueueCommandOptions, T as TciError } from './index-
|
|
2
|
-
export { a as QueuedCommandResult, b as TciCommandMatcher, c as TciCommandQueue, d as TciCommandQueueOptions, e as TciErrorCode, t as toTciError } from './index-
|
|
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';
|
|
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, 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 TciWriteResult, a as TciDialectId, b as TciHandshakeResult, c as TciDialectSelection } from './types-1YXGwrgI.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-1YXGwrgI.cjs';
|
|
11
|
+
import { TciDialectRegistry } from './dialect/index.cjs';
|
|
12
|
+
export { aetherSdrDialect, assertValidTciHandshake, builtInDialects, compareTciVersion, defaultTciDialectRegistry, expertSdr14Dialect, expertSdrLegacyDialect, expertSdrModernDialect, genericObservedDialect, parseProtocolIdentity, parseTciVersion, thetisDialect } from './dialect/index.cjs';
|
|
13
|
+
import { TciTransportFactory } from './transport/index.cjs';
|
|
14
|
+
export { TciTransport, TciTransportEvents, WebSocketTciTransport } from './transport/index.cjs';
|
|
9
15
|
|
|
10
16
|
interface TciClientOptions {
|
|
11
17
|
url: string;
|
|
@@ -13,12 +19,16 @@ interface TciClientOptions {
|
|
|
13
19
|
trx?: number;
|
|
14
20
|
vfo?: number;
|
|
15
21
|
connectTimeoutMs?: number;
|
|
22
|
+
handshakeTimeoutMs?: number;
|
|
16
23
|
commandTimeoutMs?: number;
|
|
17
24
|
writeAckMode?: TciWriteAckMode;
|
|
18
25
|
writeTimeoutMs?: number;
|
|
19
26
|
writeSettleMs?: number;
|
|
20
27
|
frequencyWriteSettleMs?: number;
|
|
28
|
+
dialect?: TciDialectSelection;
|
|
29
|
+
dialectRegistry?: TciDialectRegistry;
|
|
21
30
|
WebSocketImpl?: typeof WebSocket;
|
|
31
|
+
transportFactory?: TciTransportFactory;
|
|
22
32
|
}
|
|
23
33
|
interface TciAudioConfig {
|
|
24
34
|
sampleRate: 8_000 | 12_000 | 24_000 | 48_000 | number;
|
|
@@ -47,11 +57,60 @@ interface TciTxChronoRequest {
|
|
|
47
57
|
channels: number;
|
|
48
58
|
sampleType: TciSampleType;
|
|
49
59
|
sampleCount: number;
|
|
60
|
+
frameCount: number;
|
|
61
|
+
}
|
|
62
|
+
interface TciIqCapabilities {
|
|
63
|
+
supported: boolean;
|
|
64
|
+
currentSampleRate?: number;
|
|
65
|
+
supportedSampleRates: readonly number[];
|
|
66
|
+
}
|
|
67
|
+
interface TciIqFrame {
|
|
68
|
+
frame: TciStreamFrame;
|
|
69
|
+
receiver: number;
|
|
70
|
+
sampleRate: number;
|
|
71
|
+
centerFrequency?: number;
|
|
72
|
+
complexSampleCount: number;
|
|
73
|
+
}
|
|
74
|
+
interface TciIqStreamOptions {
|
|
75
|
+
receiver?: number;
|
|
76
|
+
sampleRate?: number;
|
|
77
|
+
firstFrameTimeoutMs?: number;
|
|
78
|
+
}
|
|
79
|
+
interface IqSampleRateResult extends TciWriteResult<number> {
|
|
80
|
+
}
|
|
81
|
+
interface TciIqStreamEvents {
|
|
82
|
+
frame: (frame: TciIqFrame) => void;
|
|
83
|
+
error: (error: TciError) => void;
|
|
84
|
+
closed: () => void;
|
|
85
|
+
}
|
|
86
|
+
interface TciIqStreamCallbacks {
|
|
87
|
+
setSampleRate: (sampleRate: number) => Promise<IqSampleRateResult>;
|
|
88
|
+
close: () => Promise<void>;
|
|
89
|
+
}
|
|
90
|
+
declare class TciIqStreamSession extends EventEmitter<TciIqStreamEvents> {
|
|
91
|
+
readonly receiver: number;
|
|
92
|
+
private _appliedSampleRate;
|
|
93
|
+
private readonly callbacks;
|
|
94
|
+
private closed;
|
|
95
|
+
private firstFrame?;
|
|
96
|
+
constructor(receiver: number, appliedSampleRate: number, callbacks: TciIqStreamCallbacks);
|
|
97
|
+
get appliedSampleRate(): number;
|
|
98
|
+
setSampleRate(sampleRate: number): Promise<IqSampleRateResult>;
|
|
99
|
+
close(): Promise<void>;
|
|
100
|
+
waitForFirstFrame(timeoutMs: number): Promise<TciIqFrame>;
|
|
101
|
+
_acceptFrame(frame: TciIqFrame): void;
|
|
102
|
+
_fail(error: TciError): void;
|
|
103
|
+
private rejectFirstFrame;
|
|
50
104
|
}
|
|
51
105
|
interface TciClientState {
|
|
52
106
|
connected: boolean;
|
|
53
107
|
ready: boolean;
|
|
54
108
|
protocol?: string;
|
|
109
|
+
protocolName?: string;
|
|
110
|
+
protocolVersion?: string;
|
|
111
|
+
dialectId?: TciDialectId;
|
|
112
|
+
dialectConfidence?: TciHandshakeResult['dialect']['confidence'];
|
|
113
|
+
dialectWarnings: string[];
|
|
55
114
|
device?: string;
|
|
56
115
|
receiveOnly?: boolean;
|
|
57
116
|
trxCount?: number;
|
|
@@ -65,6 +124,7 @@ interface TciClientState {
|
|
|
65
124
|
pttSource: Record<string, string | undefined>;
|
|
66
125
|
tune: Record<string, boolean>;
|
|
67
126
|
drive: Record<string, number>;
|
|
127
|
+
tuneDrive: Record<string, number>;
|
|
68
128
|
split: Record<string, boolean>;
|
|
69
129
|
rxSensors: Record<string, Record<string, number | string | boolean>>;
|
|
70
130
|
txSensors: Record<string, Record<string, number | string | boolean>>;
|
|
@@ -72,11 +132,17 @@ interface TciClientState {
|
|
|
72
132
|
txBufferingMs?: number;
|
|
73
133
|
running: boolean;
|
|
74
134
|
};
|
|
135
|
+
iq: {
|
|
136
|
+
sampleRate?: number;
|
|
137
|
+
activeReceivers: Record<string, boolean>;
|
|
138
|
+
};
|
|
139
|
+
dds: Record<string, number>;
|
|
75
140
|
}
|
|
76
141
|
interface TciClientEvents {
|
|
77
142
|
connected: () => void;
|
|
78
143
|
disconnected: (reason?: unknown) => void;
|
|
79
144
|
ready: (state: TciClientState) => void;
|
|
145
|
+
handshake: (result: TciHandshakeResult) => void;
|
|
80
146
|
state: (state: TciClientState) => void;
|
|
81
147
|
command: (command: TciCommand) => void;
|
|
82
148
|
binary: (frame: TciStreamFrame) => void;
|
|
@@ -84,6 +150,7 @@ interface TciClientEvents {
|
|
|
84
150
|
'tci:rx': (raw: string, commands: TciCommand[]) => void;
|
|
85
151
|
'tci:binary': (frame: TciStreamFrame) => void;
|
|
86
152
|
rxAudioFrame: (frame: TciStreamFrame) => void;
|
|
153
|
+
iqFrame: (frame: TciIqFrame) => void;
|
|
87
154
|
lineoutAudioFrame: (frame: TciStreamFrame) => void;
|
|
88
155
|
txChrono: (request: TciTxChronoRequest) => void;
|
|
89
156
|
error: (error: TciError) => void;
|
|
@@ -92,16 +159,31 @@ interface SendCommandOptions extends QueueCommandOptions {
|
|
|
92
159
|
waitForReply?: boolean;
|
|
93
160
|
}
|
|
94
161
|
declare class TciClient extends EventEmitter<TciClientEvents> {
|
|
95
|
-
readonly options: Required<Pick<TciClientOptions, 'receiver' | 'trx' | 'vfo' | 'connectTimeoutMs' | 'commandTimeoutMs' | 'writeAckMode' | 'writeTimeoutMs' | 'writeSettleMs' | 'frequencyWriteSettleMs'>> & Pick<TciClientOptions, 'url'
|
|
162
|
+
readonly options: Required<Pick<TciClientOptions, 'receiver' | 'trx' | 'vfo' | 'connectTimeoutMs' | 'handshakeTimeoutMs' | 'commandTimeoutMs' | 'writeAckMode' | 'writeTimeoutMs' | 'writeSettleMs' | 'frequencyWriteSettleMs'>> & Pick<TciClientOptions, 'url'> & {
|
|
163
|
+
dialect: TciDialectSelection;
|
|
164
|
+
};
|
|
96
165
|
private readonly WebSocketImpl;
|
|
97
|
-
private
|
|
166
|
+
private readonly transportFactory;
|
|
167
|
+
private transport?;
|
|
98
168
|
private readonly queue;
|
|
99
169
|
private readonly state;
|
|
170
|
+
private readonly stateReducers;
|
|
171
|
+
private readonly dialectRegistry;
|
|
172
|
+
private activeDialect?;
|
|
173
|
+
private handshakeResult?;
|
|
174
|
+
private handshakeError?;
|
|
175
|
+
private initializationCommands;
|
|
176
|
+
private handshakeWaiter?;
|
|
177
|
+
private activeIqSession?;
|
|
100
178
|
constructor(options: TciClientOptions);
|
|
101
|
-
connect(): Promise<
|
|
179
|
+
connect(): Promise<TciHandshakeResult>;
|
|
102
180
|
disconnect(code?: number, reason?: string): Promise<void>;
|
|
103
181
|
isConnected(): boolean;
|
|
104
182
|
getState(): TciClientState;
|
|
183
|
+
getHandshakeResult(): TciHandshakeResult | undefined;
|
|
184
|
+
getIqCapabilities(): TciIqCapabilities;
|
|
185
|
+
setIqSampleRate(sampleRate: number, timeoutMs?: number): Promise<IqSampleRateResult>;
|
|
186
|
+
openIqStream(options?: TciIqStreamOptions): Promise<TciIqStreamSession>;
|
|
105
187
|
sendCommand(name: string, args?: readonly unknown[], options?: SendCommandOptions): Promise<TciCommand | undefined>;
|
|
106
188
|
request(name: string, args?: readonly unknown[], options?: QueueCommandOptions): Promise<TciCommand>;
|
|
107
189
|
sendStateWrite(name: string, args: readonly unknown[], isApplied: (state: TciClientState) => boolean, description?: string, options?: TciWriteOptions): Promise<void>;
|
|
@@ -111,9 +193,13 @@ declare class TciClient extends EventEmitter<TciClientEvents> {
|
|
|
111
193
|
getMode(receiver?: number): Promise<string | undefined>;
|
|
112
194
|
setPtt(enabled: boolean, options?: TciPttOptions): Promise<void>;
|
|
113
195
|
getPtt(trx?: number): Promise<boolean | undefined>;
|
|
114
|
-
setTune(enabled: boolean, trx?: number): Promise<void>;
|
|
196
|
+
setTune(enabled: boolean, trx?: number, options?: TciWriteOptions): Promise<void>;
|
|
115
197
|
setDrive(value: number, trx?: number): Promise<void>;
|
|
116
|
-
|
|
198
|
+
setDriveWithResult(value: number, trx?: number, options?: TciWriteOptions): Promise<TciWriteResult<number>>;
|
|
199
|
+
getDrive(trx?: number): Promise<number | undefined>;
|
|
200
|
+
setTuneDrive(value: number, trx?: number, options?: TciWriteOptions): Promise<TciWriteResult<number>>;
|
|
201
|
+
getTuneDrive(trx?: number): Promise<number | undefined>;
|
|
202
|
+
setSplit(enabled: boolean, trx?: number, options?: TciWriteOptions): Promise<void>;
|
|
117
203
|
configureAudio(config: TciAudioConfig): Promise<void>;
|
|
118
204
|
startAudio(receiver?: number): Promise<void>;
|
|
119
205
|
stopAudio(receiver?: number): Promise<void>;
|
|
@@ -125,18 +211,26 @@ declare class TciClient extends EventEmitter<TciClientEvents> {
|
|
|
125
211
|
sendCwMessage(message: string): Promise<void>;
|
|
126
212
|
stopCw(): Promise<void>;
|
|
127
213
|
private waitForState;
|
|
128
|
-
private
|
|
129
|
-
private
|
|
214
|
+
private waitForCommand;
|
|
215
|
+
private resetHandshake;
|
|
216
|
+
private waitForHandshake;
|
|
217
|
+
private finalizeHandshake;
|
|
218
|
+
private rejectHandshake;
|
|
219
|
+
private requireDialect;
|
|
220
|
+
private attachTransport;
|
|
130
221
|
private sendRaw;
|
|
131
222
|
private sendRawBinary;
|
|
132
|
-
private
|
|
223
|
+
private handleText;
|
|
133
224
|
private handleBinary;
|
|
134
225
|
private applyCommand;
|
|
226
|
+
private createStateReducers;
|
|
135
227
|
private applyVfo;
|
|
136
228
|
private applyModulation;
|
|
137
229
|
private applyTrx;
|
|
138
230
|
private applyBooleanByFirstArg;
|
|
139
231
|
private applyDrive;
|
|
232
|
+
private applyTuneDrive;
|
|
233
|
+
private updateAudioState;
|
|
140
234
|
private applyRxChannelSensors;
|
|
141
235
|
private applyRxSensors;
|
|
142
236
|
private applyTxSensors;
|
|
@@ -146,4 +240,4 @@ declare class TciClient extends EventEmitter<TciClientEvents> {
|
|
|
146
240
|
}
|
|
147
241
|
declare function createTciClient(options: TciClientOptions): TciClient;
|
|
148
242
|
|
|
149
|
-
export { BuildTxAudioFrameOptions, QueueCommandOptions, type SendCommandOptions, type TciAudioConfig, TciClient, type TciClientEvents, type TciClientOptions, type TciClientState, TciCommand, TciError, type TciPttOptions, TciSampleType, TciSampleTypeName, TciStreamFrame, type TciTxChronoRequest, type TciWriteAckMode, type TciWriteOptions, createTciClient };
|
|
243
|
+
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, type TciPttOptions, TciSampleType, TciSampleTypeName, TciStreamFrame, TciTransportFactory, type TciTxChronoRequest, type TciWriteAckMode, type TciWriteOptions, TciWriteResult, createTciClient };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,17 @@
|
|
|
1
|
-
import { Q as QueueCommandOptions, T as TciError } from './index-
|
|
2
|
-
export { a as QueuedCommandResult, b as TciCommandMatcher, c as TciCommandQueue, d as TciCommandQueueOptions, e as TciErrorCode, t as toTciError } from './index-
|
|
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';
|
|
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, 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 TciWriteResult, a as TciDialectId, b as TciHandshakeResult, c as TciDialectSelection } from './types-BtPh4Dbd.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-BtPh4Dbd.js';
|
|
11
|
+
import { TciDialectRegistry } from './dialect/index.js';
|
|
12
|
+
export { aetherSdrDialect, assertValidTciHandshake, builtInDialects, compareTciVersion, defaultTciDialectRegistry, expertSdr14Dialect, expertSdrLegacyDialect, expertSdrModernDialect, genericObservedDialect, parseProtocolIdentity, parseTciVersion, thetisDialect } from './dialect/index.js';
|
|
13
|
+
import { TciTransportFactory } from './transport/index.js';
|
|
14
|
+
export { TciTransport, TciTransportEvents, WebSocketTciTransport } from './transport/index.js';
|
|
9
15
|
|
|
10
16
|
interface TciClientOptions {
|
|
11
17
|
url: string;
|
|
@@ -13,12 +19,16 @@ interface TciClientOptions {
|
|
|
13
19
|
trx?: number;
|
|
14
20
|
vfo?: number;
|
|
15
21
|
connectTimeoutMs?: number;
|
|
22
|
+
handshakeTimeoutMs?: number;
|
|
16
23
|
commandTimeoutMs?: number;
|
|
17
24
|
writeAckMode?: TciWriteAckMode;
|
|
18
25
|
writeTimeoutMs?: number;
|
|
19
26
|
writeSettleMs?: number;
|
|
20
27
|
frequencyWriteSettleMs?: number;
|
|
28
|
+
dialect?: TciDialectSelection;
|
|
29
|
+
dialectRegistry?: TciDialectRegistry;
|
|
21
30
|
WebSocketImpl?: typeof WebSocket;
|
|
31
|
+
transportFactory?: TciTransportFactory;
|
|
22
32
|
}
|
|
23
33
|
interface TciAudioConfig {
|
|
24
34
|
sampleRate: 8_000 | 12_000 | 24_000 | 48_000 | number;
|
|
@@ -47,11 +57,60 @@ interface TciTxChronoRequest {
|
|
|
47
57
|
channels: number;
|
|
48
58
|
sampleType: TciSampleType;
|
|
49
59
|
sampleCount: number;
|
|
60
|
+
frameCount: number;
|
|
61
|
+
}
|
|
62
|
+
interface TciIqCapabilities {
|
|
63
|
+
supported: boolean;
|
|
64
|
+
currentSampleRate?: number;
|
|
65
|
+
supportedSampleRates: readonly number[];
|
|
66
|
+
}
|
|
67
|
+
interface TciIqFrame {
|
|
68
|
+
frame: TciStreamFrame;
|
|
69
|
+
receiver: number;
|
|
70
|
+
sampleRate: number;
|
|
71
|
+
centerFrequency?: number;
|
|
72
|
+
complexSampleCount: number;
|
|
73
|
+
}
|
|
74
|
+
interface TciIqStreamOptions {
|
|
75
|
+
receiver?: number;
|
|
76
|
+
sampleRate?: number;
|
|
77
|
+
firstFrameTimeoutMs?: number;
|
|
78
|
+
}
|
|
79
|
+
interface IqSampleRateResult extends TciWriteResult<number> {
|
|
80
|
+
}
|
|
81
|
+
interface TciIqStreamEvents {
|
|
82
|
+
frame: (frame: TciIqFrame) => void;
|
|
83
|
+
error: (error: TciError) => void;
|
|
84
|
+
closed: () => void;
|
|
85
|
+
}
|
|
86
|
+
interface TciIqStreamCallbacks {
|
|
87
|
+
setSampleRate: (sampleRate: number) => Promise<IqSampleRateResult>;
|
|
88
|
+
close: () => Promise<void>;
|
|
89
|
+
}
|
|
90
|
+
declare class TciIqStreamSession extends EventEmitter<TciIqStreamEvents> {
|
|
91
|
+
readonly receiver: number;
|
|
92
|
+
private _appliedSampleRate;
|
|
93
|
+
private readonly callbacks;
|
|
94
|
+
private closed;
|
|
95
|
+
private firstFrame?;
|
|
96
|
+
constructor(receiver: number, appliedSampleRate: number, callbacks: TciIqStreamCallbacks);
|
|
97
|
+
get appliedSampleRate(): number;
|
|
98
|
+
setSampleRate(sampleRate: number): Promise<IqSampleRateResult>;
|
|
99
|
+
close(): Promise<void>;
|
|
100
|
+
waitForFirstFrame(timeoutMs: number): Promise<TciIqFrame>;
|
|
101
|
+
_acceptFrame(frame: TciIqFrame): void;
|
|
102
|
+
_fail(error: TciError): void;
|
|
103
|
+
private rejectFirstFrame;
|
|
50
104
|
}
|
|
51
105
|
interface TciClientState {
|
|
52
106
|
connected: boolean;
|
|
53
107
|
ready: boolean;
|
|
54
108
|
protocol?: string;
|
|
109
|
+
protocolName?: string;
|
|
110
|
+
protocolVersion?: string;
|
|
111
|
+
dialectId?: TciDialectId;
|
|
112
|
+
dialectConfidence?: TciHandshakeResult['dialect']['confidence'];
|
|
113
|
+
dialectWarnings: string[];
|
|
55
114
|
device?: string;
|
|
56
115
|
receiveOnly?: boolean;
|
|
57
116
|
trxCount?: number;
|
|
@@ -65,6 +124,7 @@ interface TciClientState {
|
|
|
65
124
|
pttSource: Record<string, string | undefined>;
|
|
66
125
|
tune: Record<string, boolean>;
|
|
67
126
|
drive: Record<string, number>;
|
|
127
|
+
tuneDrive: Record<string, number>;
|
|
68
128
|
split: Record<string, boolean>;
|
|
69
129
|
rxSensors: Record<string, Record<string, number | string | boolean>>;
|
|
70
130
|
txSensors: Record<string, Record<string, number | string | boolean>>;
|
|
@@ -72,11 +132,17 @@ interface TciClientState {
|
|
|
72
132
|
txBufferingMs?: number;
|
|
73
133
|
running: boolean;
|
|
74
134
|
};
|
|
135
|
+
iq: {
|
|
136
|
+
sampleRate?: number;
|
|
137
|
+
activeReceivers: Record<string, boolean>;
|
|
138
|
+
};
|
|
139
|
+
dds: Record<string, number>;
|
|
75
140
|
}
|
|
76
141
|
interface TciClientEvents {
|
|
77
142
|
connected: () => void;
|
|
78
143
|
disconnected: (reason?: unknown) => void;
|
|
79
144
|
ready: (state: TciClientState) => void;
|
|
145
|
+
handshake: (result: TciHandshakeResult) => void;
|
|
80
146
|
state: (state: TciClientState) => void;
|
|
81
147
|
command: (command: TciCommand) => void;
|
|
82
148
|
binary: (frame: TciStreamFrame) => void;
|
|
@@ -84,6 +150,7 @@ interface TciClientEvents {
|
|
|
84
150
|
'tci:rx': (raw: string, commands: TciCommand[]) => void;
|
|
85
151
|
'tci:binary': (frame: TciStreamFrame) => void;
|
|
86
152
|
rxAudioFrame: (frame: TciStreamFrame) => void;
|
|
153
|
+
iqFrame: (frame: TciIqFrame) => void;
|
|
87
154
|
lineoutAudioFrame: (frame: TciStreamFrame) => void;
|
|
88
155
|
txChrono: (request: TciTxChronoRequest) => void;
|
|
89
156
|
error: (error: TciError) => void;
|
|
@@ -92,16 +159,31 @@ interface SendCommandOptions extends QueueCommandOptions {
|
|
|
92
159
|
waitForReply?: boolean;
|
|
93
160
|
}
|
|
94
161
|
declare class TciClient extends EventEmitter<TciClientEvents> {
|
|
95
|
-
readonly options: Required<Pick<TciClientOptions, 'receiver' | 'trx' | 'vfo' | 'connectTimeoutMs' | 'commandTimeoutMs' | 'writeAckMode' | 'writeTimeoutMs' | 'writeSettleMs' | 'frequencyWriteSettleMs'>> & Pick<TciClientOptions, 'url'
|
|
162
|
+
readonly options: Required<Pick<TciClientOptions, 'receiver' | 'trx' | 'vfo' | 'connectTimeoutMs' | 'handshakeTimeoutMs' | 'commandTimeoutMs' | 'writeAckMode' | 'writeTimeoutMs' | 'writeSettleMs' | 'frequencyWriteSettleMs'>> & Pick<TciClientOptions, 'url'> & {
|
|
163
|
+
dialect: TciDialectSelection;
|
|
164
|
+
};
|
|
96
165
|
private readonly WebSocketImpl;
|
|
97
|
-
private
|
|
166
|
+
private readonly transportFactory;
|
|
167
|
+
private transport?;
|
|
98
168
|
private readonly queue;
|
|
99
169
|
private readonly state;
|
|
170
|
+
private readonly stateReducers;
|
|
171
|
+
private readonly dialectRegistry;
|
|
172
|
+
private activeDialect?;
|
|
173
|
+
private handshakeResult?;
|
|
174
|
+
private handshakeError?;
|
|
175
|
+
private initializationCommands;
|
|
176
|
+
private handshakeWaiter?;
|
|
177
|
+
private activeIqSession?;
|
|
100
178
|
constructor(options: TciClientOptions);
|
|
101
|
-
connect(): Promise<
|
|
179
|
+
connect(): Promise<TciHandshakeResult>;
|
|
102
180
|
disconnect(code?: number, reason?: string): Promise<void>;
|
|
103
181
|
isConnected(): boolean;
|
|
104
182
|
getState(): TciClientState;
|
|
183
|
+
getHandshakeResult(): TciHandshakeResult | undefined;
|
|
184
|
+
getIqCapabilities(): TciIqCapabilities;
|
|
185
|
+
setIqSampleRate(sampleRate: number, timeoutMs?: number): Promise<IqSampleRateResult>;
|
|
186
|
+
openIqStream(options?: TciIqStreamOptions): Promise<TciIqStreamSession>;
|
|
105
187
|
sendCommand(name: string, args?: readonly unknown[], options?: SendCommandOptions): Promise<TciCommand | undefined>;
|
|
106
188
|
request(name: string, args?: readonly unknown[], options?: QueueCommandOptions): Promise<TciCommand>;
|
|
107
189
|
sendStateWrite(name: string, args: readonly unknown[], isApplied: (state: TciClientState) => boolean, description?: string, options?: TciWriteOptions): Promise<void>;
|
|
@@ -111,9 +193,13 @@ declare class TciClient extends EventEmitter<TciClientEvents> {
|
|
|
111
193
|
getMode(receiver?: number): Promise<string | undefined>;
|
|
112
194
|
setPtt(enabled: boolean, options?: TciPttOptions): Promise<void>;
|
|
113
195
|
getPtt(trx?: number): Promise<boolean | undefined>;
|
|
114
|
-
setTune(enabled: boolean, trx?: number): Promise<void>;
|
|
196
|
+
setTune(enabled: boolean, trx?: number, options?: TciWriteOptions): Promise<void>;
|
|
115
197
|
setDrive(value: number, trx?: number): Promise<void>;
|
|
116
|
-
|
|
198
|
+
setDriveWithResult(value: number, trx?: number, options?: TciWriteOptions): Promise<TciWriteResult<number>>;
|
|
199
|
+
getDrive(trx?: number): Promise<number | undefined>;
|
|
200
|
+
setTuneDrive(value: number, trx?: number, options?: TciWriteOptions): Promise<TciWriteResult<number>>;
|
|
201
|
+
getTuneDrive(trx?: number): Promise<number | undefined>;
|
|
202
|
+
setSplit(enabled: boolean, trx?: number, options?: TciWriteOptions): Promise<void>;
|
|
117
203
|
configureAudio(config: TciAudioConfig): Promise<void>;
|
|
118
204
|
startAudio(receiver?: number): Promise<void>;
|
|
119
205
|
stopAudio(receiver?: number): Promise<void>;
|
|
@@ -125,18 +211,26 @@ declare class TciClient extends EventEmitter<TciClientEvents> {
|
|
|
125
211
|
sendCwMessage(message: string): Promise<void>;
|
|
126
212
|
stopCw(): Promise<void>;
|
|
127
213
|
private waitForState;
|
|
128
|
-
private
|
|
129
|
-
private
|
|
214
|
+
private waitForCommand;
|
|
215
|
+
private resetHandshake;
|
|
216
|
+
private waitForHandshake;
|
|
217
|
+
private finalizeHandshake;
|
|
218
|
+
private rejectHandshake;
|
|
219
|
+
private requireDialect;
|
|
220
|
+
private attachTransport;
|
|
130
221
|
private sendRaw;
|
|
131
222
|
private sendRawBinary;
|
|
132
|
-
private
|
|
223
|
+
private handleText;
|
|
133
224
|
private handleBinary;
|
|
134
225
|
private applyCommand;
|
|
226
|
+
private createStateReducers;
|
|
135
227
|
private applyVfo;
|
|
136
228
|
private applyModulation;
|
|
137
229
|
private applyTrx;
|
|
138
230
|
private applyBooleanByFirstArg;
|
|
139
231
|
private applyDrive;
|
|
232
|
+
private applyTuneDrive;
|
|
233
|
+
private updateAudioState;
|
|
140
234
|
private applyRxChannelSensors;
|
|
141
235
|
private applyRxSensors;
|
|
142
236
|
private applyTxSensors;
|
|
@@ -146,4 +240,4 @@ declare class TciClient extends EventEmitter<TciClientEvents> {
|
|
|
146
240
|
}
|
|
147
241
|
declare function createTciClient(options: TciClientOptions): TciClient;
|
|
148
242
|
|
|
149
|
-
export { BuildTxAudioFrameOptions, QueueCommandOptions, type SendCommandOptions, type TciAudioConfig, TciClient, type TciClientEvents, type TciClientOptions, type TciClientState, TciCommand, TciError, type TciPttOptions, TciSampleType, TciSampleTypeName, TciStreamFrame, type TciTxChronoRequest, type TciWriteAckMode, type TciWriteOptions, createTciClient };
|
|
243
|
+
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, type TciPttOptions, TciSampleType, TciSampleTypeName, TciStreamFrame, TciTransportFactory, type TciTxChronoRequest, type TciWriteAckMode, type TciWriteOptions, TciWriteResult, createTciClient };
|