hamlib 0.1.2 → 0.1.4

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
@@ -24,6 +24,24 @@ interface ModeInfo {
24
24
  width: number;
25
25
  }
26
26
 
27
+ /**
28
+ * Supported rig information interface
29
+ */
30
+ interface SupportedRigInfo {
31
+ /** Rig model number */
32
+ rigModel: number;
33
+ /** Model name */
34
+ modelName: string;
35
+ /** Manufacturer name */
36
+ mfgName: string;
37
+ /** Driver version */
38
+ version: string;
39
+ /** Driver status (Alpha, Beta, Stable, etc.) */
40
+ status: string;
41
+ /** Rig type (Transceiver, Handheld, Mobile, etc.) */
42
+ rigType: string;
43
+ }
44
+
27
45
  /**
28
46
  * VFO type
29
47
  */
@@ -34,6 +52,96 @@ type VFO = 'VFO-A' | 'VFO-B';
34
52
  */
35
53
  type RadioMode = 'USB' | 'LSB' | 'FM' | 'PKTFM' | 'AM' | 'CW' | 'RTTY' | 'DIG' | string;
36
54
 
55
+ /**
56
+ * Memory channel data interface
57
+ */
58
+ interface MemoryChannelData {
59
+ /** Channel frequency in Hz */
60
+ frequency?: number;
61
+ /** Radio mode */
62
+ mode?: RadioMode;
63
+ /** Bandwidth */
64
+ bandwidth?: number;
65
+ /** Channel description */
66
+ description?: string;
67
+ /** TX frequency for split operation */
68
+ txFrequency?: number;
69
+ /** CTCSS tone frequency */
70
+ ctcssTone?: number;
71
+ }
72
+
73
+ /**
74
+ * Memory channel info interface
75
+ */
76
+ interface MemoryChannelInfo {
77
+ /** Channel number */
78
+ channelNumber: number;
79
+ /** Channel frequency */
80
+ frequency: number;
81
+ /** Radio mode */
82
+ mode: string;
83
+ /** Bandwidth */
84
+ bandwidth: number;
85
+ /** Channel description */
86
+ description: string;
87
+ /** Split operation enabled */
88
+ split: boolean;
89
+ /** TX frequency (if split enabled) */
90
+ txFrequency?: number;
91
+ /** CTCSS tone frequency */
92
+ ctcssTone?: number;
93
+ }
94
+
95
+ /**
96
+ * Split mode info interface
97
+ */
98
+ interface SplitModeInfo {
99
+ /** TX mode */
100
+ mode: string;
101
+ /** TX bandwidth */
102
+ width: number;
103
+ }
104
+
105
+ /**
106
+ * Split status info interface
107
+ */
108
+ interface SplitStatusInfo {
109
+ /** Split enabled status */
110
+ enabled: boolean;
111
+ /** TX VFO */
112
+ txVfo: string;
113
+ }
114
+
115
+ /**
116
+ * Level type
117
+ */
118
+ type LevelType = 'AF' | 'RF' | 'SQL' | 'RFPOWER' | 'MICGAIN' | 'IF' | 'APF' | 'NR' |
119
+ 'PBT_IN' | 'PBT_OUT' | 'CWPITCH' | 'KEYSPD' | 'NOTCHF' | 'COMP' |
120
+ 'AGC' | 'BKINDL' | 'BALANCE' | 'VOXGAIN' | 'VOXDELAY' | 'ANTIVOX' |
121
+ 'STRENGTH' | 'RAWSTR' | 'SWR' | 'ALC' | 'RFPOWER_METER' |
122
+ 'COMP_METER' | 'VD_METER' | 'ID_METER' | 'TEMP_METER' | string;
123
+
124
+ /**
125
+ * Function type
126
+ */
127
+ type FunctionType = 'FAGC' | 'NB' | 'COMP' | 'VOX' | 'TONE' | 'TSQL' | 'SBKIN' |
128
+ 'FBKIN' | 'ANF' | 'NR' | 'AIP' | 'APF' | 'TUNER' | 'XIT' |
129
+ 'RIT' | 'LOCK' | 'MUTE' | 'VSC' | 'REV' | 'SQL' | 'ABM' |
130
+ 'BC' | 'MBC' | 'AFC' | 'SATMODE' | 'SCOPE' | 'RESUME' |
131
+ 'TBURST' | string;
132
+
133
+ /**
134
+ * Scan type
135
+ */
136
+ type ScanType = 'VFO' | 'MEM' | 'PROG' | 'DELTA' | 'PRIO';
137
+
138
+ /**
139
+ * VFO operation type
140
+ */
141
+ type VfoOperationType = 'CPY' | 'XCHG' | 'FROM_VFO' | 'TO_VFO' | 'MCL' | 'UP' |
142
+ 'DOWN' | 'BAND_UP' | 'BAND_DOWN' | 'LEFT' | 'RIGHT' |
143
+ 'TUNE' | 'TOGGLE';
144
+
37
145
  /**
38
146
  * HamLib class - for controlling amateur radio devices
39
147
  */
