hamlib 0.1.6 → 0.1.7

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