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 ADDED
@@ -0,0 +1,299 @@
1
+ # node-hamlib
2
+
3
+ Control amateur radio transceivers from Node.js using the [Hamlib](https://hamlib.github.io/) library.
4
+
5
+ ## Features
6
+
7
+ - **300+ Supported Radios** - Yaesu, Icom, Kenwood, Elecraft, FlexRadio, and more
8
+ - **Full Async/Promise API** - Non-blocking operations with async/await support
9
+ - **Comprehensive Serial Control** - 13 parameters for complete serial port configuration
10
+ - **Multiple Connections** - Serial ports, network (rigctld), direct control
11
+ - **TypeScript Ready** - Complete type definitions included
12
+ - **Cross-platform** - Windows, Linux, macOS
13
+
14
+ ## Installation
15
+
16
+ ```bash
17
+ npm install hamlib
18
+ ```
19
+
20
+ ## Quick Start
21
+
22
+ ```javascript
23
+ const { HamLib } = require('node-hamlib');
24
+
25
+ async function main() {
26
+ // Create rig instance (model 1035 = FT-991A)
27
+ const rig = new HamLib(1035, '/dev/ttyUSB0');
28
+
29
+ await rig.open();
30
+
31
+ // Basic operations
32
+ await rig.setFrequency(144390000); // 144.39 MHz
33
+ await rig.setMode('FM');
34
+
35
+ const freq = await rig.getFrequency();
36
+ const mode = await rig.getMode();
37
+ console.log(`${freq/1000000} MHz ${mode.mode}`);
38
+
39
+ await rig.close();
40
+ }
41
+
42
+ main().catch(console.error);
43
+ ```
44
+
45
+ ## API Reference
46
+
47
+ ### Connection
48
+
49
+ ```javascript
50
+ // Find your radio model
51
+ const rigs = HamLib.getSupportedRigs();
52
+ const ft991a = rigs.find(r => r.modelName === 'FT-991A');
53
+
54
+ // Create connection
55
+ const rig = new HamLib(1035, '/dev/ttyUSB0'); // Serial
56
+ const rig = new HamLib(1035, 'localhost:4532'); // Network (rigctld)
57
+
58
+ await rig.open();
59
+ await rig.close();
60
+ ```
61
+
62
+ ### Basic Control
63
+
64
+ ```javascript
65
+ // Frequency
66
+ await rig.setFrequency(14074000); // 14.074 MHz
67
+ const freq = await rig.getFrequency();
68
+
69
+ // Mode
70
+ await rig.setMode('USB');
71
+ const mode = await rig.getMode();
72
+
73
+ // VFO
74
+ await rig.setVfo('VFO-A');
75
+ const vfo = await rig.getVfo();
76
+
77
+ // PTT
78
+ await rig.setPtt(true); // Transmit
79
+ const isTransmitting = await rig.getPtt();
80
+
81
+ // Signal
82
+ const strength = await rig.getStrength();
83
+ ```
84
+
85
+ ### Memory Channels
86
+
87
+ ```javascript
88
+ // Store channel
89
+ await rig.setMemoryChannel(1, {
90
+ frequency: 144390000,
91
+ mode: 'FM',
92
+ description: 'Local Repeater'
93
+ });
94
+
95
+ // Recall channel
96
+ const channel = await rig.getMemoryChannel(1);
97
+ await rig.selectMemoryChannel(1);
98
+ ```
99
+
100
+ ### Advanced Features
101
+
102
+ ```javascript
103
+ // RIT/XIT offsets
104
+ await rig.setRit(100); // +100 Hz RIT
105
+ await rig.setXit(-50); // -50 Hz XIT
106
+ await rig.clearRitXit(); // Clear both
107
+
108
+ // Scanning
109
+ await rig.startScan('VFO'); // Start VFO scan
110
+ await rig.stopScan(); // Stop scan
111
+
112
+ // Levels (0.0-1.0)
113
+ await rig.setLevel('AF', 0.7); // Audio 70%
114
+ await rig.setLevel('RFPOWER', 0.5); // TX power 50%
115
+ const audioLevel = await rig.getLevel('AF');
116
+
117
+ // Functions
118
+ await rig.setFunction('NB', true); // Noise blanker on
119
+ const voxEnabled = await rig.getFunction('VOX');
120
+
121
+ // Split operation
122
+ await rig.setSplit(true); // Enable split
123
+ await rig.setSplitFreq(144340000); // TX frequency
124
+
125
+ // VFO operations
126
+ await rig.vfoOperation('CPY'); // Copy VFO A to B
127
+ await rig.vfoOperation('TOGGLE'); // Toggle VFO A/B
128
+ ```
129
+
130
+ ### Power and Status
131
+
132
+ ```javascript
133
+ // Power control
134
+ await rig.setPowerstat(1); // Power on (0=off, 1=on, 2=standby)
135
+ const powerStatus = await rig.getPowerstat();
136
+
137
+ // Carrier detection
138
+ const carrierDetected = await rig.getDcd(); // Signal present?
139
+
140
+ // Tuning steps
141
+ await rig.setTuningStep(12500); // 12.5 kHz steps
142
+ const step = await rig.getTuningStep();
143
+ ```
144
+
145
+ ### Repeater Operation
146
+
147
+ ```javascript
148
+ // Set repeater shift
149
+ await rig.setRepeaterShift('PLUS'); // '+', '-', or 'NONE'
150
+ const shift = await rig.getRepeaterShift();
151
+
152
+ // Set offset frequency
153
+ await rig.setRepeaterOffset(600000); // 600 kHz for 2m
154
+ const offset = await rig.getRepeaterOffset();
155
+ ```
156
+
157
+ ### Serial Configuration
158
+
159
+ Node-hamlib provides **comprehensive serial port configuration** with **13 parameters** covering all aspects of serial communication from basic data format to advanced timing control and device-specific features.
160
+
161
+ ```javascript
162
+ // Configure serial parameters
163
+ await rig.setSerialConfig('rate', '115200'); // Baud rate: 150 to 4000000 bps
164
+ await rig.setSerialConfig('data_bits', '8'); // Data bits: 5, 6, 7, 8
165
+ await rig.setSerialConfig('serial_parity', 'None'); // Parity: None, Even, Odd, Mark, Space
166
+ await rig.setSerialConfig('timeout', '1000'); // Timeout in milliseconds
167
+ await rig.setSerialConfig('write_delay', '10'); // Inter-byte delay (ms)
168
+
169
+ // Read current settings
170
+ const rate = await rig.getSerialConfig('rate');
171
+ const parity = await rig.getSerialConfig('serial_parity');
172
+
173
+ // PTT/DCD configuration
174
+ await rig.setPttType('DTR'); // PTT: RIG, DTR, RTS, NONE, etc.
175
+ await rig.setDcdType('RIG'); // DCD: RIG, DSR, CTS, NONE, etc.
176
+ ```
177
+
178
+ #### Complete Serial Configuration Reference
179
+
180
+ | Category | Parameter | Description | Supported Values |
181
+ |----------|-----------|-------------|------------------|
182
+ | **Basic Serial** | `data_bits` | Number of data bits | `5`, `6`, `7`, `8` |
183
+ | | `stop_bits` | Number of stop bits | `1`, `2` |
184
+ | | `serial_parity` | Parity checking | `None`, `Even`, `Odd`, `Mark`, `Space` |
185
+ | | `serial_handshake` | Flow control | `None`, `Hardware`, `Software` |
186
+ | **Control Signals** | `rts_state` | RTS line state | `ON`, `OFF`, `UNSET` |
187
+ | | `dtr_state` | DTR line state | `ON`, `OFF`, `UNSET` |
188
+ | **Communication** | `rate` | Baud rate (bps) | `150` to `4000000` |
189
+ | | `timeout` | I/O timeout (ms) | Any non-negative integer |
190
+ | | `retry` | Max retry count | Any non-negative integer |
191
+ | **Timing** | `write_delay` | Inter-byte delay (ms) | Any non-negative integer |
192
+ | | `post_write_delay` | Inter-command delay (ms) | Any non-negative integer |
193
+ | **Advanced** | `flushx` | MicroHam flush mode | `true`, `false` |
194
+
195
+ ## Complete Example
196
+
197
+ ```javascript
198
+ const { HamLib } = require('node-hamlib');
199
+
200
+ async function repeaterOperation() {
201
+ const rig = new HamLib(1035, '/dev/ttyUSB0');
202
+
203
+ try {
204
+ await rig.open();
205
+
206
+ // Set up for 2m repeater
207
+ await rig.setFrequency(145500000); // 145.500 MHz
208
+ await rig.setMode('FM');
209
+ await rig.setRepeaterShift('MINUS'); // Negative offset
210
+ await rig.setRepeaterOffset(600000); // 600 kHz offset
211
+ await rig.setTuningStep(12500); // 12.5 kHz steps
212
+ await rig.setLevel('RFPOWER', 0.5); // 50% power
213
+
214
+ // Save to memory
215
+ await rig.setMemoryChannel(1, {
216
+ frequency: 145500000,
217
+ mode: 'FM',
218
+ description: 'W1AW Repeater'
219
+ });
220
+
221
+ console.log('Setup complete for repeater operation');
222
+
223
+ } catch (error) {
224
+ console.error('Error:', error.message);
225
+ } finally {
226
+ await rig.close();
227
+ }
228
+ }
229
+
230
+ repeaterOperation();
231
+ ```
232
+
233
+ ## Supported Radios
234
+
235
+ Over **300 radio models** supported, including:
236
+
237
+ | Manufacturer | Popular Models |
238
+ |--------------|----------------|
239
+ | **Yaesu** | FT-991A, FT-891, FT-857D, FT-817ND |
240
+ | **Icom** | IC-7300, IC-9700, IC-705, IC-7610 |
241
+ | **Kenwood** | TS-2000, TS-590SG, TS-890S |
242
+ | **Elecraft** | K3, K4, KX3, KX2 |
243
+ | **FlexRadio** | 6300, 6400, 6500, 6600, 6700 |
244
+
245
+ Find your radio model:
246
+ ```javascript
247
+ const rigs = HamLib.getSupportedRigs();
248
+ console.log(rigs.find(r => r.modelName.includes('FT-991')));
249
+ ```
250
+
251
+ ## Connection Setup
252
+
253
+ ### Serial Connection
254
+ ```bash
255
+ # Linux/macOS
256
+ const rig = new HamLib(1035, '/dev/ttyUSB0');
257
+
258
+ # Windows
259
+ const rig = new HamLib(1035, 'COM3');
260
+ ```
261
+
262
+ ### Network Connection
263
+ ```bash
264
+ # Start rigctld daemon
265
+ rigctld -m 1035 -r /dev/ttyUSB0 -t 4532
266
+
267
+ # Connect from Node.js
268
+ const rig = new HamLib(1035, 'localhost:4532');
269
+ ```
270
+
271
+ ## Troubleshooting
272
+
273
+ ### Linux Permissions
274
+ ```bash
275
+ sudo usermod -a -G dialout $USER
276
+ # Log out and log back in
277
+ ```
278
+
279
+ ### Find Serial Ports
280
+ ```bash
281
+ # Linux
282
+ ls /dev/tty*
283
+
284
+ # macOS
285
+ ls /dev/cu.*
286
+
287
+ # Test connection
288
+ rigctl -m 1035 -r /dev/ttyUSB0 f
289
+ ```
290
+
291
+ ## License
292
+
293
+ LGPL - see [COPYING](COPYING) file for details.
294
+
295
+ ## Links
296
+
297
+ - [Hamlib Project](https://hamlib.github.io/)
298
+ - [Supported Radios](https://github.com/Hamlib/Hamlib/wiki/Supported-Radios)
299
+ - [rigctl Documentation](https://hamlib.github.io/manpages/rigctl.html)