hamlib 0.1.8 → 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 +32 -7
- package/lib/index.js +12 -19
- 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 +0 -10
package/README.md
CHANGED
|
@@ -13,10 +13,27 @@ Control amateur radio transceivers from Node.js using the [Hamlib](https://hamli
|
|
|
13
13
|
|
|
14
14
|
## Installation
|
|
15
15
|
|
|
16
|
+
### Option 1: NPM Installation (Recommended)
|
|
16
17
|
```bash
|
|
17
|
-
npm install hamlib
|
|
18
|
+
npm install node-hamlib
|
|
18
19
|
```
|
|
19
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
|
+
|
|
20
37
|
## Quick Start
|
|
21
38
|
|
|
22
39
|
```javascript
|
|
@@ -158,21 +175,29 @@ const offset = await rig.getRepeaterOffset();
|
|
|
158
175
|
|
|
159
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.
|
|
160
177
|
|
|
178
|
+
**Important**: Serial configuration must be done **before** calling `rig.open()`.
|
|
179
|
+
|
|
161
180
|
```javascript
|
|
162
|
-
//
|
|
181
|
+
// Create rig instance
|
|
182
|
+
const rig = new HamLib(1035, '/dev/ttyUSB0');
|
|
183
|
+
|
|
184
|
+
// Configure serial parameters BEFORE opening connection
|
|
163
185
|
await rig.setSerialConfig('rate', '115200'); // Baud rate: 150 to 4000000 bps
|
|
164
186
|
await rig.setSerialConfig('data_bits', '8'); // Data bits: 5, 6, 7, 8
|
|
165
187
|
await rig.setSerialConfig('serial_parity', 'None'); // Parity: None, Even, Odd, Mark, Space
|
|
166
188
|
await rig.setSerialConfig('timeout', '1000'); // Timeout in milliseconds
|
|
167
189
|
await rig.setSerialConfig('write_delay', '10'); // Inter-byte delay (ms)
|
|
168
190
|
|
|
169
|
-
//
|
|
170
|
-
const rate = await rig.getSerialConfig('rate');
|
|
171
|
-
const parity = await rig.getSerialConfig('serial_parity');
|
|
172
|
-
|
|
173
|
-
// PTT/DCD configuration
|
|
191
|
+
// PTT/DCD configuration (also before opening)
|
|
174
192
|
await rig.setPttType('DTR'); // PTT: RIG, DTR, RTS, NONE, etc.
|
|
175
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');
|
|
176
201
|
```
|
|
177
202
|
|
|
178
203
|
#### Complete Serial Configuration Reference
|
package/lib/index.js
CHANGED
|
@@ -418,6 +418,10 @@ class HamLib {
|
|
|
418
418
|
|
|
419
419
|
/**
|
|
420
420
|
* Set serial port configuration parameter
|
|
421
|
+
*
|
|
422
|
+
* **IMPORTANT: Must be called BEFORE rig.open()**
|
|
423
|
+
* Serial configuration cannot be changed after connection is established.
|
|
424
|
+
*
|
|
421
425
|
* @param {string} paramName - Parameter name:
|
|
422
426
|
* - Serial settings: 'data_bits', 'stop_bits', 'serial_parity', 'serial_handshake'
|
|
423
427
|
* - Control signals: 'rts_state', 'dtr_state'
|
|
@@ -426,27 +430,16 @@ class HamLib {
|
|
|
426
430
|
* - Advanced: 'flushx'
|
|
427
431
|
* @param {string} paramValue - Parameter value
|
|
428
432
|
* @example
|
|
429
|
-
* //
|
|
430
|
-
*
|
|
431
|
-
* hamlib.setSerialConfig('stop_bits', '1');
|
|
432
|
-
* hamlib.setSerialConfig('serial_parity', 'Even');
|
|
433
|
-
* hamlib.setSerialConfig('serial_handshake', 'Hardware');
|
|
433
|
+
* // Configure serial settings BEFORE opening connection
|
|
434
|
+
* const rig = new HamLib(1035, '/dev/ttyUSB0');
|
|
434
435
|
*
|
|
435
|
-
* //
|
|
436
|
-
*
|
|
437
|
-
*
|
|
438
|
-
*
|
|
439
|
-
* // Communication settings
|
|
440
|
-
* hamlib.setSerialConfig('rate', '115200');
|
|
441
|
-
* hamlib.setSerialConfig('timeout', '1000');
|
|
442
|
-
* hamlib.setSerialConfig('retry', '3');
|
|
443
|
-
*
|
|
444
|
-
* // Timing control
|
|
445
|
-
* hamlib.setSerialConfig('write_delay', '10');
|
|
446
|
-
* hamlib.setSerialConfig('post_write_delay', '50');
|
|
436
|
+
* // Basic serial settings
|
|
437
|
+
* await rig.setSerialConfig('data_bits', '8');
|
|
438
|
+
* await rig.setSerialConfig('rate', '115200');
|
|
439
|
+
* await rig.setSerialConfig('serial_parity', 'None');
|
|
447
440
|
*
|
|
448
|
-
* //
|
|
449
|
-
*
|
|
441
|
+
* // Now open with configured settings
|
|
442
|
+
* await rig.open();
|
|
450
443
|
*/
|
|
451
444
|
async setSerialConfig(paramName, paramValue) {
|
|
452
445
|
return this._nativeInstance.setSerialConfig(paramName, paramValue);
|
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/src/hamlib.cpp
CHANGED
|
@@ -3479,11 +3479,6 @@ Napi::Value NodeHamLib::GetSupportedRigs(const Napi::CallbackInfo& info) {
|
|
|
3479
3479
|
Napi::Value NodeHamLib::SetSerialConfig(const Napi::CallbackInfo& info) {
|
|
3480
3480
|
Napi::Env env = info.Env();
|
|
3481
3481
|
|
|
3482
|
-
if (!rig_is_open) {
|
|
3483
|
-
Napi::TypeError::New(env, "Rig is not open!").ThrowAsJavaScriptException();
|
|
3484
|
-
return env.Null();
|
|
3485
|
-
}
|
|
3486
|
-
|
|
3487
3482
|
if (info.Length() < 2 || !info[0].IsString() || !info[1].IsString()) {
|
|
3488
3483
|
Napi::TypeError::New(env, "Expected parameter name and value as strings").ThrowAsJavaScriptException();
|
|
3489
3484
|
return env.Null();
|
|
@@ -3501,11 +3496,6 @@ Napi::Value NodeHamLib::SetSerialConfig(const Napi::CallbackInfo& info) {
|
|
|
3501
3496
|
Napi::Value NodeHamLib::GetSerialConfig(const Napi::CallbackInfo& info) {
|
|
3502
3497
|
Napi::Env env = info.Env();
|
|
3503
3498
|
|
|
3504
|
-
if (!rig_is_open) {
|
|
3505
|
-
Napi::TypeError::New(env, "Rig is not open!").ThrowAsJavaScriptException();
|
|
3506
|
-
return env.Null();
|
|
3507
|
-
}
|
|
3508
|
-
|
|
3509
3499
|
if (info.Length() < 1 || !info[0].IsString()) {
|
|
3510
3500
|
Napi::TypeError::New(env, "Expected parameter name as string").ThrowAsJavaScriptException();
|
|
3511
3501
|
return env.Null();
|