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/index.d.ts CHANGED
@@ -42,6 +42,20 @@ interface SupportedRigInfo {
42
42
  rigType: string;
43
43
  }
44
44
 
45
+ /**
46
+ * Antenna information interface
47
+ */
48
+ interface AntennaInfo {
49
+ /** Currently selected antenna */
50
+ currentAntenna: number;
51
+ /** TX antenna selection */
52
+ txAntenna: number;
53
+ /** RX antenna selection */
54
+ rxAntenna: number;
55
+ /** Additional antenna option/parameter */
56
+ option: number;
57
+ }
58
+
45
59
  /**
46
60
  * VFO type
47
61
  */
@@ -142,11 +156,43 @@ type VfoOperationType = 'CPY' | 'XCHG' | 'FROM_VFO' | 'TO_VFO' | 'MCL' | 'UP' |
142
156
  'DOWN' | 'BAND_UP' | 'BAND_DOWN' | 'LEFT' | 'RIGHT' |
143
157
  'TUNE' | 'TOGGLE';
144
158
 
159
+ /**
160
+ * Supported baud rates for serial communication
161
+ */
162
+ type SerialBaudRate = '150' | '300' | '600' | '1200' | '2400' | '4800' | '9600' | '19200' |
163
+ '38400' | '57600' | '115200' | '230400' | '460800' | '500000' |
164
+ '576000' | '921600' | '1000000' | '1152000' | '1500000' | '2000000' |
165
+ '2500000' | '3000000' | '3500000' | '4000000';
166
+
167
+ /**
168
+ * Serial parity values
169
+ */
170
+ type SerialParity = 'None' | 'Even' | 'Odd' | 'Mark' | 'Space';
171
+
172
+ /**
173
+ * Serial handshake values
174
+ */
175
+ type SerialHandshake = 'None' | 'Hardware' | 'Software';
176
+
177
+ /**
178
+ * Serial control signal states
179
+ */
180
+ type SerialControlState = 'ON' | 'OFF' | 'UNSET';
181
+
145
182
  /**
146
183
  * Serial configuration parameter names
147
184
  */
148
- type SerialConfigParam = 'data_bits' | 'stop_bits' | 'serial_parity' | 'serial_handshake' |
149
- 'rts_state' | 'dtr_state';
185
+ type SerialConfigParam =
186
+ // Basic serial settings
187
+ 'data_bits' | 'stop_bits' | 'serial_parity' | 'serial_handshake' |
188
+ // Control signals
189
+ 'rts_state' | 'dtr_state' |
190
+ // Communication settings
191
+ 'rate' | 'timeout' | 'retry' |
192
+ // Timing control
193
+ 'write_delay' | 'post_write_delay' |
194
+ // Advanced features
195
+ 'flushx';
150
196
 
151
197
  /**
152
198
  * PTT (Push-to-Talk) types
@@ -248,12 +294,13 @@ declare class HamLib {
248
294
  * Set radio mode
249
295
  * @param mode Radio mode (such as 'USB', 'LSB', 'FM', 'PKTFM')
250
296
  * @param bandwidth Optional bandwidth setting ('narrow', 'wide', or default)
251
- * @note Operates on the current VFO (RIG_VFO_CURR)
297
+ * @param vfo Optional VFO to set mode on ('VFO-A' or 'VFO-B'). If not specified, uses current VFO
252
298
  * @example
253
299
  * await rig.setMode('USB');
254
300
  * await rig.setMode('FM', 'narrow');
301
+ * await rig.setMode('USB', 'wide', 'VFO-A');
255
302
  */
256
- setMode(mode: RadioMode, bandwidth?: 'narrow' | 'wide'): Promise<number>;
303
+ setMode(mode: RadioMode, bandwidth?: 'narrow' | 'wide', vfo?: VFO): Promise<number>;
257
304
 
258
305
  /**
259
306
  * Set PTT (Push-to-Talk) status
@@ -288,10 +335,13 @@ declare class HamLib {
288
335
 
289
336
  /**
290
337
  * Get current signal strength
338
+ * @param vfo Optional VFO to get signal strength from ('VFO-A' or 'VFO-B'). If not specified, uses current VFO
291
339
  * @returns Signal strength value
292
- * @note Operates on the current VFO (RIG_VFO_CURR)
340
+ * @example
341
+ * const strength = await rig.getStrength(); // Get strength from current VFO
342
+ * const strengthA = await rig.getStrength('VFO-A'); // Get strength from VFO-A
293
343
  */
294
- getStrength(): Promise<number>;
344
+ getStrength(vfo?: VFO): Promise<number>;
295
345
 
296
346
  /**
297
347
  * Close connection to device
@@ -318,7 +368,7 @@ declare class HamLib {
318
368
  * @param channelNumber Memory channel number
319
369
  * @param channelData Channel data (frequency, mode, description, etc.)
320
370
  */
321
- setMemoryChannel(channelNumber: number, channelData: MemoryChannelData): void;
371
+ setMemoryChannel(channelNumber: number, channelData: MemoryChannelData): Promise<number>;
322
372
 
323
373
  /**
324
374
  * Get memory channel data
@@ -326,13 +376,13 @@ declare class HamLib {
326
376
  * @param readOnly Whether to read in read-only mode (default: true)
327
377
  * @returns Channel data
328
378
  */
329
- getMemoryChannel(channelNumber: number, readOnly?: boolean): MemoryChannelInfo;
379
+ getMemoryChannel(channelNumber: number, readOnly?: boolean): Promise<MemoryChannelInfo>;
330
380
 
