hamlib 0.1.7 → 0.1.9
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 +60 -9
- package/index.d.ts +73 -15
- package/lib/index.js +33 -11
- 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 +79 -10
package/README.md
CHANGED
|
@@ -5,17 +5,35 @@ Control amateur radio transceivers from Node.js using the [Hamlib](https://hamli
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
7
7
|
- **300+ Supported Radios** - Yaesu, Icom, Kenwood, Elecraft, FlexRadio, and more
|
|
8
|
-
- **Full Async/Promise API** - Non-blocking operations with async/await support
|
|
8
|
+
- **Full Async/Promise API** - Non-blocking operations with async/await support
|
|
9
|
+
- **Comprehensive Serial Control** - 13 parameters for complete serial port configuration
|
|
9
10
|
- **Multiple Connections** - Serial ports, network (rigctld), direct control
|
|
10
11
|
- **TypeScript Ready** - Complete type definitions included
|
|
11
12
|
- **Cross-platform** - Windows, Linux, macOS
|
|
12
13
|
|
|
13
14
|
## Installation
|
|
14
15
|
|
|
16
|
+
### Option 1: NPM Installation (Recommended)
|
|
15
17
|
```bash
|
|
16
18
|
npm install node-hamlib
|
|
17
19
|
```
|
|
18
20
|
|
|
21
|
+
The package will automatically use precompiled binaries if available for your platform, otherwise it will build from source.
|
|
22
|
+
|
|
23
|
+
### Option 2: Manual Prebuilds Installation
|
|
24
|
+
|
|
25
|
+
For faster installation or offline environments, you can manually install precompiled binaries:
|
|
26
|
+
|
|
27
|
+
1. **Download Prebuilds**: Go to [Releases](../../releases) and download `node-hamlib-prebuilds.zip`
|
|
28
|
+
2. **Extract**: Unzip to your project's `node_modules/node-hamlib/prebuilds/` directory
|
|
29
|
+
3. **Install**: Run `npm install node-hamlib --ignore-scripts`
|
|
30
|
+
|
|
31
|
+
**Supported Prebuilt Platforms:**
|
|
32
|
+
- ✅ Linux x64
|
|
33
|
+
- ✅ Linux ARM64
|
|
34
|
+
- ✅ macOS ARM64 (Apple Silicon)
|
|
35
|
+
- ✅ Windows x64
|
|
36
|
+
|
|
19
37
|
## Quick Start
|
|
20
38
|
|
|
21
39
|
```javascript
|
|
@@ -155,17 +173,50 @@ const offset = await rig.getRepeaterOffset();
|
|
|
155
173
|
|
|
156
174
|
### Serial Configuration
|
|
157
175
|
|
|
176
|
+
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.
|
|
177
|
+
|
|
178
|
+
**Important**: Serial configuration must be done **before** calling `rig.open()`.
|
|
179
|
+
|
|
158
180
|
```javascript
|
|
159
|
-
//
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
//
|
|
165
|
-
await rig.
|
|
166
|
-
await rig.
|
|
181
|
+
// Create rig instance
|
|
182
|
+
const rig = new HamLib(1035, '/dev/ttyUSB0');
|
|
183
|
+
|
|
184
|
+
// Configure serial parameters BEFORE opening connection
|
|
185
|
+
await rig.setSerialConfig('rate', '115200'); // Baud rate: 150 to 4000000 bps
|
|
186
|
+
await rig.setSerialConfig('data_bits', '8'); // Data bits: 5, 6, 7, 8
|
|
187
|
+
await rig.setSerialConfig('serial_parity', 'None'); // Parity: None, Even, Odd, Mark, Space
|
|
188
|
+
await rig.setSerialConfig('timeout', '1000'); // Timeout in milliseconds
|
|
189
|
+
await rig.setSerialConfig('write_delay', '10'); // Inter-byte delay (ms)
|
|
190
|
+
|
|
191
|
+
// PTT/DCD configuration (also before opening)
|
|
192
|
+
await rig.setPttType('DTR'); // PTT: RIG, DTR, RTS, NONE, etc.
|
|
193
|
+
await rig.setDcdType('RIG'); // DCD: RIG, DSR, CTS, NONE, etc.
|
|
194
|
+
|
|
195
|
+
// Now open the connection with configured settings
|
|
196
|
+
await rig.open();
|
|
197
|
+
|
|
198
|
+
// Read current settings (can be done anytime)
|
|
199
|
+
const rate = await rig.getSerialConfig('rate');
|
|
200
|
+
const parity = await rig.getSerialConfig('serial_parity');
|
|
167
201
|
```
|
|
168
202
|
|
|
203
|
+
#### Complete Serial Configuration Reference
|
|
204
|
+
|
|
205
|
+
| Category | Parameter | Description | Supported Values |
|
|
206
|
+
|----------|-----------|-------------|------------------|
|
|
207
|
+
| **Basic Serial** | `data_bits` | Number of data bits | `5`, `6`, `7`, `8` |
|
|
208
|
+
| | `stop_bits` | Number of stop bits | `1`, `2` |
|
|
209
|
+
| | `serial_parity` | Parity checking | `None`, `Even`, `Odd`, `Mark`, `Space` |
|
|
210
|
+
| | `serial_handshake` | Flow control | `None`, `Hardware`, `Software` |
|
|
211
|
+
| **Control Signals** | `rts_state` | RTS line state | `ON`, `OFF`, `UNSET` |
|
|
212
|
+
| | `dtr_state` | DTR line state | `ON`, `OFF`, `UNSET` |
|
|
213
|
+
| **Communication** | `rate` | Baud rate (bps) | `150` to `4000000` |
|
|
214
|
+
| | `timeout` | I/O timeout (ms) | Any non-negative integer |
|
|
215
|
+
| | `retry` | Max retry count | Any non-negative integer |
|
|
216
|
+
| **Timing** | `write_delay` | Inter-byte delay (ms) | Any non-negative integer |
|
|
217
|
+
| | `post_write_delay` | Inter-command delay (ms) | Any non-negative integer |
|
|
218
|
+
| **Advanced** | `flushx` | MicroHam flush mode | `true`, `false` |
|
|
219
|
+
|
|
169
220
|
## Complete Example
|
|
170
221
|
|
|
171
222
|
```javascript
|
package/index.d.ts
CHANGED
|
@@ -156,11 +156,43 @@ type VfoOperationType = 'CPY' | 'XCHG' | 'FROM_VFO' | 'TO_VFO' | 'MCL' | 'UP' |
|
|
|
156
156
|
'DOWN' | 'BAND_UP' | 'BAND_DOWN' | 'LEFT' | 'RIGHT' |
|
|
157
157
|
'TUNE' | 'TOGGLE';
|
|
158
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
|
+
|
|
159
182
|
/**
|
|
160
183
|
* Serial configuration parameter names
|
|
161
184
|
*/
|
|
162
|
-
type SerialConfigParam =
|
|
163
|
-
|
|
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';
|
|
164
196
|
|
|
165
197
|
/**
|
|
166
198
|
* PTT (Push-to-Talk) types
|
|
@@ -523,30 +555,55 @@ declare class HamLib {
|
|
|
523
555
|
|
|
524
556
|
/**
|
|
525
557
|
* Set serial port configuration parameter
|
|
526
|
-
* @param paramName Parameter name
|
|
527
|
-
* @param paramValue Parameter value
|
|
558
|
+
* @param paramName Parameter name for serial configuration
|
|
559
|
+
* @param paramValue Parameter value as string
|
|
528
560
|
* @example
|
|
529
|
-
* //
|
|
561
|
+
* // Basic serial settings
|
|
530
562
|
* await hamlib.setSerialConfig('data_bits', '8');
|
|
531
|
-
*
|
|
532
|
-
* // Set parity to even
|
|
563
|
+
* await hamlib.setSerialConfig('stop_bits', '1');
|
|
533
564
|
* await hamlib.setSerialConfig('serial_parity', 'Even');
|
|
534
|
-
*
|
|
535
|
-
* // Set handshake to hardware
|
|
536
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');
|
|
575
|
+
*
|
|
576
|
+
* // Timing control
|
|
577
|
+
* await hamlib.setSerialConfig('write_delay', '10');
|
|
578
|
+
* await hamlib.setSerialConfig('post_write_delay', '50');
|
|
579
|
+
*
|
|
580
|
+
* // Advanced features
|
|
581
|
+
* await hamlib.setSerialConfig('flushx', 'true');
|
|
537
582
|
*/
|
|
538
583
|
setSerialConfig(paramName: SerialConfigParam, paramValue: string): Promise<number>;
|
|
539
584
|
|
|
540
585
|
/**
|
|
541
586
|
* Get serial port configuration parameter
|
|
542
|
-
* @param paramName Parameter name to retrieve
|
|
543
|
-
* @returns Parameter value
|
|
587
|
+
* @param paramName Parameter name to retrieve (any SerialConfigParam)
|
|
588
|
+
* @returns Parameter value as string
|
|
544
589
|
* @example
|
|
545
|
-
* // Get
|
|
590
|
+
* // Get basic serial settings
|
|
546
591
|
* const dataBits = await hamlib.getSerialConfig('data_bits');
|
|
547
|
-
*
|
|
548
|
-
* // Get current parity setting
|
|
549
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');
|
|
599
|
+
*
|
|
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');
|
|
550
607
|
*/
|
|
551
608
|
getSerialConfig(paramName: SerialConfigParam): Promise<string>;
|
|
552
609
|
|
|
@@ -1045,7 +1102,8 @@ declare const nodeHamlib: {
|
|
|
1045
1102
|
// Export types for use elsewhere
|
|
1046
1103
|
export { ConnectionInfo, ModeInfo, SupportedRigInfo, AntennaInfo, VFO, RadioMode, MemoryChannelData,
|
|
1047
1104
|
MemoryChannelInfo, SplitModeInfo, SplitStatusInfo, LevelType, FunctionType,
|
|
1048
|
-
ScanType, VfoOperationType, SerialConfigParam,
|
|
1105
|
+
ScanType, VfoOperationType, SerialConfigParam, SerialBaudRate, SerialParity,
|
|
1106
|
+
SerialHandshake, SerialControlState, PttType, DcdType, SerialConfigOptions, HamLib };
|
|
1049
1107
|
|
|
1050
1108
|
// Support both CommonJS and ES module exports
|
|
1051
1109
|
// @ts-ignore
|
package/lib/index.js
CHANGED
|
@@ -418,17 +418,28 @@ class HamLib {
|
|
|
418
418
|
|
|
419
419
|
/**
|
|
420
420
|
* Set serial port configuration parameter
|
|
421
|
-
*
|
|
421
|
+
*
|
|
422
|
+
* **IMPORTANT: Must be called BEFORE rig.open()**
|
|
423
|
+
* Serial configuration cannot be changed after connection is established.
|
|
424
|
+
*
|
|
425
|
+
* @param {string} paramName - Parameter name:
|
|
426
|
+
* - Serial settings: 'data_bits', 'stop_bits', 'serial_parity', 'serial_handshake'
|
|
427
|
+
* - Control signals: 'rts_state', 'dtr_state'
|
|
428
|
+
* - Communication: 'rate', 'timeout', 'retry'
|
|
429
|
+
* - Timing: 'write_delay', 'post_write_delay'
|
|
430
|
+
* - Advanced: 'flushx'
|
|
422
431
|
* @param {string} paramValue - Parameter value
|
|
423
432
|
* @example
|
|
424
|
-
* //
|
|
425
|
-
*
|
|
433
|
+
* // Configure serial settings BEFORE opening connection
|
|
434
|
+
* const rig = new HamLib(1035, '/dev/ttyUSB0');
|
|
426
435
|
*
|
|
427
|
-
* //
|
|
428
|
-
*
|
|
436
|
+
* // Basic serial settings
|
|
437
|
+
* await rig.setSerialConfig('data_bits', '8');
|
|
438
|
+
* await rig.setSerialConfig('rate', '115200');
|
|
439
|
+
* await rig.setSerialConfig('serial_parity', 'None');
|
|
429
440
|
*
|
|
430
|
-
* //
|
|
431
|
-
*
|
|
441
|
+
* // Now open with configured settings
|
|
442
|
+
* await rig.open();
|
|
432
443
|
*/
|
|
433
444
|
async setSerialConfig(paramName, paramValue) {
|
|
434
445
|
return this._nativeInstance.setSerialConfig(paramName, paramValue);
|
|
@@ -436,14 +447,25 @@ class HamLib {
|
|
|
436
447
|
|
|
437
448
|
/**
|
|
438
449
|
* Get serial port configuration parameter
|
|
439
|
-
* @param {string} paramName - Parameter name to retrieve
|
|
450
|
+
* @param {string} paramName - Parameter name to retrieve (same as setSerialConfig)
|
|
440
451
|
* @returns {string} Parameter value
|
|
441
452
|
* @example
|
|
442
|
-
* // Get
|
|
453
|
+
* // Get basic serial settings
|
|
443
454
|
* const dataBits = hamlib.getSerialConfig('data_bits');
|
|
444
|
-
*
|
|
445
|
-
* // Get current parity setting
|
|
446
455
|
* const parity = hamlib.getSerialConfig('serial_parity');
|
|
456
|
+
* const handshake = hamlib.getSerialConfig('serial_handshake');
|
|
457
|
+
*
|
|
458
|
+
* // Get communication settings
|
|
459
|
+
* const rate = hamlib.getSerialConfig('rate');
|
|
460
|
+
* const timeout = hamlib.getSerialConfig('timeout');
|
|
461
|
+
*
|
|
462
|
+
* // Get control signals state
|
|
463
|
+
* const rtsState = hamlib.getSerialConfig('rts_state');
|
|
464
|
+
* const dtrState = hamlib.getSerialConfig('dtr_state');
|
|
465
|
+
*
|
|
466
|
+
* // Get timing settings
|
|
467
|
+
* const writeDelay = hamlib.getSerialConfig('write_delay');
|
|
468
|
+
* const flushx = hamlib.getSerialConfig('flushx');
|
|
447
469
|
*/
|
|
448
470
|
async getSerialConfig(paramName) {
|
|
449
471
|
return this._nativeInstance.getSerialConfig(paramName);
|
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/src/hamlib.cpp
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
#include <string>
|
|
4
4
|
#include <vector>
|
|
5
5
|
#include <memory>
|
|
6
|
+
#include <algorithm>
|
|
6
7
|
|
|
7
8
|
// Cross-platform compatibility for hamlib token types
|
|
8
9
|
// Linux versions use token_t, some others use hamlib_token_t
|
|
@@ -1185,6 +1186,66 @@ public:
|
|
|
1185
1186
|
}
|
|
1186
1187
|
hamlib_instance_->my_rig->state.rigport.parm.serial.dtr_state = state;
|
|
1187
1188
|
result_code_ = RIG_OK;
|
|
1189
|
+
} else if (param_name_ == "rate") {
|
|
1190
|
+
int rate = std::stoi(param_value_);
|
|
1191
|
+
// Validate supported baud rates based on common values in Hamlib
|
|
1192
|
+
std::vector<int> valid_rates = {150, 300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200,
|
|
1193
|
+
230400, 460800, 500000, 576000, 921600, 1000000, 1152000, 1500000,
|
|
1194
|
+
2000000, 2500000, 3000000, 3500000, 4000000};
|
|
1195
|
+
if (std::find(valid_rates.begin(), valid_rates.end(), rate) != valid_rates.end()) {
|
|
1196
|
+
hamlib_instance_->my_rig->state.rigport.parm.serial.rate = rate;
|
|
1197
|
+
result_code_ = RIG_OK;
|
|
1198
|
+
} else {
|
|
1199
|
+
result_code_ = -RIG_EINVAL;
|
|
1200
|
+
error_message_ = "Invalid baud rate value";
|
|
1201
|
+
}
|
|
1202
|
+
} else if (param_name_ == "timeout") {
|
|
1203
|
+
int timeout_val = std::stoi(param_value_);
|
|
1204
|
+
if (timeout_val >= 0) {
|
|
1205
|
+
hamlib_instance_->my_rig->state.rigport.timeout = timeout_val;
|
|
1206
|
+
result_code_ = RIG_OK;
|
|
1207
|
+
} else {
|
|
1208
|
+
result_code_ = -RIG_EINVAL;
|
|
1209
|
+
error_message_ = "Timeout must be non-negative";
|
|
1210
|
+
}
|
|
1211
|
+
} else if (param_name_ == "retry") {
|
|
1212
|
+
int retry_val = std::stoi(param_value_);
|
|
1213
|
+
if (retry_val >= 0) {
|
|
1214
|
+
hamlib_instance_->my_rig->state.rigport.retry = (short)retry_val;
|
|
1215
|
+
result_code_ = RIG_OK;
|
|
1216
|
+
} else {
|
|
1217
|
+
result_code_ = -RIG_EINVAL;
|
|
1218
|
+
error_message_ = "Retry count must be non-negative";
|
|
1219
|
+
}
|
|
1220
|
+
} else if (param_name_ == "write_delay") {
|
|
1221
|
+
int delay = std::stoi(param_value_);
|
|
1222
|
+
if (delay >= 0) {
|
|
1223
|
+
hamlib_instance_->my_rig->state.rigport.write_delay = delay;
|
|
1224
|
+
result_code_ = RIG_OK;
|
|
1225
|
+
} else {
|
|
1226
|
+
result_code_ = -RIG_EINVAL;
|
|
1227
|
+
error_message_ = "Write delay must be non-negative";
|
|
1228
|
+
}
|
|
1229
|
+
} else if (param_name_ == "post_write_delay") {
|
|
1230
|
+
int delay = std::stoi(param_value_);
|
|
1231
|
+
if (delay >= 0) {
|
|
1232
|
+
hamlib_instance_->my_rig->state.rigport.post_write_delay = delay;
|
|
1233
|
+
result_code_ = RIG_OK;
|
|
1234
|
+
} else {
|
|
1235
|
+
result_code_ = -RIG_EINVAL;
|
|
1236
|
+
error_message_ = "Post write delay must be non-negative";
|
|
1237
|
+
}
|
|
1238
|
+
} else if (param_name_ == "flushx") {
|
|
1239
|
+
if (param_value_ == "true" || param_value_ == "1") {
|
|
1240
|
+
hamlib_instance_->my_rig->state.rigport.flushx = 1;
|
|
1241
|
+
result_code_ = RIG_OK;
|
|
1242
|
+
} else if (param_value_ == "false" || param_value_ == "0") {
|
|
1243
|
+
hamlib_instance_->my_rig->state.rigport.flushx = 0;
|
|
1244
|
+
result_code_ = RIG_OK;
|
|
1245
|
+
} else {
|
|
1246
|
+
result_code_ = -RIG_EINVAL;
|
|
1247
|
+
error_message_ = "Flushx must be true/false or 1/0";
|
|
1248
|
+
}
|
|
1188
1249
|
} else {
|
|
1189
1250
|
result_code_ = -RIG_EINVAL;
|
|
1190
1251
|
error_message_ = "Unknown serial configuration parameter";
|
|
@@ -1278,6 +1339,24 @@ public:
|
|
|
1278
1339
|
break;
|
|
1279
1340
|
}
|
|
1280
1341
|
result_code_ = RIG_OK;
|
|
1342
|
+
} else if (param_name_ == "rate") {
|
|
1343
|
+
param_value_ = std::to_string(hamlib_instance_->my_rig->state.rigport.parm.serial.rate);
|
|
1344
|
+
result_code_ = RIG_OK;
|
|
1345
|
+
} else if (param_name_ == "timeout") {
|
|
1346
|
+
param_value_ = std::to_string(hamlib_instance_->my_rig->state.rigport.timeout);
|
|
1347
|
+
result_code_ = RIG_OK;
|
|
1348
|
+
} else if (param_name_ == "retry") {
|
|
1349
|
+
param_value_ = std::to_string(hamlib_instance_->my_rig->state.rigport.retry);
|
|
1350
|
+
result_code_ = RIG_OK;
|
|
1351
|
+
} else if (param_name_ == "write_delay") {
|
|
1352
|
+
param_value_ = std::to_string(hamlib_instance_->my_rig->state.rigport.write_delay);
|
|
1353
|
+
result_code_ = RIG_OK;
|
|
1354
|
+
} else if (param_name_ == "post_write_delay") {
|
|
1355
|
+
param_value_ = std::to_string(hamlib_instance_->my_rig->state.rigport.post_write_delay);
|
|
1356
|
+
result_code_ = RIG_OK;
|
|
1357
|
+
} else if (param_name_ == "flushx") {
|
|
1358
|
+
param_value_ = hamlib_instance_->my_rig->state.rigport.flushx ? "true" : "false";
|
|
1359
|
+
result_code_ = RIG_OK;
|
|
1281
1360
|
} else {
|
|
1282
1361
|
result_code_ = -RIG_EINVAL;
|
|
1283
1362
|
error_message_ = "Unknown serial configuration parameter";
|
|
@@ -3400,11 +3479,6 @@ Napi::Value NodeHamLib::GetSupportedRigs(const Napi::CallbackInfo& info) {
|
|
|
3400
3479
|
Napi::Value NodeHamLib::SetSerialConfig(const Napi::CallbackInfo& info) {
|
|
3401
3480
|
Napi::Env env = info.Env();
|
|
3402
3481
|
|
|
3403
|
-
if (!rig_is_open) {
|
|
3404
|
-
Napi::TypeError::New(env, "Rig is not open!").ThrowAsJavaScriptException();
|
|
3405
|
-
return env.Null();
|
|
3406
|
-
}
|
|
3407
|
-
|
|
3408
3482
|
if (info.Length() < 2 || !info[0].IsString() || !info[1].IsString()) {
|
|
3409
3483
|
Napi::TypeError::New(env, "Expected parameter name and value as strings").ThrowAsJavaScriptException();
|
|
3410
3484
|
return env.Null();
|
|
@@ -3422,11 +3496,6 @@ Napi::Value NodeHamLib::SetSerialConfig(const Napi::CallbackInfo& info) {
|
|
|
3422
3496
|
Napi::Value NodeHamLib::GetSerialConfig(const Napi::CallbackInfo& info) {
|
|
3423
3497
|
Napi::Env env = info.Env();
|
|
3424
3498
|
|
|
3425
|
-
if (!rig_is_open) {
|
|
3426
|
-
Napi::TypeError::New(env, "Rig is not open!").ThrowAsJavaScriptException();
|
|
3427
|
-
return env.Null();
|
|
3428
|
-
}
|
|
3429
|
-
|
|
3430
3499
|
if (info.Length() < 1 || !info[0].IsString()) {
|
|
3431
3500
|
Napi::TypeError::New(env, "Expected parameter name as string").ThrowAsJavaScriptException();
|
|
3432
3501
|
return env.Null();
|