@@ -57,6 +165,19 @@ declare class HamLib {
57
165
  */
58
166
  constructor(model: number, port?: string);
59
167
 
168
+ /**
169
+ * Get list of all supported radio models
170
+ * @returns Array of supported radio models with details
171
+ * @static
172
+ * @example
173
+ * const supportedRigs = HamLib.getSupportedRigs();
174
+ * console.log(`Found ${supportedRigs.length} supported rigs`);
175
+ * supportedRigs.forEach(rig => {
176
+ * console.log(`${rig.rigModel}: ${rig.mfgName} ${rig.modelName} (${rig.status})`);
177
+ * });
178
+ */
179
+ static getSupportedRigs(): SupportedRigInfo[];
180
+
60
181
  /**
61
182
  * Open connection to device
62
183
  * Must be called before other operations
@@ -148,6 +269,181 @@ declare class HamLib {
148
269
  * @returns Object containing connection type, port path, connection status, and model numbers
149
270
  */
150
271
  getConnectionInfo(): ConnectionInfo;
272
+
273
+ // Memory Channel Management
274
+
275
+ /**
276
+ * Set memory channel data
277
+ * @param channelNumber Memory channel number
278
+ * @param channelData Channel data (frequency, mode, description, etc.)
279
+ */
280
+ setMemoryChannel(channelNumber: number, channelData: MemoryChannelData): void;
281
+
282
+ /**
283
+ * Get memory channel data
284
+ * @param channelNumber Memory channel number
285
+ * @param readOnly Whether to read in read-only mode (default: true)
286
+ * @returns Channel data
287
+ */
288
+ getMemoryChannel(channelNumber: number, readOnly?: boolean): MemoryChannelInfo;
289
+
290
+ /**
291
+ * Select memory channel for operation
292
+ * @param channelNumber Memory channel number to select
293
+ */
294
+ selectMemoryChannel(channelNumber: number): void;
295
+
296
+ // RIT/XIT Control
297
+
298
+ /**
299
+ * Set RIT (Receiver Incremental Tuning) offset
300
+ * @param offsetHz RIT offset in Hz
301
+ */
302
+ setRit(offsetHz: number): void;
303
+
304
+ /**
305
+ * Get current RIT offset
306
+ * @returns RIT offset in Hz
307
+ */
308
+ getRit(): number;
309
+
310
+ /**
311
+ * Set XIT (Transmitter Incremental Tuning) offset
312
+ * @param offsetHz XIT offset in Hz
313
+ */
314
+ setXit(offsetHz: number): void;
315
+
316
+ /**
317
+ * Get current XIT offset
318
+ * @returns XIT offset in Hz
319
+ */
320
+ getXit(): number;
321
+
322
+ /**
323
+ * Clear both RIT and XIT offsets
324
+ * @returns Success status
325
+ */
326
+ clearRitXit(): boolean;
327
+
328
+ // Scanning Operations
329
+
330
+ /**
331
+ * Start scanning operation
332
+ * @param scanType Scan type ('VFO', 'MEM', 'PROG', 'DELTA', 'PRIO')
333
+ * @param channel Optional channel number for some scan types
334
+ */
335
+ startScan(scanType: ScanType, channel?: number): void;
336
+
337
+ /**
338
+ * Stop scanning operation
339
+ */
340
+ stopScan(): void;
341
+
342
+ // Level Controls
343
+
344
+ /**
345
+ * Set radio level (gain, volume, etc.)
346
+ * @param levelType Level type ('AF', 'RF', 'SQL', 'RFPOWER', etc.)
347
+ * @param value Level value (0.0-1.0 typically)
348
+ */
349
+ setLevel(levelType: LevelType, value: number): void;
350
+
351
+ /**
352
+ * Get radio level
353
+ * @param levelType Level type ('AF', 'RF', 'SQL', 'STRENGTH', etc.)
354
+ * @returns Level value
355
+ */
356
+ getLevel(levelType: LevelType): number;
357
+
358
+ /**
359
+ * Get list of supported level types
360
+ * @returns Array of supported level types
361
+ */
362
+ getSupportedLevels(): string[];
363
+
364
+ // Function Controls
365
+
366
+ /**
367
+ * Set radio function on/off
368
+ * @param functionType Function type ('NB', 'COMP', 'VOX', 'TONE', etc.)
369
+ * @param enable true to enable, false to disable
370
+ */
371
+ setFunction(functionType: FunctionType, enable: boolean): void;
372
+
373
+ /**
374
+ * Get radio function status
375
+ * @param functionType Function type ('NB', 'COMP', 'VOX', 'TONE', etc.)
376
+ * @returns Function enabled status
377
+ */
378
+ getFunction(functionType: FunctionType): boolean;
379
+
380
+ /**
381
+ * Get list of supported function types
382
+ * @returns Array of supported function types
383
+ */
384
+ getSupportedFunctions(): string[];
385
+
386
+ // Split Operations
387
+
388
+ /**
389
+ * Set split mode TX frequency
390
+ * @param txFrequency TX frequency in Hz
391
+ */
392
+ setSplitFreq(txFrequency: number): void;
393
+
394
+ /**
395
+ * Get split mode TX frequency
396
+ * @returns TX frequency in Hz
397
+ */
398
+ getSplitFreq(): number;
399
+
400
+ /**
401
+ * Set split mode TX mode
402
+ * @param txMode TX mode ('USB', 'LSB', 'FM', etc.)
403
+ * @param txWidth Optional TX bandwidth
404
+ */
405
+ setSplitMode(txMode: RadioMode, txWidth?: number): void;
406
+
407
+ /**
408
+ * Get split mode TX mode
409
+ * @returns TX mode and width
410
+ */
411
+ getSplitMode(): SplitModeInfo;
412
+
413
+ /**
414
+ * Enable/disable split operation
415
+ * @param enable true to enable split, false to disable
416
+ * @param txVfo TX VFO ('VFO-A' or 'VFO-B')
417
+ */
418
+ setSplit(enable: boolean, txVfo?: VFO): void;
419
+
420
+ /**
421
+ * Get split operation status
422
+ * @returns Split status and TX VFO
423
+ */
424
+ getSplit(): SplitStatusInfo;
425
+
426
+ // VFO Operations
427
+
428
+ /**
429
+ * Perform VFO operation
430
+ * @param operation VFO operation ('CPY', 'XCHG', 'FROM_VFO', 'TO_VFO', etc.)
431
+ */
432
+ vfoOperation(operation: VfoOperationType): void;
433
+
434
+ // Antenna Selection
435
+
436
+ /**
437
+ * Set antenna
438
+ * @param antenna Antenna number (1, 2, 3, etc.)
439
+ */
440
+ setAntenna(antenna: number): void;
441
+
442
+ /**
443
+ * Get current antenna
444
+ * @returns Current antenna number
445
+ */
446
+ getAntenna(): number;
151
447
  }