331
381
  /**
332
382
  * Select memory channel for operation
333
383
  * @param channelNumber Memory channel number to select
334
384
  */
335
- selectMemoryChannel(channelNumber: number): void;
385
+ selectMemoryChannel(channelNumber: number): Promise<number>;
336
386
 
337
387
  // RIT/XIT Control
338
388
 
@@ -340,45 +390,53 @@ declare class HamLib {
340
390
  * Set RIT (Receiver Incremental Tuning) offset
341
391
  * @param offsetHz RIT offset in Hz
342
392
  */
343
- setRit(offsetHz: number): void;
393
+ setRit(offsetHz: number): Promise<number>;
344
394
 
345
395
  /**
346
396
  * Get current RIT offset
347
397
  * @returns RIT offset in Hz
348
398
  */
349
- getRit(): number;
399
+ getRit(): Promise<number>;
350
400
 
351
401
  /**
352
402
  * Set XIT (Transmitter Incremental Tuning) offset
353
403
  * @param offsetHz XIT offset in Hz
354
404
  */
355
- setXit(offsetHz: number): void;
405
+ setXit(offsetHz: number): Promise<number>;
356
406
 
357
407
  /**
358
408
  * Get current XIT offset
359
409
  * @returns XIT offset in Hz
360
410
  */
361
- getXit(): number;
411
+ getXit(): Promise<number>;
362
412
 
363
413
  /**
364
414
  * Clear both RIT and XIT offsets
365
415
  * @returns Success status
366
416
  */
367
- clearRitXit(): boolean;
417
+ clearRitXit(): Promise<number>;
368
418
 
369
419
  // Scanning Operations
370
420
 
371
421
  /**
372
422
  * Start scanning operation
373
423
  * @param scanType Scan type ('VFO', 'MEM', 'PROG', 'DELTA', 'PRIO')
374
- * @param channel Optional channel number for some scan types
424
+ * @param callback Callback function
425
+ */
426
+ startScan(scanType: ScanType): Promise<number>;
427
+
428
+ /**
429
+ * Start scanning operation with channel
430
+ * @param scanType Scan type ('VFO', 'MEM', 'PROG', 'DELTA', 'PRIO')
431
+ * @param channel Channel number for some scan types
432
+ * @param callback Callback function
375
433
  */
376
- startScan(scanType: ScanType, channel?: number): void;
434
+ startScan(scanType: ScanType, channel: number): Promise<number>;
377
435
 
378
436
  /**
379
437
  * Stop scanning operation
380
438
  */
381
- stopScan(): void;
439
+ stopScan(): Promise<number>;
382
440
 
383
441
  // Level Controls
384
442
 
@@ -387,14 +445,14 @@ declare class HamLib {
387
445
  * @param levelType Level type ('AF', 'RF', 'SQL', 'RFPOWER', etc.)
388
446
  * @param value Level value (0.0-1.0 typically)
389
447
  */
390
- setLevel(levelType: LevelType, value: number): void;
448
+ setLevel(levelType: LevelType, value: number): Promise<number>;
391
449
 
392
450
  /**
393
451
  * Get radio level
394
452
  * @param levelType Level type ('AF', 'RF', 'SQL', 'STRENGTH', etc.)
395
453
  * @returns Level value
396
454
  */
397
- getLevel(levelType: LevelType): number;
455
+ getLevel(levelType: LevelType): Promise<number>;
398
456
 
399
457
  /**
400
458
  * Get list of supported level types
@@ -409,14 +467,14 @@ declare class HamLib {
409
467
  * @param functionType Function type ('NB', 'COMP', 'VOX', 'TONE', etc.)
410
468
  * @param enable true to enable, false to disable
411
469
  */
412
- setFunction(functionType: FunctionType, enable: boolean): void;
470
+ setFunction(functionType: FunctionType, enable: boolean): Promise<number>;
413
471
 
414
472
  /**
415
473
  * Get radio function status
416
474
  * @param functionType Function type ('NB', 'COMP', 'VOX', 'TONE', etc.)
417
475
  * @returns Function enabled status
418
476
  */
419
- getFunction(functionType: FunctionType): boolean;
477
+ getFunction(functionType: FunctionType): Promise<boolean>;
420
478
 
421
479
  /**
422
480
  * Get list of supported function types
@@ -429,40 +487,57 @@ declare class HamLib {
429
487
  /**
430
488
  * Set split mode TX frequency
431
489
  * @param txFrequency TX frequency in Hz
490
+ * @param vfo Optional VFO to set TX frequency on ('VFO-A' or 'VFO-B'). If not specified, uses current VFO
432
491
  */
433
- setSplitFreq(txFrequency: number): void;
492
+ setSplitFreq(txFrequency: number, vfo?: VFO): Promise<number>;
434
493
 
435
494
  /**
436
495
  * Get split mode TX frequency
496
+ * @param vfo Optional VFO to get TX frequency from ('VFO-A' or 'VFO-B'). If not specified, uses current VFO
437
497
  * @returns TX frequency in Hz
438
498
  */
439
- getSplitFreq(): number;
499
+ getSplitFreq(vfo?: VFO): Promise<number>;
440
500
 
441
501
  /**
442
502
  * Set split mode TX mode
443
503
  * @param txMode TX mode ('USB', 'LSB', 'FM', etc.)
444
- * @param txWidth Optional TX bandwidth
504
+ * @param vfo Optional VFO to set TX mode on ('VFO-A' or 'VFO-B'). If not specified, uses current VFO
445
505
  */
446
- setSplitMode(txMode: RadioMode, txWidth?: number): void;
506
+ setSplitMode(txMode: RadioMode, vfo?: VFO): Promise<number>;
507
+
508
+ /**
509
+ * Set split mode TX mode with width
510
+ * @param txMode TX mode ('USB', 'LSB', 'FM', etc.)
511
+ * @param txWidth TX bandwidth
512
+ * @param vfo Optional VFO to set TX mode on ('VFO-A' or 'VFO-B'). If not specified, uses current VFO
513
+ */
514
+ setSplitMode(txMode: RadioMode, txWidth: number, vfo?: VFO): Promise<number>;
447
515
 
448
516
  /**
449
517
  * Get split mode TX mode
518
+ * @param vfo Optional VFO to get TX mode from ('VFO-A' or 'VFO-B'). If not specified, uses current VFO
450
519
  * @returns TX mode and width
451
520
  */
452
- getSplitMode(): SplitModeInfo;
521
+ getSplitMode(vfo?: VFO): Promise<SplitModeInfo>;
453
522
 
454
523
  /**
455
524
  * Enable/disable split operation
456
525
  * @param enable true to enable split, false to disable
457
- * @param txVfo TX VFO ('VFO-A' or 'VFO-B')
526
+ * @param rxVfo Optional RX VFO ('VFO-A' or 'VFO-B'). If not specified, uses current VFO
527
+ * @param txVfo Optional TX VFO ('VFO-A' or 'VFO-B'). If not specified, uses VFO-B
528
+ * @example
529
+ * await rig.setSplit(true); // Enable split with defaults
530
+ * await rig.setSplit(true, 'VFO-A'); // Enable split, RX on VFO-A, TX on VFO-B
531
+ * await rig.setSplit(true, 'VFO-A', 'VFO-B'); // Enable split, explicit RX and TX VFOs
458
532
  */
459
- setSplit(enable: boolean, txVfo?: VFO): void;
533
+ setSplit(enable: boolean, rxVfo?: VFO, txVfo?: VFO): Promise<number>;
460
534
 
461
535
  /**
462
536
  * Get split operation status
537
+ * @param vfo Optional VFO to get status from ('VFO-A' or 'VFO-B'). If not specified, uses current VFO
463
538
  * @returns Split status and TX VFO
464
539
  */
465
- getSplit(): SplitStatusInfo;
540
+ getSplit(vfo?: VFO): Promise<SplitStatusInfo>;
466
541
 
467
542
  // VFO Operations
468
543
 
@@ -470,94 +545,109 @@ declare class HamLib {
470
545
  * Perform VFO operation
471
546
  * @param operation VFO operation ('CPY', 'XCHG', 'FROM_VFO', 'TO_VFO', etc.)
472
547
  */
473
- vfoOperation(operation: VfoOperationType): void;
548
+ vfoOperation(operation: VfoOperationType): Promise<number>;
474
549
 
475
550
  // Antenna Selection
476
551
 
477
- /**
478
- * Set antenna
479
- * @param antenna Antenna number (1, 2, 3, etc.)
480
- */
481
- setAntenna(antenna: number): void;
482
-
483
- /**
484
- * Get current antenna
485
- * @returns Current antenna number
486
- */
487
- getAntenna(): number;
552
+ // Note: setAntenna and getAntenna are defined later with full VFO support
488
553
 
489
554
  // Serial Port Configuration
490
555
 
491
556
  /**
492
557
  * Set serial port configuration parameter
493
- * @param paramName Parameter name ('data_bits', 'stop_bits', 'serial_parity', 'serial_handshake', 'rts_state', 'dtr_state')
494
- * @param paramValue Parameter value
558
+ * @param paramName Parameter name for serial configuration
559
+ * @param paramValue Parameter value as string
495
560
  * @example
496
- * // Set data bits to 8
497
- * hamlib.setSerialConfig('data_bits', '8');
561
+ * // Basic serial settings
562
+ * await hamlib.setSerialConfig('data_bits', '8');
563
+ * await hamlib.setSerialConfig('stop_bits', '1');
564
+ * await hamlib.setSerialConfig('serial_parity', 'Even');
565
+ * await hamlib.setSerialConfig('serial_handshake', 'Hardware');
566
+ *
567
+ * // Control signals
568
+ * await hamlib.setSerialConfig('rts_state', 'ON');
569
+ * await hamlib.setSerialConfig('dtr_state', 'OFF');
570
+ *
571
+ * // Communication settings
572
+ * await hamlib.setSerialConfig('rate', '115200');
573
+ * await hamlib.setSerialConfig('timeout', '1000');
574
+ * await hamlib.setSerialConfig('retry', '3');
498
575
  *
499
- * // Set parity to even
500
- * hamlib.setSerialConfig('serial_parity', 'Even');
576
+ * // Timing control
577
+ * await hamlib.setSerialConfig('write_delay', '10');
578
+ * await hamlib.setSerialConfig('post_write_delay', '50');
501
579
  *
502
- * // Set handshake to hardware
503
- * hamlib.setSerialConfig('serial_handshake', 'Hardware');
580
+ * // Advanced features
581
+ * await hamlib.setSerialConfig('flushx', 'true');
504
582
  */
505
- setSerialConfig(paramName: SerialConfigParam, paramValue: string): void;
583
+ setSerialConfig(paramName: SerialConfigParam, paramValue: string): Promise<number>;
506
584
 
507
585
  /**
508
586
  * Get serial port configuration parameter
509
- * @param paramName Parameter name to retrieve
510
- * @returns Parameter value
587
+ * @param paramName Parameter name to retrieve (any SerialConfigParam)
588
+ * @returns Parameter value as string
511
589
  * @example
512
- * // Get current data bits setting
513
- * const dataBits = hamlib.getSerialConfig('data_bits');
590
+ * // Get basic serial settings
591
+ * const dataBits = await hamlib.getSerialConfig('data_bits');
592
+ * const parity = await hamlib.getSerialConfig('serial_parity');
593
+ * const handshake = await hamlib.getSerialConfig('serial_handshake');
594
+ *
595
+ * // Get communication settings
596
+ * const rate = await hamlib.getSerialConfig('rate');
597
+ * const timeout = await hamlib.getSerialConfig('timeout');
598
+ * const retry = await hamlib.getSerialConfig('retry');
514
599
  *
515
- * // Get current parity setting
516
- * const parity = hamlib.getSerialConfig('serial_parity');
600
+ * // Get control signals
601
+ * const rtsState = await hamlib.getSerialConfig('rts_state');
602
+ * const dtrState = await hamlib.getSerialConfig('dtr_state');
603
+ *
604
+ * // Get timing and advanced settings
605
+ * const writeDelay = await hamlib.getSerialConfig('write_delay');
606
+ * const flushx = await hamlib.getSerialConfig('flushx');
517
607
  */
518
- getSerialConfig(paramName: SerialConfigParam): string;
608
+ getSerialConfig(paramName: SerialConfigParam): Promise<string>;
519
609
 
520
610
  /**
521
611
  * Set PTT (Push-to-Talk) type
522
612
  * @param pttType PTT type ('RIG', 'DTR', 'RTS', 'PARALLEL', 'CM108', 'GPIO', 'GPION', 'NONE')
523
613
  * @example
524
614
  * // Use DTR line for PTT
525
- * hamlib.setPttType('DTR');
615
+ * await hamlib.setPttType('DTR');
526
616
  *
527
617
  * // Use RTS line for PTT
528
- * hamlib.setPttType('RTS');
618
+ * await hamlib.setPttType('RTS');
529
619
  *
530
620
  * // Use CAT command for PTT
531
- * hamlib.setPttType('RIG');
621
+ * await hamlib.setPttType('RIG');
532
622
  */
533
- setPttType(pttType: PttType): void;
623
+ setPttType(pttType: PttType): Promise<number>;
534
624
 
535
625
  /**
536
626
  * Get current PTT type
537
627
  * @returns Current PTT type
538
628
  */
539
- getPttType(): string;
629
+ getPttType(): Promise<string>;
540
630
 
541
631
  /**
542
632
  * Set DCD (Data Carrier Detect) type
543
633
  * @param dcdType DCD type ('RIG', 'DSR', 'CTS', 'CD', 'PARALLEL', 'CM108', 'GPIO', 'GPION', 'NONE')
544
634
  * @example
545
635
  * // Use DSR line for DCD
546
- * hamlib.setDcdType('DSR');
636
+ * await hamlib.setDcdType('DSR');
547
637
  *
548
638
  * // Use CTS line for DCD
549
- * hamlib.setDcdType('CTS');
639
+ * await hamlib.setDcdType('CTS');
550
640
  *
551
641
  * // Use CAT command for DCD
552
- * hamlib.setDcdType('RIG');
642
+ * await hamlib.setDcdType('RIG');
553
643
  */
554
- setDcdType(dcdType: DcdType): void;
644
+ setDcdType(dcdType: DcdType): Promise<number>;
555
645
 
556
646
  /**
557
647
  * Get current DCD type
558
648
  * @returns Current DCD type
559
649
  */
560
- getDcdType(): string;
650
+ getDcdType(): Promise<string>;
561
651
 
562
652
  /**
563
653
  * Get supported serial configuration options
@@ -568,6 +658,438 @@ declare class HamLib {
568
658
  * console.log('Supported PTT types:', configs.ptt_type);
569
659
  */
570
660
  getSupportedSerialConfigs(): SerialConfigOptions;
661
+
662
+ // Power Control
663
+
664
+ /**
665
+ * Set radio power status
666
+ * @param status Power status (0=OFF, 1=ON, 2=STANDBY, 4=OPERATE, 8=UNKNOWN)
667
+ * @returns Success status
668
+ * @example
669
+ * await rig.setPowerstat(1); // Power on
670
+ * await rig.setPowerstat(0); // Power off
671
+ * await rig.setPowerstat(2); // Standby mode
672
+ */
673
+ setPowerstat(status: number): Promise<number>;
674
+
675
+ /**
676
+ * Get current radio power status
677
+ * @returns Power status (0=OFF, 1=ON, 2=STANDBY, 4=OPERATE, 8=UNKNOWN)
678
+ * @example
679
+ * const powerStatus = await rig.getPowerstat();
680
+ * if (powerStatus === 1) {
681
+ * console.log('Radio is powered on');
682
+ * }
683
+ */
684
+ getPowerstat(): Promise<number>;
685
+
686
+ // PTT Status Detection
687
+
688
+ /**
689
+ * Get current PTT status
690
+ * @param vfo Optional VFO to get PTT status from ('VFO-A' or 'VFO-B'). If not specified, uses current VFO
691
+ * @returns PTT status (true if transmitting, false if receiving)
692
+ * @example
693
+ * const isTransmitting = await rig.getPtt();
694
+ * if (isTransmitting) {
695
+ * console.log('Radio is transmitting');
696
+ * }
697
+ */
698
+ getPtt(vfo?: VFO): Promise<boolean>;
699
+
700
+ // Data Carrier Detect
701
+
702
+ /**
703
+ * Get current DCD (Data Carrier Detect) status
704
+ * @param vfo Optional VFO to get DCD status from ('VFO-A' or 'VFO-B'). If not specified, uses current VFO
705
+ * @returns DCD status (true if carrier detected, false if no carrier)
706
+ * @example
707
+ * const carrierDetected = await rig.getDcd();
708
+ * if (carrierDetected) {
709
+ * console.log('Carrier detected');
710
+ * }
711
+ */
712
+ getDcd(vfo?: VFO): Promise<boolean>;
713
+
714
+ // Tuning Step Control
715
+
716
+ /**
717
+ * Set tuning step
718
+ * @param step Tuning step in Hz
719
+ * @param vfo Optional VFO to set tuning step on ('VFO-A' or 'VFO-B'). If not specified, uses current VFO
720
+ * @returns Success status
721
+ * @example
722
+ * await rig.setTuningStep(25000); // 25 kHz steps
723
+ * await rig.setTuningStep(12500); // 12.5 kHz steps
724
+ * await rig.setTuningStep(100); // 100 Hz steps for HF
725
+ */
726
+ setTuningStep(step: number, vfo?: VFO): Promise<number>;
727
+
728
+ /**
729
+ * Get current tuning step
730
+ * @param vfo Optional VFO to get tuning step from ('VFO-A' or 'VFO-B'). If not specified, uses current VFO
731
+ * @returns Current tuning step in Hz
732
+ * @example
733
+ * const step = await rig.getTuningStep();
734
+ * console.log(`Current tuning step: ${step} Hz`);
735
+ */
736
+ getTuningStep(vfo?: VFO): Promise<number>;
737
+
738
+ // Repeater Control
739
+
740
+ /**
741
+ * Set repeater shift direction
742
+ * @param shift Repeater shift direction ('NONE', 'MINUS', 'PLUS', '-', '+')
743
+ * @param vfo Optional VFO to set repeater shift on ('VFO-A' or 'VFO-B'). If not specified, uses current VFO
744
+ * @returns Success status
745
+ * @example
746
+ * await rig.setRepeaterShift('PLUS'); // Positive shift (+)
747
+ * await rig.setRepeaterShift('MINUS'); // Negative shift (-)
748
+ * await rig.setRepeaterShift('NONE'); // No shift (simplex)
749
+ */
750
+ setRepeaterShift(shift: 'NONE' | 'MINUS' | 'PLUS' | '-' | '+' | 'none' | 'minus' | 'plus', vfo?: VFO): Promise<number>;
751
+
752
+ /**
753
+ * Get current repeater shift direction
754
+ * @param vfo Optional VFO to get repeater shift from ('VFO-A' or 'VFO-B'). If not specified, uses current VFO
755
+ * @returns Current repeater shift direction
756
+ * @example
757
+ * const shift = await rig.getRepeaterShift();
758
+ * console.log(`Repeater shift: ${shift}`); // 'None', 'Minus', or 'Plus'
759
+ */
760
+ getRepeaterShift(vfo?: VFO): Promise<string>;
761
+
762
+ /**
763
+ * Set repeater offset frequency
764
+ * @param offset Repeater offset in Hz
765
+ * @param vfo Optional VFO to set repeater offset on ('VFO-A' or 'VFO-B'). If not specified, uses current VFO
766
+ * @returns Success status
767
+ * @example
768
+ * await rig.setRepeaterOffset(600000); // 600 kHz offset (2m band)
769
+ * await rig.setRepeaterOffset(5000000); // 5 MHz offset (70cm band)
770
+ */
771
+ setRepeaterOffset(offset: number, vfo?: VFO): Promise<number>;
772
+
773
+ /**
774
+ * Get current repeater offset frequency
775
+ * @param vfo Optional VFO to get repeater offset from ('VFO-A' or 'VFO-B'). If not specified, uses current VFO
776
+ * @returns Current repeater offset in Hz
777
+ * @example
778
+ * const offset = await rig.getRepeaterOffset();
779
+ * console.log(`Repeater offset: ${offset} Hz`);
780
+ */
781
+ getRepeaterOffset(vfo?: VFO): Promise<number>;
782
+
783
+ // CTCSS/DCS Tone Control
784
+
785
+ /**
786
+ * Set CTCSS tone frequency
787
+ * @param tone CTCSS tone frequency in tenths of Hz (e.g., 1000 for 100.0 Hz)
788
+ * @param vfo Optional VFO to set tone on ('VFO-A' or 'VFO-B'). If not specified, uses current VFO
789
+ * @returns Success status
790
+ * @example
791
+ * await rig.setCtcssTone(1000); // Set 100.0 Hz CTCSS tone
792
+ * await rig.setCtcssTone(1318); // Set 131.8 Hz CTCSS tone
793
+ */
794
+ setCtcssTone(tone: number, vfo?: VFO): Promise<number>;
795
+
796
+ /**
797
+ * Get current CTCSS tone frequency
798
+ * @param vfo Optional VFO to get tone from ('VFO-A' or 'VFO-B'). If not specified, uses current VFO
799
+ * @returns Current CTCSS tone frequency in tenths of Hz
800
+ * @example
801
+ * const tone = await rig.getCtcssTone();
802
+ * console.log(`CTCSS tone: ${tone / 10} Hz`);
803
+ */
804
+ getCtcssTone(vfo?: VFO): Promise<number>;
805
+
806
+ /**
807
+ * Set DCS code
808
+ * @param code DCS code (e.g., 23, 174, 754)
809
+ * @param vfo Optional VFO to set code on ('VFO-A' or 'VFO-B'). If not specified, uses current VFO
810
+ * @returns Success status
811
+ * @example
812
+ * await rig.setDcsCode(23); // Set DCS code 023
813
+ * await rig.setDcsCode(174); // Set DCS code 174
814
+ */
815
+ setDcsCode(code: number, vfo?: VFO): Promise<number>;
816
+
817
+ /**
818
+ * Get current DCS code
819
+ * @param vfo Optional VFO to get code from ('VFO-A' or 'VFO-B'). If not specified, uses current VFO
820
+ * @returns Current DCS code
821
+ * @example
822
+ * const code = await rig.getDcsCode();
823
+ * console.log(`DCS code: ${code.toString().padStart(3, '0')}`);
824
+ */
825
+ getDcsCode(vfo?: VFO): Promise<number>;
826
+
827
+ /**
828
+ * Set CTCSS SQL (squelch) tone frequency
829
+ * @param tone CTCSS SQL tone frequency in tenths of Hz (e.g., 1000 for 100.0 Hz)
830
+ * @param vfo Optional VFO to set tone on ('VFO-A' or 'VFO-B'). If not specified, uses current VFO
831
+ * @returns Success status
832
+ * @example
833
+ * await rig.setCtcssSql(1000); // Set 100.0 Hz CTCSS SQL tone
834
+ */
835
+ setCtcssSql(tone: number, vfo?: VFO): Promise<number>;
836
+
837
+ /**
838
+ * Get current CTCSS SQL tone frequency
839
+ * @param vfo Optional VFO to get tone from ('VFO-A' or 'VFO-B'). If not specified, uses current VFO
840
+ * @returns Current CTCSS SQL tone frequency in tenths of Hz
841
+ * @example
842
+ * const tone = await rig.getCtcssSql();
843
+ * console.log(`CTCSS SQL tone: ${tone / 10} Hz`);
844
+ */
845
+ getCtcssSql(vfo?: VFO): Promise<number>;
846
+
847
+ /**
848
+ * Set DCS SQL (squelch) code
849
+ * @param code DCS SQL code (e.g., 23, 174, 754)
850
+ * @param vfo Optional VFO to set code on ('VFO-A' or 'VFO-B'). If not specified, uses current VFO
851
+ * @returns Success status
852
+ * @example
853
+ * await rig.setDcsSql(23); // Set DCS SQL code 023
854
+ */
855
+ setDcsSql(code: number, vfo?: VFO): Promise<number>;
856
+
857
+ /**
858
+ * Get current DCS SQL code
859
+ * @param vfo Optional VFO to get code from ('VFO-A' or 'VFO-B'). If not specified, uses current VFO
860
+ * @returns Current DCS SQL code
861
+ * @example
862
+ * const code = await rig.getDcsSql();
863
+ * console.log(`DCS SQL code: ${code.toString().padStart(3, '0')}`);
864
+ */
865
+ getDcsSql(vfo?: VFO): Promise<number>;
866
+
867
+ // Parameter Control
868
+
869
+ /**
870
+ * Set radio parameter
871
+ * @param paramName Parameter name (e.g., 'ANN', 'APO', 'BACKLIGHT', 'BEEP', 'TIME', 'BAT')
872
+ * @param value Parameter value (numeric)
873
+ * @returns Success status
874
+ * @example
875
+ * await rig.setParm('BACKLIGHT', 0.5); // Set backlight to 50%
876
+ * await rig.setParm('BEEP', 1); // Enable beep
877
+ */
878
+ setParm(paramName: string, value: number): Promise<number>;
879
+
880
+ /**
881
+ * Get radio parameter value
882
+ * @param paramName Parameter name (e.g., 'ANN', 'APO', 'BACKLIGHT', 'BEEP', 'TIME', 'BAT')
883
+ * @returns Parameter value
884
+ * @example
885
+ * const backlight = await rig.getParm('BACKLIGHT');
886
+ * const beep = await rig.getParm('BEEP');
887
+ */
888
+ getParm(paramName: string): Promise<number>;
889
+
890
+ // DTMF Support
891
+
892
+ /**
893
+ * Send DTMF digits
894
+ * @param digits DTMF digits to send (0-9, A-D, *, #)
895
+ * @param vfo Optional VFO to send from ('VFO-A' or 'VFO-B'). If not specified, uses current VFO
896
+ * @returns Success status
897
+ * @example
898
+ * await rig.sendDtmf('1234'); // Send DTMF sequence 1234
899
+ * await rig.sendDtmf('*70#'); // Send *70# sequence
900
+ */
901
+ sendDtmf(digits: string, vfo?: VFO): Promise<number>;
902
+
903
+ /**
904
+ * Receive DTMF digits
905
+ * @param maxLength Maximum number of digits to receive (default: 32)
906
+ * @param vfo Optional VFO to receive from ('VFO-A' or 'VFO-B'). If not specified, uses current VFO
907
+ * @returns Received DTMF digits and count
908
+ * @example
909
+ * const result = await rig.recvDtmf(10);
910
+ * console.log(`Received DTMF: ${result.digits} (${result.length} digits)`);
911
+ */
912
+ recvDtmf(maxLength?: number, vfo?: VFO): Promise<{digits: string, length: number}>;
913
+
914
+ // Memory Channel Advanced Operations
915
+
916
+ /**
917
+ * Get current memory channel number
918
+ * @param vfo Optional VFO to get memory channel from ('VFO-A' or 'VFO-B'). If not specified, uses current VFO
919
+ * @returns Current memory channel number
920
+ * @example
921
+ * const currentChannel = await rig.getMem();
922
+ * console.log(`Current memory channel: ${currentChannel}`);
923
+ */
924
+ getMem(vfo?: VFO): Promise<number>;
925
+
926
+ /**
927
+ * Set memory bank
928
+ * @param bank Bank number to select
929
+ * @param vfo Optional VFO to set bank on ('VFO-A' or 'VFO-B'). If not specified, uses current VFO
930
+ * @returns Success status
931
+ * @example
932
+ * await rig.setBank(1); // Select memory bank 1
933
+ * await rig.setBank(2); // Select memory bank 2
934
+ */
935
+ setBank(bank: number, vfo?: VFO): Promise<number>;
936
+
937
+ /**
938
+ * Get total number of memory channels available
939
+ * @returns Total number of memory channels
940
+ * @example
941
+ * const totalChannels = await rig.memCount();
942
+ * console.log(`Total memory channels: ${totalChannels}`);
943
+ */
944
+ memCount(): Promise<number>;
945
+
946
+ // Morse Code Support
947
+
948
+ /**
949
+ * Send Morse code message
950
+ * @param message Morse code message to send (text will be converted to Morse)
951
+ * @param vfo Optional VFO to send from ('VFO-A' or 'VFO-B'). If not specified, uses current VFO
952
+ * @returns Success status
953
+ * @example
954
+ * await rig.sendMorse('CQ CQ DE VK3ABC K'); // Send CQ call
955
+ * await rig.sendMorse('TEST MSG'); // Send test message
956
+ */
957
+ sendMorse(message: string, vfo?: VFO): Promise<number>;
958
+
959
+ /**
960
+ * Stop current Morse code transmission
961
+ * @param vfo Optional VFO to stop ('VFO-A' or 'VFO-B'). If not specified, uses current VFO
962
+ * @returns Success status
963
+ * @example
964
+ * await rig.stopMorse(); // Stop ongoing Morse transmission
965
+ */
966
+ stopMorse(vfo?: VFO): Promise<number>;
967
+
968
+ /**
969
+ * Wait for Morse code transmission to complete
970
+ * @param vfo Optional VFO to wait on ('VFO-A' or 'VFO-B'). If not specified, uses current VFO
971
+ * @returns Success status when transmission completes
972
+ * @example
973
+ * await rig.sendMorse('TEST');
974
+ * await rig.waitMorse(); // Wait for transmission to complete
975
+ */
976
+ waitMorse(vfo?: VFO): Promise<number>;
977
+
978
+ // Voice Memory Support
979
+
980
+ /**
981
+ * Play voice memory channel
982
+ * @param channel Voice memory channel number to play
983
+ * @param vfo Optional VFO to play from ('VFO-A' or 'VFO-B'). If not specified, uses current VFO
984
+ * @returns Success status
985
+ * @example
986
+ * await rig.sendVoiceMem(1); // Play voice memory channel 1
987
+ * await rig.sendVoiceMem(3); // Play voice memory channel 3
988
+ */
989
+ sendVoiceMem(channel: number, vfo?: VFO): Promise<number>;
990
+
991
+ /**
992
+ * Stop voice memory playback
993
+ * @param vfo Optional VFO to stop ('VFO-A' or 'VFO-B'). If not specified, uses current VFO
994
+ * @returns Success status
995
+ * @example
996
+ * await rig.stopVoiceMem(); // Stop ongoing voice memory playback
997
+ */
998
+ stopVoiceMem(vfo?: VFO): Promise<number>;
999
+
1000
+ // Complex Split Frequency/Mode Operations
1001
+
1002
+ /**
1003
+ * Set split frequency and mode simultaneously
1004
+ * @param txFrequency TX frequency in Hz
1005
+ * @param txMode TX mode ('USB', 'LSB', 'FM', etc.)
1006
+ * @param txWidth TX bandwidth in Hz
1007
+ * @param vfo Optional VFO for split operation ('VFO-A' or 'VFO-B'). If not specified, uses current VFO
1008
+ * @returns Success status
1009
+ * @example
1010
+ * await rig.setSplitFreqMode(14205000, 'USB', 2400); // Set split: TX on 14.205 MHz USB 2400Hz width
1011
+ * await rig.setSplitFreqMode(145520000, 'FM', 15000); // Set split: TX on 145.52 MHz FM 15kHz width
1012
+ */
1013
+ setSplitFreqMode(txFrequency: number, txMode: RadioMode, txWidth: number, vfo?: VFO): Promise<number>;
1014
+
1015
+ /**
1016
+ * Get split frequency and mode information
1017
+ * @param vfo Optional VFO to get split info from ('VFO-A' or 'VFO-B'). If not specified, uses current VFO
1018
+ * @returns Object containing TX frequency, mode, and width
1019
+ * @example
1020
+ * const splitInfo = await rig.getSplitFreqMode();
1021
+ * console.log(`Split TX: ${splitInfo.txFrequency} Hz, Mode: ${splitInfo.txMode}, Width: ${splitInfo.txWidth} Hz`);
1022
+ */
1023
+ getSplitFreqMode(vfo?: VFO): Promise<{txFrequency: number, txMode: string, txWidth: number}>;
1024
+
1025
+ // Antenna Control
1026
+
1027
+ /**
1028
+ * Set antenna selection
1029
+ * @param antenna Antenna number to select (1-based)
1030
+ * @param vfo Optional VFO to set antenna on ('VFO-A' or 'VFO-B'). If not specified, uses current VFO
1031
+ * @returns Success status
1032
+ * @example
1033
+ * await rig.setAntenna(1); // Select antenna 1
1034
+ * await rig.setAntenna(2); // Select antenna 2
1035
+ */
1036
+ setAntenna(antenna: number, vfo?: VFO): Promise<number>;
1037
+
1038
+ /**
1039
+ * Get comprehensive antenna information
1040
+ * @param vfo Optional VFO to get antenna info from ('VFO-A' or 'VFO-B'). If not specified, uses current VFO
1041
+ * @returns Antenna information object containing current, TX, RX antenna settings and option
1042
+ * @example
1043
+ * const antennaInfo = await rig.getAntenna();
1044
+ * console.log(`Current: ${antennaInfo.currentAntenna}`);
1045
+ * console.log(`TX: ${antennaInfo.txAntenna}, RX: ${antennaInfo.rxAntenna}`);
1046
+ * console.log(`Option: ${antennaInfo.option}`);
1047
+ */
1048
+ getAntenna(vfo?: VFO): Promise<AntennaInfo>;
1049
+
1050
+ // Power Conversion Functions
1051
+
1052
+ /**
1053
+ * Convert power level to milliwatts
1054
+ * @param power Power level (0.0-1.0, where 1.0 = 100% power)
1055
+ * @param frequency Frequency in Hz
1056
+ * @param mode Radio mode ('USB', 'LSB', 'FM', 'AM', etc.)
1057
+ * @returns Power in milliwatts
1058
+ * @example
1059
+ * const milliwatts = await rig.power2mW(0.5, 14205000, 'USB');
1060
+ * console.log(`50% power = ${milliwatts} mW`);
1061
+ */
1062
+ power2mW(power: number, frequency: number, mode: RadioMode): Promise<number>;
1063
+
1064
+ /**
1065
+ * Convert milliwatts to power level
1066
+ * @param milliwatts Power in milliwatts
1067
+ * @param frequency Frequency in Hz
1068
+ * @param mode Radio mode ('USB', 'LSB', 'FM', 'AM', etc.)
1069
+ * @returns Power level (0.0-1.0, where 1.0 = 100% power)
1070
+ * @example
1071
+ * const powerLevel = await rig.mW2power(5000, 14205000, 'USB');
1072
+ * console.log(`5000 mW = ${(powerLevel * 100).toFixed(1)}% power`);
1073
+ */
1074
+ mW2power(milliwatts: number, frequency: number, mode: RadioMode): Promise<number>;
1075
+
1076
+ // Reset Function
1077
+
1078
+ /**
1079
+ * Reset radio to default state
1080
+ * @param resetType Reset type ('NONE', 'SOFT', 'VFO', 'MCALL', 'MASTER'). Default: 'SOFT'
1081
+ * - NONE: No reset
1082
+ * - SOFT: Soft reset (preserve some settings)
1083
+ * - VFO: VFO reset
1084
+ * - MCALL: Memory clear
1085
+ * - MASTER: Master reset (complete factory reset)
1086
+ * @returns Success status
1087
+ * @example
1088
+ * await rig.reset('SOFT'); // Soft reset
1089
+ * await rig.reset('MASTER'); // Factory reset (CAUTION: loses all settings!)
1090
+ * await rig.reset(); // Default soft reset
1091
+ */
1092
+ reset(resetType?: 'NONE' | 'SOFT' | 'VFO' | 'MCALL' | 'MASTER'): Promise<number>;
571
1093
  }
572
1094
 
573
1095
  /**
@@ -578,10 +1100,12 @@ declare const nodeHamlib: {
578
1100
  };
579
1101
 
580
1102
  // Export types for use elsewhere
581
- export { ConnectionInfo, ModeInfo, SupportedRigInfo, VFO, RadioMode, MemoryChannelData,
1103
+ export { ConnectionInfo, ModeInfo, SupportedRigInfo, AntennaInfo, VFO, RadioMode, MemoryChannelData,
582
1104
  MemoryChannelInfo, SplitModeInfo, SplitStatusInfo, LevelType, FunctionType,
583
- ScanType, VfoOperationType, SerialConfigParam, PttType, DcdType, SerialConfigOptions, HamLib };
1105
+ ScanType, VfoOperationType, SerialConfigParam, SerialBaudRate, SerialParity,
1106
+ SerialHandshake, SerialControlState, PttType, DcdType, SerialConfigOptions, HamLib };
584
1107
 
585
1108
  // Support both CommonJS and ES module exports
1109
+ // @ts-ignore
586
1110
  export = nodeHamlib;
587
1111
  export default nodeHamlib;