wsjtx-lib 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +20 -0
- package/README.md +390 -0
- package/dist/src/index.d.ts +180 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +402 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/types.d.ts +251 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/types.js +100 -0
- package/dist/src/types.js.map +1 -0
- package/dist/test/wsjtx.basic.test.d.ts +7 -0
- package/dist/test/wsjtx.basic.test.d.ts.map +1 -0
- package/dist/test/wsjtx.basic.test.js +220 -0
- package/dist/test/wsjtx.basic.test.js.map +1 -0
- package/dist/test/wsjtx.test.d.ts +12 -0
- package/dist/test/wsjtx.test.d.ts.map +1 -0
- package/dist/test/wsjtx.test.js +618 -0
- package/dist/test/wsjtx.test.js.map +1 -0
- package/package.json +88 -0
- package/prebuilds/darwin-arm64/build-info.json +10 -0
- package/prebuilds/darwin-arm64/libfftw3f.3.dylib +0 -0
- package/prebuilds/darwin-arm64/libfftw3f_threads.3.dylib +0 -0
- package/prebuilds/darwin-arm64/libgfortran.5.dylib +0 -0
- package/prebuilds/darwin-arm64/wsjtx_lib_nodejs.node +0 -0
- package/prebuilds/linux-x64/build-info.json +10 -0
- package/prebuilds/linux-x64/libfftw3f.so.3 +0 -0
- package/prebuilds/linux-x64/libfftw3f_threads.so.3 +0 -0
- package/prebuilds/linux-x64/libgcc_s.so.1 +0 -0
- package/prebuilds/linux-x64/libgfortran.so.5 +0 -0
- package/prebuilds/linux-x64/wsjtx_lib_nodejs.node +0 -0
- package/prebuilds/package-info.json +25 -0
- package/prebuilds/win32-x64/build-info.json +14 -0
- package/prebuilds/win32-x64/libfftw3f-3.dll +0 -0
- package/prebuilds/win32-x64/libfftw3f_threads-3.dll +0 -0
- package/prebuilds/win32-x64/libgcc_s_seh-1.dll +0 -0
- package/prebuilds/win32-x64/libgfortran-5.dll +0 -0
- package/prebuilds/win32-x64/libstdc++-6.dll +0 -0
- package/prebuilds/win32-x64/libwinpthread-1.dll +0 -0
- package/prebuilds/win32-x64/wsjtx_lib_nodejs.node +0 -0
|
@@ -0,0 +1,402 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WSJTX Digital Radio Protocol Library for Node.js
|
|
3
|
+
*
|
|
4
|
+
* High-level TypeScript wrapper around the native C++ WSJTX library bindings.
|
|
5
|
+
* Provides async/await support, input validation, and convenient utilities
|
|
6
|
+
* for working with digital amateur radio protocols.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* import { WSJTXLib, WSJTXMode } from 'wsjtx-lib';
|
|
11
|
+
*
|
|
12
|
+
* const lib = new WSJTXLib();
|
|
13
|
+
*
|
|
14
|
+
* // Decode FT8 audio data
|
|
15
|
+
* const audioData = new Float32Array(48000 * 13); // 13 seconds at 48kHz
|
|
16
|
+
* const result = await lib.decode(WSJTXMode.FT8, audioData, 1500);
|
|
17
|
+
*
|
|
18
|
+
* // Get decoded messages
|
|
19
|
+
* const messages = lib.pullMessages();
|
|
20
|
+
* console.log('Decoded messages:', messages);
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
import { WSJTXMode, WSJTXError } from './types.js';
|
|
24
|
+
import { createRequire } from 'node:module';
|
|
25
|
+
import { fileURLToPath } from 'node:url';
|
|
26
|
+
import path from 'node:path';
|
|
27
|
+
import fs from 'node:fs';
|
|
28
|
+
// Create require function for ES modules
|
|
29
|
+
const require = createRequire(import.meta.url);
|
|
30
|
+
// Get the directory of this file
|
|
31
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
32
|
+
const __dirname = path.dirname(__filename);
|
|
33
|
+
// Determine the correct path to the native module
|
|
34
|
+
// Priority order:
|
|
35
|
+
// 1. Prebuilt binaries (for npm published packages)
|
|
36
|
+
// 2. Local build output (for development)
|
|
37
|
+
function findNativeModule() {
|
|
38
|
+
const platform = process.platform;
|
|
39
|
+
const arch = process.arch;
|
|
40
|
+
const possiblePaths = [
|
|
41
|
+
// 1. Prebuilt binaries (npm packages) - highest priority
|
|
42
|
+
path.resolve(__dirname, '..', 'prebuilds', `${platform}-${arch}`, 'wsjtx_lib_nodejs.node'),
|
|
43
|
+
// 2. GitHub Actions legacy format (for backward compatibility)
|
|
44
|
+
path.resolve(__dirname, '..', 'prebuilds', `${platform}-latest-${arch}`, 'wsjtx_lib_nodejs.node'),
|
|
45
|
+
path.resolve(__dirname, '..', 'prebuilds', `ubuntu-latest-${arch}`, 'wsjtx_lib_nodejs.node'), // Linux
|
|
46
|
+
path.resolve(__dirname, '..', 'prebuilds', `macos-latest-${arch}`, 'wsjtx_lib_nodejs.node'), // macOS
|
|
47
|
+
path.resolve(__dirname, '..', 'prebuilds', `windows-latest-${arch}`, 'wsjtx_lib_nodejs.node'), // Windows
|
|
48
|
+
// 3. Local development builds - third priority
|
|
49
|
+
// From dist/src/ - direct build output
|
|
50
|
+
path.resolve(__dirname, '..', '..', 'build', 'wsjtx_lib_nodejs.node'),
|
|
51
|
+
// From dist/src/ - Release subdirectory
|
|
52
|
+
path.resolve(__dirname, '..', '..', 'build', 'Release', 'wsjtx_lib_nodejs.node'),
|
|
53
|
+
// 4. Direct build output (when running from src/)
|
|
54
|
+
path.resolve(__dirname, '..', 'build', 'wsjtx_lib_nodejs.node'),
|
|
55
|
+
// Release subdirectory (MSVC, cmake default, etc.)
|
|
56
|
+
path.resolve(__dirname, '..', 'build', 'Release', 'wsjtx_lib_nodejs.node'),
|
|
57
|
+
];
|
|
58
|
+
for (const modulePath of possiblePaths) {
|
|
59
|
+
if (fs.existsSync(modulePath)) {
|
|
60
|
+
return modulePath;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
// If no module found, throw a helpful error with all attempted paths
|
|
64
|
+
const pathList = possiblePaths.map(p => ` - ${p}`).join('\n');
|
|
65
|
+
throw new Error(`Native module not found for ${platform}-${arch}.\n` +
|
|
66
|
+
`Searched in:\n${pathList}\n\n` +
|
|
67
|
+
'Solutions:\n' +
|
|
68
|
+
'1. If you installed via npm, this may be a missing prebuilt binary\n' +
|
|
69
|
+
'2. For development, run "npm run build" to compile the native module\n' +
|
|
70
|
+
'3. Check if your platform/architecture is supported');
|
|
71
|
+
}
|
|
72
|
+
const nativeModulePath = findNativeModule();
|
|
73
|
+
// Import the native module (will be built by cmake-js)
|
|
74
|
+
// @ts-ignore - Native module types are defined separately
|
|
75
|
+
const { WSJTXLib: NativeWSJTXLib } = require(nativeModulePath);
|
|
76
|
+
/**
|
|
77
|
+
* Main WSJTX library class providing digital radio protocol processing
|
|
78
|
+
*
|
|
79
|
+
* This class wraps the native C++ implementation and provides a convenient
|
|
80
|
+
* TypeScript/JavaScript interface with proper error handling, validation,
|
|
81
|
+
* and async/await support.
|
|
82
|
+
*/
|
|
83
|
+
export class WSJTXLib {
|
|
84
|
+
native;
|
|
85
|
+
config;
|
|
86
|
+
/**
|
|
87
|
+
* Create a new WSJTX library instance
|
|
88
|
+
*
|
|
89
|
+
* @param config Optional configuration options
|
|
90
|
+
* @throws {WSJTXError} If the native library fails to initialize
|
|
91
|
+
*/
|
|
92
|
+
constructor(config = {}) {
|
|
93
|
+
this.config = {
|
|
94
|
+
maxThreads: 4,
|
|
95
|
+
debug: false,
|
|
96
|
+
...config
|
|
97
|
+
};
|
|
98
|
+
try {
|
|
99
|
+
this.native = new NativeWSJTXLib();
|
|
100
|
+
}
|
|
101
|
+
catch (error) {
|
|
102
|
+
throw new WSJTXError(`Failed to initialize WSJTX library: ${error instanceof Error ? error.message : String(error)}`, 'INIT_ERROR');
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Decode digital radio signals from audio data
|
|
107
|
+
*
|
|
108
|
+
* This method processes audio samples and attempts to decode digital
|
|
109
|
+
* messages using the specified protocol mode. The operation is performed
|
|
110
|
+
* asynchronously to avoid blocking the Node.js event loop.
|
|
111
|
+
*
|
|
112
|
+
* @param mode The digital mode to use for decoding
|
|
113
|
+
* @param audioData Audio samples (Float32Array or Int16Array)
|
|
114
|
+
* @param frequency Center frequency in Hz
|
|
115
|
+
* @param threads Number of threads to use (1-16, default: 4)
|
|
116
|
+
* @returns Promise that resolves when decoding is complete
|
|
117
|
+
*
|
|
118
|
+
* @throws {WSJTXError} If parameters are invalid or decoding fails
|
|
119
|
+
*
|
|
120
|
+
* @example
|
|
121
|
+
* ```typescript
|
|
122
|
+
* const audioData = new Float32Array(48000 * 13); // 13 seconds
|
|
123
|
+
* await lib.decode(WSJTXMode.FT8, audioData, 1500);
|
|
124
|
+
* const messages = lib.pullMessages();
|
|
125
|
+
* ```
|
|
126
|
+
*/
|
|
127
|
+
async decode(mode, audioData, frequency, threads = this.config.maxThreads || 4) {
|
|
128
|
+
this.validateMode(mode);
|
|
129
|
+
this.validateFrequency(frequency);
|
|
130
|
+
this.validateThreads(threads);
|
|
131
|
+
this.validateAudioData(audioData);
|
|
132
|
+
if (!this.isDecodingSupported(mode)) {
|
|
133
|
+
throw new WSJTXError(`Decoding not supported for mode: ${WSJTXMode[mode]}`, 'UNSUPPORTED_MODE');
|
|
134
|
+
}
|
|
135
|
+
return new Promise((resolve, reject) => {
|
|
136
|
+
const callback = (error, result) => {
|
|
137
|
+
if (error) {
|
|
138
|
+
reject(new WSJTXError(error.message, 'DECODE_ERROR'));
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
// Convert boolean result to DecodeResult object
|
|
142
|
+
resolve({ success: result });
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
try {
|
|
146
|
+
this.native.decode(mode, audioData, frequency, threads, callback);
|
|
147
|
+
}
|
|
148
|
+
catch (error) {
|
|
149
|
+
reject(new WSJTXError(`Decode operation failed: ${error instanceof Error ? error.message : String(error)}`, 'DECODE_ERROR'));
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Encode a message into audio waveform for transmission
|
|
155
|
+
*
|
|
156
|
+
* Generates the audio waveform that represents the specified message
|
|
157
|
+
* using the given digital mode. The resulting audio can be fed to
|
|
158
|
+
* a radio transmitter or audio interface.
|
|
159
|
+
*
|
|
160
|
+
* @param mode The digital mode to use for encoding
|
|
161
|
+
* @param message The message text to encode (mode-specific format)
|
|
162
|
+
* @param frequency Center frequency in Hz
|
|
163
|
+
* @param threads Number of threads to use (1-16, default: 4)
|
|
164
|
+
* @returns Promise that resolves with encoded audio data and actual message sent
|
|
165
|
+
*
|
|
166
|
+
* @throws {WSJTXError} If parameters are invalid or encoding fails
|
|
167
|
+
*
|
|
168
|
+
* @example
|
|
169
|
+
* ```typescript
|
|
170
|
+
* const result = await lib.encode(WSJTXMode.FT8, 'CQ DX K1ABC FN20', 1500);
|
|
171
|
+
* console.log('Generated audio samples:', result.audioData.length);
|
|
172
|
+
* console.log('Actual message sent:', result.messageSent);
|
|
173
|
+
* ```
|
|
174
|
+
*/
|
|
175
|
+
async encode(mode, message, frequency, threads = this.config.maxThreads || 4) {
|
|
176
|
+
this.validateMode(mode);
|
|
177
|
+
this.validateMessage(message);
|
|
178
|
+
this.validateFrequency(frequency);
|
|
179
|
+
this.validateThreads(threads);
|
|
180
|
+
if (!this.isEncodingSupported(mode)) {
|
|
181
|
+
throw new WSJTXError(`Encoding not supported for mode: ${WSJTXMode[mode]}`, 'UNSUPPORTED_MODE');
|
|
182
|
+
}
|
|
183
|
+
return new Promise((resolve, reject) => {
|
|
184
|
+
const callback = (error, result) => {
|
|
185
|
+
if (error) {
|
|
186
|
+
reject(new WSJTXError(error.message, 'ENCODE_ERROR'));
|
|
187
|
+
}
|
|
188
|
+
else {
|
|
189
|
+
resolve(result);
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
try {
|
|
193
|
+
this.native.encode(mode, message, frequency, threads, callback);
|
|
194
|
+
}
|
|
195
|
+
catch (error) {
|
|
196
|
+
reject(new WSJTXError(`Encode operation failed: ${error instanceof Error ? error.message : String(error)}`, 'ENCODE_ERROR'));
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Decode WSPR signals from IQ data
|
|
202
|
+
*
|
|
203
|
+
* WSPR (Weak Signal Propagation Reporter) is a specialized protocol
|
|
204
|
+
* for studying radio propagation. This method takes IQ (complex)
|
|
205
|
+
* samples and attempts to decode WSPR transmissions.
|
|
206
|
+
*
|
|
207
|
+
* @param iqData Interleaved I,Q samples as Float32Array
|
|
208
|
+
* @param options Decoder options (frequency, callsign, etc.)
|
|
209
|
+
* @returns Promise that resolves with array of decoded WSPR results
|
|
210
|
+
*
|
|
211
|
+
* @throws {WSJTXError} If parameters are invalid or decoding fails
|
|
212
|
+
*
|
|
213
|
+
* @example
|
|
214
|
+
* ```typescript
|
|
215
|
+
* const iqData = new Float32Array(2 * 12000 * 111); // 2 minutes of IQ data
|
|
216
|
+
* const options = {
|
|
217
|
+
* dialFrequency: 14095600, // 20m WSPR frequency
|
|
218
|
+
* callsign: 'K1ABC',
|
|
219
|
+
* locator: 'FN20'
|
|
220
|
+
* };
|
|
221
|
+
* const results = await lib.decodeWSPR(iqData, options);
|
|
222
|
+
* ```
|
|
223
|
+
*/
|
|
224
|
+
async decodeWSPR(iqData, options = {}) {
|
|
225
|
+
this.validateIQData(iqData);
|
|
226
|
+
const defaultOptions = {
|
|
227
|
+
dialFrequency: 14095600, // 20m WSPR frequency
|
|
228
|
+
callsign: '',
|
|
229
|
+
locator: '',
|
|
230
|
+
quickMode: false,
|
|
231
|
+
useHashTable: true,
|
|
232
|
+
passes: 2,
|
|
233
|
+
subtraction: true,
|
|
234
|
+
...options
|
|
235
|
+
};
|
|
236
|
+
return new Promise((resolve, reject) => {
|
|
237
|
+
const callback = (error, results) => {
|
|
238
|
+
if (error) {
|
|
239
|
+
reject(new WSJTXError(error.message, 'WSPR_DECODE_ERROR'));
|
|
240
|
+
}
|
|
241
|
+
else {
|
|
242
|
+
resolve(results);
|
|
243
|
+
}
|
|
244
|
+
};
|
|
245
|
+
try {
|
|
246
|
+
this.native.decodeWSPR(iqData, defaultOptions, callback);
|
|
247
|
+
}
|
|
248
|
+
catch (error) {
|
|
249
|
+
reject(new WSJTXError(`WSPR decode failed: ${error instanceof Error ? error.message : String(error)}`, 'WSPR_DECODE_ERROR'));
|
|
250
|
+
}
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Retrieve decoded messages from the internal queue
|
|
255
|
+
*
|
|
256
|
+
* Messages are added to an internal queue as they are decoded.
|
|
257
|
+
* This method retrieves and removes all pending messages from the queue.
|
|
258
|
+
*
|
|
259
|
+
* @returns Array of decoded messages
|
|
260
|
+
*
|
|
261
|
+
* @example
|
|
262
|
+
* ```typescript
|
|
263
|
+
* const messages = lib.pullMessages();
|
|
264
|
+
* messages.forEach(msg => {
|
|
265
|
+
* console.log(`${msg.text} (SNR: ${msg.snr} dB, ΔT: ${msg.deltaTime}s)`);
|
|
266
|
+
* });
|
|
267
|
+
* ```
|
|
268
|
+
*/
|
|
269
|
+
pullMessages() {
|
|
270
|
+
try {
|
|
271
|
+
return this.native.pullMessages();
|
|
272
|
+
}
|
|
273
|
+
catch (error) {
|
|
274
|
+
throw new WSJTXError(`Failed to pull messages: ${error instanceof Error ? error.message : String(error)}`, 'PULL_ERROR');
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* Check if encoding is supported for a specific mode
|
|
279
|
+
*
|
|
280
|
+
* @param mode The mode to check
|
|
281
|
+
* @returns True if encoding is supported
|
|
282
|
+
*/
|
|
283
|
+
isEncodingSupported(mode) {
|
|
284
|
+
return this.native.isEncodingSupported(mode);
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* Check if decoding is supported for a specific mode
|
|
288
|
+
*
|
|
289
|
+
* @param mode The mode to check
|
|
290
|
+
* @returns True if decoding is supported
|
|
291
|
+
*/
|
|
292
|
+
isDecodingSupported(mode) {
|
|
293
|
+
return this.native.isDecodingSupported(mode);
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* Get the required sample rate for a specific mode
|
|
297
|
+
*
|
|
298
|
+
* @param mode The mode to query
|
|
299
|
+
* @returns Sample rate in Hz
|
|
300
|
+
*/
|
|
301
|
+
getSampleRate(mode) {
|
|
302
|
+
return this.native.getSampleRate(mode);
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Get the transmission duration for a specific mode
|
|
306
|
+
*
|
|
307
|
+
* @param mode The mode to query
|
|
308
|
+
* @returns Duration in seconds
|
|
309
|
+
*/
|
|
310
|
+
getTransmissionDuration(mode) {
|
|
311
|
+
return this.native.getTransmissionDuration(mode);
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* Get capabilities for all supported modes
|
|
315
|
+
*
|
|
316
|
+
* @returns Array of mode capability information
|
|
317
|
+
*/
|
|
318
|
+
getAllModeCapabilities() {
|
|
319
|
+
const modes = Object.values(WSJTXMode).filter(v => typeof v === 'number');
|
|
320
|
+
return modes.map(mode => ({
|
|
321
|
+
mode,
|
|
322
|
+
encodingSupported: this.isEncodingSupported(mode),
|
|
323
|
+
decodingSupported: this.isDecodingSupported(mode),
|
|
324
|
+
sampleRate: this.getSampleRate(mode),
|
|
325
|
+
duration: this.getTransmissionDuration(mode)
|
|
326
|
+
}));
|
|
327
|
+
}
|
|
328
|
+
/**
|
|
329
|
+
* Convert audio format between Float32Array and Int16Array
|
|
330
|
+
*
|
|
331
|
+
* @param audioData Input audio data
|
|
332
|
+
* @param targetFormat Target format ('float32' or 'int16')
|
|
333
|
+
* @returns Converted audio data
|
|
334
|
+
*/
|
|
335
|
+
static convertAudioFormat(audioData, targetFormat) {
|
|
336
|
+
if (targetFormat !== 'float32' && targetFormat !== 'int16') {
|
|
337
|
+
throw new Error(`Invalid target format: ${targetFormat}. Must be 'float32' or 'int16'`);
|
|
338
|
+
}
|
|
339
|
+
if (targetFormat === 'float32') {
|
|
340
|
+
if (audioData instanceof Float32Array) {
|
|
341
|
+
return audioData;
|
|
342
|
+
}
|
|
343
|
+
// Convert Int16Array to Float32Array
|
|
344
|
+
const result = new Float32Array(audioData.length);
|
|
345
|
+
for (let i = 0; i < audioData.length; i++) {
|
|
346
|
+
result[i] = audioData[i] / 32768.0;
|
|
347
|
+
}
|
|
348
|
+
return result;
|
|
349
|
+
}
|
|
350
|
+
else {
|
|
351
|
+
if (audioData instanceof Int16Array) {
|
|
352
|
+
return audioData;
|
|
353
|
+
}
|
|
354
|
+
// Convert Float32Array to Int16Array
|
|
355
|
+
const result = new Int16Array(audioData.length);
|
|
356
|
+
for (let i = 0; i < audioData.length; i++) {
|
|
357
|
+
result[i] = Math.max(-32768, Math.min(32767, Math.round(audioData[i] * 32768)));
|
|
358
|
+
}
|
|
359
|
+
return result;
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
// Validation methods
|
|
363
|
+
validateMode(mode) {
|
|
364
|
+
if (!Object.values(WSJTXMode).includes(mode)) {
|
|
365
|
+
throw new WSJTXError(`Invalid mode: ${mode}`, 'INVALID_MODE');
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
validateFrequency(frequency) {
|
|
369
|
+
if (!Number.isInteger(frequency) || frequency < 0 || frequency > 30000000) {
|
|
370
|
+
throw new WSJTXError(`Invalid frequency: ${frequency}. Must be between 0 and 30,000,000 Hz`, 'INVALID_FREQUENCY');
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
validateThreads(threads) {
|
|
374
|
+
if (!Number.isInteger(threads) || threads < 1 || threads > 16) {
|
|
375
|
+
throw new WSJTXError(`Invalid thread count: ${threads}. Must be between 1 and 16`, 'INVALID_THREADS');
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
validateMessage(message) {
|
|
379
|
+
if (typeof message !== 'string' || message.length === 0 || message.length > 22) {
|
|
380
|
+
throw new WSJTXError(`Invalid message: "${message}". Must be 1-22 characters long`, 'INVALID_MESSAGE');
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
validateAudioData(audioData) {
|
|
384
|
+
if (!(audioData instanceof Float32Array) && !(audioData instanceof Int16Array)) {
|
|
385
|
+
throw new WSJTXError('Invalid audio data: must be Float32Array or Int16Array', 'INVALID_AUDIO_DATA');
|
|
386
|
+
}
|
|
387
|
+
if (audioData.length === 0) {
|
|
388
|
+
throw new WSJTXError('Audio data cannot be empty', 'INVALID_AUDIO_DATA');
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
validateIQData(iqData) {
|
|
392
|
+
if (!(iqData instanceof Float32Array)) {
|
|
393
|
+
throw new WSJTXError('Invalid IQ data: must be Float32Array with interleaved I,Q samples', 'INVALID_IQ_DATA');
|
|
394
|
+
}
|
|
395
|
+
if (iqData.length === 0 || iqData.length % 2 !== 0) {
|
|
396
|
+
throw new WSJTXError('IQ data length must be even (interleaved I,Q samples)', 'INVALID_IQ_DATA');
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
// Re-export types for convenience
|
|
401
|
+
export { WSJTXMode, WSJTXError, };
|
|
402
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EACL,SAAS,EAQT,UAAU,EAOX,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,MAAM,SAAS,CAAC;AAEzB,yCAAyC;AACzC,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAE/C,iCAAiC;AACjC,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC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oB,CACrB,CAAC;QACJ,CAAC;QACD,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC3B,MAAM,IAAI,UAAU,CAAC,4BAA4B,EAAE,oBAAoB,CAAC,CAAC;QAC3E,CAAC;IACH,CAAC;IAEO,cAAc,CAAC,MAAc;QACnC,IAAI,CAAC,CAAC,MAAM,YAAY,YAAY,CAAC,EAAE,CAAC;YACtC,MAAM,IAAI,UAAU,CAClB,oEAAoE,EACpE,iBAAiB,CAClB,CAAC;QACJ,CAAC;QACD,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;YACnD,MAAM,IAAI,UAAU,CAClB,uDAAuD,EACvD,iBAAiB,CAClB,CAAC;QACJ,CAAC;IACH,CAAC;CACF;AAED,kCAAkC;AAClC,OAAO,EACL,SAAS,EACT,UAAU,GACX,CAAC"}
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WSJTX Digital Radio Protocol Library for Node.js
|
|
3
|
+
*
|
|
4
|
+
* This library provides encoding and decoding capabilities for various
|
|
5
|
+
* digital amateur radio protocols including FT8, FT4, WSPR, and others.
|
|
6
|
+
*
|
|
7
|
+
* The library is a Node.js C++ extension that wraps the wsjtx_lib C library,
|
|
8
|
+
* providing high-performance digital signal processing capabilities with
|
|
9
|
+
* multi-platform support (Windows, macOS, Linux).
|
|
10
|
+
*
|
|
11
|
+
* @version 1.0.0
|
|
12
|
+
* @author WSJTX Development Team
|
|
13
|
+
* @license GPL-3.0
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Supported WSJTX digital radio modes
|
|
17
|
+
*
|
|
18
|
+
* Each mode has different characteristics in terms of symbol rate,
|
|
19
|
+
* bandwidth, transmission duration, and sensitivity.
|
|
20
|
+
*/
|
|
21
|
+
export declare enum WSJTXMode {
|
|
22
|
+
/**
|
|
23
|
+
* FT8 - 8-FSK modulation, 15-second transmissions
|
|
24
|
+
* - Sample rate: 48 kHz
|
|
25
|
+
* - Duration: 12.64 seconds
|
|
26
|
+
* - Bandwidth: ~50 Hz
|
|
27
|
+
* - Sensitivity: -24 dB
|
|
28
|
+
*/
|
|
29
|
+
FT8 = 0,
|
|
30
|
+
/**
|
|
31
|
+
* FT4 - 4-FSK modulation, 6-second transmissions
|
|
32
|
+
* - Sample rate: 48 kHz
|
|
33
|
+
* - Duration: 6.0 seconds
|
|
34
|
+
* - Bandwidth: ~80 Hz
|
|
35
|
+
* - Sensitivity: -17 dB
|
|
36
|
+
*/
|
|
37
|
+
FT4 = 1,
|
|
38
|
+
/**
|
|
39
|
+
* JT4 - Weak signal mode for microwave EME
|
|
40
|
+
* - Sample rate: 11.025 kHz
|
|
41
|
+
* - Duration: 47.1 seconds
|
|
42
|
+
* - Multiple bandwidth options
|
|
43
|
+
*/
|
|
44
|
+
JT4 = 2,
|
|
45
|
+
/**
|
|
46
|
+
* JT65 - Popular EME and HF weak signal mode
|
|
47
|
+
* - Sample rate: 11.025 kHz
|
|
48
|
+
* - Duration: 46.8 seconds
|
|
49
|
+
* - Bandwidth: ~180 Hz
|
|
50
|
+
*/
|
|
51
|
+
JT65 = 3,
|
|
52
|
+
/**
|
|
53
|
+
* JT9 - Low data rate, narrow bandwidth mode
|
|
54
|
+
* - Sample rate: 12 kHz
|
|
55
|
+
* - Duration: 49.0 seconds
|
|
56
|
+
* - Bandwidth: ~16 Hz
|
|
57
|
+
*/
|
|
58
|
+
JT9 = 4,
|
|
59
|
+
/**
|
|
60
|
+
* FST4 - Flexible format for 15-900 second transmissions
|
|
61
|
+
* - Sample rate: 12 kHz
|
|
62
|
+
* - Variable duration (15s, 30s, 60s, 120s, 300s, 900s)
|
|
63
|
+
* - Ultra-weak signal capability
|
|
64
|
+
*/
|
|
65
|
+
FST4 = 5,
|
|
66
|
+
/**
|
|
67
|
+
* Q65 - Optimized for EME on VHF and higher
|
|
68
|
+
* - Sample rate: 12 kHz
|
|
69
|
+
* - Duration: 60 seconds
|
|
70
|
+
* - Multiple bandwidth options
|
|
71
|
+
*/
|
|
72
|
+
Q65 = 6,
|
|
73
|
+
/**
|
|
74
|
+
* FST4W - Weak signal beacons
|
|
75
|
+
* - Sample rate: 12 kHz
|
|
76
|
+
* - Duration: 120 seconds
|
|
77
|
+
* - Optimized for propagation studies
|
|
78
|
+
*/
|
|
79
|
+
FST4W = 7,
|
|
80
|
+
/**
|
|
81
|
+
* WSPR - Weak Signal Propagation Reporter
|
|
82
|
+
* - Sample rate: 12 kHz
|
|
83
|
+
* - Duration: 110.6 seconds
|
|
84
|
+
* - 4-FSK modulation, very weak signal capability
|
|
85
|
+
*/
|
|
86
|
+
WSPR = 8
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Audio data formats supported by the library
|
|
90
|
+
* Can be either 32-bit floating point or 16-bit signed integer samples
|
|
91
|
+
*/
|
|
92
|
+
export type AudioData = Float32Array | Int16Array;
|
|
93
|
+
/**
|
|
94
|
+
* IQ (In-phase/Quadrature) data for WSPR decoding
|
|
95
|
+
* Interleaved I,Q samples as 32-bit floating point values
|
|
96
|
+
*/
|
|
97
|
+
export type IQData = Float32Array;
|
|
98
|
+
/**
|
|
99
|
+
* Time information for decoded messages
|
|
100
|
+
*/
|
|
101
|
+
export interface WSJTXTime {
|
|
102
|
+
/** Hour (0-23) */
|
|
103
|
+
hour: number;
|
|
104
|
+
/** Minute (0-59) */
|
|
105
|
+
minute: number;
|
|
106
|
+
/** Second (0-59) */
|
|
107
|
+
second: number;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* A decoded WSJTX message containing timing and signal information
|
|
111
|
+
*/
|
|
112
|
+
export interface WSJTXMessage {
|
|
113
|
+
/** The decoded message text */
|
|
114
|
+
text: string;
|
|
115
|
+
/** Signal-to-noise ratio in dB */
|
|
116
|
+
snr: number;
|
|
117
|
+
/** Time offset from start of transmission period in seconds */
|
|
118
|
+
deltaTime: number;
|
|
119
|
+
/** Frequency offset from dial frequency in Hz */
|
|
120
|
+
deltaFrequency: number;
|
|
121
|
+
/** Unix timestamp when the message was decoded */
|
|
122
|
+
timestamp: number;
|
|
123
|
+
/** Sync quality metric (mode-dependent) */
|
|
124
|
+
sync: number;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Result from a decode operation
|
|
128
|
+
*/
|
|
129
|
+
export interface DecodeResult {
|
|
130
|
+
/** Whether the decode operation completed successfully */
|
|
131
|
+
success: boolean;
|
|
132
|
+
/** Optional error message if decode failed */
|
|
133
|
+
error?: string;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Result from an encode operation
|
|
137
|
+
*/
|
|
138
|
+
export interface EncodeResult {
|
|
139
|
+
/** Generated audio waveform data */
|
|
140
|
+
audioData: Float32Array;
|
|
141
|
+
/** The actual message that was encoded (may differ from input) */
|
|
142
|
+
messageSent: string;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Single WSPR decode result
|
|
146
|
+
*/
|
|
147
|
+
export interface WSPRResult {
|
|
148
|
+
/** Frequency of the decoded signal in Hz */
|
|
149
|
+
frequency: number;
|
|
150
|
+
/** Sync quality metric */
|
|
151
|
+
sync: number;
|
|
152
|
+
/** Signal-to-noise ratio in dB */
|
|
153
|
+
snr: number;
|
|
154
|
+
/** Time offset in seconds */
|
|
155
|
+
deltaTime: number;
|
|
156
|
+
/** Frequency drift in Hz/minute */
|
|
157
|
+
drift: number;
|
|
158
|
+
/** Jitter metric */
|
|
159
|
+
jitter: number;
|
|
160
|
+
/** Decoded message text */
|
|
161
|
+
message: string;
|
|
162
|
+
/** Decoded callsign */
|
|
163
|
+
callsign: string;
|
|
164
|
+
/** Decoded grid locator */
|
|
165
|
+
locator: string;
|
|
166
|
+
/** Decoded power in dBm */
|
|
167
|
+
power: string;
|
|
168
|
+
/** Number of decode cycles */
|
|
169
|
+
cycles: number;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Options for WSPR decoding
|
|
173
|
+
*/
|
|
174
|
+
export interface WSPRDecodeOptions {
|
|
175
|
+
/** Dial frequency in Hz (default: 14095600 for 20m WSPR) */
|
|
176
|
+
dialFrequency?: number;
|
|
177
|
+
/** Receiving station callsign for better decoding */
|
|
178
|
+
callsign?: string;
|
|
179
|
+
/** Receiving station grid locator */
|
|
180
|
+
locator?: string;
|
|
181
|
+
/** Enable quick decode mode (faster but less sensitive) */
|
|
182
|
+
quickMode?: boolean;
|
|
183
|
+
/** Use hash table for callsign/locator lookup */
|
|
184
|
+
useHashTable?: boolean;
|
|
185
|
+
/** Number of decoding passes (1-3, default: 2) */
|
|
186
|
+
passes?: number;
|
|
187
|
+
/** Enable signal subtraction for better weak signal decoding */
|
|
188
|
+
subtraction?: boolean;
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Error thrown by WSJTX library operations
|
|
192
|
+
*/
|
|
193
|
+
export declare class WSJTXError extends Error {
|
|
194
|
+
code?: string | undefined;
|
|
195
|
+
constructor(message: string, code?: string | undefined);
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Configuration options for the WSJTX library
|
|
199
|
+
*/
|
|
200
|
+
export interface WSJTXConfig {
|
|
201
|
+
/** Maximum number of threads to use for processing (1-16) */
|
|
202
|
+
maxThreads?: number;
|
|
203
|
+
/** Enable debug logging */
|
|
204
|
+
debug?: boolean;
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Library version information
|
|
208
|
+
*/
|
|
209
|
+
export interface VersionInfo {
|
|
210
|
+
/** WSJTXLib wrapper version */
|
|
211
|
+
wrapperVersion: string;
|
|
212
|
+
/** Underlying wsjtx_lib version */
|
|
213
|
+
libraryVersion: string;
|
|
214
|
+
/** Node.js version used to build */
|
|
215
|
+
nodeVersion: string;
|
|
216
|
+
/** Build timestamp */
|
|
217
|
+
buildDate: string;
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Mode capabilities information
|
|
221
|
+
*/
|
|
222
|
+
export interface ModeCapabilities {
|
|
223
|
+
/** Mode identifier */
|
|
224
|
+
mode: WSJTXMode;
|
|
225
|
+
/** Whether encoding is supported */
|
|
226
|
+
encodingSupported: boolean;
|
|
227
|
+
/** Whether decoding is supported */
|
|
228
|
+
decodingSupported: boolean;
|
|
229
|
+
/** Required sample rate in Hz */
|
|
230
|
+
sampleRate: number;
|
|
231
|
+
/** Transmission duration in seconds */
|
|
232
|
+
duration: number;
|
|
233
|
+
/** Typical bandwidth in Hz */
|
|
234
|
+
bandwidth?: number;
|
|
235
|
+
/** Typical sensitivity in dB */
|
|
236
|
+
sensitivity?: number;
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Callback function for decode operations
|
|
240
|
+
* The native module returns a boolean indicating completion status
|
|
241
|
+
*/
|
|
242
|
+
export type DecodeCallback = (error: Error | null, result: boolean) => void;
|
|
243
|
+
/**
|
|
244
|
+
* Callback function type for asynchronous encode operations
|
|
245
|
+
*/
|
|
246
|
+
export type EncodeCallback = (error: Error | null, result: EncodeResult) => void;
|
|
247
|
+
/**
|
|
248
|
+
* Callback function type for asynchronous WSPR decode operations
|
|
249
|
+
*/
|
|
250
|
+
export type WSPRDecodeCallback = (error: Error | null, results: WSPRResult[]) => void;
|
|
251
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH;;;;;GAKG;AACH,oBAAY,SAAS;IACjB;;;;;;OAMG;IACH,GAAG,IAAI;IAEP;;;;;;OAMG;IACH,GAAG,IAAI;IAEP;;;;;OAKG;IACH,GAAG,IAAI;IAEP;;;;;OAKG;IACH,IAAI,IAAI;IAER;;;;;OAKG;IACH,GAAG,IAAI;IAEP;;;;;OAKG;IACH,IAAI,IAAI;IAER;;;;;OAKG;IACH,GAAG,IAAI;IAEP;;;;;OA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