hamlib 0.1.5 → 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 +273 -0
- package/index.d.ts +540 -74
- package/lib/index.js +653 -68
- 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 +3915 -972
- package/src/hamlib.h +84 -1
- package/src/hamlib_compat.h +44 -0
- package/Readme.md +0 -560
package/lib/index.js
CHANGED
|
@@ -35,7 +35,7 @@ class HamLib {
|
|
|
35
35
|
* Must be called before other operations
|
|
36
36
|
* @throws {Error} Throws error when connection fails
|
|
37
37
|
*/
|
|
38
|
-
open() {
|
|
38
|
+
async open() {
|
|
39
39
|
return this._nativeInstance.open();
|
|
40
40
|
}
|
|
41
41
|
|
|
@@ -44,7 +44,7 @@ class HamLib {
|
|
|
44
44
|
* @param {string} vfo - VFO identifier ('VFO-A' or 'VFO-B')
|
|
45
45
|
* @throws {Error} Throws error when device doesn't support or operation fails
|
|
46
46
|
*/
|
|
47
|
-
setVfo(vfo) {
|
|
47
|
+
async setVfo(vfo) {
|
|
48
48
|
return this._nativeInstance.setVfo(vfo);
|
|
49
49
|
}
|
|
50
50
|
|
|
@@ -53,39 +53,55 @@ class HamLib {
|
|
|
53
53
|
* @param {number} frequency - Frequency in hertz
|
|
54
54
|
* @param {string} [vfo] - Optional VFO ('VFO-A' or 'VFO-B')
|
|
55
55
|
*/
|
|
56
|
-
setFrequency(frequency, vfo) {
|
|
56
|
+
async setFrequency(frequency, vfo) {
|
|
57
57
|
if (vfo) {
|
|
58
58
|
return this._nativeInstance.setFrequency(frequency, vfo);
|
|
59
|
+
} else {
|
|
60
|
+
return this._nativeInstance.setFrequency(frequency);
|
|
59
61
|
}
|
|
60
|
-
return this._nativeInstance.setFrequency(frequency);
|
|
61
62
|
}
|
|
62
63
|
|
|
63
64
|
/**
|
|
64
65
|
* Set radio mode
|
|
65
66
|
* @param {string} mode - Radio mode ('USB', 'LSB', 'FM', 'PKTFM', etc.)
|
|
66
67
|
* @param {string} [bandwidth] - Optional bandwidth ('narrow', 'wide')
|
|
68
|
+
* @param {string} [vfo] - Optional VFO ('VFO-A' or 'VFO-B')
|
|
67
69
|
*/
|
|
68
|
-
setMode(mode, bandwidth) {
|
|
69
|
-
if (
|
|
70
|
+
async setMode(mode, bandwidth, vfo) {
|
|
71
|
+
if (vfo !== undefined) {
|
|
72
|
+
if (bandwidth) {
|
|
73
|
+
return this._nativeInstance.setMode(mode, bandwidth, vfo);
|
|
74
|
+
} else {
|
|
75
|
+
return this._nativeInstance.setMode(mode, vfo);
|
|
76
|
+
}
|
|
77
|
+
} else if (bandwidth) {
|
|
70
78
|
return this._nativeInstance.setMode(mode, bandwidth);
|
|
79
|
+
} else {
|
|
80
|
+
return this._nativeInstance.setMode(mode);
|
|
71
81
|
}
|
|
72
|
-
return this._nativeInstance.setMode(mode);
|
|
73
82
|
}
|
|
74
83
|
|
|
75
84
|
/**
|
|
76
85
|
* Set PTT (Push-to-Talk) status
|
|
77
86
|
* @param {boolean} state - true to enable PTT, false to disable
|
|
78
87
|
*/
|
|
79
|
-
setPtt(state) {
|
|
88
|
+
async setPtt(state) {
|
|
80
89
|
return this._nativeInstance.setPtt(state);
|
|
81
90
|
}
|
|
82
91
|
|
|
83
92
|
/**
|
|
84
93
|
* Get current VFO
|
|
85
|
-
* @
|
|
94
|
+
* @param {Object} [options] - Options for VFO query
|
|
95
|
+
* @param {boolean} [options.fallbackToDefault=false] - Return default VFO instead of throwing error if not supported
|
|
96
|
+
* @returns {string} Current VFO identifier ('VFO-A', 'VFO-B', or 'VFO-CURR')
|
|
86
97
|
*/
|
|
87
|
-
getVfo() {
|
|
88
|
-
|
|
98
|
+
async getVfo(options = {}) {
|
|
99
|
+
try {
|
|
100
|
+
return await this._nativeInstance.getVfo();
|
|
101
|
+
} catch (error) {
|
|
102
|
+
// 如果无线电不支持VFO查询,且用户要求回退到默认值
|
|
103
|
+
return 'VFO-CURR'; // 返回合理的默认值
|
|
104
|
+
}
|
|
89
105
|
}
|
|
90
106
|
|
|
91
107
|
/**
|
|
@@ -93,34 +109,40 @@ class HamLib {
|
|
|
93
109
|
* @param {string} [vfo] - Optional VFO ('VFO-A' or 'VFO-B')
|
|
94
110
|
* @returns {number} Current frequency in hertz
|
|
95
111
|
*/
|
|
96
|
-
getFrequency(vfo) {
|
|
112
|
+
async getFrequency(vfo) {
|
|
97
113
|
if (vfo) {
|
|
98
114
|
return this._nativeInstance.getFrequency(vfo);
|
|
115
|
+
} else {
|
|
116
|
+
return this._nativeInstance.getFrequency();
|
|
99
117
|
}
|
|
100
|
-
return this._nativeInstance.getFrequency();
|
|
101
118
|
}
|
|
102
119
|
|
|
103
120
|
/**
|
|
104
121
|
* Get current radio mode
|
|
105
122
|
* @returns {Object} Object containing mode and bandwidth information
|
|
106
123
|
*/
|
|
107
|
-
getMode() {
|
|
124
|
+
async getMode() {
|
|
108
125
|
return this._nativeInstance.getMode();
|
|
109
126
|
}
|
|
110
127
|
|
|
111
128
|
/**
|
|
112
129
|
* Get current signal strength
|
|
130
|
+
* @param {string} [vfo] - Optional VFO ('VFO-A' or 'VFO-B')
|
|
113
131
|
* @returns {number} Signal strength value
|
|
114
132
|
*/
|
|
115
|
-
getStrength() {
|
|
116
|
-
|
|
133
|
+
async getStrength(vfo) {
|
|
134
|
+
if (vfo) {
|
|
135
|
+
return this._nativeInstance.getStrength(vfo);
|
|
136
|
+
} else {
|
|
137
|
+
return this._nativeInstance.getStrength();
|
|
138
|
+
}
|
|
117
139
|
}
|
|
118
140
|
|
|
119
141
|
/**
|
|
120
142
|
* Close connection to device
|
|
121
143
|
* Connection can be re-established by calling open()
|
|
122
144
|
*/
|
|
123
|
-
close() {
|
|
145
|
+
async close() {
|
|
124
146
|
return this._nativeInstance.close();
|
|
125
147
|
}
|
|
126
148
|
|
|
@@ -128,7 +150,7 @@ class HamLib {
|
|
|
128
150
|
* Destroy connection to device
|
|
129
151
|
* Object reference should be deleted after calling this
|
|
130
152
|
*/
|
|
131
|
-
destroy() {
|
|
153
|
+
async destroy() {
|
|
132
154
|
return this._nativeInstance.destroy();
|
|
133
155
|
}
|
|
134
156
|
|
|
@@ -147,7 +169,7 @@ class HamLib {
|
|
|
147
169
|
* @param {number} channelNumber - Memory channel number
|
|
148
170
|
* @param {Object} channelData - Channel data (frequency, mode, description, etc.)
|
|
149
171
|
*/
|
|
150
|
-
setMemoryChannel(channelNumber, channelData) {
|
|
172
|
+
async setMemoryChannel(channelNumber, channelData) {
|
|
151
173
|
return this._nativeInstance.setMemoryChannel(channelNumber, channelData);
|
|
152
174
|
}
|
|
153
175
|
|
|
@@ -157,7 +179,7 @@ class HamLib {
|
|
|
157
179
|
* @param {boolean} [readOnly=true] - Whether to read in read-only mode
|
|
158
180
|
* @returns {Object} Channel data
|
|
159
181
|
*/
|
|
160
|
-
getMemoryChannel(channelNumber, readOnly = true) {
|
|
182
|
+
async getMemoryChannel(channelNumber, readOnly = true) {
|
|
161
183
|
return this._nativeInstance.getMemoryChannel(channelNumber, readOnly);
|
|
162
184
|
}
|
|
163
185
|
|
|
@@ -165,7 +187,7 @@ class HamLib {
|
|
|
165
187
|
* Select memory channel for operation
|
|
166
188
|
* @param {number} channelNumber - Memory channel number to select
|
|
167
189
|
*/
|
|
168
|
-
selectMemoryChannel(channelNumber) {
|
|
190
|
+
async selectMemoryChannel(channelNumber) {
|
|
169
191
|
return this._nativeInstance.selectMemoryChannel(channelNumber);
|
|
170
192
|
}
|
|
171
193
|
|
|
@@ -175,7 +197,7 @@ class HamLib {
|
|
|
175
197
|
* Set RIT (Receiver Incremental Tuning) offset
|
|
176
198
|
* @param {number} offsetHz - RIT offset in Hz
|
|
177
199
|
*/
|
|
178
|
-
setRit(offsetHz) {
|
|
200
|
+
async setRit(offsetHz) {
|
|
179
201
|
return this._nativeInstance.setRit(offsetHz);
|
|
180
202
|
}
|
|
181
203
|
|
|
@@ -183,7 +205,7 @@ class HamLib {
|
|
|
183
205
|
* Get current RIT offset
|
|
184
206
|
* @returns {number} RIT offset in Hz
|
|
185
207
|
*/
|
|
186
|
-
getRit() {
|
|
208
|
+
async getRit() {
|
|
187
209
|
return this._nativeInstance.getRit();
|
|
188
210
|
}
|
|
189
211
|
|
|
@@ -191,7 +213,7 @@ class HamLib {
|
|
|
191
213
|
* Set XIT (Transmitter Incremental Tuning) offset
|
|
192
214
|
* @param {number} offsetHz - XIT offset in Hz
|
|
193
215
|
*/
|
|
194
|
-
setXit(offsetHz) {
|
|
216
|
+
async setXit(offsetHz) {
|
|
195
217
|
return this._nativeInstance.setXit(offsetHz);
|
|
196
218
|
}
|
|
197
219
|
|
|
@@ -199,7 +221,7 @@ class HamLib {
|
|
|
199
221
|
* Get current XIT offset
|
|
200
222
|
* @returns {number} XIT offset in Hz
|
|
201
223
|
*/
|
|
202
|
-
getXit() {
|
|
224
|
+
async getXit() {
|
|
203
225
|
return this._nativeInstance.getXit();
|
|
204
226
|
}
|
|
205
227
|
|
|
@@ -207,7 +229,7 @@ class HamLib {
|
|
|
207
229
|
* Clear both RIT and XIT offsets
|
|
208
230
|
* @returns {boolean} Success status
|
|
209
231
|
*/
|
|
210
|
-
clearRitXit() {
|
|
232
|
+
async clearRitXit() {
|
|
211
233
|
return this._nativeInstance.clearRitXit();
|
|
212
234
|
}
|
|
213
235
|
|
|
@@ -218,14 +240,14 @@ class HamLib {
|
|
|
218
240
|
* @param {string} scanType - Scan type ('VFO', 'MEM', 'PROG', 'DELTA', 'PRIO')
|
|
219
241
|
* @param {number} [channel=0] - Optional channel number for some scan types
|
|
220
242
|
*/
|
|
221
|
-
startScan(scanType, channel = 0) {
|
|
243
|
+
async startScan(scanType, channel = 0) {
|
|
222
244
|
return this._nativeInstance.startScan(scanType, channel);
|
|
223
245
|
}
|
|
224
246
|
|
|
225
247
|
/**
|
|
226
248
|
* Stop scanning operation
|
|
227
249
|
*/
|
|
228
|
-
stopScan() {
|
|
250
|
+
async stopScan() {
|
|
229
251
|
return this._nativeInstance.stopScan();
|
|
230
252
|
}
|
|
231
253
|
|
|
@@ -236,7 +258,7 @@ class HamLib {
|
|
|
236
258
|
* @param {string} levelType - Level type ('AF', 'RF', 'SQL', 'RFPOWER', etc.)
|
|
237
259
|
* @param {number} value - Level value (0.0-1.0 typically)
|
|
238
260
|
*/
|
|
239
|
-
setLevel(levelType, value) {
|
|
261
|
+
async setLevel(levelType, value) {
|
|
240
262
|
return this._nativeInstance.setLevel(levelType, value);
|
|
241
263
|
}
|
|
242
264
|
|
|
@@ -245,7 +267,7 @@ class HamLib {
|
|
|
245
267
|
* @param {string} levelType - Level type ('AF', 'RF', 'SQL', 'STRENGTH', etc.)
|
|
246
268
|
* @returns {number} Level value
|
|
247
269
|
*/
|
|
248
|
-
getLevel(levelType) {
|
|
270
|
+
async getLevel(levelType) {
|
|
249
271
|
return this._nativeInstance.getLevel(levelType);
|
|
250
272
|
}
|
|
251
273
|
|
|
@@ -264,7 +286,7 @@ class HamLib {
|
|
|
264
286
|
* @param {string} functionType - Function type ('NB', 'COMP', 'VOX', 'TONE', etc.)
|
|
265
287
|
* @param {boolean} enable - true to enable, false to disable
|
|
266
288
|
*/
|
|
267
|
-
setFunction(functionType, enable) {
|
|
289
|
+
async setFunction(functionType, enable) {
|
|
268
290
|
return this._nativeInstance.setFunction(functionType, enable);
|
|
269
291
|
}
|
|
270
292
|
|
|
@@ -273,7 +295,7 @@ class HamLib {
|
|
|
273
295
|
* @param {string} functionType - Function type ('NB', 'COMP', 'VOX', 'TONE', etc.)
|
|
274
296
|
* @returns {boolean} Function enabled status
|
|
275
297
|
*/
|
|
276
|
-
getFunction(functionType) {
|
|
298
|
+
async getFunction(functionType) {
|
|
277
299
|
return this._nativeInstance.getFunction(functionType);
|
|
278
300
|
}
|
|
279
301
|
|
|
@@ -290,54 +312,92 @@ class HamLib {
|
|
|
290
312
|
/**
|
|
291
313
|
* Set split mode TX frequency
|
|
292
314
|
* @param {number} txFrequency - TX frequency in Hz
|
|
315
|
+
* @param {string} [vfo] - Optional VFO ('VFO-A' or 'VFO-B')
|
|
293
316
|
*/
|
|
294
|
-
setSplitFreq(txFrequency) {
|
|
295
|
-
|
|
317
|
+
async setSplitFreq(txFrequency, vfo) {
|
|
318
|
+
if (vfo) {
|
|
319
|
+
return this._nativeInstance.setSplitFreq(txFrequency, vfo);
|
|
320
|
+
} else {
|
|
321
|
+
return this._nativeInstance.setSplitFreq(txFrequency);
|
|
322
|
+
}
|
|
296
323
|
}
|
|
297
324
|
|
|
298
325
|
/**
|
|
299
326
|
* Get split mode TX frequency
|
|
327
|
+
* @param {string} [vfo] - Optional VFO ('VFO-A' or 'VFO-B')
|
|
300
328
|
* @returns {number} TX frequency in Hz
|
|
301
329
|
*/
|
|
302
|
-
getSplitFreq() {
|
|
303
|
-
|
|
330
|
+
async getSplitFreq(vfo) {
|
|
331
|
+
if (vfo) {
|
|
332
|
+
return this._nativeInstance.getSplitFreq(vfo);
|
|
333
|
+
} else {
|
|
334
|
+
return this._nativeInstance.getSplitFreq();
|
|
335
|
+
}
|
|
304
336
|
}
|
|
305
337
|
|
|
306
338
|
/**
|
|
307
339
|
* Set split mode TX mode
|
|
308
340
|
* @param {string} txMode - TX mode ('USB', 'LSB', 'FM', etc.)
|
|
309
341
|
* @param {number} [txWidth] - Optional TX bandwidth
|
|
342
|
+
* @param {string} [vfo] - Optional VFO ('VFO-A' or 'VFO-B')
|
|
310
343
|
*/
|
|
311
|
-
setSplitMode(txMode, txWidth) {
|
|
312
|
-
if (
|
|
344
|
+
async setSplitMode(txMode, txWidth, vfo) {
|
|
345
|
+
if (vfo !== undefined) {
|
|
346
|
+
if (txWidth !== undefined) {
|
|
347
|
+
return this._nativeInstance.setSplitMode(txMode, txWidth, vfo);
|
|
348
|
+
} else {
|
|
349
|
+
return this._nativeInstance.setSplitMode(txMode, vfo);
|
|
350
|
+
}
|
|
351
|
+
} else if (txWidth !== undefined) {
|
|
313
352
|
return this._nativeInstance.setSplitMode(txMode, txWidth);
|
|
353
|
+
} else {
|
|
354
|
+
return this._nativeInstance.setSplitMode(txMode);
|
|
314
355
|
}
|
|
315
|
-
return this._nativeInstance.setSplitMode(txMode);
|
|
316
356
|
}
|
|
317
357
|
|
|
318
358
|
/**
|
|
319
359
|
* Get split mode TX mode
|
|
360
|
+
* @param {string} [vfo] - Optional VFO ('VFO-A' or 'VFO-B')
|
|
320
361
|
* @returns {Object} TX mode and width
|
|
321
362
|
*/
|
|
322
|
-
getSplitMode() {
|
|
323
|
-
|
|
363
|
+
async getSplitMode(vfo) {
|
|
364
|
+
if (vfo) {
|
|
365
|
+
return this._nativeInstance.getSplitMode(vfo);
|
|
366
|
+
} else {
|
|
367
|
+
return this._nativeInstance.getSplitMode();
|
|
368
|
+
}
|
|
324
369
|
}
|
|
325
370
|
|
|
326
371
|
/**
|
|
327
372
|
* Enable/disable split operation
|
|
328
373
|
* @param {boolean} enable - true to enable split, false to disable
|
|
329
|
-
* @param {string} [
|
|
374
|
+
* @param {string} [rxVfo] - RX VFO ('VFO-A' or 'VFO-B'). Default: current VFO
|
|
375
|
+
* @param {string} [txVfo] - TX VFO ('VFO-A' or 'VFO-B'). Default: VFO-B
|
|
330
376
|
*/
|
|
331
|
-
setSplit(enable, txVfo
|
|
332
|
-
|
|
377
|
+
async setSplit(enable, rxVfo, txVfo) {
|
|
378
|
+
if (txVfo !== undefined) {
|
|
379
|
+
// 3-parameter version: setSplit(enable, rxVfo, txVfo) - matches Hamlib API order
|
|
380
|
+
return this._nativeInstance.setSplit(enable, rxVfo, txVfo);
|
|
381
|
+
} else if (rxVfo !== undefined) {
|
|
382
|
+
// 2-parameter version: setSplit(enable, rxVfo)
|
|
383
|
+
return this._nativeInstance.setSplit(enable, rxVfo);
|
|
384
|
+
} else {
|
|
385
|
+
// 1-parameter version: setSplit(enable)
|
|
386
|
+
return this._nativeInstance.setSplit(enable);
|
|
387
|
+
}
|
|
333
388
|
}
|
|
334
389
|
|
|
335
390
|
/**
|
|
336
391
|
* Get split operation status
|
|
392
|
+
* @param {string} [vfo] - Optional VFO ('VFO-A' or 'VFO-B')
|
|
337
393
|
* @returns {Object} Split status and TX VFO
|
|
338
394
|
*/
|
|
339
|
-
getSplit() {
|
|
340
|
-
|
|
395
|
+
async getSplit(vfo) {
|
|
396
|
+
if (vfo) {
|
|
397
|
+
return this._nativeInstance.getSplit(vfo);
|
|
398
|
+
} else {
|
|
399
|
+
return this._nativeInstance.getSplit();
|
|
400
|
+
}
|
|
341
401
|
}
|
|
342
402
|
|
|
343
403
|
// VFO Operations
|
|
@@ -346,27 +406,13 @@ class HamLib {
|
|
|
346
406
|
* Perform VFO operation
|
|
347
407
|
* @param {string} operation - VFO operation ('CPY', 'XCHG', 'FROM_VFO', 'TO_VFO', 'MCL', 'UP', 'DOWN', 'BAND_UP', 'BAND_DOWN', 'LEFT', 'RIGHT', 'TUNE', 'TOGGLE')
|
|
348
408
|
*/
|
|
349
|
-
vfoOperation(operation) {
|
|
409
|
+
async vfoOperation(operation) {
|
|
350
410
|
return this._nativeInstance.vfoOperation(operation);
|
|
351
411
|
}
|
|
352
412
|
|
|
353
413
|
// Antenna Selection
|
|
354
414
|
|
|
355
|
-
|
|
356
|
-
* Set antenna
|
|
357
|
-
* @param {number} antenna - Antenna number (1, 2, 3, etc.)
|
|
358
|
-
*/
|
|
359
|
-
setAntenna(antenna) {
|
|
360
|
-
return this._nativeInstance.setAntenna(antenna);
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
/**
|
|
364
|
-
* Get current antenna
|
|
365
|
-
* @returns {number} Current antenna number
|
|
366
|
-
*/
|
|
367
|
-
getAntenna() {
|
|
368
|
-
return this._nativeInstance.getAntenna();
|
|
369
|
-
}
|
|
415
|
+
// Note: setAntenna and getAntenna are defined later in the file with full VFO support
|
|
370
416
|
|
|
371
417
|
// Serial Port Configuration
|
|
372
418
|
|
|
@@ -384,7 +430,7 @@ class HamLib {
|
|
|
384
430
|
* // Set handshake to hardware
|
|
385
431
|
* hamlib.setSerialConfig('serial_handshake', 'Hardware');
|
|
386
432
|
*/
|
|
387
|
-
setSerialConfig(paramName, paramValue) {
|
|
433
|
+
async setSerialConfig(paramName, paramValue) {
|
|
388
434
|
return this._nativeInstance.setSerialConfig(paramName, paramValue);
|
|
389
435
|
}
|
|
390
436
|
|
|
@@ -399,7 +445,7 @@ class HamLib {
|
|
|
399
445
|
* // Get current parity setting
|
|
400
446
|
* const parity = hamlib.getSerialConfig('serial_parity');
|
|
401
447
|
*/
|
|
402
|
-
getSerialConfig(paramName) {
|
|
448
|
+
async getSerialConfig(paramName) {
|
|
403
449
|
return this._nativeInstance.getSerialConfig(paramName);
|
|
404
450
|
}
|
|
405
451
|
|
|
@@ -416,7 +462,7 @@ class HamLib {
|
|
|
416
462
|
* // Use CAT command for PTT
|
|
417
463
|
* hamlib.setPttType('RIG');
|
|
418
464
|
*/
|
|
419
|
-
setPttType(pttType) {
|
|
465
|
+
async setPttType(pttType) {
|
|
420
466
|
return this._nativeInstance.setPttType(pttType);
|
|
421
467
|
}
|
|
422
468
|
|
|
@@ -424,7 +470,7 @@ class HamLib {
|
|
|
424
470
|
* Get current PTT type
|
|
425
471
|
* @returns {string} Current PTT type
|
|
426
472
|
*/
|
|
427
|
-
getPttType() {
|
|
473
|
+
async getPttType() {
|
|
428
474
|
return this._nativeInstance.getPttType();
|
|
429
475
|
}
|
|
430
476
|
|
|
@@ -441,7 +487,7 @@ class HamLib {
|
|
|
441
487
|
* // Use CAT command for DCD
|
|
442
488
|
* hamlib.setDcdType('RIG');
|
|
443
489
|
*/
|
|
444
|
-
setDcdType(dcdType) {
|
|
490
|
+
async setDcdType(dcdType) {
|
|
445
491
|
return this._nativeInstance.setDcdType(dcdType);
|
|
446
492
|
}
|
|
447
493
|
|
|
@@ -449,7 +495,7 @@ class HamLib {
|
|
|
449
495
|
* Get current DCD type
|
|
450
496
|
* @returns {string} Current DCD type
|
|
451
497
|
*/
|
|
452
|
-
getDcdType() {
|
|
498
|
+
async getDcdType() {
|
|
453
499
|
return this._nativeInstance.getDcdType();
|
|
454
500
|
}
|
|
455
501
|
|
|
@@ -464,6 +510,545 @@ class HamLib {
|
|
|
464
510
|
getSupportedSerialConfigs() {
|
|
465
511
|
return this._nativeInstance.getSupportedSerialConfigs();
|
|
466
512
|
}
|
|
513
|
+
|
|
514
|
+
// Power Control
|
|
515
|
+
|
|
516
|
+
/**
|
|
517
|
+
* Set radio power status
|
|
518
|
+
* @param {number} status - Power status (0=OFF, 1=ON, 2=STANDBY, 4=OPERATE, 8=UNKNOWN)
|
|
519
|
+
* @returns {Promise<number>} Success status
|
|
520
|
+
* @example
|
|
521
|
+
* await rig.setPowerstat(1); // Power on
|
|
522
|
+
* await rig.setPowerstat(0); // Power off
|
|
523
|
+
* await rig.setPowerstat(2); // Standby mode
|
|
524
|
+
*/
|
|
525
|
+
async setPowerstat(status) {
|
|
526
|
+
return this._nativeInstance.setPowerstat(status);
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
/**
|
|
530
|
+
* Get current radio power status
|
|
531
|
+
* @returns {Promise<number>} Power status (0=OFF, 1=ON, 2=STANDBY, 4=OPERATE, 8=UNKNOWN)
|
|
532
|
+
* @example
|
|
533
|
+
* const powerStatus = await rig.getPowerstat();
|
|
534
|
+
* if (powerStatus === 1) {
|
|
535
|
+
* console.log('Radio is powered on');
|
|
536
|
+
* }
|
|
537
|
+
*/
|
|
538
|
+
async getPowerstat() {
|
|
539
|
+
return this._nativeInstance.getPowerstat();
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
// PTT Status Detection
|
|
543
|
+
|
|
544
|
+
/**
|
|
545
|
+
* Get current PTT status
|
|
546
|
+
* @param {string} [vfo] - Optional VFO to get PTT status from ('VFO-A' or 'VFO-B'). If not specified, uses current VFO
|
|
547
|
+
* @returns {Promise<boolean>} PTT status (true if transmitting, false if receiving)
|
|
548
|
+
* @example
|
|
549
|
+
* const isTransmitting = await rig.getPtt();
|
|
550
|
+
* if (isTransmitting) {
|
|
551
|
+
* console.log('Radio is transmitting');
|
|
552
|
+
* }
|
|
553
|
+
*/
|
|
554
|
+
async getPtt(vfo) {
|
|
555
|
+
if (vfo) {
|
|
556
|
+
return this._nativeInstance.getPtt(vfo);
|
|
557
|
+
} else {
|
|
558
|
+
return this._nativeInstance.getPtt();
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
// Data Carrier Detect
|
|
563
|
+
|
|
564
|
+
/**
|
|
565
|
+
* Get current DCD (Data Carrier Detect) status
|
|
566
|
+
* @param {string} [vfo] - Optional VFO to get DCD status from ('VFO-A' or 'VFO-B'). If not specified, uses current VFO
|
|
567
|
+
* @returns {Promise<boolean>} DCD status (true if carrier detected, false if no carrier)
|
|
568
|
+
* @example
|
|
569
|
+
* const carrierDetected = await rig.getDcd();
|
|
570
|
+
* if (carrierDetected) {
|
|
571
|
+
* console.log('Carrier detected');
|
|
572
|
+
* }
|
|
573
|
+
*/
|
|
574
|
+
async getDcd(vfo) {
|
|
575
|
+
if (vfo) {
|
|
576
|
+
return this._nativeInstance.getDcd(vfo);
|
|
577
|
+
} else {
|
|
578
|
+
return this._nativeInstance.getDcd();
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
// Tuning Step Control
|
|
583
|
+
|
|
584
|
+
/**
|
|
585
|
+
* Set tuning step
|
|
586
|
+
* @param {number} step - Tuning step in Hz
|
|
587
|
+
* @param {string} [vfo] - Optional VFO to set tuning step on ('VFO-A' or 'VFO-B'). If not specified, uses current VFO
|
|
588
|
+
* @returns {Promise<number>} Success status
|
|
589
|
+
* @example
|
|
590
|
+
* await rig.setTuningStep(25000); // 25 kHz steps
|
|
591
|
+
* await rig.setTuningStep(12500); // 12.5 kHz steps
|
|
592
|
+
* await rig.setTuningStep(100); // 100 Hz steps for HF
|
|
593
|
+
*/
|
|
594
|
+
async setTuningStep(step, vfo) {
|
|
595
|
+
if (vfo) {
|
|
596
|
+
return this._nativeInstance.setTuningStep(step, vfo);
|
|
597
|
+
} else {
|
|
598
|
+
return this._nativeInstance.setTuningStep(step);
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
/**
|
|
603
|
+
* Get current tuning step
|
|
604
|
+
* @param {string} [vfo] - Optional VFO to get tuning step from ('VFO-A' or 'VFO-B'). If not specified, uses current VFO
|
|
605
|
+
* @returns {Promise<number>} Current tuning step in Hz
|
|
606
|
+
* @example
|
|
607
|
+
* const step = await rig.getTuningStep();
|
|
608
|
+
* console.log(`Current tuning step: ${step} Hz`);
|
|
609
|
+
*/
|
|
610
|
+
async getTuningStep(vfo) {
|
|
611
|
+
if (vfo) {
|
|
612
|
+
return this._nativeInstance.getTuningStep(vfo);
|
|
613
|
+
} else {
|
|
614
|
+
return this._nativeInstance.getTuningStep();
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
// Repeater Control
|
|
619
|
+
|
|
620
|
+
/**
|
|
621
|
+
* Set repeater shift direction
|
|
622
|
+
* @param {string} shift - Repeater shift direction ('NONE', 'MINUS', 'PLUS', '-', '+')
|
|
623
|
+
* @param {string} [vfo] - Optional VFO to set repeater shift on ('VFO-A' or 'VFO-B'). If not specified, uses current VFO
|
|
624
|
+
* @returns {Promise<number>} Success status
|
|
625
|
+
* @example
|
|
626
|
+
* await rig.setRepeaterShift('PLUS'); // Positive shift (+)
|
|
627
|
+
* await rig.setRepeaterShift('MINUS'); // Negative shift (-)
|
|
628
|
+
* await rig.setRepeaterShift('NONE'); // No shift (simplex)
|
|
629
|
+
*/
|
|
630
|
+
async setRepeaterShift(shift, vfo) {
|
|
631
|
+
if (vfo) {
|
|
632
|
+
return this._nativeInstance.setRepeaterShift(shift, vfo);
|
|
633
|
+
} else {
|
|
634
|
+
return this._nativeInstance.setRepeaterShift(shift);
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
/**
|
|
639
|
+
* Get current repeater shift direction
|
|
640
|
+
* @param {string} [vfo] - Optional VFO to get repeater shift from ('VFO-A' or 'VFO-B'). If not specified, uses current VFO
|
|
641
|
+
* @returns {Promise<string>} Current repeater shift direction
|
|
642
|
+
* @example
|
|
643
|
+
* const shift = await rig.getRepeaterShift();
|
|
644
|
+
* console.log(`Repeater shift: ${shift}`); // 'None', 'Minus', or 'Plus'
|
|
645
|
+
*/
|
|
646
|
+
async getRepeaterShift(vfo) {
|
|
647
|
+
if (vfo) {
|
|
648
|
+
return this._nativeInstance.getRepeaterShift(vfo);
|
|
649
|
+
} else {
|
|
650
|
+
return this._nativeInstance.getRepeaterShift();
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
/**
|
|
655
|
+
* Set repeater offset frequency
|
|
656
|
+
* @param {number} offset - Repeater offset in Hz
|
|
657
|
+
* @param {string} [vfo] - Optional VFO to set repeater offset on ('VFO-A' or 'VFO-B'). If not specified, uses current VFO
|
|
658
|
+
* @returns {Promise<number>} Success status
|
|
659
|
+
* @example
|
|
660
|
+
* await rig.setRepeaterOffset(600000); // 600 kHz offset (2m band)
|
|
661
|
+
* await rig.setRepeaterOffset(5000000); // 5 MHz offset (70cm band)
|
|
662
|
+
*/
|
|
663
|
+
async setRepeaterOffset(offset, vfo) {
|
|
664
|
+
if (vfo) {
|
|
665
|
+
return this._nativeInstance.setRepeaterOffset(offset, vfo);
|
|
666
|
+
} else {
|
|
667
|
+
return this._nativeInstance.setRepeaterOffset(offset);
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
/**
|
|
672
|
+
* Get current repeater offset frequency
|
|
673
|
+
* @param {string} [vfo] - Optional VFO to get repeater offset from ('VFO-A' or 'VFO-B'). If not specified, uses current VFO
|
|
674
|
+
* @returns {Promise<number>} Current repeater offset in Hz
|
|
675
|
+
* @example
|
|
676
|
+
* const offset = await rig.getRepeaterOffset();
|
|
677
|
+
* console.log(`Repeater offset: ${offset} Hz`);
|
|
678
|
+
*/
|
|
679
|
+
async getRepeaterOffset(vfo) {
|
|
680
|
+
if (vfo) {
|
|
681
|
+
return this._nativeInstance.getRepeaterOffset(vfo);
|
|
682
|
+
} else {
|
|
683
|
+
return this._nativeInstance.getRepeaterOffset();
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
// CTCSS/DCS Tone Control
|
|
688
|
+
|
|
689
|
+
/**
|
|
690
|
+
* Set CTCSS tone frequency
|
|
691
|
+
* @param {number} tone - CTCSS tone frequency in tenths of Hz (e.g., 1000 for 100.0 Hz)
|
|
692
|
+
* @param {string} [vfo] - Optional VFO ('VFO-A' or 'VFO-B')
|
|
693
|
+
*/
|
|
694
|
+
async setCtcssTone(tone, vfo) {
|
|
695
|
+
if (vfo) {
|
|
696
|
+
return this._nativeInstance.setCtcssTone(tone, vfo);
|
|
697
|
+
} else {
|
|
698
|
+
return this._nativeInstance.setCtcssTone(tone);
|
|
699
|
+
}
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
/**
|
|
703
|
+
* Get current CTCSS tone frequency
|
|
704
|
+
* @param {string} [vfo] - Optional VFO ('VFO-A' or 'VFO-B')
|
|
705
|
+
* @returns {number} Current CTCSS tone frequency in tenths of Hz
|
|
706
|
+
*/
|
|
707
|
+
async getCtcssTone(vfo) {
|
|
708
|
+
if (vfo) {
|
|
709
|
+
return this._nativeInstance.getCtcssTone(vfo);
|
|
710
|
+
} else {
|
|
711
|
+
return this._nativeInstance.getCtcssTone();
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
/**
|
|
716
|
+
* Set DCS code
|
|
717
|
+
* @param {number} code - DCS code (e.g., 23, 174, 754)
|
|
718
|
+
* @param {string} [vfo] - Optional VFO ('VFO-A' or 'VFO-B')
|
|
719
|
+
*/
|
|
720
|
+
async setDcsCode(code, vfo) {
|
|
721
|
+
if (vfo) {
|
|
722
|
+
return this._nativeInstance.setDcsCode(code, vfo);
|
|
723
|
+
} else {
|
|
724
|
+
return this._nativeInstance.setDcsCode(code);
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
/**
|
|
729
|
+
* Get current DCS code
|
|
730
|
+
* @param {string} [vfo] - Optional VFO ('VFO-A' or 'VFO-B')
|
|
731
|
+
* @returns {number} Current DCS code
|
|
732
|
+
*/
|
|
733
|
+
async getDcsCode(vfo) {
|
|
734
|
+
if (vfo) {
|
|
735
|
+
return this._nativeInstance.getDcsCode(vfo);
|
|
736
|
+
} else {
|
|
737
|
+
return this._nativeInstance.getDcsCode();
|
|
738
|
+
}
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
/**
|
|
742
|
+
* Set CTCSS SQL (squelch) tone frequency
|
|
743
|
+
* @param {number} tone - CTCSS SQL tone frequency in tenths of Hz (e.g., 1000 for 100.0 Hz)
|
|
744
|
+
* @param {string} [vfo] - Optional VFO ('VFO-A' or 'VFO-B')
|
|
745
|
+
*/
|
|
746
|
+
async setCtcssSql(tone, vfo) {
|
|
747
|
+
if (vfo) {
|
|
748
|
+
return this._nativeInstance.setCtcssSql(tone, vfo);
|
|
749
|
+
} else {
|
|
750
|
+
return this._nativeInstance.setCtcssSql(tone);
|
|
751
|
+
}
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
/**
|
|
755
|
+
* Get current CTCSS SQL tone frequency
|
|
756
|
+
* @param {string} [vfo] - Optional VFO ('VFO-A' or 'VFO-B')
|
|
757
|
+
* @returns {number} Current CTCSS SQL tone frequency in tenths of Hz
|
|
758
|
+
*/
|
|
759
|
+
async getCtcssSql(vfo) {
|
|
760
|
+
if (vfo) {
|
|
761
|
+
return this._nativeInstance.getCtcssSql(vfo);
|
|
762
|
+
} else {
|
|
763
|
+
return this._nativeInstance.getCtcssSql();
|
|
764
|
+
}
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
/**
|
|
768
|
+
* Set DCS SQL (squelch) code
|
|
769
|
+
* @param {number} code - DCS SQL code (e.g., 23, 174, 754)
|
|
770
|
+
* @param {string} [vfo] - Optional VFO ('VFO-A' or 'VFO-B')
|
|
771
|
+
*/
|
|
772
|
+
async setDcsSql(code, vfo) {
|
|
773
|
+
if (vfo) {
|
|
774
|
+
return this._nativeInstance.setDcsSql(code, vfo);
|
|
775
|
+
} else {
|
|
776
|
+
return this._nativeInstance.setDcsSql(code);
|
|
777
|
+
}
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
/**
|
|
781
|
+
* Get current DCS SQL code
|
|
782
|
+
* @param {string} [vfo] - Optional VFO ('VFO-A' or 'VFO-B')
|
|
783
|
+
* @returns {number} Current DCS SQL code
|
|
784
|
+
*/
|
|
785
|
+
async getDcsSql(vfo) {
|
|
786
|
+
if (vfo) {
|
|
787
|
+
return this._nativeInstance.getDcsSql(vfo);
|
|
788
|
+
} else {
|
|
789
|
+
return this._nativeInstance.getDcsSql();
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
// Parameter Control
|
|
794
|
+
|
|
795
|
+
/**
|
|
796
|
+
* Set radio parameter
|
|
797
|
+
* @param {string} paramName - Parameter name (e.g., 'ANN', 'APO', 'BACKLIGHT', 'BEEP', 'TIME', 'BAT')
|
|
798
|
+
* @param {number} value - Parameter value (numeric)
|
|
799
|
+
*/
|
|
800
|
+
async setParm(paramName, value) {
|
|
801
|
+
return this._nativeInstance.setParm(paramName, value);
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
/**
|
|
805
|
+
* Get radio parameter value
|
|
806
|
+
* @param {string} paramName - Parameter name (e.g., 'ANN', 'APO', 'BACKLIGHT', 'BEEP', 'TIME', 'BAT')
|
|
807
|
+
* @returns {number} Parameter value
|
|
808
|
+
*/
|
|
809
|
+
async getParm(paramName) {
|
|
810
|
+
return this._nativeInstance.getParm(paramName);
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
// DTMF Support
|
|
814
|
+
|
|
815
|
+
/**
|
|
816
|
+
* Send DTMF digits
|
|
817
|
+
* @param {string} digits - DTMF digits to send (0-9, A-D, *, #)
|
|
818
|
+
* @param {string} [vfo] - Optional VFO ('VFO-A' or 'VFO-B')
|
|
819
|
+
*/
|
|
820
|
+
async sendDtmf(digits, vfo) {
|
|
821
|
+
if (vfo) {
|
|
822
|
+
return this._nativeInstance.sendDtmf(digits, vfo);
|
|
823
|
+
} else {
|
|
824
|
+
return this._nativeInstance.sendDtmf(digits);
|
|
825
|
+
}
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
/**
|
|
829
|
+
* Receive DTMF digits
|
|
830
|
+
* @param {number} [maxLength=32] - Maximum number of digits to receive
|
|
831
|
+
* @param {string} [vfo] - Optional VFO ('VFO-A' or 'VFO-B')
|
|
832
|
+
* @returns {Object} Object containing digits and length
|
|
833
|
+
*/
|
|
834
|
+
async recvDtmf(maxLength, vfo) {
|
|
835
|
+
if (vfo) {
|
|
836
|
+
return this._nativeInstance.recvDtmf(maxLength || 32, vfo);
|
|
837
|
+
} else {
|
|
838
|
+
return this._nativeInstance.recvDtmf(maxLength || 32);
|
|
839
|
+
}
|
|
840
|
+
}
|
|
841
|
+
|
|
842
|
+
// Memory Channel Advanced Operations
|
|
843
|
+
|
|
844
|
+
/**
|
|
845
|
+
* Get current memory channel number
|
|
846
|
+
* @param {string} [vfo] - Optional VFO ('VFO-A' or 'VFO-B')
|
|
847
|
+
* @returns {number} Current memory channel number
|
|
848
|
+
*/
|
|
849
|
+
async getMem(vfo) {
|
|
850
|
+
if (vfo) {
|
|
851
|
+
return this._nativeInstance.getMem(vfo);
|
|
852
|
+
} else {
|
|
853
|
+
return this._nativeInstance.getMem();
|
|
854
|
+
}
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
/**
|
|
858
|
+
* Set memory bank
|
|
859
|
+
* @param {number} bank - Bank number to select
|
|
860
|
+
* @param {string} [vfo] - Optional VFO ('VFO-A' or 'VFO-B')
|
|
861
|
+
*/
|
|
862
|
+
async setBank(bank, vfo) {
|
|
863
|
+
if (vfo) {
|
|
864
|
+
return this._nativeInstance.setBank(bank, vfo);
|
|
865
|
+
} else {
|
|
866
|
+
return this._nativeInstance.setBank(bank);
|
|
867
|
+
}
|
|
868
|
+
}
|
|
869
|
+
|
|
870
|
+
/**
|
|
871
|
+
* Get total number of memory channels available
|
|
872
|
+
* @returns {number} Total number of memory channels
|
|
873
|
+
*/
|
|
874
|
+
async memCount() {
|
|
875
|
+
return this._nativeInstance.memCount();
|
|
876
|
+
}
|
|
877
|
+
|
|
878
|
+
// Morse Code Support
|
|
879
|
+
|
|
880
|
+
/**
|
|
881
|
+
* Send Morse code message
|
|
882
|
+
* @param {string} message - Morse code message to send (text will be converted to Morse)
|
|
883
|
+
* @param {string} [vfo] - Optional VFO ('VFO-A' or 'VFO-B')
|
|
884
|
+
*/
|
|
885
|
+
async sendMorse(message, vfo) {
|
|
886
|
+
if (vfo) {
|
|
887
|
+
return this._nativeInstance.sendMorse(message, vfo);
|
|
888
|
+
} else {
|
|
889
|
+
return this._nativeInstance.sendMorse(message);
|
|
890
|
+
}
|
|
891
|
+
}
|
|
892
|
+
|
|
893
|
+
/**
|
|
894
|
+
* Stop current Morse code transmission
|
|
895
|
+
* @param {string} [vfo] - Optional VFO ('VFO-A' or 'VFO-B')
|
|
896
|
+
*/
|
|
897
|
+
async stopMorse(vfo) {
|
|
898
|
+
if (vfo) {
|
|
899
|
+
return this._nativeInstance.stopMorse(vfo);
|
|
900
|
+
} else {
|
|
901
|
+
return this._nativeInstance.stopMorse();
|
|
902
|
+
}
|
|
903
|
+
}
|
|
904
|
+
|
|
905
|
+
/**
|
|
906
|
+
* Wait for Morse code transmission to complete
|
|
907
|
+
* @param {string} [vfo] - Optional VFO ('VFO-A' or 'VFO-B')
|
|
908
|
+
*/
|
|
909
|
+
async waitMorse(vfo) {
|
|
910
|
+
if (vfo) {
|
|
911
|
+
return this._nativeInstance.waitMorse(vfo);
|
|
912
|
+
} else {
|
|
913
|
+
return this._nativeInstance.waitMorse();
|
|
914
|
+
}
|
|
915
|
+
}
|
|
916
|
+
|
|
917
|
+
// Voice Memory Support
|
|
918
|
+
|
|
919
|
+
/**
|
|
920
|
+
* Play voice memory channel
|
|
921
|
+
* @param {number} channel - Voice memory channel number to play
|
|
922
|
+
* @param {string} [vfo] - Optional VFO ('VFO-A' or 'VFO-B')
|
|
923
|
+
*/
|
|
924
|
+
async sendVoiceMem(channel, vfo) {
|
|
925
|
+
if (vfo) {
|
|
926
|
+
return this._nativeInstance.sendVoiceMem(channel, vfo);
|
|
927
|
+
} else {
|
|
928
|
+
return this._nativeInstance.sendVoiceMem(channel);
|
|
929
|
+
}
|
|
930
|
+
}
|
|
931
|
+
|
|
932
|
+
/**
|
|
933
|
+
* Stop voice memory playback
|
|
934
|
+
* @param {string} [vfo] - Optional VFO ('VFO-A' or 'VFO-B')
|
|
935
|
+
*/
|
|
936
|
+
async stopVoiceMem(vfo) {
|
|
937
|
+
if (vfo) {
|
|
938
|
+
return this._nativeInstance.stopVoiceMem(vfo);
|
|
939
|
+
} else {
|
|
940
|
+
return this._nativeInstance.stopVoiceMem();
|
|
941
|
+
}
|
|
942
|
+
}
|
|
943
|
+
|
|
944
|
+
// Complex Split Frequency/Mode Operations
|
|
945
|
+
|
|
946
|
+
/**
|
|
947
|
+
* Set split frequency and mode simultaneously
|
|
948
|
+
* @param {number} txFrequency - TX frequency in Hz
|
|
949
|
+
* @param {string} txMode - TX mode ('USB', 'LSB', 'FM', etc.)
|
|
950
|
+
* @param {number} txWidth - TX bandwidth in Hz
|
|
951
|
+
* @param {string} [vfo] - Optional VFO ('VFO-A' or 'VFO-B')
|
|
952
|
+
*/
|
|
953
|
+
async setSplitFreqMode(txFrequency, txMode, txWidth, vfo) {
|
|
954
|
+
if (vfo) {
|
|
955
|
+
return this._nativeInstance.setSplitFreqMode(txFrequency, txMode, txWidth, vfo);
|
|
956
|
+
} else {
|
|
957
|
+
return this._nativeInstance.setSplitFreqMode(txFrequency, txMode, txWidth);
|
|
958
|
+
}
|
|
959
|
+
}
|
|
960
|
+
|
|
961
|
+
/**
|
|
962
|
+
* Get split frequency and mode information
|
|
963
|
+
* @param {string} [vfo] - Optional VFO ('VFO-A' or 'VFO-B')
|
|
964
|
+
* @returns {Object} Object containing TX frequency, mode, and width
|
|
965
|
+
*/
|
|
966
|
+
async getSplitFreqMode(vfo) {
|
|
967
|
+
if (vfo) {
|
|
968
|
+
return this._nativeInstance.getSplitFreqMode(vfo);
|
|
969
|
+
} else {
|
|
970
|
+
return this._nativeInstance.getSplitFreqMode();
|
|
971
|
+
}
|
|
972
|
+
}
|
|
973
|
+
|
|
974
|
+
// Antenna Control
|
|
975
|
+
|
|
976
|
+
/**
|
|
977
|
+
* Set antenna selection
|
|
978
|
+
* @param {number} antenna - Antenna number to select (1-based)
|
|
979
|
+
* @param {string} [vfo] - Optional VFO ('VFO-A' or 'VFO-B')
|
|
980
|
+
* @returns {Promise<number>} Success status
|
|
981
|
+
* @example
|
|
982
|
+
* await rig.setAntenna(1); // Select antenna 1
|
|
983
|
+
* await rig.setAntenna(2); // Select antenna 2
|
|
984
|
+
*/
|
|
985
|
+
async setAntenna(antenna, vfo) {
|
|
986
|
+
if (vfo) {
|
|
987
|
+
return this._nativeInstance.setAntenna(antenna, vfo);
|
|
988
|
+
} else {
|
|
989
|
+
return this._nativeInstance.setAntenna(antenna);
|
|
990
|
+
}
|
|
991
|
+
}
|
|
992
|
+
|
|
993
|
+
/**
|
|
994
|
+
* Get comprehensive antenna information
|
|
995
|
+
* @param {string} [vfo] - Optional VFO ('VFO-A' or 'VFO-B')
|
|
996
|
+
* @returns {Promise<Object>} Antenna information object containing:
|
|
997
|
+
* - currentAntenna: Currently selected antenna
|
|
998
|
+
* - txAntenna: TX antenna selection
|
|
999
|
+
* - rxAntenna: RX antenna selection
|
|
1000
|
+
* - option: Additional antenna option/parameter
|
|
1001
|
+
* @example
|
|
1002
|
+
* const antennaInfo = await rig.getAntenna();
|
|
1003
|
+
* console.log(`Current: ${antennaInfo.currentAntenna}, TX: ${antennaInfo.txAntenna}, RX: ${antennaInfo.rxAntenna}`);
|
|
1004
|
+
*/
|
|
1005
|
+
async getAntenna(vfo) {
|
|
1006
|
+
if (vfo) {
|
|
1007
|
+
return this._nativeInstance.getAntenna(vfo);
|
|
1008
|
+
} else {
|
|
1009
|
+
return this._nativeInstance.getAntenna();
|
|
1010
|
+
}
|
|
1011
|
+
}
|
|
1012
|
+
|
|
1013
|
+
// Power Conversion Functions
|
|
1014
|
+
|
|
1015
|
+
/**
|
|
1016
|
+
* Convert power level to milliwatts
|
|
1017
|
+
* @param {number} power - Power level (0.0-1.0)
|
|
1018
|
+
* @param {number} frequency - Frequency in Hz
|
|
1019
|
+
* @param {string} mode - Radio mode ('USB', 'LSB', 'FM', etc.)
|
|
1020
|
+
* @returns {Promise<number>} Power in milliwatts
|
|
1021
|
+
* @example
|
|
1022
|
+
* const milliwatts = await rig.power2mW(0.5, 14205000, 'USB');
|
|
1023
|
+
* console.log(`50% power = ${milliwatts} mW`);
|
|
1024
|
+
*/
|
|
1025
|
+
async power2mW(power, frequency, mode) {
|
|
1026
|
+
return this._nativeInstance.power2mW(power, frequency, mode);
|
|
1027
|
+
}
|
|
1028
|
+
|
|
1029
|
+
/**
|
|
1030
|
+
* Convert milliwatts to power level
|
|
1031
|
+
* @param {number} milliwatts - Power in milliwatts
|
|
1032
|
+
* @param {number} frequency - Frequency in Hz
|
|
1033
|
+
* @param {string} mode - Radio mode ('USB', 'LSB', 'FM', etc.)
|
|
1034
|
+
* @returns {Promise<number>} Power level (0.0-1.0)
|
|
1035
|
+
* @example
|
|
1036
|
+
* const powerLevel = await rig.mW2power(5000, 14205000, 'USB');
|
|
1037
|
+
* console.log(`5000 mW = ${(powerLevel * 100).toFixed(1)}% power`);
|
|
1038
|
+
*/
|
|
1039
|
+
async mW2power(milliwatts, frequency, mode) {
|
|
1040
|
+
return this._nativeInstance.mW2power(milliwatts, frequency, mode);
|
|
1041
|
+
}
|
|
1042
|
+
|
|
1043
|
+
// Reset Function
|
|
1044
|
+
|
|
1045
|
+
/**
|
|
1046
|
+
* Reset radio to default state
|
|
1047
|
+
* @param {string} [resetType='SOFT'] - Reset type ('NONE', 'SOFT', 'VFO', 'MCALL', 'MASTER')
|
|
1048
|
+
*/
|
|
1049
|
+
async reset(resetType = 'SOFT') {
|
|
1050
|
+
return this._nativeInstance.reset(resetType);
|
|
1051
|
+
}
|
|
467
1052
|
}
|
|
468
1053
|
|
|
469
1054
|
// Export for CommonJS
|