hamlib 0.1.6 → 0.1.8
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/README.md +299 -0
- package/index.d.ts +593 -69
- package/lib/index.js +695 -190
- package/package.json +1 -1
- package/prebuilds/darwin-arm64/hamlib.node +0 -0
- package/prebuilds/linux-arm64/hamlib.node +0 -0
- package/prebuilds/linux-x64/hamlib.node +0 -0
- package/src/hamlib.cpp +4249 -1592
- package/src/hamlib.h +69 -2
- package/src/hamlib_compat.h +44 -0
- package/Readme.md +0 -593
package/Readme.md
DELETED
|
@@ -1,593 +0,0 @@
|
|
|
1
|
-
# node-hamlib
|
|
2
|
-
|
|
3
|
-
A comprehensive Node.js wrapper for [Hamlib](https://hamlib.github.io/) - control amateur radio transceivers from JavaScript/TypeScript.
|
|
4
|
-
|
|
5
|
-
## 🚀 Features
|
|
6
|
-
|
|
7
|
-
- **Async/Await Support**: All operations are asynchronous and non-blocking for optimal performance
|
|
8
|
-
- **Built-in Methods**: Complete radio control API including memory channels, RIT/XIT, scanning, levels, functions, and more
|
|
9
|
-
- **303+ Supported Radios**: Works with Yaesu, Icom, Kenwood, Elecraft, FlexRadio, and many more
|
|
10
|
-
- **Multi-platform**: Pre-built binaries for Windows x64, Linux x64/ARM64, macOS ARM64
|
|
11
|
-
- **Connection Types**: Serial ports, network (rigctld), and direct control
|
|
12
|
-
- **TypeScript Support**: Full type definitions and IntelliSense
|
|
13
|
-
- **Modern JavaScript**: CommonJS and ES Modules support
|
|
14
|
-
|
|
15
|
-
## ⚡ Async Operations
|
|
16
|
-
|
|
17
|
-
**All radio control operations are asynchronous** to prevent blocking the Node.js event loop during I/O operations:
|
|
18
|
-
|
|
19
|
-
```javascript
|
|
20
|
-
// ✅ Correct - Using async/await
|
|
21
|
-
await rig.setFrequency(144390000);
|
|
22
|
-
const frequency = await rig.getFrequency();
|
|
23
|
-
|
|
24
|
-
// ✅ Correct - Using Promises
|
|
25
|
-
rig.setFrequency(144390000)
|
|
26
|
-
.then(() => rig.getFrequency())
|
|
27
|
-
.then(freq => console.log('Frequency:', freq))
|
|
28
|
-
.catch(err => console.error('Error:', err));
|
|
29
|
-
|
|
30
|
-
// ❌ Incorrect - Operations are no longer synchronous
|
|
31
|
-
// rig.setFrequency(144390000); // This won't work as expected
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
## 📦 Quick Start
|
|
35
|
-
|
|
36
|
-
```bash
|
|
37
|
-
npm install node-hamlib
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
```javascript
|
|
41
|
-
const { HamLib } = require('node-hamlib');
|
|
42
|
-
|
|
43
|
-
async function controlRadio() {
|
|
44
|
-
// Find your radio model
|
|
45
|
-
const rigs = HamLib.getSupportedRigs();
|
|
46
|
-
console.log('Supported radios:', rigs.length);
|
|
47
|
-
|
|
48
|
-
// Connect to radio
|
|
49
|
-
const rig = new HamLib(1035, '/dev/ttyUSB0'); // FT-991A
|
|
50
|
-
await rig.open();
|
|
51
|
-
|
|
52
|
-
// Basic control
|
|
53
|
-
await rig.setFrequency(144390000); // 144.39 MHz
|
|
54
|
-
await rig.setMode('FM');
|
|
55
|
-
await rig.setPtt(true);
|
|
56
|
-
|
|
57
|
-
// Get status
|
|
58
|
-
console.log('Frequency:', await rig.getFrequency());
|
|
59
|
-
console.log('Mode:', await rig.getMode());
|
|
60
|
-
console.log('Signal:', await rig.getStrength());
|
|
61
|
-
|
|
62
|
-
await rig.close();
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
controlRadio().catch(console.error);
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
## 📡 Complete API Reference
|
|
69
|
-
|
|
70
|
-
### 🔍 Radio Discovery
|
|
71
|
-
|
|
72
|
-
#### `HamLib.getSupportedRigs()`
|
|
73
|
-
Get all supported radio models
|
|
74
|
-
```javascript
|
|
75
|
-
const rigs = HamLib.getSupportedRigs();
|
|
76
|
-
console.log(`Found ${rigs.length} supported radios`);
|
|
77
|
-
|
|
78
|
-
// Find your radio
|
|
79
|
-
const yaesu = rigs.filter(r => r.mfgName === 'Yaesu');
|
|
80
|
-
const ft991a = rigs.find(r => r.modelName === 'FT-991A');
|
|
81
|
-
console.log('FT-991A Model ID:', ft991a.rigModel);
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
### 🔌 Connection Management
|
|
85
|
-
|
|
86
|
-
#### `new HamLib(model, port)`
|
|
87
|
-
Create radio instance
|
|
88
|
-
```javascript
|
|
89
|
-
// Serial connection
|
|
90
|
-
const rig = new HamLib(1035, '/dev/ttyUSB0'); // Linux
|
|
91
|
-
const rig = new HamLib(1035, '/dev/cu.usbserial-1420'); // macOS
|
|
92
|
-
const rig = new HamLib(1035, 'COM3'); // Windows
|
|
93
|
-
|
|
94
|
-
// Network connection
|
|
95
|
-
const rig = new HamLib(1035, 'localhost:4532'); // rigctld
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
#### `open()` / `close()` / `destroy()`
|
|
99
|
-
Connection control
|
|
100
|
-
```javascript
|
|
101
|
-
await rig.open(); // Open connection
|
|
102
|
-
await rig.close(); // Close (can reopen)
|
|
103
|
-
await rig.destroy(); // Destroy permanently
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
#### `getConnectionInfo()`
|
|
107
|
-
Get connection details
|
|
108
|
-
```javascript
|
|
109
|
-
const info = rig.getConnectionInfo();
|
|
110
|
-
console.log('Connection type:', info.connectionType);
|
|
111
|
-
console.log('Port:', info.port);
|
|
112
|
-
console.log('Status:', info.status);
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
### 📻 Basic Radio Control
|
|
116
|
-
|
|
117
|
-
#### Frequency Control
|
|
118
|
-
```javascript
|
|
119
|
-
// Set frequency (Hz)
|
|
120
|
-
await rig.setFrequency(144390000);
|
|
121
|
-
await rig.setFrequency(144390000, 'VFO-A');
|
|
122
|
-
|
|
123
|
-
// Get frequency
|
|
124
|
-
const freq = await rig.getFrequency();
|
|
125
|
-
const freqA = await rig.getFrequency('VFO-A');
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
#### Mode Control
|
|
129
|
-
```javascript
|
|
130
|
-
// Set mode
|
|
131
|
-
await rig.setMode('FM');
|
|
132
|
-
await rig.setMode('USB', 'wide');
|
|
133
|
-
|
|
134
|
-
// Get mode
|
|
135
|
-
const mode = await rig.getMode();
|
|
136
|
-
console.log('Mode:', mode.mode);
|
|
137
|
-
console.log('Bandwidth:', mode.bandwidth);
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
#### VFO Control
|
|
141
|
-
```javascript
|
|
142
|
-
// Set VFO
|
|
143
|
-
await rig.setVfo('VFO-A');
|
|
144
|
-
await rig.setVfo('VFO-B');
|
|
145
|
-
|
|
146
|
-
// Get current VFO
|
|
147
|
-
const vfo = await rig.getVfo();
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
#### PTT Control
|
|
151
|
-
```javascript
|
|
152
|
-
await rig.setPtt(true); // Transmit
|
|
153
|
-
await rig.setPtt(false); // Receive
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
#### Signal Monitoring
|
|
157
|
-
```javascript
|
|
158
|
-
const strength = await rig.getStrength();
|
|
159
|
-
console.log('Signal strength:', strength);
|
|
160
|
-
```
|
|
161
|
-
|
|
162
|
-
### 💾 Memory Channel Management
|
|
163
|
-
|
|
164
|
-
#### `setMemoryChannel(channel, data)`
|
|
165
|
-
Store memory channel
|
|
166
|
-
```javascript
|
|
167
|
-
rig.setMemoryChannel(1, {
|
|
168
|
-
frequency: 144390000,
|
|
169
|
-
mode: 'FM',
|
|
170
|
-
description: 'Local Repeater'
|
|
171
|
-
});
|
|
172
|
-
```
|
|
173
|
-
|
|
174
|
-
#### `getMemoryChannel(channel, readOnly)`
|
|
175
|
-
Retrieve memory channel
|
|
176
|
-
```javascript
|
|
177
|
-
const channel = rig.getMemoryChannel(1);
|
|
178
|
-
console.log('Channel 1:', channel);
|
|
179
|
-
```
|
|
180
|
-
|
|
181
|
-
#### `selectMemoryChannel(channel)`
|
|
182
|
-
Select memory channel
|
|
183
|
-
```javascript
|
|
184
|
-
rig.selectMemoryChannel(1);
|
|
185
|
-
```
|
|
186
|
-
|
|
187
|
-
### 🎛️ RIT/XIT Control
|
|
188
|
-
|
|
189
|
-
#### RIT (Receiver Incremental Tuning)
|
|
190
|
-
```javascript
|
|
191
|
-
rig.setRit(100); // +100 Hz offset
|
|
192
|
-
const rit = rig.getRit();
|
|
193
|
-
```
|
|
194
|
-
|
|
195
|
-
#### XIT (Transmitter Incremental Tuning)
|
|
196
|
-
```javascript
|
|
197
|
-
rig.setXit(-50); // -50 Hz offset
|
|
198
|
-
const xit = rig.getXit();
|
|
199
|
-
```
|
|
200
|
-
|
|
201
|
-
#### Clear RIT/XIT
|
|
202
|
-
```javascript
|
|
203
|
-
rig.clearRitXit(); // Clear both offsets
|
|
204
|
-
```
|
|
205
|
-
|
|
206
|
-
### 🔍 Scanning Operations
|
|
207
|
-
|
|
208
|
-
#### `startScan(type, channel)`
|
|
209
|
-
Start scanning
|
|
210
|
-
```javascript
|
|
211
|
-
rig.startScan('VFO'); // VFO scan
|
|
212
|
-
rig.startScan('MEM'); // Memory scan
|
|
213
|
-
rig.startScan('PROG'); // Program scan
|
|
214
|
-
```
|
|
215
|
-
|
|
216
|
-
#### `stopScan()`
|
|
217
|
-
Stop scanning
|
|
218
|
-
```javascript
|
|
219
|
-
rig.stopScan();
|
|
220
|
-
```
|
|
221
|
-
|
|
222
|
-
### 🎚️ Level Controls
|
|
223
|
-
|
|
224
|
-
#### `getSupportedLevels()`
|
|
225
|
-
Get available level controls
|
|
226
|
-
```javascript
|
|
227
|
-
const levels = rig.getSupportedLevels();
|
|
228
|
-
console.log('Available levels:', levels);
|
|
229
|
-
// ['AF', 'RF', 'SQL', 'RFPOWER', 'MICGAIN', ...]
|
|
230
|
-
```
|
|
231
|
-
|
|
232
|
-
#### `setLevel(type, value)` / `getLevel(type)`
|
|
233
|
-
Control audio and RF levels
|
|
234
|
-
```javascript
|
|
235
|
-
rig.setLevel('AF', 0.7); // Audio gain 70%
|
|
236
|
-
rig.setLevel('RF', 0.5); // RF gain 50%
|
|
237
|
-
rig.setLevel('SQL', 0.3); // Squelch 30%
|
|
238
|
-
rig.setLevel('RFPOWER', 0.5); // TX power 50%
|
|
239
|
-
rig.setLevel('MICGAIN', 0.8); // Mic gain 80%
|
|
240
|
-
|
|
241
|
-
// Get levels
|
|
242
|
-
const audioGain = rig.getLevel('AF');
|
|
243
|
-
const rfGain = rig.getLevel('RF');
|
|
244
|
-
```
|
|
245
|
-
|
|
246
|
-
### 🔧 Function Controls
|
|
247
|
-
|
|
248
|
-
#### `getSupportedFunctions()`
|
|
249
|
-
Get available function controls
|
|
250
|
-
```javascript
|
|
251
|
-
const functions = rig.getSupportedFunctions();
|
|
252
|
-
console.log('Available functions:', functions);
|
|
253
|
-
// ['NB', 'COMP', 'VOX', 'TONE', 'TSQL', 'TUNER', ...]
|
|
254
|
-
```
|
|
255
|
-
|
|
256
|
-
#### `setFunction(type, enable)` / `getFunction(type)`
|
|
257
|
-
Control radio functions
|
|
258
|
-
```javascript
|
|
259
|
-
rig.setFunction('NB', true); // Enable noise blanker
|
|
260
|
-
rig.setFunction('COMP', true); // Enable compressor
|
|
261
|
-
rig.setFunction('VOX', true); // Enable VOX
|
|
262
|
-
rig.setFunction('TUNER', true); // Enable auto tuner
|
|
263
|
-
|
|
264
|
-
// Get function status
|
|
265
|
-
const nbEnabled = rig.getFunction('NB');
|
|
266
|
-
const compEnabled = rig.getFunction('COMP');
|
|
267
|
-
```
|
|
268
|
-
|
|
269
|
-
### 📡 Split Operations
|
|
270
|
-
|
|
271
|
-
#### Split Frequency
|
|
272
|
-
```javascript
|
|
273
|
-
rig.setSplitFreq(144340000); // TX frequency
|
|
274
|
-
const txFreq = rig.getSplitFreq();
|
|
275
|
-
```
|
|
276
|
-
|
|
277
|
-
#### Split Mode
|
|
278
|
-
```javascript
|
|
279
|
-
rig.setSplitMode('FM', 'wide'); // TX mode
|
|
280
|
-
const txMode = rig.getSplitMode();
|
|
281
|
-
```
|
|
282
|
-
|
|
283
|
-
#### Split Control
|
|
284
|
-
```javascript
|
|
285
|
-
rig.setSplit(true, 'VFO-B'); // Enable split
|
|
286
|
-
const splitStatus = rig.getSplit();
|
|
287
|
-
```
|
|
288
|
-
|
|
289
|
-
### 📻 VFO Operations
|
|
290
|
-
|
|
291
|
-
#### `vfoOperation(operation)`
|
|
292
|
-
VFO operations
|
|
293
|
-
```javascript
|
|
294
|
-
rig.vfoOperation('CPY'); // Copy VFO A to B
|
|
295
|
-
rig.vfoOperation('XCHG'); // Exchange VFO A and B
|
|
296
|
-
rig.vfoOperation('UP'); // Frequency up
|
|
297
|
-
rig.vfoOperation('DOWN'); // Frequency down
|
|
298
|
-
rig.vfoOperation('TOGGLE'); // Toggle VFO A/B
|
|
299
|
-
```
|
|
300
|
-
|
|
301
|
-
### 📶 Antenna Selection
|
|
302
|
-
|
|
303
|
-
#### `setAntenna(antenna)` / `getAntenna()`
|
|
304
|
-
Antenna control
|
|
305
|
-
```javascript
|
|
306
|
-
rig.setAntenna(1); // Select antenna 1
|
|
307
|
-
rig.setAntenna(2); // Select antenna 2
|
|
308
|
-
const antenna = rig.getAntenna();
|
|
309
|
-
```
|
|
310
|
-
|
|
311
|
-
### ⚙️ Serial Port Configuration
|
|
312
|
-
|
|
313
|
-
#### `getSupportedSerialConfigs()`
|
|
314
|
-
Get available serial configuration options
|
|
315
|
-
```javascript
|
|
316
|
-
const configs = rig.getSupportedSerialConfigs();
|
|
317
|
-
console.log('Data bits:', configs.serial.data_bits); // ['5', '6', '7', '8']
|
|
318
|
-
console.log('Stop bits:', configs.serial.stop_bits); // ['1', '2']
|
|
319
|
-
console.log('Parity:', configs.serial.serial_parity); // ['None', 'Even', 'Odd']
|
|
320
|
-
console.log('Handshake:', configs.serial.serial_handshake); // ['None', 'Hardware', 'Software']
|
|
321
|
-
console.log('PTT types:', configs.ptt_type); // ['RIG', 'DTR', 'RTS', 'PARALLEL', ...]
|
|
322
|
-
console.log('DCD types:', configs.dcd_type); // ['RIG', 'DSR', 'CTS', 'CD', ...]
|
|
323
|
-
```
|
|
324
|
-
|
|
325
|
-
#### `setSerialConfig(param, value)` / `getSerialConfig(param)`
|
|
326
|
-
Configure serial port parameters
|
|
327
|
-
```javascript
|
|
328
|
-
// Basic serial configuration (most common)
|
|
329
|
-
rig.setSerialConfig('data_bits', '8'); // 8 data bits
|
|
330
|
-
rig.setSerialConfig('stop_bits', '1'); // 1 stop bit
|
|
331
|
-
rig.setSerialConfig('serial_parity', 'None'); // No parity
|
|
332
|
-
rig.setSerialConfig('serial_handshake', 'None'); // No flow control
|
|
333
|
-
|
|
334
|
-
// Hardware flow control (if supported)
|
|
335
|
-
rig.setSerialConfig('serial_handshake', 'Hardware');
|
|
336
|
-
|
|
337
|
-
// Control line states
|
|
338
|
-
rig.setSerialConfig('rts_state', 'ON'); // Set RTS high
|
|
339
|
-
rig.setSerialConfig('dtr_state', 'OFF'); // Set DTR low
|
|
340
|
-
|
|
341
|
-
// Get current configuration
|
|
342
|
-
const dataBits = rig.getSerialConfig('data_bits');
|
|
343
|
-
const parity = rig.getSerialConfig('serial_parity');
|
|
344
|
-
```
|
|
345
|
-
|
|
346
|
-
#### `setPttType(type)` / `getPttType()`
|
|
347
|
-
Configure PTT (Push-to-Talk) method
|
|
348
|
-
```javascript
|
|
349
|
-
// Use CAT command for PTT (recommended)
|
|
350
|
-
rig.setPttType('RIG');
|
|
351
|
-
|
|
352
|
-
// Use DTR line for PTT (legacy interfaces)
|
|
353
|
-
rig.setPttType('DTR');
|
|
354
|
-
|
|
355
|
-
// Use RTS line for PTT (alternative)
|
|
356
|
-
rig.setPttType('RTS');
|
|
357
|
-
|
|
358
|
-
// Disable PTT control
|
|
359
|
-
rig.setPttType('NONE');
|
|
360
|
-
|
|
361
|
-
// Get current PTT type
|
|
362
|
-
const pttType = rig.getPttType();
|
|
363
|
-
console.log('PTT method:', pttType);
|
|
364
|
-
```
|
|
365
|
-
|
|
366
|
-
#### `setDcdType(type)` / `getDcdType()`
|
|
367
|
-
Configure DCD (Data Carrier Detect) method
|
|
368
|
-
```javascript
|
|
369
|
-
// Use CAT command for DCD (software squelch)
|
|
370
|
-
rig.setDcdType('RIG');
|
|
371
|
-
|
|
372
|
-
// Use DSR line for DCD (hardware squelch)
|
|
373
|
-
rig.setDcdType('DSR');
|
|
374
|
-
|
|
375
|
-
// Use CTS line for DCD (alternative)
|
|
376
|
-
rig.setDcdType('CTS');
|
|
377
|
-
|
|
378
|
-
// Get current DCD type
|
|
379
|
-
const dcdType = rig.getDcdType();
|
|
380
|
-
console.log('DCD method:', dcdType);
|
|
381
|
-
```
|
|
382
|
-
|
|
383
|
-
#### Common Serial Configurations
|
|
384
|
-
|
|
385
|
-
**Yaesu Radios:**
|
|
386
|
-
```javascript
|
|
387
|
-
rig.setSerialConfig('data_bits', '8');
|
|
388
|
-
rig.setSerialConfig('stop_bits', '1');
|
|
389
|
-
rig.setSerialConfig('serial_parity', 'None');
|
|
390
|
-
rig.setSerialConfig('serial_handshake', 'None');
|
|
391
|
-
rig.setPttType('RIG'); // Use CAT command
|
|
392
|
-
// Baud rate: 4800/9600 (set in constructor)
|
|
393
|
-
```
|
|
394
|
-
|
|
395
|
-
**Kenwood Radios:**
|
|
396
|
-
```javascript
|
|
397
|
-
rig.setSerialConfig('data_bits', '8');
|
|
398
|
-
rig.setSerialConfig('stop_bits', '2'); // Note: 2 stop bits
|
|
399
|
-
rig.setSerialConfig('serial_parity', 'None');
|
|
400
|
-
rig.setSerialConfig('serial_handshake', 'None');
|
|
401
|
-
rig.setPttType('RIG');
|
|
402
|
-
// Baud rate: 9600
|
|
403
|
-
```
|
|
404
|
-
|
|
405
|
-
**Legacy Interface (DTR/RTS PTT):**
|
|
406
|
-
```javascript
|
|
407
|
-
rig.setSerialConfig('data_bits', '8');
|
|
408
|
-
rig.setSerialConfig('stop_bits', '1');
|
|
409
|
-
rig.setSerialConfig('serial_parity', 'None');
|
|
410
|
-
rig.setPttType('DTR'); // Use DTR for PTT
|
|
411
|
-
rig.setDcdType('DSR'); // Use DSR for squelch
|
|
412
|
-
```
|
|
413
|
-
|
|
414
|
-
## 🎯 Complete Example
|
|
415
|
-
|
|
416
|
-
```javascript
|
|
417
|
-
const { HamLib } = require('node-hamlib');
|
|
418
|
-
|
|
419
|
-
async function radioControl() {
|
|
420
|
-
// Find radios
|
|
421
|
-
const rigs = HamLib.getSupportedRigs();
|
|
422
|
-
const ft991a = rigs.find(r => r.modelName === 'FT-991A');
|
|
423
|
-
|
|
424
|
-
if (!ft991a) {
|
|
425
|
-
console.log('FT-991A not found');
|
|
426
|
-
return;
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
// Connect
|
|
430
|
-
const rig = new HamLib(ft991a.rigModel, '/dev/ttyUSB0');
|
|
431
|
-
|
|
432
|
-
try {
|
|
433
|
-
await rig.open();
|
|
434
|
-
console.log('Connected to', rig.getConnectionInfo().port);
|
|
435
|
-
|
|
436
|
-
// Set up radio
|
|
437
|
-
await rig.setFrequency(144390000);
|
|
438
|
-
await rig.setMode('FM');
|
|
439
|
-
await rig.setLevel('RFPOWER', 0.5);
|
|
440
|
-
await rig.setFunction('NB', true);
|
|
441
|
-
|
|
442
|
-
// Store memory channel
|
|
443
|
-
await rig.setMemoryChannel(1, {
|
|
444
|
-
frequency: 144390000,
|
|
445
|
-
mode: 'FM',
|
|
446
|
-
description: 'Local Repeater'
|
|
447
|
-
});
|
|
448
|
-
|
|
449
|
-
// Monitor signal
|
|
450
|
-
const monitorInterval = setInterval(async () => {
|
|
451
|
-
try {
|
|
452
|
-
const freq = await rig.getFrequency();
|
|
453
|
-
const mode = await rig.getMode();
|
|
454
|
-
const strength = await rig.getStrength();
|
|
455
|
-
|
|
456
|
-
console.log(`${freq/1000000} MHz ${mode.mode} S:${strength}`);
|
|
457
|
-
} catch (err) {
|
|
458
|
-
console.error('Monitor error:', err.message);
|
|
459
|
-
}
|
|
460
|
-
}, 1000);
|
|
461
|
-
|
|
462
|
-
// Stop monitoring after 30 seconds
|
|
463
|
-
setTimeout(() => {
|
|
464
|
-
clearInterval(monitorInterval);
|
|
465
|
-
}, 30000);
|
|
466
|
-
|
|
467
|
-
} catch (error) {
|
|
468
|
-
console.error('Error:', error.message);
|
|
469
|
-
} finally {
|
|
470
|
-
await rig.close();
|
|
471
|
-
}
|
|
472
|
-
}
|
|
473
|
-
|
|
474
|
-
radioControl().catch(console.error);
|
|
475
|
-
```
|
|
476
|
-
|
|
477
|
-
## 📋 Supported Radios
|
|
478
|
-
|
|
479
|
-
This library supports **303+ radio models** from major manufacturers:
|
|
480
|
-
|
|
481
|
-
| Manufacturer | Models | Popular Radios |
|
|
482
|
-
|--------------|--------|----------------|
|
|
483
|
-
| **Yaesu** | 46 | FT-991A, FT-891, FT-857D, FT-817ND |
|
|
484
|
-
| **Icom** | 83 | IC-7300, IC-9700, IC-705, IC-7610 |
|
|
485
|
-
| **Kenwood** | 35 | TS-2000, TS-590SG, TS-890S, TH-D74 |
|
|
486
|
-
| **Elecraft** | 7 | K3, K4, KX3, KX2 |
|
|
487
|
-
| **FlexRadio** | 10 | 6300, 6400, 6500, 6600, 6700 |
|
|
488
|
-
| **Others** | 122 | AOR, JRC, Ten-Tec, Winradio, etc. |
|
|
489
|
-
|
|
490
|
-
### Finding Your Radio
|
|
491
|
-
```javascript
|
|
492
|
-
const rigs = HamLib.getSupportedRigs();
|
|
493
|
-
|
|
494
|
-
// Search by manufacturer
|
|
495
|
-
const yaesu = rigs.filter(r => r.mfgName === 'Yaesu');
|
|
496
|
-
|
|
497
|
-
// Search by model name
|
|
498
|
-
const ft991a = rigs.find(r => r.modelName.includes('FT-991A'));
|
|
499
|
-
|
|
500
|
-
// List all radios
|
|
501
|
-
rigs.forEach(rig => {
|
|
502
|
-
console.log(`${rig.rigModel}: ${rig.mfgName} ${rig.modelName}`);
|
|
503
|
-
});
|
|
504
|
-
```
|
|
505
|
-
|
|
506
|
-
## 🛠️ Installation & Setup
|
|
507
|
-
|
|
508
|
-
### System Requirements
|
|
509
|
-
- Node.js 12.0.0 or higher
|
|
510
|
-
- Supported platforms: Windows x64, Linux x64/ARM64, macOS ARM64
|
|
511
|
-
|
|
512
|
-
### Install Dependencies (if building from source)
|
|
513
|
-
```bash
|
|
514
|
-
# Ubuntu/Debian
|
|
515
|
-
sudo apt-get install libhamlib-dev
|
|
516
|
-
|
|
517
|
-
# macOS
|
|
518
|
-
brew install hamlib
|
|
519
|
-
|
|
520
|
-
# Windows
|
|
521
|
-
vcpkg install hamlib:x64-windows
|
|
522
|
-
```
|
|
523
|
-
|
|
524
|
-
### Building from Source
|
|
525
|
-
```bash
|
|
526
|
-
npm install
|
|
527
|
-
npm run build
|
|
528
|
-
```
|
|
529
|
-
|
|
530
|
-
### Testing
|
|
531
|
-
```bash
|
|
532
|
-
npm test
|
|
533
|
-
```
|
|
534
|
-
|
|
535
|
-
## 🔧 Connection Types
|
|
536
|
-
|
|
537
|
-
### Serial Connection
|
|
538
|
-
```javascript
|
|
539
|
-
// Linux
|
|
540
|
-
const rig = new HamLib(1035, '/dev/ttyUSB0');
|
|
541
|
-
|
|
542
|
-
// macOS
|
|
543
|
-
const rig = new HamLib(1035, '/dev/cu.usbserial-1420');
|
|
544
|
-
|
|
545
|
-
// Windows
|
|
546
|
-
const rig = new HamLib(1035, 'COM3');
|
|
547
|
-
```
|
|
548
|
-
|
|
549
|
-
### Network Connection (rigctld)
|
|
550
|
-
```javascript
|
|
551
|
-
const rig = new HamLib(1035, 'localhost:4532');
|
|
552
|
-
```
|
|
553
|
-
|
|
554
|
-
Start rigctld:
|
|
555
|
-
```bash
|
|
556
|
-
rigctld -m 1035 -r /dev/ttyUSB0 -t 4532
|
|
557
|
-
```
|
|
558
|
-
|
|
559
|
-
## 🐛 Troubleshooting
|
|
560
|
-
|
|
561
|
-
### Permission Issues (Linux)
|
|
562
|
-
```bash
|
|
563
|
-
sudo usermod -a -G dialout $USER
|
|
564
|
-
# Log out and back in
|
|
565
|
-
```
|
|
566
|
-
|
|
567
|
-
### Finding Serial Ports
|
|
568
|
-
```bash
|
|
569
|
-
# Linux
|
|
570
|
-
ls /dev/tty*
|
|
571
|
-
|
|
572
|
-
# macOS
|
|
573
|
-
ls /dev/cu.*
|
|
574
|
-
|
|
575
|
-
# Windows
|
|
576
|
-
# Use Device Manager
|
|
577
|
-
```
|
|
578
|
-
|
|
579
|
-
### Testing Connection
|
|
580
|
-
```bash
|
|
581
|
-
# Test with rigctl
|
|
582
|
-
rigctl -m 1035 -r /dev/ttyUSB0 f
|
|
583
|
-
```
|
|
584
|
-
|
|
585
|
-
## 📄 License
|
|
586
|
-
|
|
587
|
-
LGPL - see [COPYING](COPYING) file for details.
|
|
588
|
-
|
|
589
|
-
## 🔗 Links
|
|
590
|
-
|
|
591
|
-
- [Hamlib Project](https://hamlib.github.io/)
|
|
592
|
-
- [Supported Radios](https://github.com/Hamlib/Hamlib/wiki/Supported-Radios)
|
|
593
|
-
- [rigctl Documentation](https://hamlib.github.io/manpages/rigctl.html)
|