152
448
 
153
449
  /**
@@ -158,7 +454,9 @@ declare const nodeHamlib: {
158
454
  };
159
455
 
160
456
  // Export types for use elsewhere
161
- export { ConnectionInfo, ModeInfo, VFO, RadioMode, HamLib };
457
+ export { ConnectionInfo, ModeInfo, SupportedRigInfo, VFO, RadioMode, MemoryChannelData,
458
+ MemoryChannelInfo, SplitModeInfo, SplitStatusInfo, LevelType, FunctionType,
459
+ ScanType, VfoOperationType, HamLib };
162
460
 
163
461
  // Support both CommonJS and ES module exports
164
462
  export = nodeHamlib;
@@ -35,11 +35,11 @@ function getPlatformBinaryPath() {
35
35
  */
36
36
  function loadNativeModule() {
37
37
  const possiblePaths = [
38
- // First try prebuilt binary
39
- getPlatformBinaryPath(),
40
- // Fallback to locally compiled binary
38
+ // First try locally compiled binary (prioritize latest features)
41
39
  path.join(__dirname, '..', 'build', 'Release', 'hamlib.node'),
42
40
  path.join(__dirname, '..', 'build', 'Debug', 'hamlib.node'),
41
+ // Fallback to prebuilt binary
42
+ getPlatformBinaryPath(),
43
43
  // Try different possible locations
44
44
  path.join(__dirname, '..', 'hamlib.node'),
45
45
  path.join(process.cwd(), 'hamlib.node'),
package/lib/index.js CHANGED
@@ -21,6 +21,15 @@ class HamLib {
21
21
  this._nativeInstance = new nativeModule.HamLib(model, port);
22
22
  }
23
23
 
24
+ /**
25
+ * Get list of all supported radio models
26
+ * @returns {Array} Array of supported radio models with details
27
+ * @static
28
+ */
29
+ static getSupportedRigs() {
30
+ return nativeModule.HamLib.getSupportedRigs();
31
+ }
32
+
24
33
  /**
25
34
  * Open connection to the radio device
26
35
  * Must be called before other operations
@@ -130,6 +139,234 @@ class HamLib {
130
139
  getConnectionInfo() {
131
140
  return this._nativeInstance.getConnectionInfo();
132
141
  }
142
+
143
+ // Memory Channel Management
144
+
145
+ /**
146
+ * Set memory channel data
147
+ * @param {number} channelNumber - Memory channel number
148
+ * @param {Object} channelData - Channel data (frequency, mode, description, etc.)
149
+ */
150
+ setMemoryChannel(channelNumber, channelData) {
151
+ return this._nativeInstance.setMemoryChannel(channelNumber, channelData);
152
+ }
153
+
154
+ /**
155
+ * Get memory channel data
156
+ * @param {number} channelNumber - Memory channel number
157
+ * @param {boolean} [readOnly=true] - Whether to read in read-only mode
158
+ * @returns {Object} Channel data
159
+ */
160
+ getMemoryChannel(channelNumber, readOnly = true) {
161
+ return this._nativeInstance.getMemoryChannel(channelNumber, readOnly);
162
+ }
163
+
164
+ /**
165
+ * Select memory channel for operation
166
+ * @param {number} channelNumber - Memory channel number to select
167
+ */
168
+ selectMemoryChannel(channelNumber) {
169
+ return this._nativeInstance.selectMemoryChannel(channelNumber);
170
+ }
171
+
172
+ // RIT/XIT Control
173
+
174
+ /**
175
+ * Set RIT (Receiver Incremental Tuning) offset
176
+ * @param {number} offsetHz - RIT offset in Hz
177
+ */
178
+ setRit(offsetHz) {
179
+ return this._nativeInstance.setRit(offsetHz);
180
+ }
181
+
182
+ /**
183
+ * Get current RIT offset
184
+ * @returns {number} RIT offset in Hz
185
+ */
186
+ getRit() {
187
+ return this._nativeInstance.getRit();
188
+ }
189
+
190
+ /**
191
+ * Set XIT (Transmitter Incremental Tuning) offset
192
+ * @param {number} offsetHz - XIT offset in Hz
193
+ */
194
+ setXit(offsetHz) {
195
+ return this._nativeInstance.setXit(offsetHz);
196
+ }
197
+
198
+ /**
199
+ * Get current XIT offset
200
+ * @returns {number} XIT offset in Hz
201
+ */
202
+ getXit() {
203
+ return this._nativeInstance.getXit();
204
+ }
205
+
206
+ /**
207
+ * Clear both RIT and XIT offsets
208
+ * @returns {boolean} Success status
209
+ */
210
+ clearRitXit() {
211
+ return this._nativeInstance.clearRitXit();
212
+ }
213
+
214
+ // Scanning Operations
215
+
216
+ /**
217
+ * Start scanning operation
218
+ * @param {string} scanType - Scan type ('VFO', 'MEM', 'PROG', 'DELTA', 'PRIO')
219
+ * @param {number} [channel=0] - Optional channel number for some scan types
220
+ */
221
+ startScan(scanType, channel = 0) {
222
+ return this._nativeInstance.startScan(scanType, channel);
223
+ }
224
+
225
+ /**
226
+ * Stop scanning operation
227
+ */
228
+ stopScan() {
229
+ return this._nativeInstance.stopScan();
230
+ }
231
+
232
+ // Level Controls
233
+
234
+ /**
235
+ * Set radio level (gain, volume, etc.)
236
+ * @param {string} levelType - Level type ('AF', 'RF', 'SQL', 'RFPOWER', etc.)
237
+ * @param {number} value - Level value (0.0-1.0 typically)
238
+ */
239
+ setLevel(levelType, value) {
240
+ return this._nativeInstance.setLevel(levelType, value);
241
+ }
242
+
243
+ /**
244
+ * Get radio level
245
+ * @param {string} levelType - Level type ('AF', 'RF', 'SQL', 'STRENGTH', etc.)
246
+ * @returns {number} Level value
247
+ */
248
+ getLevel(levelType) {
249
+ return this._nativeInstance.getLevel(levelType);
250
+ }
251
+
252
+ /**
253
+ * Get list of supported level types
254
+ * @returns {Array<string>} Array of supported level types
255
+ */
256
+ getSupportedLevels() {
257
+ return this._nativeInstance.getSupportedLevels();
258
+ }
259
+
260
+ // Function Controls
261
+
262
+ /**
263
+ * Set radio function on/off
264
+ * @param {string} functionType - Function type ('NB', 'COMP', 'VOX', 'TONE', etc.)
265
+ * @param {boolean} enable - true to enable, false to disable
266
+ */
267
+ setFunction(functionType, enable) {
268
+ return this._nativeInstance.setFunction(functionType, enable);
269
+ }
270
+
271
+ /**
272
+ * Get radio function status
273
+ * @param {string} functionType - Function type ('NB', 'COMP', 'VOX', 'TONE', etc.)
274
+ * @returns {boolean} Function enabled status
275
+ */
276
+ getFunction(functionType) {
277
+ return this._nativeInstance.getFunction(functionType);
278
+ }
279
+
280
+ /**
281
+ * Get list of supported function types
282
+ * @returns {Array<string>} Array of supported function types
283
+ */
284
+ getSupportedFunctions() {
285
+ return this._nativeInstance.getSupportedFunctions();
286
+ }
287
+
288
+ // Split Operations
289
+
290
+ /**
291
+ * Set split mode TX frequency
292
+ * @param {number} txFrequency - TX frequency in Hz
293
+ */
294
+ setSplitFreq(txFrequency) {
295
+ return this._nativeInstance.setSplitFreq(txFrequency);
296
+ }
297
+
298
+ /**
299
+ * Get split mode TX frequency
300
+ * @returns {number} TX frequency in Hz
301
+ */
302
+ getSplitFreq() {
303
+ return this._nativeInstance.getSplitFreq();
304
+ }
305
+
306
+ /**
307
+ * Set split mode TX mode
308
+ * @param {string} txMode - TX mode ('USB', 'LSB', 'FM', etc.)
309
+ * @param {number} [txWidth] - Optional TX bandwidth
310
+ */
311
+ setSplitMode(txMode, txWidth) {
312
+ if (txWidth !== undefined) {
313
+ return this._nativeInstance.setSplitMode(txMode, txWidth);
314
+ }
315
+ return this._nativeInstance.setSplitMode(txMode);
316
+ }
317
+
318
+ /**
319
+ * Get split mode TX mode
320
+ * @returns {Object} TX mode and width
321
+ */
322
+ getSplitMode() {
323
+ return this._nativeInstance.getSplitMode();
324
+ }
325
+
326
+ /**
327
+ * Enable/disable split operation
328
+ * @param {boolean} enable - true to enable split, false to disable
329
+ * @param {string} [txVfo='VFO-B'] - TX VFO ('VFO-A' or 'VFO-B')
330
+ */
331
+ setSplit(enable, txVfo = 'VFO-B') {
332
+ return this._nativeInstance.setSplit(enable, txVfo);
333
+ }
334
+
335
+ /**
336
+ * Get split operation status
337
+ * @returns {Object} Split status and TX VFO
338
+ */
339
+ getSplit() {
340
+ return this._nativeInstance.getSplit();
341
+ }
342
+
343
+ // VFO Operations
344
+
345
+ /**
346
+ * Perform VFO operation
347
+ * @param {string} operation - VFO operation ('CPY', 'XCHG', 'FROM_VFO', 'TO_VFO', 'MCL', 'UP', 'DOWN', 'BAND_UP', 'BAND_DOWN', 'LEFT', 'RIGHT', 'TUNE', 'TOGGLE')
348
+ */
349
+ vfoOperation(operation) {
350
+ return this._nativeInstance.vfoOperation(operation);
351
+ }
352
+
353
+ // Antenna Selection
354
+
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
+ }
133
370
  }
134
371
 
135
372
  // Export for CommonJS
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hamlib",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "Node.js wrapper for hamlib radio control library",
5
5
  "main": "index.js",
6
6
  "module": "lib/index.mjs",
@@ -30,6 +30,7 @@
30
30
  "lib/",
31
31
  "prebuilds/",
32
32
  "src/",
33
+ "scripts/",
33
34
  "index.js",
34
35
  "index.d.ts",
35
36
  "binding.gyp",
Binary file
Binary file
Binary file