hamlib 0.1.27 → 0.2.0

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/src/hamlib.cpp CHANGED
@@ -1,25 +1,15 @@
1
1
  #include "hamlib.h"
2
- #include "hamlib_compat.h"
2
+ #include "shim/hamlib_shim.h"
3
3
  #include <string>
4
4
  #include <vector>
5
5
  #include <memory>
6
6
  #include <algorithm>
7
7
 
8
- // Cross-platform compatibility for hamlib token types
9
- // Linux versions use token_t, some others use hamlib_token_t
10
- #ifndef HAMLIB_TOKEN_T
11
- #ifdef __linux__
12
- #define HAMLIB_TOKEN_T token_t
13
- #else
14
- #define HAMLIB_TOKEN_T hamlib_token_t
15
- #endif
16
- #endif
17
-
18
8
  // 安全宏 - 检查RIG指针有效性,防止空指针解引用和已销毁对象访问
19
9
  #define CHECK_RIG_VALID() \
20
10
  do { \
21
11
  if (!hamlib_instance_ || !hamlib_instance_->my_rig) { \
22
- result_code_ = -RIG_EINVAL; \
12
+ result_code_ = SHIM_RIG_EINVAL; \
23
13
  error_message_ = "RIG is not initialized or has been destroyed"; \
24
14
  return; \
25
15
  } \
@@ -49,24 +39,24 @@ public:
49
39
  void Execute() override {
50
40
  CHECK_RIG_VALID();
51
41
 
52
- result_code_ = rig_open(hamlib_instance_->my_rig);
53
- if (result_code_ != RIG_OK) {
54
- error_message_ = rigerror(result_code_);
42
+ result_code_ = shim_rig_open(hamlib_instance_->my_rig);
43
+ if (result_code_ != SHIM_RIG_OK) {
44
+ error_message_ = shim_rigerror(result_code_);
55
45
  } else {
56
- rig_set_freq_callback(hamlib_instance_->my_rig, NodeHamLib::freq_change_cb, hamlib_instance_);
57
- auto ppt_cb = +[](RIG *rig, vfo_t vfo, ptt_t ptt, rig_ptr_t arg) {
46
+ shim_rig_set_freq_callback(hamlib_instance_->my_rig, NodeHamLib::freq_change_cb, hamlib_instance_);
47
+ auto ppt_cb = +[](void* handle, int vfo, int ptt, void* arg) -> int {
58
48
  printf("PPT pushed!");
59
49
  return 0;
60
50
  };
61
- int cb_result = rig_set_ptt_callback(hamlib_instance_->my_rig, ppt_cb, NULL);
62
- rig_set_trn(hamlib_instance_->my_rig, RIG_TRN_POLL);
51
+ int cb_result = shim_rig_set_ptt_callback(hamlib_instance_->my_rig, ppt_cb, NULL);
52
+ shim_rig_set_trn(hamlib_instance_->my_rig, SHIM_RIG_TRN_POLL);
63
53
  hamlib_instance_->rig_is_open = true;
64
54
  }
65
55
  }
66
-
56
+
67
57
  void OnOK() override {
68
58
  Napi::Env env = Env();
69
- if (result_code_ != RIG_OK && !error_message_.empty()) {
59
+ if (result_code_ != SHIM_RIG_OK && !error_message_.empty()) {
70
60
  deferred_.Reject(Napi::Error::New(env, error_message_).Value());
71
61
  } else {
72
62
  deferred_.Resolve(Napi::Number::New(env, result_code_));
@@ -81,21 +71,21 @@ public:
81
71
 
82
72
  class SetFrequencyAsyncWorker : public HamLibAsyncWorker {
83
73
  public:
84
- SetFrequencyAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, freq_t freq, vfo_t vfo)
74
+ SetFrequencyAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, double freq, int vfo)
85
75
  : HamLibAsyncWorker(env, hamlib_instance), freq_(freq), vfo_(vfo) {}
86
76
 
87
77
  void Execute() override {
88
78
  CHECK_RIG_VALID();
89
79
 
90
- result_code_ = rig_set_freq(hamlib_instance_->my_rig, vfo_, freq_);
91
- if (result_code_ != RIG_OK) {
92
- error_message_ = rigerror(result_code_);
80
+ result_code_ = shim_rig_set_freq(hamlib_instance_->my_rig, vfo_, freq_);
81
+ if (result_code_ != SHIM_RIG_OK) {
82
+ error_message_ = shim_rigerror(result_code_);
93
83
  }
94
84
  }
95
85
 
96
86
  void OnOK() override {
97
87
  Napi::Env env = Env();
98
- if (result_code_ != RIG_OK && !error_message_.empty()) {
88
+ if (result_code_ != SHIM_RIG_OK && !error_message_.empty()) {
99
89
  deferred_.Reject(Napi::Error::New(env, error_message_).Value());
100
90
  } else {
101
91
  deferred_.Resolve(Napi::Number::New(env, result_code_));
@@ -108,27 +98,27 @@ public:
108
98
  }
109
99
 
110
100
  private:
111
- freq_t freq_;
112
- vfo_t vfo_;
101
+ double freq_;
102
+ int vfo_;
113
103
  };
114
104
 
115
105
  class GetFrequencyAsyncWorker : public HamLibAsyncWorker {
116
106
  public:
117
- GetFrequencyAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, vfo_t vfo)
107
+ GetFrequencyAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, int vfo)
118
108
  : HamLibAsyncWorker(env, hamlib_instance), vfo_(vfo), freq_(0) {}
119
109
 
120
110
  void Execute() override {
121
111
  CHECK_RIG_VALID();
122
112
 
123
- result_code_ = rig_get_freq(hamlib_instance_->my_rig, vfo_, &freq_);
124
- if (result_code_ != RIG_OK) {
125
- error_message_ = rigerror(result_code_);
113
+ result_code_ = shim_rig_get_freq(hamlib_instance_->my_rig, vfo_, &freq_);
114
+ if (result_code_ != SHIM_RIG_OK) {
115
+ error_message_ = shim_rigerror(result_code_);
126
116
  }
127
117
  }
128
118
 
129
119
  void OnOK() override {
130
120
  Napi::Env env = Env();
131
- if (result_code_ != RIG_OK && !error_message_.empty()) {
121
+ if (result_code_ != SHIM_RIG_OK && !error_message_.empty()) {
132
122
  deferred_.Reject(Napi::Error::New(env, error_message_).Value());
133
123
  } else {
134
124
  deferred_.Resolve(Napi::Number::New(env, freq_));
@@ -141,27 +131,27 @@ public:
141
131
  }
142
132
 
143
133
  private:
144
- vfo_t vfo_;
145
- freq_t freq_;
134
+ int vfo_;
135
+ double freq_;
146
136
  };
147
137
 
148
138
  class SetModeAsyncWorker : public HamLibAsyncWorker {
149
139
  public:
150
- SetModeAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, rmode_t mode, pbwidth_t width, vfo_t vfo = RIG_VFO_CURR)
140
+ SetModeAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, int mode, int width, int vfo = SHIM_RIG_VFO_CURR)
151
141
  : HamLibAsyncWorker(env, hamlib_instance), mode_(mode), width_(width), vfo_(vfo) {}
152
142
 
153
143
  void Execute() override {
154
144
  CHECK_RIG_VALID();
155
145
 
156
- result_code_ = rig_set_mode(hamlib_instance_->my_rig, vfo_, mode_, width_);
157
- if (result_code_ != RIG_OK) {
158
- error_message_ = rigerror(result_code_);
146
+ result_code_ = shim_rig_set_mode(hamlib_instance_->my_rig, vfo_, mode_, width_);
147
+ if (result_code_ != SHIM_RIG_OK) {
148
+ error_message_ = shim_rigerror(result_code_);
159
149
  }
160
150
  }
161
151
 
162
152
  void OnOK() override {
163
153
  Napi::Env env = Env();
164
- if (result_code_ != RIG_OK && !error_message_.empty()) {
154
+ if (result_code_ != SHIM_RIG_OK && !error_message_.empty()) {
165
155
  deferred_.Reject(Napi::Error::New(env, error_message_).Value());
166
156
  } else {
167
157
  deferred_.Resolve(Napi::Number::New(env, result_code_));
@@ -174,9 +164,9 @@ public:
174
164
  }
175
165
 
176
166
  private:
177
- rmode_t mode_;
178
- pbwidth_t width_;
179
- vfo_t vfo_;
167
+ int mode_;
168
+ int width_;
169
+ int vfo_;
180
170
  };
181
171
 
182
172
  class GetModeAsyncWorker : public HamLibAsyncWorker {
@@ -187,20 +177,20 @@ public:
187
177
  void Execute() override {
188
178
  CHECK_RIG_VALID();
189
179
 
190
- result_code_ = rig_get_mode(hamlib_instance_->my_rig, RIG_VFO_CURR, &mode_, &width_);
191
- if (result_code_ != RIG_OK) {
192
- error_message_ = rigerror(result_code_);
180
+ result_code_ = shim_rig_get_mode(hamlib_instance_->my_rig, SHIM_RIG_VFO_CURR, &mode_, &width_);
181
+ if (result_code_ != SHIM_RIG_OK) {
182
+ error_message_ = shim_rigerror(result_code_);
193
183
  }
194
184
  }
195
185
 
196
186
  void OnOK() override {
197
187
  Napi::Env env = Env();
198
- if (result_code_ != RIG_OK && !error_message_.empty()) {
188
+ if (result_code_ != SHIM_RIG_OK && !error_message_.empty()) {
199
189
  deferred_.Reject(Napi::Error::New(env, error_message_).Value());
200
190
  } else {
201
191
  Napi::Object obj = Napi::Object::New(env);
202
192
  // Convert mode to string using rig_strrmode
203
- const char* mode_str = rig_strrmode(mode_);
193
+ const char* mode_str = shim_rig_strrmode(mode_);
204
194
  obj.Set(Napi::String::New(env, "mode"), Napi::String::New(env, mode_str));
205
195
  obj.Set(Napi::String::New(env, "bandwidth"), width_);
206
196
  deferred_.Resolve(obj);
@@ -213,27 +203,27 @@ public:
213
203
  }
214
204
 
215
205
  private:
216
- rmode_t mode_;
217
- pbwidth_t width_;
206
+ int mode_;
207
+ int width_;
218
208
  };
219
209
 
220
210
  class SetPttAsyncWorker : public HamLibAsyncWorker {
221
211
  public:
222
- SetPttAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, ptt_t ptt)
212
+ SetPttAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, int ptt)
223
213
  : HamLibAsyncWorker(env, hamlib_instance), ptt_(ptt) {}
224
214
 
225
215
  void Execute() override {
226
216
  CHECK_RIG_VALID();
227
217
 
228
- result_code_ = rig_set_ptt(hamlib_instance_->my_rig, RIG_VFO_CURR, ptt_);
229
- if (result_code_ != RIG_OK) {
230
- error_message_ = rigerror(result_code_);
218
+ result_code_ = shim_rig_set_ptt(hamlib_instance_->my_rig, SHIM_RIG_VFO_CURR, ptt_);
219
+ if (result_code_ != SHIM_RIG_OK) {
220
+ error_message_ = shim_rigerror(result_code_);
231
221
  }
232
222
  }
233
223
 
234
224
  void OnOK() override {
235
225
  Napi::Env env = Env();
236
- if (result_code_ != RIG_OK && !error_message_.empty()) {
226
+ if (result_code_ != SHIM_RIG_OK && !error_message_.empty()) {
237
227
  deferred_.Reject(Napi::Error::New(env, error_message_).Value());
238
228
  } else {
239
229
  deferred_.Resolve(Napi::Number::New(env, result_code_));
@@ -246,26 +236,26 @@ public:
246
236
  }
247
237
 
248
238
  private:
249
- ptt_t ptt_;
239
+ int ptt_;
250
240
  };
251
241
 
252
242
  class GetStrengthAsyncWorker : public HamLibAsyncWorker {
253
243
  public:
254
- GetStrengthAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, vfo_t vfo)
244
+ GetStrengthAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, int vfo)
255
245
  : HamLibAsyncWorker(env, hamlib_instance), vfo_(vfo), strength_(0) {}
256
246
 
257
247
  void Execute() override {
258
248
  CHECK_RIG_VALID();
259
249
 
260
- result_code_ = rig_get_strength(hamlib_instance_->my_rig, vfo_, &strength_);
261
- if (result_code_ != RIG_OK) {
262
- error_message_ = rigerror(result_code_);
250
+ result_code_ = shim_rig_get_strength(hamlib_instance_->my_rig, vfo_, &strength_);
251
+ if (result_code_ != SHIM_RIG_OK) {
252
+ error_message_ = shim_rigerror(result_code_);
263
253
  }
264
254
  }
265
255
 
266
256
  void OnOK() override {
267
257
  Napi::Env env = Env();
268
- if (result_code_ != RIG_OK && !error_message_.empty()) {
258
+ if (result_code_ != SHIM_RIG_OK && !error_message_.empty()) {
269
259
  deferred_.Reject(Napi::Error::New(env, error_message_).Value());
270
260
  } else {
271
261
  deferred_.Resolve(Napi::Number::New(env, strength_));
@@ -278,95 +268,93 @@ public:
278
268
  }
279
269
 
280
270
  private:
281
- vfo_t vfo_;
271
+ int vfo_;
282
272
  int strength_;
283
273
  };
284
274
 
285
275
  class SetLevelAsyncWorker : public HamLibAsyncWorker {
286
276
  public:
287
- SetLevelAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, setting_t level_type, value_t value)
277
+ SetLevelAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, uint64_t level_type, float value)
288
278
  : HamLibAsyncWorker(env, hamlib_instance), level_type_(level_type), value_(value) {}
289
-
279
+
290
280
  void Execute() override {
291
281
  CHECK_RIG_VALID();
292
-
293
- result_code_ = rig_set_level(hamlib_instance_->my_rig, RIG_VFO_CURR, level_type_, value_);
294
- if (result_code_ != RIG_OK) {
295
- error_message_ = rigerror(result_code_);
282
+
283
+ result_code_ = shim_rig_set_level_f(hamlib_instance_->my_rig, SHIM_RIG_VFO_CURR, level_type_, value_);
284
+ if (result_code_ != SHIM_RIG_OK) {
285
+ error_message_ = shim_rigerror(result_code_);
296
286
  }
297
287
  }
298
-
288
+
299
289
  void OnOK() override {
300
290
  Napi::Env env = Env();
301
- if (result_code_ != RIG_OK && !error_message_.empty()) {
291
+ if (result_code_ != SHIM_RIG_OK && !error_message_.empty()) {
302
292
  deferred_.Reject(Napi::Error::New(env, error_message_).Value());
303
293
  } else {
304
294
  deferred_.Resolve(Napi::Number::New(env, result_code_));
305
295
  }
306
296
  }
307
-
297
+
308
298
  void OnError(const Napi::Error& e) override {
309
299
  Napi::Env env = Env();
310
300
  deferred_.Reject(Napi::Error::New(env, error_message_).Value());
311
301
  }
312
-
302
+
313
303
  private:
314
- setting_t level_type_;
315
- value_t value_;
304
+ uint64_t level_type_;
305
+ float value_;
316
306
  };
317
307
 
318
308
  class GetLevelAsyncWorker : public HamLibAsyncWorker {
319
309
  public:
320
- GetLevelAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, setting_t level_type)
321
- : HamLibAsyncWorker(env, hamlib_instance), level_type_(level_type) {
322
- value_.f = 0.0;
323
- }
324
-
310
+ GetLevelAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, uint64_t level_type)
311
+ : HamLibAsyncWorker(env, hamlib_instance), level_type_(level_type), value_(0.0f) {}
312
+
325
313
  void Execute() override {
326
314
  CHECK_RIG_VALID();
327
-
328
- result_code_ = rig_get_level(hamlib_instance_->my_rig, RIG_VFO_CURR, level_type_, &value_);
329
- if (result_code_ != RIG_OK) {
330
- error_message_ = rigerror(result_code_);
315
+
316
+ result_code_ = shim_rig_get_level_f(hamlib_instance_->my_rig, SHIM_RIG_VFO_CURR, level_type_, &value_);
317
+ if (result_code_ != SHIM_RIG_OK) {
318
+ error_message_ = shim_rigerror(result_code_);
331
319
  }
332
320
  }
333
-
321
+
334
322
  void OnOK() override {
335
323
  Napi::Env env = Env();
336
- if (result_code_ != RIG_OK && !error_message_.empty()) {
324
+ if (result_code_ != SHIM_RIG_OK && !error_message_.empty()) {
337
325
  deferred_.Reject(Napi::Error::New(env, error_message_).Value());
338
326
  } else {
339
- deferred_.Resolve(Napi::Number::New(env, value_.f));
327
+ deferred_.Resolve(Napi::Number::New(env, value_));
340
328
  }
341
329
  }
342
-
330
+
343
331
  void OnError(const Napi::Error& e) override {
344
332
  Napi::Env env = Env();
345
333
  deferred_.Reject(Napi::Error::New(env, error_message_).Value());
346
334
  }
347
-
335
+
348
336
  private:
349
- setting_t level_type_;
350
- value_t value_;
337
+ uint64_t level_type_;
338
+ float value_;
351
339
  };
352
340
 
353
341
  class SetFunctionAsyncWorker : public HamLibAsyncWorker {
354
342
  public:
355
- SetFunctionAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, setting_t func_type, int enable)
343
+ SetFunctionAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, uint64_t func_type, int enable)
356
344
  : HamLibAsyncWorker(env, hamlib_instance), func_type_(func_type), enable_(enable) {}
357
345
 
358
346
  void Execute() override {
359
347
  CHECK_RIG_VALID();
360
348
 
361
- result_code_ = rig_set_func(hamlib_instance_->my_rig, RIG_VFO_CURR, func_type_, enable_);
362
- if (result_code_ != RIG_OK) {
363
- error_message_ = rigerror(result_code_);
349
+ result_code_ = shim_rig_set_func(hamlib_instance_->my_rig, SHIM_RIG_VFO_CURR, func_type_, enable_);
350
+ if (result_code_ != SHIM_RIG_OK) {
351
+ error_message_ = shim_rigerror(result_code_);
364
352
  }
365
353
  }
366
354
 
367
355
  void OnOK() override {
368
356
  Napi::Env env = Env();
369
- if (result_code_ != RIG_OK && !error_message_.empty()) {
357
+ if (result_code_ != SHIM_RIG_OK && !error_message_.empty()) {
370
358
  deferred_.Reject(Napi::Error::New(env, error_message_).Value());
371
359
  } else {
372
360
  deferred_.Resolve(Napi::Number::New(env, result_code_));
@@ -379,27 +367,27 @@ public:
379
367
  }
380
368
 
381
369
  private:
382
- setting_t func_type_;
370
+ uint64_t func_type_;
383
371
  int enable_;
384
372
  };
385
373
 
386
374
  class GetFunctionAsyncWorker : public HamLibAsyncWorker {
387
375
  public:
388
- GetFunctionAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, setting_t func_type)
376
+ GetFunctionAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, uint64_t func_type)
389
377
  : HamLibAsyncWorker(env, hamlib_instance), func_type_(func_type), state_(0) {}
390
378
 
391
379
  void Execute() override {
392
380
  CHECK_RIG_VALID();
393
381
 
394
- result_code_ = rig_get_func(hamlib_instance_->my_rig, RIG_VFO_CURR, func_type_, &state_);
395
- if (result_code_ != RIG_OK) {
396
- error_message_ = rigerror(result_code_);
382
+ result_code_ = shim_rig_get_func(hamlib_instance_->my_rig, SHIM_RIG_VFO_CURR, func_type_, &state_);
383
+ if (result_code_ != SHIM_RIG_OK) {
384
+ error_message_ = shim_rigerror(result_code_);
397
385
  }
398
386
  }
399
387
 
400
388
  void OnOK() override {
401
389
  Napi::Env env = Env();
402
- if (result_code_ != RIG_OK && !error_message_.empty()) {
390
+ if (result_code_ != SHIM_RIG_OK && !error_message_.empty()) {
403
391
  deferred_.Reject(Napi::Error::New(env, error_message_).Value());
404
392
  } else {
405
393
  deferred_.Resolve(Napi::Boolean::New(env, state_ != 0));
@@ -412,27 +400,27 @@ public:
412
400
  }
413
401
 
414
402
  private:
415
- setting_t func_type_;
403
+ uint64_t func_type_;
416
404
  int state_;
417
405
  };
418
406
 
419
407
  class SetMemoryChannelAsyncWorker : public HamLibAsyncWorker {
420
408
  public:
421
- SetMemoryChannelAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, const channel_t& chan)
409
+ SetMemoryChannelAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, const shim_channel_t& chan)
422
410
  : HamLibAsyncWorker(env, hamlib_instance), chan_(chan) {}
423
411
 
424
412
  void Execute() override {
425
413
  CHECK_RIG_VALID();
426
414
 
427
- result_code_ = rig_set_channel(hamlib_instance_->my_rig, RIG_VFO_MEM, &chan_);
428
- if (result_code_ != RIG_OK) {
429
- error_message_ = rigerror(result_code_);
415
+ result_code_ = shim_rig_set_channel(hamlib_instance_->my_rig, SHIM_RIG_VFO_MEM, &chan_);
416
+ if (result_code_ != SHIM_RIG_OK) {
417
+ error_message_ = shim_rigerror(result_code_);
430
418
  }
431
419
  }
432
420
 
433
421
  void OnOK() override {
434
422
  Napi::Env env = Env();
435
- if (result_code_ != RIG_OK && !error_message_.empty()) {
423
+ if (result_code_ != SHIM_RIG_OK && !error_message_.empty()) {
436
424
  deferred_.Reject(Napi::Error::New(env, error_message_).Value());
437
425
  } else {
438
426
  deferred_.Resolve(Napi::Number::New(env, result_code_));
@@ -445,7 +433,7 @@ public:
445
433
  }
446
434
 
447
435
  private:
448
- channel_t chan_;
436
+ shim_channel_t chan_;
449
437
  };
450
438
 
451
439
  class GetMemoryChannelAsyncWorker : public HamLibAsyncWorker {
@@ -459,10 +447,10 @@ public:
459
447
  CHECK_RIG_VALID();
460
448
 
461
449
  chan_.channel_num = channel_num_;
462
- chan_.vfo = RIG_VFO_MEM;
463
- result_code_ = rig_get_channel(hamlib_instance_->my_rig, RIG_VFO_MEM, &chan_, read_only_);
464
- if (result_code_ != RIG_OK) {
465
- error_message_ = rigerror(result_code_);
450
+ chan_.vfo = SHIM_RIG_VFO_MEM;
451
+ result_code_ = shim_rig_get_channel(hamlib_instance_->my_rig, SHIM_RIG_VFO_MEM, &chan_, read_only_);
452
+ if (result_code_ != SHIM_RIG_OK) {
453
+ error_message_ = shim_rigerror(result_code_);
466
454
  }
467
455
  }
468
456
 
@@ -473,8 +461,8 @@ public:
473
461
  obj.Set(Napi::String::New(env, "channelNumber"), chan_.channel_num);
474
462
  obj.Set(Napi::String::New(env, "frequency"), chan_.freq);
475
463
 
476
- if (chan_.mode != RIG_MODE_NONE) {
477
- const char* mode_str = rig_strrmode(chan_.mode);
464
+ if (chan_.mode != SHIM_RIG_MODE_NONE) {
465
+ const char* mode_str = shim_rig_strrmode(chan_.mode);
478
466
  obj.Set(Napi::String::New(env, "mode"), Napi::String::New(env, mode_str));
479
467
  }
480
468
 
@@ -484,7 +472,7 @@ public:
484
472
  obj.Set(Napi::String::New(env, "description"), Napi::String::New(env, chan_.channel_desc));
485
473
  }
486
474
 
487
- if (chan_.split == RIG_SPLIT_ON) {
475
+ if (chan_.split == SHIM_RIG_SPLIT_ON) {
488
476
  obj.Set(Napi::String::New(env, "txFrequency"), chan_.tx_freq);
489
477
  }
490
478
 
@@ -503,7 +491,7 @@ public:
503
491
  private:
504
492
  int channel_num_;
505
493
  bool read_only_;
506
- channel_t chan_;
494
+ shim_channel_t chan_;
507
495
  };
508
496
 
509
497
  class SelectMemoryChannelAsyncWorker : public HamLibAsyncWorker {
@@ -514,15 +502,15 @@ public:
514
502
  void Execute() override {
515
503
  CHECK_RIG_VALID();
516
504
 
517
- result_code_ = rig_set_mem(hamlib_instance_->my_rig, RIG_VFO_CURR, channel_num_);
518
- if (result_code_ != RIG_OK) {
519
- error_message_ = rigerror(result_code_);
505
+ result_code_ = shim_rig_set_mem(hamlib_instance_->my_rig, SHIM_RIG_VFO_CURR, channel_num_);
506
+ if (result_code_ != SHIM_RIG_OK) {
507
+ error_message_ = shim_rigerror(result_code_);
520
508
  }
521
509
  }
522
510
 
523
511
  void OnOK() override {
524
512
  Napi::Env env = Env();
525
- if (result_code_ != RIG_OK && !error_message_.empty()) {
513
+ if (result_code_ != SHIM_RIG_OK && !error_message_.empty()) {
526
514
  deferred_.Reject(Napi::Error::New(env, error_message_).Value());
527
515
  } else {
528
516
  deferred_.Resolve(Napi::Number::New(env, result_code_));
@@ -540,21 +528,21 @@ private:
540
528
 
541
529
  class SetRitAsyncWorker : public HamLibAsyncWorker {
542
530
  public:
543
- SetRitAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, shortfreq_t rit_offset)
531
+ SetRitAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, int rit_offset)
544
532
  : HamLibAsyncWorker(env, hamlib_instance), rit_offset_(rit_offset) {}
545
533
 
546
534
  void Execute() override {
547
535
  CHECK_RIG_VALID();
548
536
 
549
- result_code_ = rig_set_rit(hamlib_instance_->my_rig, RIG_VFO_CURR, rit_offset_);
550
- if (result_code_ != RIG_OK) {
551
- error_message_ = rigerror(result_code_);
537
+ result_code_ = shim_rig_set_rit(hamlib_instance_->my_rig, SHIM_RIG_VFO_CURR, rit_offset_);
538
+ if (result_code_ != SHIM_RIG_OK) {
539
+ error_message_ = shim_rigerror(result_code_);
552
540
  }
553
541
  }
554
542
 
555
543
  void OnOK() override {
556
544
  Napi::Env env = Env();
557
- if (result_code_ != RIG_OK && !error_message_.empty()) {
545
+ if (result_code_ != SHIM_RIG_OK && !error_message_.empty()) {
558
546
  deferred_.Reject(Napi::Error::New(env, error_message_).Value());
559
547
  } else {
560
548
  deferred_.Resolve(Napi::Number::New(env, result_code_));
@@ -567,7 +555,7 @@ public:
567
555
  }
568
556
 
569
557
  private:
570
- shortfreq_t rit_offset_;
558
+ int rit_offset_;
571
559
  };
572
560
 
573
561
  class GetRitAsyncWorker : public HamLibAsyncWorker {
@@ -578,15 +566,15 @@ public:
578
566
  void Execute() override {
579
567
  CHECK_RIG_VALID();
580
568
 
581
- result_code_ = rig_get_rit(hamlib_instance_->my_rig, RIG_VFO_CURR, &rit_offset_);
582
- if (result_code_ != RIG_OK) {
583
- error_message_ = rigerror(result_code_);
569
+ result_code_ = shim_rig_get_rit(hamlib_instance_->my_rig, SHIM_RIG_VFO_CURR, &rit_offset_);
570
+ if (result_code_ != SHIM_RIG_OK) {
571
+ error_message_ = shim_rigerror(result_code_);
584
572
  }
585
573
  }
586
574
 
587
575
  void OnOK() override {
588
576
  Napi::Env env = Env();
589
- if (result_code_ != RIG_OK && !error_message_.empty()) {
577
+ if (result_code_ != SHIM_RIG_OK && !error_message_.empty()) {
590
578
  deferred_.Reject(Napi::Error::New(env, error_message_).Value());
591
579
  } else {
592
580
  deferred_.Resolve(Napi::Number::New(env, rit_offset_));
@@ -599,26 +587,26 @@ public:
599
587
  }
600
588
 
601
589
  private:
602
- shortfreq_t rit_offset_;
590
+ int rit_offset_;
603
591
  };
604
592
 
605
593
  class SetXitAsyncWorker : public HamLibAsyncWorker {
606
594
  public:
607
- SetXitAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, shortfreq_t xit_offset)
595
+ SetXitAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, int xit_offset)
608
596
  : HamLibAsyncWorker(env, hamlib_instance), xit_offset_(xit_offset) {}
609
597
 
610
598
  void Execute() override {
611
599
  CHECK_RIG_VALID();
612
600
 
613
- result_code_ = rig_set_xit(hamlib_instance_->my_rig, RIG_VFO_CURR, xit_offset_);
614
- if (result_code_ != RIG_OK) {
615
- error_message_ = rigerror(result_code_);
601
+ result_code_ = shim_rig_set_xit(hamlib_instance_->my_rig, SHIM_RIG_VFO_CURR, xit_offset_);
602
+ if (result_code_ != SHIM_RIG_OK) {
603
+ error_message_ = shim_rigerror(result_code_);
616
604
  }
617
605
  }
618
606
 
619
607
  void OnOK() override {
620
608
  Napi::Env env = Env();
621
- if (result_code_ != RIG_OK && !error_message_.empty()) {
609
+ if (result_code_ != SHIM_RIG_OK && !error_message_.empty()) {
622
610
  deferred_.Reject(Napi::Error::New(env, error_message_).Value());
623
611
  } else {
624
612
  deferred_.Resolve(Napi::Number::New(env, result_code_));
@@ -631,7 +619,7 @@ public:
631
619
  }
632
620
 
633
621
  private:
634
- shortfreq_t xit_offset_;
622
+ int xit_offset_;
635
623
  };
636
624
 
637
625
  class GetXitAsyncWorker : public HamLibAsyncWorker {
@@ -642,15 +630,15 @@ public:
642
630
  void Execute() override {
643
631
  CHECK_RIG_VALID();
644
632
 
645
- result_code_ = rig_get_xit(hamlib_instance_->my_rig, RIG_VFO_CURR, &xit_offset_);
646
- if (result_code_ != RIG_OK) {
647
- error_message_ = rigerror(result_code_);
633
+ result_code_ = shim_rig_get_xit(hamlib_instance_->my_rig, SHIM_RIG_VFO_CURR, &xit_offset_);
634
+ if (result_code_ != SHIM_RIG_OK) {
635
+ error_message_ = shim_rigerror(result_code_);
648
636
  }
649
637
  }
650
638
 
651
639
  void OnOK() override {
652
640
  Napi::Env env = Env();
653
- if (result_code_ != RIG_OK && !error_message_.empty()) {
641
+ if (result_code_ != SHIM_RIG_OK && !error_message_.empty()) {
654
642
  deferred_.Reject(Napi::Error::New(env, error_message_).Value());
655
643
  } else {
656
644
  deferred_.Resolve(Napi::Number::New(env, xit_offset_));
@@ -663,7 +651,7 @@ public:
663
651
  }
664
652
 
665
653
  private:
666
- shortfreq_t xit_offset_;
654
+ int xit_offset_;
667
655
  };
668
656
 
669
657
  class ClearRitXitAsyncWorker : public HamLibAsyncWorker {
@@ -674,23 +662,23 @@ public:
674
662
  void Execute() override {
675
663
  CHECK_RIG_VALID();
676
664
 
677
- int ritCode = rig_set_rit(hamlib_instance_->my_rig, RIG_VFO_CURR, 0);
678
- int xitCode = rig_set_xit(hamlib_instance_->my_rig, RIG_VFO_CURR, 0);
665
+ int ritCode = shim_rig_set_rit(hamlib_instance_->my_rig, SHIM_RIG_VFO_CURR, 0);
666
+ int xitCode = shim_rig_set_xit(hamlib_instance_->my_rig, SHIM_RIG_VFO_CURR, 0);
679
667
 
680
- if (ritCode != RIG_OK) {
668
+ if (ritCode != SHIM_RIG_OK) {
681
669
  result_code_ = ritCode;
682
- error_message_ = rigerror(ritCode);
683
- } else if (xitCode != RIG_OK) {
670
+ error_message_ = shim_rigerror(ritCode);
671
+ } else if (xitCode != SHIM_RIG_OK) {
684
672
  result_code_ = xitCode;
685
- error_message_ = rigerror(xitCode);
673
+ error_message_ = shim_rigerror(xitCode);
686
674
  } else {
687
- result_code_ = RIG_OK;
675
+ result_code_ = SHIM_RIG_OK;
688
676
  }
689
677
  }
690
678
 
691
679
  void OnOK() override {
692
680
  Napi::Env env = Env();
693
- if (result_code_ != RIG_OK && !error_message_.empty()) {
681
+ if (result_code_ != SHIM_RIG_OK && !error_message_.empty()) {
694
682
  deferred_.Reject(Napi::Error::New(env, error_message_).Value());
695
683
  } else {
696
684
  deferred_.Resolve(Napi::Number::New(env, result_code_));
@@ -705,21 +693,21 @@ public:
705
693
 
706
694
  class SetSplitFreqAsyncWorker : public HamLibAsyncWorker {
707
695
  public:
708
- SetSplitFreqAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, freq_t tx_freq, vfo_t vfo = RIG_VFO_CURR)
696
+ SetSplitFreqAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, double tx_freq, int vfo = SHIM_RIG_VFO_CURR)
709
697
  : HamLibAsyncWorker(env, hamlib_instance), tx_freq_(tx_freq), vfo_(vfo) {}
710
698
 
711
699
  void Execute() override {
712
700
  CHECK_RIG_VALID();
713
701
 
714
- result_code_ = rig_set_split_freq(hamlib_instance_->my_rig, vfo_, tx_freq_);
715
- if (result_code_ != RIG_OK) {
716
- error_message_ = rigerror(result_code_);
702
+ result_code_ = shim_rig_set_split_freq(hamlib_instance_->my_rig, vfo_, tx_freq_);
703
+ if (result_code_ != SHIM_RIG_OK) {
704
+ error_message_ = shim_rigerror(result_code_);
717
705
  }
718
706
  }
719
707
 
720
708
  void OnOK() override {
721
709
  Napi::Env env = Env();
722
- if (result_code_ != RIG_OK && !error_message_.empty()) {
710
+ if (result_code_ != SHIM_RIG_OK && !error_message_.empty()) {
723
711
  deferred_.Reject(Napi::Error::New(env, error_message_).Value());
724
712
  } else {
725
713
  deferred_.Resolve(Napi::Number::New(env, result_code_));
@@ -732,27 +720,27 @@ public:
732
720
  }
733
721
 
734
722
  private:
735
- freq_t tx_freq_;
736
- vfo_t vfo_;
723
+ double tx_freq_;
724
+ int vfo_;
737
725
  };
738
726
 
739
727
  class GetSplitFreqAsyncWorker : public HamLibAsyncWorker {
740
728
  public:
741
- GetSplitFreqAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, vfo_t vfo = RIG_VFO_CURR)
729
+ GetSplitFreqAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, int vfo = SHIM_RIG_VFO_CURR)
742
730
  : HamLibAsyncWorker(env, hamlib_instance), tx_freq_(0), vfo_(vfo) {}
743
731
 
744
732
  void Execute() override {
745
733
  CHECK_RIG_VALID();
746
734
 
747
- result_code_ = rig_get_split_freq(hamlib_instance_->my_rig, vfo_, &tx_freq_);
748
- if (result_code_ != RIG_OK) {
749
- error_message_ = rigerror(result_code_);
735
+ result_code_ = shim_rig_get_split_freq(hamlib_instance_->my_rig, vfo_, &tx_freq_);
736
+ if (result_code_ != SHIM_RIG_OK) {
737
+ error_message_ = shim_rigerror(result_code_);
750
738
  }
751
739
  }
752
740
 
753
741
  void OnOK() override {
754
742
  Napi::Env env = Env();
755
- if (result_code_ != RIG_OK && !error_message_.empty()) {
743
+ if (result_code_ != SHIM_RIG_OK && !error_message_.empty()) {
756
744
  deferred_.Reject(Napi::Error::New(env, error_message_).Value());
757
745
  } else {
758
746
  deferred_.Resolve(Napi::Number::New(env, tx_freq_));
@@ -765,27 +753,27 @@ public:
765
753
  }
766
754
 
767
755
  private:
768
- freq_t tx_freq_;
769
- vfo_t vfo_;
756
+ double tx_freq_;
757
+ int vfo_;
770
758
  };
771
759
 
772
760
  class SetSplitAsyncWorker : public HamLibAsyncWorker {
773
761
  public:
774
- SetSplitAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, vfo_t rx_vfo, split_t split, vfo_t tx_vfo)
762
+ SetSplitAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, int rx_vfo, int split, int tx_vfo)
775
763
  : HamLibAsyncWorker(env, hamlib_instance), rx_vfo_(rx_vfo), split_(split), tx_vfo_(tx_vfo) {}
776
764
 
777
765
  void Execute() override {
778
766
  CHECK_RIG_VALID();
779
767
 
780
- result_code_ = rig_set_split_vfo(hamlib_instance_->my_rig, rx_vfo_, split_, tx_vfo_);
781
- if (result_code_ != RIG_OK) {
782
- error_message_ = rigerror(result_code_);
768
+ result_code_ = shim_rig_set_split_vfo(hamlib_instance_->my_rig, rx_vfo_, split_, tx_vfo_);
769
+ if (result_code_ != SHIM_RIG_OK) {
770
+ error_message_ = shim_rigerror(result_code_);
783
771
  }
784
772
  }
785
773
 
786
774
  void OnOK() override {
787
775
  Napi::Env env = Env();
788
- if (result_code_ != RIG_OK && !error_message_.empty()) {
776
+ if (result_code_ != SHIM_RIG_OK && !error_message_.empty()) {
789
777
  deferred_.Reject(Napi::Error::New(env, error_message_).Value());
790
778
  } else {
791
779
  deferred_.Resolve(Napi::Number::New(env, result_code_));
@@ -798,35 +786,35 @@ public:
798
786
  }
799
787
 
800
788
  private:
801
- vfo_t rx_vfo_;
802
- split_t split_;
803
- vfo_t tx_vfo_;
789
+ int rx_vfo_;
790
+ int split_;
791
+ int tx_vfo_;
804
792
  };
805
793
 
806
794
  class GetSplitAsyncWorker : public HamLibAsyncWorker {
807
795
  public:
808
- GetSplitAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, vfo_t vfo = RIG_VFO_CURR)
809
- : HamLibAsyncWorker(env, hamlib_instance), split_(RIG_SPLIT_OFF), tx_vfo_(RIG_VFO_B), vfo_(vfo) {}
796
+ GetSplitAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, int vfo = SHIM_RIG_VFO_CURR)
797
+ : HamLibAsyncWorker(env, hamlib_instance), split_(SHIM_RIG_SPLIT_OFF), tx_vfo_(SHIM_RIG_VFO_B), vfo_(vfo) {}
810
798
 
811
799
  void Execute() override {
812
800
  CHECK_RIG_VALID();
813
801
 
814
- result_code_ = rig_get_split_vfo(hamlib_instance_->my_rig, vfo_, &split_, &tx_vfo_);
815
- if (result_code_ != RIG_OK) {
816
- error_message_ = rigerror(result_code_);
802
+ result_code_ = shim_rig_get_split_vfo(hamlib_instance_->my_rig, vfo_, &split_, &tx_vfo_);
803
+ if (result_code_ != SHIM_RIG_OK) {
804
+ error_message_ = shim_rigerror(result_code_);
817
805
  }
818
806
  }
819
807
 
820
808
  void OnOK() override {
821
809
  Napi::Env env = Env();
822
- if (result_code_ != RIG_OK && !error_message_.empty()) {
810
+ if (result_code_ != SHIM_RIG_OK && !error_message_.empty()) {
823
811
  deferred_.Reject(Napi::Error::New(env, error_message_).Value());
824
812
  } else {
825
813
  Napi::Object obj = Napi::Object::New(env);
826
- obj.Set(Napi::String::New(env, "enabled"), Napi::Boolean::New(env, split_ == RIG_SPLIT_ON));
814
+ obj.Set(Napi::String::New(env, "enabled"), Napi::Boolean::New(env, split_ == SHIM_RIG_SPLIT_ON));
827
815
 
828
816
  const char* vfo_str = "VFO-B";
829
- if (tx_vfo_ == RIG_VFO_A) {
817
+ if (tx_vfo_ == SHIM_RIG_VFO_A) {
830
818
  vfo_str = "VFO-A";
831
819
  }
832
820
  obj.Set(Napi::String::New(env, "txVfo"), Napi::String::New(env, vfo_str));
@@ -841,28 +829,28 @@ public:
841
829
  }
842
830
 
843
831
  private:
844
- split_t split_;
845
- vfo_t tx_vfo_;
846
- vfo_t vfo_;
832
+ int split_;
833
+ int tx_vfo_;
834
+ int vfo_;
847
835
  };
848
836
 
849
837
  class SetVfoAsyncWorker : public HamLibAsyncWorker {
850
838
  public:
851
- SetVfoAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, vfo_t vfo)
839
+ SetVfoAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, int vfo)
852
840
  : HamLibAsyncWorker(env, hamlib_instance), vfo_(vfo) {}
853
841
 
854
842
  void Execute() override {
855
843
  CHECK_RIG_VALID();
856
844
 
857
- result_code_ = rig_set_vfo(hamlib_instance_->my_rig, vfo_);
858
- if (result_code_ != RIG_OK) {
859
- error_message_ = rigerror(result_code_);
845
+ result_code_ = shim_rig_set_vfo(hamlib_instance_->my_rig, vfo_);
846
+ if (result_code_ != SHIM_RIG_OK) {
847
+ error_message_ = shim_rigerror(result_code_);
860
848
  }
861
849
  }
862
850
 
863
851
  void OnOK() override {
864
852
  Napi::Env env = Env();
865
- if (result_code_ != RIG_OK && !error_message_.empty()) {
853
+ if (result_code_ != SHIM_RIG_OK && !error_message_.empty()) {
866
854
  deferred_.Reject(Napi::Error::New(env, error_message_).Value());
867
855
  } else {
868
856
  deferred_.Resolve(Napi::Number::New(env, result_code_));
@@ -875,7 +863,7 @@ public:
875
863
  }
876
864
 
877
865
  private:
878
- vfo_t vfo_;
866
+ int vfo_;
879
867
  };
880
868
 
881
869
  class GetVfoAsyncWorker : public HamLibAsyncWorker {
@@ -886,21 +874,20 @@ public:
886
874
  void Execute() override {
887
875
  CHECK_RIG_VALID();
888
876
 
889
- result_code_ = rig_get_vfo(hamlib_instance_->my_rig, &vfo_);
890
- if (result_code_ != RIG_OK) {
877
+ result_code_ = shim_rig_get_vfo(hamlib_instance_->my_rig, &vfo_);
878
+ if (result_code_ != SHIM_RIG_OK) {
891
879
  // 提供更清晰的错误信息
892
880
  switch (result_code_) {
893
- case RIG_ENAVAIL:
894
- case -11: // Feature not available
881
+ case SHIM_RIG_ENAVAIL:
895
882
  error_message_ = "VFO query not supported by this radio";
896
883
  break;
897
- case RIG_EIO:
884
+ case SHIM_RIG_EIO:
898
885
  error_message_ = "I/O error during VFO query";
899
886
  break;
900
- case RIG_ETIMEOUT:
887
+ case SHIM_RIG_ETIMEOUT:
901
888
  error_message_ = "Timeout during VFO query";
902
889
  break;
903
- case RIG_EPROTO:
890
+ case SHIM_RIG_EPROTO:
904
891
  error_message_ = "Protocol error during VFO query";
905
892
  break;
906
893
  default:
@@ -914,19 +901,19 @@ public:
914
901
  Napi::Env env = Env();
915
902
 
916
903
  // 如果API调用失败,reject Promise
917
- if (result_code_ != RIG_OK) {
904
+ if (result_code_ != SHIM_RIG_OK) {
918
905
  deferred_.Reject(Napi::Error::New(env, error_message_).Value());
919
906
  return;
920
907
  }
921
908
 
922
909
  const char* vfo_str = "VFO-CURR"; // 默认值
923
- if (vfo_ == RIG_VFO_A) {
910
+ if (vfo_ == SHIM_RIG_VFO_A) {
924
911
  vfo_str = "VFO-A";
925
- } else if (vfo_ == RIG_VFO_B) {
912
+ } else if (vfo_ == SHIM_RIG_VFO_B) {
926
913
  vfo_str = "VFO-B";
927
- } else if (vfo_ == RIG_VFO_CURR) {
914
+ } else if (vfo_ == SHIM_RIG_VFO_CURR) {
928
915
  vfo_str = "VFO-CURR";
929
- } else if (vfo_ == RIG_VFO_MEM) {
916
+ } else if (vfo_ == SHIM_RIG_VFO_MEM) {
930
917
  vfo_str = "VFO-MEM";
931
918
  }
932
919
  deferred_.Resolve(Napi::String::New(env, vfo_str));
@@ -938,7 +925,7 @@ public:
938
925
  }
939
926
 
940
927
  private:
941
- vfo_t vfo_;
928
+ int vfo_;
942
929
  };
943
930
 
944
931
  class CloseAsyncWorker : public HamLibAsyncWorker {
@@ -951,13 +938,13 @@ public:
951
938
 
952
939
  // 检查rig是否已经关闭
953
940
  if (!hamlib_instance_->rig_is_open) {
954
- result_code_ = RIG_OK; // 已经关闭,返回成功
941
+ result_code_ = SHIM_RIG_OK; // 已经关闭,返回成功
955
942
  return;
956
943
  }
957
944
 
958
- result_code_ = rig_close(hamlib_instance_->my_rig);
959
- if (result_code_ != RIG_OK) {
960
- error_message_ = rigerror(result_code_);
945
+ result_code_ = shim_rig_close(hamlib_instance_->my_rig);
946
+ if (result_code_ != SHIM_RIG_OK) {
947
+ error_message_ = shim_rigerror(result_code_);
961
948
  } else {
962
949
  hamlib_instance_->rig_is_open = false;
963
950
  }
@@ -965,7 +952,7 @@ public:
965
952
 
966
953
  void OnOK() override {
967
954
  Napi::Env env = Env();
968
- if (result_code_ != RIG_OK && !error_message_.empty()) {
955
+ if (result_code_ != SHIM_RIG_OK && !error_message_.empty()) {
969
956
  deferred_.Reject(Napi::Error::New(env, error_message_).Value());
970
957
  } else {
971
958
  deferred_.Resolve(Napi::Number::New(env, result_code_));
@@ -987,9 +974,9 @@ public:
987
974
  CHECK_RIG_VALID();
988
975
 
989
976
  // rig_cleanup会自动调用rig_close,所以我们不需要重复调用
990
- result_code_ = rig_cleanup(hamlib_instance_->my_rig);
991
- if (result_code_ != RIG_OK) {
992
- error_message_ = rigerror(result_code_);
977
+ result_code_ = shim_rig_cleanup(hamlib_instance_->my_rig);
978
+ if (result_code_ != SHIM_RIG_OK) {
979
+ error_message_ = shim_rigerror(result_code_);
993
980
  } else {
994
981
  hamlib_instance_->rig_is_open = false;
995
982
  hamlib_instance_->my_rig = nullptr; // 重要:清空指针防止重复释放
@@ -998,7 +985,7 @@ public:
998
985
 
999
986
  void OnOK() override {
1000
987
  Napi::Env env = Env();
1001
- if (result_code_ != RIG_OK && !error_message_.empty()) {
988
+ if (result_code_ != SHIM_RIG_OK && !error_message_.empty()) {
1002
989
  deferred_.Reject(Napi::Error::New(env, error_message_).Value());
1003
990
  } else {
1004
991
  deferred_.Resolve(Napi::Number::New(env, result_code_));
@@ -1014,21 +1001,21 @@ public:
1014
1001
  // Start Scan AsyncWorker
1015
1002
  class StartScanAsyncWorker : public HamLibAsyncWorker {
1016
1003
  public:
1017
- StartScanAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, scan_t scan_type, int channel)
1018
- : HamLibAsyncWorker(env, hamlib_instance), scan_type_(scan_type), channel_(channel) {}
1004
+ StartScanAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, int intype, int channel)
1005
+ : HamLibAsyncWorker(env, hamlib_instance), intype_(intype), channel_(channel) {}
1019
1006
 
1020
1007
  void Execute() override {
1021
1008
  CHECK_RIG_VALID();
1022
1009
 
1023
- result_code_ = rig_scan(hamlib_instance_->my_rig, RIG_VFO_CURR, scan_type_, channel_);
1024
- if (result_code_ != RIG_OK) {
1025
- error_message_ = rigerror(result_code_);
1010
+ result_code_ = shim_rig_scan(hamlib_instance_->my_rig, SHIM_RIG_VFO_CURR, intype_, channel_);
1011
+ if (result_code_ != SHIM_RIG_OK) {
1012
+ error_message_ = shim_rigerror(result_code_);
1026
1013
  }
1027
1014
  }
1028
1015
 
1029
1016
  void OnOK() override {
1030
1017
  Napi::Env env = Env();
1031
- if (result_code_ != RIG_OK && !error_message_.empty()) {
1018
+ if (result_code_ != SHIM_RIG_OK && !error_message_.empty()) {
1032
1019
  deferred_.Reject(Napi::Error::New(env, error_message_).Value());
1033
1020
  } else {
1034
1021
  deferred_.Resolve(Napi::Number::New(env, result_code_));
@@ -1041,7 +1028,7 @@ public:
1041
1028
  }
1042
1029
 
1043
1030
  private:
1044
- scan_t scan_type_;
1031
+ int intype_;
1045
1032
  int channel_;
1046
1033
  };
1047
1034
 
@@ -1054,15 +1041,15 @@ public:
1054
1041
  void Execute() override {
1055
1042
  CHECK_RIG_VALID();
1056
1043
 
1057
- result_code_ = rig_scan(hamlib_instance_->my_rig, RIG_VFO_CURR, RIG_SCAN_STOP, 0);
1058
- if (result_code_ != RIG_OK) {
1059
- error_message_ = rigerror(result_code_);
1044
+ result_code_ = shim_rig_scan(hamlib_instance_->my_rig, SHIM_RIG_VFO_CURR, SHIM_RIG_SCAN_STOP, 0);
1045
+ if (result_code_ != SHIM_RIG_OK) {
1046
+ error_message_ = shim_rigerror(result_code_);
1060
1047
  }
1061
1048
  }
1062
1049
 
1063
1050
  void OnOK() override {
1064
1051
  Napi::Env env = Env();
1065
- if (result_code_ != RIG_OK && !error_message_.empty()) {
1052
+ if (result_code_ != SHIM_RIG_OK && !error_message_.empty()) {
1066
1053
  deferred_.Reject(Napi::Error::New(env, error_message_).Value());
1067
1054
  } else {
1068
1055
  deferred_.Resolve(Napi::Number::New(env, result_code_));
@@ -1078,21 +1065,21 @@ public:
1078
1065
  // VFO Operation AsyncWorker
1079
1066
  class VfoOperationAsyncWorker : public HamLibAsyncWorker {
1080
1067
  public:
1081
- VfoOperationAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, vfo_op_t vfo_op)
1068
+ VfoOperationAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, int vfo_op)
1082
1069
  : HamLibAsyncWorker(env, hamlib_instance), vfo_op_(vfo_op) {}
1083
1070
 
1084
1071
  void Execute() override {
1085
1072
  CHECK_RIG_VALID();
1086
1073
 
1087
- result_code_ = rig_vfo_op(hamlib_instance_->my_rig, RIG_VFO_CURR, vfo_op_);
1088
- if (result_code_ != RIG_OK) {
1089
- error_message_ = rigerror(result_code_);
1074
+ result_code_ = shim_rig_vfo_op(hamlib_instance_->my_rig, SHIM_RIG_VFO_CURR, vfo_op_);
1075
+ if (result_code_ != SHIM_RIG_OK) {
1076
+ error_message_ = shim_rigerror(result_code_);
1090
1077
  }
1091
1078
  }
1092
1079
 
1093
1080
  void OnOK() override {
1094
1081
  Napi::Env env = Env();
1095
- if (result_code_ != RIG_OK && !error_message_.empty()) {
1082
+ if (result_code_ != SHIM_RIG_OK && !error_message_.empty()) {
1096
1083
  deferred_.Reject(Napi::Error::New(env, error_message_).Value());
1097
1084
  } else {
1098
1085
  deferred_.Resolve(Napi::Number::New(env, result_code_));
@@ -1105,109 +1092,109 @@ public:
1105
1092
  }
1106
1093
 
1107
1094
  private:
1108
- vfo_op_t vfo_op_;
1095
+ int vfo_op_;
1109
1096
  };
1110
1097
 
1111
1098
  // Set Antenna AsyncWorker
1112
1099
  class SetAntennaAsyncWorker : public HamLibAsyncWorker {
1113
1100
  public:
1114
- SetAntennaAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, ant_t antenna, vfo_t vfo, value_t option)
1101
+ SetAntennaAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, int antenna, int vfo, float option)
1115
1102
  : HamLibAsyncWorker(env, hamlib_instance), antenna_(antenna), vfo_(vfo), option_(option) {}
1116
-
1103
+
1117
1104
  void Execute() override {
1118
1105
  CHECK_RIG_VALID();
1119
-
1120
- result_code_ = rig_set_ant(hamlib_instance_->my_rig, vfo_, antenna_, option_);
1121
- if (result_code_ != RIG_OK) {
1122
- error_message_ = rigerror(result_code_);
1106
+
1107
+ result_code_ = shim_rig_set_ant(hamlib_instance_->my_rig, vfo_, antenna_, option_);
1108
+ if (result_code_ != SHIM_RIG_OK) {
1109
+ error_message_ = shim_rigerror(result_code_);
1123
1110
  }
1124
1111
  }
1125
-
1112
+
1126
1113
  void OnOK() override {
1127
1114
  Napi::Env env = Env();
1128
- if (result_code_ != RIG_OK && !error_message_.empty()) {
1115
+ if (result_code_ != SHIM_RIG_OK && !error_message_.empty()) {
1129
1116
  deferred_.Reject(Napi::Error::New(env, error_message_).Value());
1130
1117
  } else {
1131
1118
  deferred_.Resolve(Napi::Number::New(env, result_code_));
1132
1119
  }
1133
1120
  }
1134
-
1121
+
1135
1122
  void OnError(const Napi::Error& e) override {
1136
1123
  Napi::Env env = Env();
1137
1124
  deferred_.Reject(Napi::Error::New(env, error_message_).Value());
1138
1125
  }
1139
-
1126
+
1140
1127
  private:
1141
- ant_t antenna_;
1142
- vfo_t vfo_;
1143
- value_t option_;
1128
+ int antenna_;
1129
+ int vfo_;
1130
+ float option_;
1144
1131
  };
1145
1132
 
1146
1133
  // Get Antenna AsyncWorker
1147
1134
  class GetAntennaAsyncWorker : public HamLibAsyncWorker {
1148
1135
  public:
1149
- GetAntennaAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, vfo_t vfo, ant_t antenna)
1136
+ GetAntennaAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, int vfo, int antenna)
1150
1137
  : HamLibAsyncWorker(env, hamlib_instance), vfo_(vfo), antenna_(antenna), antenna_curr_(0), antenna_tx_(0), antenna_rx_(0) {}
1151
1138
 
1152
1139
  void Execute() override {
1153
1140
  CHECK_RIG_VALID();
1154
1141
 
1155
- option_ = {0};
1156
-
1157
- result_code_ = rig_get_ant(hamlib_instance_->my_rig, vfo_, antenna_, &option_, &antenna_curr_, &antenna_tx_, &antenna_rx_);
1158
- if (result_code_ != RIG_OK) {
1159
- error_message_ = rigerror(result_code_);
1142
+ option_ = 0.0f;
1143
+
1144
+ result_code_ = shim_rig_get_ant(hamlib_instance_->my_rig, vfo_, antenna_, &option_, &antenna_curr_, &antenna_tx_, &antenna_rx_);
1145
+ if (result_code_ != SHIM_RIG_OK) {
1146
+ error_message_ = shim_rigerror(result_code_);
1160
1147
  }
1161
1148
  }
1162
-
1149
+
1163
1150
  void OnOK() override {
1164
1151
  Napi::Env env = Env();
1165
- if (result_code_ != RIG_OK && !error_message_.empty()) {
1152
+ if (result_code_ != SHIM_RIG_OK && !error_message_.empty()) {
1166
1153
  deferred_.Reject(Napi::Error::New(env, error_message_).Value());
1167
1154
  } else {
1168
1155
  Napi::Object result = Napi::Object::New(env);
1169
-
1156
+
1170
1157
  result.Set("currentAntenna", Napi::Number::New(env, antenna_curr_));
1171
1158
  result.Set("txAntenna", Napi::Number::New(env, antenna_tx_));
1172
1159
  result.Set("rxAntenna", Napi::Number::New(env, antenna_rx_));
1173
- result.Set("option", Napi::Number::New(env, option_.f));
1174
-
1160
+ result.Set("option", Napi::Number::New(env, option_));
1161
+
1175
1162
  deferred_.Resolve(result);
1176
1163
  }
1177
1164
  }
1178
-
1165
+
1179
1166
  void OnError(const Napi::Error& e) override {
1180
1167
  Napi::Env env = Env();
1181
1168
  deferred_.Reject(Napi::Error::New(env, error_message_).Value());
1182
1169
  }
1183
-
1170
+
1184
1171
  private:
1185
- vfo_t vfo_;
1186
- ant_t antenna_;
1187
- ant_t antenna_curr_;
1188
- ant_t antenna_tx_;
1189
- ant_t antenna_rx_;
1190
- value_t option_;
1172
+ int vfo_;
1173
+ int antenna_;
1174
+ int antenna_curr_;
1175
+ int antenna_tx_;
1176
+ int antenna_rx_;
1177
+ float option_;
1191
1178
  };
1192
1179
 
1193
1180
  // Power to mW Conversion AsyncWorker
1194
1181
  class Power2mWAsyncWorker : public HamLibAsyncWorker {
1195
1182
  public:
1196
- Power2mWAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, float power, freq_t freq, rmode_t mode)
1183
+ Power2mWAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, float power, double freq, int mode)
1197
1184
  : HamLibAsyncWorker(env, hamlib_instance), power_(power), freq_(freq), mode_(mode), mwpower_(0) {}
1198
1185
 
1199
1186
  void Execute() override {
1200
1187
  CHECK_RIG_VALID();
1201
1188
 
1202
- result_code_ = rig_power2mW(hamlib_instance_->my_rig, &mwpower_, power_, freq_, mode_);
1203
- if (result_code_ != RIG_OK) {
1204
- error_message_ = rigerror(result_code_);
1189
+ result_code_ = shim_rig_power2mW(hamlib_instance_->my_rig, &mwpower_, power_, freq_, mode_);
1190
+ if (result_code_ != SHIM_RIG_OK) {
1191
+ error_message_ = shim_rigerror(result_code_);
1205
1192
  }
1206
1193
  }
1207
1194
 
1208
1195
  void OnOK() override {
1209
1196
  Napi::Env env = Env();
1210
- if (result_code_ != RIG_OK && !error_message_.empty()) {
1197
+ if (result_code_ != SHIM_RIG_OK && !error_message_.empty()) {
1211
1198
  deferred_.Reject(Napi::Error::New(env, error_message_).Value());
1212
1199
  } else {
1213
1200
  deferred_.Resolve(Napi::Number::New(env, mwpower_));
@@ -1221,29 +1208,29 @@ public:
1221
1208
 
1222
1209
  private:
1223
1210
  float power_;
1224
- freq_t freq_;
1225
- rmode_t mode_;
1211
+ double freq_;
1212
+ int mode_;
1226
1213
  unsigned int mwpower_;
1227
1214
  };
1228
1215
 
1229
1216
  // mW to Power Conversion AsyncWorker
1230
1217
  class MW2PowerAsyncWorker : public HamLibAsyncWorker {
1231
1218
  public:
1232
- MW2PowerAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, unsigned int mwpower, freq_t freq, rmode_t mode)
1219
+ MW2PowerAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, unsigned int mwpower, double freq, int mode)
1233
1220
  : HamLibAsyncWorker(env, hamlib_instance), mwpower_(mwpower), freq_(freq), mode_(mode), power_(0.0) {}
1234
1221
 
1235
1222
  void Execute() override {
1236
1223
  CHECK_RIG_VALID();
1237
1224
 
1238
- result_code_ = rig_mW2power(hamlib_instance_->my_rig, &power_, mwpower_, freq_, mode_);
1239
- if (result_code_ != RIG_OK) {
1240
- error_message_ = rigerror(result_code_);
1225
+ result_code_ = shim_rig_mW2power(hamlib_instance_->my_rig, &power_, mwpower_, freq_, mode_);
1226
+ if (result_code_ != SHIM_RIG_OK) {
1227
+ error_message_ = shim_rigerror(result_code_);
1241
1228
  }
1242
1229
  }
1243
1230
 
1244
1231
  void OnOK() override {
1245
1232
  Napi::Env env = Env();
1246
- if (result_code_ != RIG_OK && !error_message_.empty()) {
1233
+ if (result_code_ != SHIM_RIG_OK && !error_message_.empty()) {
1247
1234
  deferred_.Reject(Napi::Error::New(env, error_message_).Value());
1248
1235
  } else {
1249
1236
  deferred_.Resolve(Napi::Number::New(env, power_));
@@ -1257,29 +1244,29 @@ public:
1257
1244
 
1258
1245
  private:
1259
1246
  unsigned int mwpower_;
1260
- freq_t freq_;
1261
- rmode_t mode_;
1247
+ double freq_;
1248
+ int mode_;
1262
1249
  float power_;
1263
1250
  };
1264
1251
 
1265
1252
  // Set Split Mode AsyncWorker
1266
1253
  class SetSplitModeAsyncWorker : public HamLibAsyncWorker {
1267
1254
  public:
1268
- SetSplitModeAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, rmode_t tx_mode, pbwidth_t tx_width, vfo_t vfo = RIG_VFO_CURR)
1255
+ SetSplitModeAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, int tx_mode, int tx_width, int vfo = SHIM_RIG_VFO_CURR)
1269
1256
  : HamLibAsyncWorker(env, hamlib_instance), tx_mode_(tx_mode), tx_width_(tx_width), vfo_(vfo) {}
1270
1257
 
1271
1258
  void Execute() override {
1272
1259
  CHECK_RIG_VALID();
1273
1260
 
1274
- result_code_ = rig_set_split_mode(hamlib_instance_->my_rig, vfo_, tx_mode_, tx_width_);
1275
- if (result_code_ != RIG_OK) {
1276
- error_message_ = rigerror(result_code_);
1261
+ result_code_ = shim_rig_set_split_mode(hamlib_instance_->my_rig, vfo_, tx_mode_, tx_width_);
1262
+ if (result_code_ != SHIM_RIG_OK) {
1263
+ error_message_ = shim_rigerror(result_code_);
1277
1264
  }
1278
1265
  }
1279
1266
 
1280
1267
  void OnOK() override {
1281
1268
  Napi::Env env = Env();
1282
- if (result_code_ != RIG_OK && !error_message_.empty()) {
1269
+ if (result_code_ != SHIM_RIG_OK && !error_message_.empty()) {
1283
1270
  deferred_.Reject(Napi::Error::New(env, error_message_).Value());
1284
1271
  } else {
1285
1272
  deferred_.Resolve(Napi::Number::New(env, result_code_));
@@ -1292,34 +1279,34 @@ public:
1292
1279
  }
1293
1280
 
1294
1281
  private:
1295
- rmode_t tx_mode_;
1296
- pbwidth_t tx_width_;
1297
- vfo_t vfo_;
1282
+ int tx_mode_;
1283
+ int tx_width_;
1284
+ int vfo_;
1298
1285
  };
1299
1286
 
1300
1287
  // Get Split Mode AsyncWorker
1301
1288
  class GetSplitModeAsyncWorker : public HamLibAsyncWorker {
1302
1289
  public:
1303
- GetSplitModeAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, vfo_t vfo = RIG_VFO_CURR)
1290
+ GetSplitModeAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, int vfo = SHIM_RIG_VFO_CURR)
1304
1291
  : HamLibAsyncWorker(env, hamlib_instance), tx_mode_(0), tx_width_(0), vfo_(vfo) {}
1305
1292
 
1306
1293
  void Execute() override {
1307
1294
  CHECK_RIG_VALID();
1308
1295
 
1309
- result_code_ = rig_get_split_mode(hamlib_instance_->my_rig, vfo_, &tx_mode_, &tx_width_);
1310
- if (result_code_ != RIG_OK) {
1311
- error_message_ = rigerror(result_code_);
1296
+ result_code_ = shim_rig_get_split_mode(hamlib_instance_->my_rig, vfo_, &tx_mode_, &tx_width_);
1297
+ if (result_code_ != SHIM_RIG_OK) {
1298
+ error_message_ = shim_rigerror(result_code_);
1312
1299
  }
1313
1300
  }
1314
1301
 
1315
1302
  void OnOK() override {
1316
1303
  Napi::Env env = Env();
1317
- if (result_code_ != RIG_OK && !error_message_.empty()) {
1304
+ if (result_code_ != SHIM_RIG_OK && !error_message_.empty()) {
1318
1305
  deferred_.Reject(Napi::Error::New(env, error_message_).Value());
1319
1306
  } else {
1320
1307
  Napi::Object obj = Napi::Object::New(env);
1321
1308
  // Convert mode to string using rig_strrmode
1322
- const char* mode_str = rig_strrmode(tx_mode_);
1309
+ const char* mode_str = shim_rig_strrmode(tx_mode_);
1323
1310
  obj.Set(Napi::String::New(env, "mode"), Napi::String::New(env, mode_str));
1324
1311
  obj.Set(Napi::String::New(env, "width"), tx_width_);
1325
1312
  deferred_.Resolve(obj);
@@ -1332,9 +1319,9 @@ public:
1332
1319
  }
1333
1320
 
1334
1321
  private:
1335
- rmode_t tx_mode_;
1336
- pbwidth_t tx_width_;
1337
- vfo_t vfo_;
1322
+ int tx_mode_;
1323
+ int tx_width_;
1324
+ int vfo_;
1338
1325
  };
1339
1326
 
1340
1327
  // Set Serial Config AsyncWorker
@@ -1349,137 +1336,137 @@ public:
1349
1336
  // Apply serial configuration parameter
1350
1337
  if (param_name_ == "data_bits") {
1351
1338
  int data_bits = std::stoi(param_value_);
1352
- hamlib_instance_->my_rig->state.rigport.parm.serial.data_bits = data_bits;
1353
- result_code_ = RIG_OK;
1339
+ shim_rig_set_serial_data_bits(hamlib_instance_->my_rig, data_bits);
1340
+ result_code_ = SHIM_RIG_OK;
1354
1341
  } else if (param_name_ == "stop_bits") {
1355
1342
  int stop_bits = std::stoi(param_value_);
1356
- hamlib_instance_->my_rig->state.rigport.parm.serial.stop_bits = stop_bits;
1357
- result_code_ = RIG_OK;
1343
+ shim_rig_set_serial_stop_bits(hamlib_instance_->my_rig, stop_bits);
1344
+ result_code_ = SHIM_RIG_OK;
1358
1345
  } else if (param_name_ == "serial_parity") {
1359
- enum serial_parity_e parity;
1346
+ int parity;
1360
1347
  if (param_value_ == "None") {
1361
- parity = RIG_PARITY_NONE;
1348
+ parity = SHIM_RIG_PARITY_NONE;
1362
1349
  } else if (param_value_ == "Even") {
1363
- parity = RIG_PARITY_EVEN;
1350
+ parity = SHIM_RIG_PARITY_EVEN;
1364
1351
  } else if (param_value_ == "Odd") {
1365
- parity = RIG_PARITY_ODD;
1352
+ parity = SHIM_RIG_PARITY_ODD;
1366
1353
  } else {
1367
- result_code_ = -RIG_EINVAL;
1354
+ result_code_ = SHIM_RIG_EINVAL;
1368
1355
  error_message_ = "Invalid parity value";
1369
1356
  return;
1370
1357
  }
1371
- hamlib_instance_->my_rig->state.rigport.parm.serial.parity = parity;
1372
- result_code_ = RIG_OK;
1358
+ shim_rig_set_serial_parity(hamlib_instance_->my_rig, parity);
1359
+ result_code_ = SHIM_RIG_OK;
1373
1360
  } else if (param_name_ == "serial_handshake") {
1374
- enum serial_handshake_e handshake;
1361
+ int handshake;
1375
1362
  if (param_value_ == "None") {
1376
- handshake = RIG_HANDSHAKE_NONE;
1363
+ handshake = SHIM_RIG_HANDSHAKE_NONE;
1377
1364
  } else if (param_value_ == "Hardware") {
1378
- handshake = RIG_HANDSHAKE_HARDWARE;
1365
+ handshake = SHIM_RIG_HANDSHAKE_HARDWARE;
1379
1366
  } else if (param_value_ == "Software") {
1380
- handshake = RIG_HANDSHAKE_XONXOFF;
1367
+ handshake = SHIM_RIG_HANDSHAKE_XONXOFF;
1381
1368
  } else {
1382
- result_code_ = -RIG_EINVAL;
1369
+ result_code_ = SHIM_RIG_EINVAL;
1383
1370
  error_message_ = "Invalid handshake value";
1384
1371
  return;
1385
1372
  }
1386
- hamlib_instance_->my_rig->state.rigport.parm.serial.handshake = handshake;
1387
- result_code_ = RIG_OK;
1373
+ shim_rig_set_serial_handshake(hamlib_instance_->my_rig, handshake);
1374
+ result_code_ = SHIM_RIG_OK;
1388
1375
  } else if (param_name_ == "rts_state") {
1389
- enum serial_control_state_e state;
1376
+ int state;
1390
1377
  if (param_value_ == "ON") {
1391
- state = RIG_SIGNAL_ON;
1378
+ state = SHIM_RIG_SIGNAL_ON;
1392
1379
  } else if (param_value_ == "OFF") {
1393
- state = RIG_SIGNAL_OFF;
1380
+ state = SHIM_RIG_SIGNAL_OFF;
1394
1381
  } else {
1395
- result_code_ = -RIG_EINVAL;
1382
+ result_code_ = SHIM_RIG_EINVAL;
1396
1383
  error_message_ = "Invalid RTS state value";
1397
1384
  return;
1398
1385
  }
1399
- hamlib_instance_->my_rig->state.rigport.parm.serial.rts_state = state;
1400
- result_code_ = RIG_OK;
1386
+ shim_rig_set_serial_rts_state(hamlib_instance_->my_rig, state);
1387
+ result_code_ = SHIM_RIG_OK;
1401
1388
  } else if (param_name_ == "dtr_state") {
1402
- enum serial_control_state_e state;
1389
+ int state;
1403
1390
  if (param_value_ == "ON") {
1404
- state = RIG_SIGNAL_ON;
1391
+ state = SHIM_RIG_SIGNAL_ON;
1405
1392
  } else if (param_value_ == "OFF") {
1406
- state = RIG_SIGNAL_OFF;
1393
+ state = SHIM_RIG_SIGNAL_OFF;
1407
1394
  } else {
1408
- result_code_ = -RIG_EINVAL;
1395
+ result_code_ = SHIM_RIG_EINVAL;
1409
1396
  error_message_ = "Invalid DTR state value";
1410
1397
  return;
1411
1398
  }
1412
- hamlib_instance_->my_rig->state.rigport.parm.serial.dtr_state = state;
1413
- result_code_ = RIG_OK;
1399
+ shim_rig_set_serial_dtr_state(hamlib_instance_->my_rig, state);
1400
+ result_code_ = SHIM_RIG_OK;
1414
1401
  } else if (param_name_ == "rate") {
1415
1402
  int rate = std::stoi(param_value_);
1416
1403
  // Validate supported baud rates based on common values in Hamlib
1417
- std::vector<int> valid_rates = {150, 300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200,
1418
- 230400, 460800, 500000, 576000, 921600, 1000000, 1152000, 1500000,
1404
+ std::vector<int> valid_rates = {150, 300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200,
1405
+ 230400, 460800, 500000, 576000, 921600, 1000000, 1152000, 1500000,
1419
1406
  2000000, 2500000, 3000000, 3500000, 4000000};
1420
1407
  if (std::find(valid_rates.begin(), valid_rates.end(), rate) != valid_rates.end()) {
1421
- hamlib_instance_->my_rig->state.rigport.parm.serial.rate = rate;
1422
- result_code_ = RIG_OK;
1408
+ shim_rig_set_serial_rate(hamlib_instance_->my_rig, rate);
1409
+ result_code_ = SHIM_RIG_OK;
1423
1410
  } else {
1424
- result_code_ = -RIG_EINVAL;
1411
+ result_code_ = SHIM_RIG_EINVAL;
1425
1412
  error_message_ = "Invalid baud rate value";
1426
1413
  }
1427
1414
  } else if (param_name_ == "timeout") {
1428
1415
  int timeout_val = std::stoi(param_value_);
1429
1416
  if (timeout_val >= 0) {
1430
- hamlib_instance_->my_rig->state.rigport.timeout = timeout_val;
1431
- result_code_ = RIG_OK;
1417
+ shim_rig_set_port_timeout(hamlib_instance_->my_rig, timeout_val);
1418
+ result_code_ = SHIM_RIG_OK;
1432
1419
  } else {
1433
- result_code_ = -RIG_EINVAL;
1420
+ result_code_ = SHIM_RIG_EINVAL;
1434
1421
  error_message_ = "Timeout must be non-negative";
1435
1422
  }
1436
1423
  } else if (param_name_ == "retry") {
1437
1424
  int retry_val = std::stoi(param_value_);
1438
1425
  if (retry_val >= 0) {
1439
- hamlib_instance_->my_rig->state.rigport.retry = (short)retry_val;
1440
- result_code_ = RIG_OK;
1426
+ shim_rig_set_port_retry(hamlib_instance_->my_rig, retry_val);
1427
+ result_code_ = SHIM_RIG_OK;
1441
1428
  } else {
1442
- result_code_ = -RIG_EINVAL;
1429
+ result_code_ = SHIM_RIG_EINVAL;
1443
1430
  error_message_ = "Retry count must be non-negative";
1444
1431
  }
1445
1432
  } else if (param_name_ == "write_delay") {
1446
1433
  int delay = std::stoi(param_value_);
1447
1434
  if (delay >= 0) {
1448
- hamlib_instance_->my_rig->state.rigport.write_delay = delay;
1449
- result_code_ = RIG_OK;
1435
+ shim_rig_set_port_write_delay(hamlib_instance_->my_rig, delay);
1436
+ result_code_ = SHIM_RIG_OK;
1450
1437
  } else {
1451
- result_code_ = -RIG_EINVAL;
1438
+ result_code_ = SHIM_RIG_EINVAL;
1452
1439
  error_message_ = "Write delay must be non-negative";
1453
1440
  }
1454
1441
  } else if (param_name_ == "post_write_delay") {
1455
1442
  int delay = std::stoi(param_value_);
1456
1443
  if (delay >= 0) {
1457
- hamlib_instance_->my_rig->state.rigport.post_write_delay = delay;
1458
- result_code_ = RIG_OK;
1444
+ shim_rig_set_port_post_write_delay(hamlib_instance_->my_rig, delay);
1445
+ result_code_ = SHIM_RIG_OK;
1459
1446
  } else {
1460
- result_code_ = -RIG_EINVAL;
1447
+ result_code_ = SHIM_RIG_EINVAL;
1461
1448
  error_message_ = "Post write delay must be non-negative";
1462
1449
  }
1463
1450
  } else if (param_name_ == "flushx") {
1464
1451
  if (param_value_ == "true" || param_value_ == "1") {
1465
- hamlib_instance_->my_rig->state.rigport.flushx = 1;
1466
- result_code_ = RIG_OK;
1452
+ shim_rig_set_port_flushx(hamlib_instance_->my_rig, 1);
1453
+ result_code_ = SHIM_RIG_OK;
1467
1454
  } else if (param_value_ == "false" || param_value_ == "0") {
1468
- hamlib_instance_->my_rig->state.rigport.flushx = 0;
1469
- result_code_ = RIG_OK;
1455
+ shim_rig_set_port_flushx(hamlib_instance_->my_rig, 0);
1456
+ result_code_ = SHIM_RIG_OK;
1470
1457
  } else {
1471
- result_code_ = -RIG_EINVAL;
1458
+ result_code_ = SHIM_RIG_EINVAL;
1472
1459
  error_message_ = "Flushx must be true/false or 1/0";
1473
1460
  }
1474
1461
  } else {
1475
- result_code_ = -RIG_EINVAL;
1462
+ result_code_ = SHIM_RIG_EINVAL;
1476
1463
  error_message_ = "Unknown serial configuration parameter";
1477
1464
  }
1478
1465
  }
1479
1466
 
1480
1467
  void OnOK() override {
1481
1468
  Napi::Env env = Env();
1482
- if (result_code_ != RIG_OK && !error_message_.empty()) {
1469
+ if (result_code_ != SHIM_RIG_OK && !error_message_.empty()) {
1483
1470
  deferred_.Reject(Napi::Error::New(env, error_message_).Value());
1484
1471
  } else {
1485
1472
  deferred_.Resolve(Napi::Number::New(env, result_code_));
@@ -1507,96 +1494,96 @@ public:
1507
1494
 
1508
1495
  // Get serial configuration parameter
1509
1496
  if (param_name_ == "data_bits") {
1510
- param_value_ = std::to_string(hamlib_instance_->my_rig->state.rigport.parm.serial.data_bits);
1511
- result_code_ = RIG_OK;
1497
+ param_value_ = std::to_string(shim_rig_get_serial_data_bits(hamlib_instance_->my_rig));
1498
+ result_code_ = SHIM_RIG_OK;
1512
1499
  } else if (param_name_ == "stop_bits") {
1513
- param_value_ = std::to_string(hamlib_instance_->my_rig->state.rigport.parm.serial.stop_bits);
1514
- result_code_ = RIG_OK;
1500
+ param_value_ = std::to_string(shim_rig_get_serial_stop_bits(hamlib_instance_->my_rig));
1501
+ result_code_ = SHIM_RIG_OK;
1515
1502
  } else if (param_name_ == "serial_parity") {
1516
- switch (hamlib_instance_->my_rig->state.rigport.parm.serial.parity) {
1517
- case RIG_PARITY_NONE:
1503
+ switch (shim_rig_get_serial_parity(hamlib_instance_->my_rig)) {
1504
+ case SHIM_RIG_PARITY_NONE:
1518
1505
  param_value_ = "None";
1519
1506
  break;
1520
- case RIG_PARITY_EVEN:
1507
+ case SHIM_RIG_PARITY_EVEN:
1521
1508
  param_value_ = "Even";
1522
1509
  break;
1523
- case RIG_PARITY_ODD:
1510
+ case SHIM_RIG_PARITY_ODD:
1524
1511
  param_value_ = "Odd";
1525
1512
  break;
1526
1513
  default:
1527
1514
  param_value_ = "Unknown";
1528
1515
  break;
1529
1516
  }
1530
- result_code_ = RIG_OK;
1517
+ result_code_ = SHIM_RIG_OK;
1531
1518
  } else if (param_name_ == "serial_handshake") {
1532
- switch (hamlib_instance_->my_rig->state.rigport.parm.serial.handshake) {
1533
- case RIG_HANDSHAKE_NONE:
1519
+ switch (shim_rig_get_serial_handshake(hamlib_instance_->my_rig)) {
1520
+ case SHIM_RIG_HANDSHAKE_NONE:
1534
1521
  param_value_ = "None";
1535
1522
  break;
1536
- case RIG_HANDSHAKE_HARDWARE:
1523
+ case SHIM_RIG_HANDSHAKE_HARDWARE:
1537
1524
  param_value_ = "Hardware";
1538
1525
  break;
1539
- case RIG_HANDSHAKE_XONXOFF:
1526
+ case SHIM_RIG_HANDSHAKE_XONXOFF:
1540
1527
  param_value_ = "Software";
1541
1528
  break;
1542
1529
  default:
1543
1530
  param_value_ = "Unknown";
1544
1531
  break;
1545
1532
  }
1546
- result_code_ = RIG_OK;
1533
+ result_code_ = SHIM_RIG_OK;
1547
1534
  } else if (param_name_ == "rts_state") {
1548
- switch (hamlib_instance_->my_rig->state.rigport.parm.serial.rts_state) {
1549
- case RIG_SIGNAL_ON:
1535
+ switch (shim_rig_get_serial_rts_state(hamlib_instance_->my_rig)) {
1536
+ case SHIM_RIG_SIGNAL_ON:
1550
1537
  param_value_ = "ON";
1551
1538
  break;
1552
- case RIG_SIGNAL_OFF:
1539
+ case SHIM_RIG_SIGNAL_OFF:
1553
1540
  param_value_ = "OFF";
1554
1541
  break;
1555
1542
  default:
1556
1543
  param_value_ = "Unknown";
1557
1544
  break;
1558
1545
  }
1559
- result_code_ = RIG_OK;
1546
+ result_code_ = SHIM_RIG_OK;
1560
1547
  } else if (param_name_ == "dtr_state") {
1561
- switch (hamlib_instance_->my_rig->state.rigport.parm.serial.dtr_state) {
1562
- case RIG_SIGNAL_ON:
1548
+ switch (shim_rig_get_serial_dtr_state(hamlib_instance_->my_rig)) {
1549
+ case SHIM_RIG_SIGNAL_ON:
1563
1550
  param_value_ = "ON";
1564
1551
  break;
1565
- case RIG_SIGNAL_OFF:
1552
+ case SHIM_RIG_SIGNAL_OFF:
1566
1553
  param_value_ = "OFF";
1567
1554
  break;
1568
1555
  default:
1569
1556
  param_value_ = "Unknown";
1570
1557
  break;
1571
1558
  }
1572
- result_code_ = RIG_OK;
1559
+ result_code_ = SHIM_RIG_OK;
1573
1560
  } else if (param_name_ == "rate") {
1574
- param_value_ = std::to_string(hamlib_instance_->my_rig->state.rigport.parm.serial.rate);
1575
- result_code_ = RIG_OK;
1561
+ param_value_ = std::to_string(shim_rig_get_serial_rate(hamlib_instance_->my_rig));
1562
+ result_code_ = SHIM_RIG_OK;
1576
1563
  } else if (param_name_ == "timeout") {
1577
- param_value_ = std::to_string(hamlib_instance_->my_rig->state.rigport.timeout);
1578
- result_code_ = RIG_OK;
1564
+ param_value_ = std::to_string(shim_rig_get_port_timeout(hamlib_instance_->my_rig));
1565
+ result_code_ = SHIM_RIG_OK;
1579
1566
  } else if (param_name_ == "retry") {
1580
- param_value_ = std::to_string(hamlib_instance_->my_rig->state.rigport.retry);
1581
- result_code_ = RIG_OK;
1567
+ param_value_ = std::to_string(shim_rig_get_port_retry(hamlib_instance_->my_rig));
1568
+ result_code_ = SHIM_RIG_OK;
1582
1569
  } else if (param_name_ == "write_delay") {
1583
- param_value_ = std::to_string(hamlib_instance_->my_rig->state.rigport.write_delay);
1584
- result_code_ = RIG_OK;
1570
+ param_value_ = std::to_string(shim_rig_get_port_write_delay(hamlib_instance_->my_rig));
1571
+ result_code_ = SHIM_RIG_OK;
1585
1572
  } else if (param_name_ == "post_write_delay") {
1586
- param_value_ = std::to_string(hamlib_instance_->my_rig->state.rigport.post_write_delay);
1587
- result_code_ = RIG_OK;
1573
+ param_value_ = std::to_string(shim_rig_get_port_post_write_delay(hamlib_instance_->my_rig));
1574
+ result_code_ = SHIM_RIG_OK;
1588
1575
  } else if (param_name_ == "flushx") {
1589
- param_value_ = hamlib_instance_->my_rig->state.rigport.flushx ? "true" : "false";
1590
- result_code_ = RIG_OK;
1576
+ param_value_ = shim_rig_get_port_flushx(hamlib_instance_->my_rig) ? "true" : "false";
1577
+ result_code_ = SHIM_RIG_OK;
1591
1578
  } else {
1592
- result_code_ = -RIG_EINVAL;
1579
+ result_code_ = SHIM_RIG_EINVAL;
1593
1580
  error_message_ = "Unknown serial configuration parameter";
1594
1581
  }
1595
1582
  }
1596
1583
 
1597
1584
  void OnOK() override {
1598
1585
  Napi::Env env = Env();
1599
- if (result_code_ != RIG_OK && !error_message_.empty()) {
1586
+ if (result_code_ != SHIM_RIG_OK && !error_message_.empty()) {
1600
1587
  deferred_.Reject(Napi::Error::New(env, error_message_).Value());
1601
1588
  } else {
1602
1589
  deferred_.Resolve(Napi::String::New(env, param_value_));
@@ -1616,42 +1603,42 @@ private:
1616
1603
  // Set PTT Type AsyncWorker
1617
1604
  class SetPttTypeAsyncWorker : public HamLibAsyncWorker {
1618
1605
  public:
1619
- SetPttTypeAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, const std::string& ptt_type)
1620
- : HamLibAsyncWorker(env, hamlib_instance), ptt_type_(ptt_type) {}
1606
+ SetPttTypeAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, const std::string& intype)
1607
+ : HamLibAsyncWorker(env, hamlib_instance), intype_(intype) {}
1621
1608
 
1622
1609
  void Execute() override {
1623
1610
  CHECK_RIG_VALID();
1624
1611
 
1625
- ptt_type_t ptt_type;
1626
- if (ptt_type_ == "RIG") {
1627
- ptt_type = RIG_PTT_RIG;
1628
- } else if (ptt_type_ == "DTR") {
1629
- ptt_type = RIG_PTT_SERIAL_DTR;
1630
- } else if (ptt_type_ == "RTS") {
1631
- ptt_type = RIG_PTT_SERIAL_RTS;
1632
- } else if (ptt_type_ == "PARALLEL") {
1633
- ptt_type = RIG_PTT_PARALLEL;
1634
- } else if (ptt_type_ == "CM108") {
1635
- ptt_type = RIG_PTT_CM108;
1636
- } else if (ptt_type_ == "GPIO") {
1637
- ptt_type = RIG_PTT_GPIO;
1638
- } else if (ptt_type_ == "GPION") {
1639
- ptt_type = RIG_PTT_GPION;
1640
- } else if (ptt_type_ == "NONE") {
1641
- ptt_type = RIG_PTT_NONE;
1612
+ int intype;
1613
+ if (intype_ == "RIG") {
1614
+ intype = SHIM_RIG_PTT_RIG;
1615
+ } else if (intype_ == "DTR") {
1616
+ intype = SHIM_RIG_PTT_SERIAL_DTR;
1617
+ } else if (intype_ == "RTS") {
1618
+ intype = SHIM_RIG_PTT_SERIAL_RTS;
1619
+ } else if (intype_ == "PARALLEL") {
1620
+ intype = SHIM_RIG_PTT_PARALLEL;
1621
+ } else if (intype_ == "CM108") {
1622
+ intype = SHIM_RIG_PTT_CM108;
1623
+ } else if (intype_ == "GPIO") {
1624
+ intype = SHIM_RIG_PTT_GPIO;
1625
+ } else if (intype_ == "GPION") {
1626
+ intype = SHIM_RIG_PTT_GPION;
1627
+ } else if (intype_ == "NONE") {
1628
+ intype = SHIM_RIG_PTT_NONE;
1642
1629
  } else {
1643
- result_code_ = -RIG_EINVAL;
1630
+ result_code_ = SHIM_RIG_EINVAL;
1644
1631
  error_message_ = "Invalid PTT type";
1645
1632
  return;
1646
1633
  }
1647
1634
 
1648
- hamlib_instance_->my_rig->state.pttport.type.ptt = ptt_type;
1649
- result_code_ = RIG_OK;
1635
+ shim_rig_set_ptt_type(hamlib_instance_->my_rig, intype);
1636
+ result_code_ = SHIM_RIG_OK;
1650
1637
  }
1651
1638
 
1652
1639
  void OnOK() override {
1653
1640
  Napi::Env env = Env();
1654
- if (result_code_ != RIG_OK && !error_message_.empty()) {
1641
+ if (result_code_ != SHIM_RIG_OK && !error_message_.empty()) {
1655
1642
  deferred_.Reject(Napi::Error::New(env, error_message_).Value());
1656
1643
  } else {
1657
1644
  deferred_.Resolve(Napi::Number::New(env, result_code_));
@@ -1664,7 +1651,7 @@ public:
1664
1651
  }
1665
1652
 
1666
1653
  private:
1667
- std::string ptt_type_;
1654
+ std::string intype_;
1668
1655
  };
1669
1656
 
1670
1657
  // Get PTT Type AsyncWorker
@@ -1676,46 +1663,46 @@ public:
1676
1663
  void Execute() override {
1677
1664
  CHECK_RIG_VALID();
1678
1665
 
1679
- ptt_type_t ptt_type = hamlib_instance_->my_rig->state.pttport.type.ptt;
1666
+ int intype = shim_rig_get_ptt_type(hamlib_instance_->my_rig);
1680
1667
 
1681
- switch (ptt_type) {
1682
- case RIG_PTT_RIG:
1683
- ptt_type_str_ = "RIG";
1668
+ switch (intype) {
1669
+ case SHIM_RIG_PTT_RIG:
1670
+ intype_str_ = "RIG";
1684
1671
  break;
1685
- case RIG_PTT_SERIAL_DTR:
1686
- ptt_type_str_ = "DTR";
1672
+ case SHIM_RIG_PTT_SERIAL_DTR:
1673
+ intype_str_ = "DTR";
1687
1674
  break;
1688
- case RIG_PTT_SERIAL_RTS:
1689
- ptt_type_str_ = "RTS";
1675
+ case SHIM_RIG_PTT_SERIAL_RTS:
1676
+ intype_str_ = "RTS";
1690
1677
  break;
1691
- case RIG_PTT_PARALLEL:
1692
- ptt_type_str_ = "PARALLEL";
1678
+ case SHIM_RIG_PTT_PARALLEL:
1679
+ intype_str_ = "PARALLEL";
1693
1680
  break;
1694
- case RIG_PTT_CM108:
1695
- ptt_type_str_ = "CM108";
1681
+ case SHIM_RIG_PTT_CM108:
1682
+ intype_str_ = "CM108";
1696
1683
  break;
1697
- case RIG_PTT_GPIO:
1698
- ptt_type_str_ = "GPIO";
1684
+ case SHIM_RIG_PTT_GPIO:
1685
+ intype_str_ = "GPIO";
1699
1686
  break;
1700
- case RIG_PTT_GPION:
1701
- ptt_type_str_ = "GPION";
1687
+ case SHIM_RIG_PTT_GPION:
1688
+ intype_str_ = "GPION";
1702
1689
  break;
1703
- case RIG_PTT_NONE:
1704
- ptt_type_str_ = "NONE";
1690
+ case SHIM_RIG_PTT_NONE:
1691
+ intype_str_ = "NONE";
1705
1692
  break;
1706
1693
  default:
1707
- ptt_type_str_ = "Unknown";
1694
+ intype_str_ = "Unknown";
1708
1695
  break;
1709
1696
  }
1710
- result_code_ = RIG_OK;
1697
+ result_code_ = SHIM_RIG_OK;
1711
1698
  }
1712
1699
 
1713
1700
  void OnOK() override {
1714
1701
  Napi::Env env = Env();
1715
- if (result_code_ != RIG_OK && !error_message_.empty()) {
1702
+ if (result_code_ != SHIM_RIG_OK && !error_message_.empty()) {
1716
1703
  deferred_.Reject(Napi::Error::New(env, error_message_).Value());
1717
1704
  } else {
1718
- deferred_.Resolve(Napi::String::New(env, ptt_type_str_));
1705
+ deferred_.Resolve(Napi::String::New(env, intype_str_));
1719
1706
  }
1720
1707
  }
1721
1708
 
@@ -1725,50 +1712,50 @@ public:
1725
1712
  }
1726
1713
 
1727
1714
  private:
1728
- std::string ptt_type_str_;
1715
+ std::string intype_str_;
1729
1716
  };
1730
1717
 
1731
1718
  // Set DCD Type AsyncWorker
1732
1719
  class SetDcdTypeAsyncWorker : public HamLibAsyncWorker {
1733
1720
  public:
1734
- SetDcdTypeAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, const std::string& dcd_type)
1735
- : HamLibAsyncWorker(env, hamlib_instance), dcd_type_(dcd_type) {}
1721
+ SetDcdTypeAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, const std::string& intype)
1722
+ : HamLibAsyncWorker(env, hamlib_instance), intype_(intype) {}
1736
1723
 
1737
1724
  void Execute() override {
1738
1725
  CHECK_RIG_VALID();
1739
1726
 
1740
- dcd_type_t dcd_type;
1741
- if (dcd_type_ == "RIG") {
1742
- dcd_type = RIG_DCD_RIG;
1743
- } else if (dcd_type_ == "DSR") {
1744
- dcd_type = RIG_DCD_SERIAL_DSR;
1745
- } else if (dcd_type_ == "CTS") {
1746
- dcd_type = RIG_DCD_SERIAL_CTS;
1747
- } else if (dcd_type_ == "CD") {
1748
- dcd_type = RIG_DCD_SERIAL_CAR;
1749
- } else if (dcd_type_ == "PARALLEL") {
1750
- dcd_type = RIG_DCD_PARALLEL;
1751
- } else if (dcd_type_ == "CM108") {
1752
- dcd_type = RIG_DCD_CM108;
1753
- } else if (dcd_type_ == "GPIO") {
1754
- dcd_type = RIG_DCD_GPIO;
1755
- } else if (dcd_type_ == "GPION") {
1756
- dcd_type = RIG_DCD_GPION;
1757
- } else if (dcd_type_ == "NONE") {
1758
- dcd_type = RIG_DCD_NONE;
1727
+ int intype;
1728
+ if (intype_ == "RIG") {
1729
+ intype = SHIM_RIG_DCD_RIG;
1730
+ } else if (intype_ == "DSR") {
1731
+ intype = SHIM_RIG_DCD_SERIAL_DSR;
1732
+ } else if (intype_ == "CTS") {
1733
+ intype = SHIM_RIG_DCD_SERIAL_CTS;
1734
+ } else if (intype_ == "CD") {
1735
+ intype = SHIM_RIG_DCD_SERIAL_CAR;
1736
+ } else if (intype_ == "PARALLEL") {
1737
+ intype = SHIM_RIG_DCD_PARALLEL;
1738
+ } else if (intype_ == "CM108") {
1739
+ intype = SHIM_RIG_DCD_CM108;
1740
+ } else if (intype_ == "GPIO") {
1741
+ intype = SHIM_RIG_DCD_GPIO;
1742
+ } else if (intype_ == "GPION") {
1743
+ intype = SHIM_RIG_DCD_GPION;
1744
+ } else if (intype_ == "NONE") {
1745
+ intype = SHIM_RIG_DCD_NONE;
1759
1746
  } else {
1760
- result_code_ = -RIG_EINVAL;
1747
+ result_code_ = SHIM_RIG_EINVAL;
1761
1748
  error_message_ = "Invalid DCD type";
1762
1749
  return;
1763
1750
  }
1764
1751
 
1765
- hamlib_instance_->my_rig->state.dcdport.type.dcd = dcd_type;
1766
- result_code_ = RIG_OK;
1752
+ shim_rig_set_dcd_type(hamlib_instance_->my_rig, intype);
1753
+ result_code_ = SHIM_RIG_OK;
1767
1754
  }
1768
1755
 
1769
1756
  void OnOK() override {
1770
1757
  Napi::Env env = Env();
1771
- if (result_code_ != RIG_OK && !error_message_.empty()) {
1758
+ if (result_code_ != SHIM_RIG_OK && !error_message_.empty()) {
1772
1759
  deferred_.Reject(Napi::Error::New(env, error_message_).Value());
1773
1760
  } else {
1774
1761
  deferred_.Resolve(Napi::Number::New(env, result_code_));
@@ -1781,7 +1768,7 @@ public:
1781
1768
  }
1782
1769
 
1783
1770
  private:
1784
- std::string dcd_type_;
1771
+ std::string intype_;
1785
1772
  };
1786
1773
 
1787
1774
  // Get DCD Type AsyncWorker
@@ -1793,49 +1780,49 @@ public:
1793
1780
  void Execute() override {
1794
1781
  CHECK_RIG_VALID();
1795
1782
 
1796
- dcd_type_t dcd_type = hamlib_instance_->my_rig->state.dcdport.type.dcd;
1783
+ int intype = shim_rig_get_dcd_type(hamlib_instance_->my_rig);
1797
1784
 
1798
- switch (dcd_type) {
1799
- case RIG_DCD_RIG:
1800
- dcd_type_str_ = "RIG";
1785
+ switch (intype) {
1786
+ case SHIM_RIG_DCD_RIG:
1787
+ intype_str_ = "RIG";
1801
1788
  break;
1802
- case RIG_DCD_SERIAL_DSR:
1803
- dcd_type_str_ = "DSR";
1789
+ case SHIM_RIG_DCD_SERIAL_DSR:
1790
+ intype_str_ = "DSR";
1804
1791
  break;
1805
- case RIG_DCD_SERIAL_CTS:
1806
- dcd_type_str_ = "CTS";
1792
+ case SHIM_RIG_DCD_SERIAL_CTS:
1793
+ intype_str_ = "CTS";
1807
1794
  break;
1808
- case RIG_DCD_SERIAL_CAR:
1809
- dcd_type_str_ = "CD";
1795
+ case SHIM_RIG_DCD_SERIAL_CAR:
1796
+ intype_str_ = "CD";
1810
1797
  break;
1811
- case RIG_DCD_PARALLEL:
1812
- dcd_type_str_ = "PARALLEL";
1798
+ case SHIM_RIG_DCD_PARALLEL:
1799
+ intype_str_ = "PARALLEL";
1813
1800
  break;
1814
- case RIG_DCD_CM108:
1815
- dcd_type_str_ = "CM108";
1801
+ case SHIM_RIG_DCD_CM108:
1802
+ intype_str_ = "CM108";
1816
1803
  break;
1817
- case RIG_DCD_GPIO:
1818
- dcd_type_str_ = "GPIO";
1804
+ case SHIM_RIG_DCD_GPIO:
1805
+ intype_str_ = "GPIO";
1819
1806
  break;
1820
- case RIG_DCD_GPION:
1821
- dcd_type_str_ = "GPION";
1807
+ case SHIM_RIG_DCD_GPION:
1808
+ intype_str_ = "GPION";
1822
1809
  break;
1823
- case RIG_DCD_NONE:
1824
- dcd_type_str_ = "NONE";
1810
+ case SHIM_RIG_DCD_NONE:
1811
+ intype_str_ = "NONE";
1825
1812
  break;
1826
1813
  default:
1827
- dcd_type_str_ = "Unknown";
1814
+ intype_str_ = "Unknown";
1828
1815
  break;
1829
1816
  }
1830
- result_code_ = RIG_OK;
1817
+ result_code_ = SHIM_RIG_OK;
1831
1818
  }
1832
1819
 
1833
1820
  void OnOK() override {
1834
1821
  Napi::Env env = Env();
1835
- if (result_code_ != RIG_OK && !error_message_.empty()) {
1822
+ if (result_code_ != SHIM_RIG_OK && !error_message_.empty()) {
1836
1823
  deferred_.Reject(Napi::Error::New(env, error_message_).Value());
1837
1824
  } else {
1838
- deferred_.Resolve(Napi::String::New(env, dcd_type_str_));
1825
+ deferred_.Resolve(Napi::String::New(env, intype_str_));
1839
1826
  }
1840
1827
  }
1841
1828
 
@@ -1845,27 +1832,27 @@ public:
1845
1832
  }
1846
1833
 
1847
1834
  private:
1848
- std::string dcd_type_str_;
1835
+ std::string intype_str_;
1849
1836
  };
1850
1837
 
1851
1838
  // Power Control AsyncWorker classes
1852
1839
  class SetPowerstatAsyncWorker : public HamLibAsyncWorker {
1853
1840
  public:
1854
- SetPowerstatAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, powerstat_t status)
1841
+ SetPowerstatAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, int status)
1855
1842
  : HamLibAsyncWorker(env, hamlib_instance), status_(status) {}
1856
1843
 
1857
1844
  void Execute() override {
1858
1845
  CHECK_RIG_VALID();
1859
1846
 
1860
- result_code_ = rig_set_powerstat(hamlib_instance_->my_rig, status_);
1861
- if (result_code_ != RIG_OK) {
1862
- error_message_ = rigerror(result_code_);
1847
+ result_code_ = shim_rig_set_powerstat(hamlib_instance_->my_rig, status_);
1848
+ if (result_code_ != SHIM_RIG_OK) {
1849
+ error_message_ = shim_rigerror(result_code_);
1863
1850
  }
1864
1851
  }
1865
1852
 
1866
1853
  void OnOK() override {
1867
1854
  Napi::Env env = Env();
1868
- if (result_code_ != RIG_OK && !error_message_.empty()) {
1855
+ if (result_code_ != SHIM_RIG_OK && !error_message_.empty()) {
1869
1856
  deferred_.Reject(Napi::Error::New(env, error_message_).Value());
1870
1857
  } else {
1871
1858
  deferred_.Resolve(Napi::Number::New(env, result_code_));
@@ -1878,26 +1865,26 @@ public:
1878
1865
  }
1879
1866
 
1880
1867
  private:
1881
- powerstat_t status_;
1868
+ int status_;
1882
1869
  };
1883
1870
 
1884
1871
  class GetPowerstatAsyncWorker : public HamLibAsyncWorker {
1885
1872
  public:
1886
1873
  GetPowerstatAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance)
1887
- : HamLibAsyncWorker(env, hamlib_instance), status_(RIG_POWER_UNKNOWN) {}
1874
+ : HamLibAsyncWorker(env, hamlib_instance), status_(SHIM_RIG_POWER_UNKNOWN) {}
1888
1875
 
1889
1876
  void Execute() override {
1890
1877
  CHECK_RIG_VALID();
1891
1878
 
1892
- result_code_ = rig_get_powerstat(hamlib_instance_->my_rig, &status_);
1893
- if (result_code_ != RIG_OK) {
1894
- error_message_ = rigerror(result_code_);
1879
+ result_code_ = shim_rig_get_powerstat(hamlib_instance_->my_rig, &status_);
1880
+ if (result_code_ != SHIM_RIG_OK) {
1881
+ error_message_ = shim_rigerror(result_code_);
1895
1882
  }
1896
1883
  }
1897
1884
 
1898
1885
  void OnOK() override {
1899
1886
  Napi::Env env = Env();
1900
- if (result_code_ != RIG_OK && !error_message_.empty()) {
1887
+ if (result_code_ != SHIM_RIG_OK && !error_message_.empty()) {
1901
1888
  deferred_.Reject(Napi::Error::New(env, error_message_).Value());
1902
1889
  } else {
1903
1890
  deferred_.Resolve(Napi::Number::New(env, static_cast<int>(status_)));
@@ -1910,30 +1897,30 @@ public:
1910
1897
  }
1911
1898
 
1912
1899
  private:
1913
- powerstat_t status_;
1900
+ int status_;
1914
1901
  };
1915
1902
 
1916
1903
  // PTT Status Detection AsyncWorker
1917
1904
  class GetPttAsyncWorker : public HamLibAsyncWorker {
1918
1905
  public:
1919
- GetPttAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, vfo_t vfo)
1920
- : HamLibAsyncWorker(env, hamlib_instance), vfo_(vfo), ptt_(RIG_PTT_OFF) {}
1906
+ GetPttAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, int vfo)
1907
+ : HamLibAsyncWorker(env, hamlib_instance), vfo_(vfo), ptt_(SHIM_RIG_PTT_OFF) {}
1921
1908
 
1922
1909
  void Execute() override {
1923
1910
  CHECK_RIG_VALID();
1924
1911
 
1925
- result_code_ = rig_get_ptt(hamlib_instance_->my_rig, vfo_, &ptt_);
1926
- if (result_code_ != RIG_OK) {
1927
- error_message_ = rigerror(result_code_);
1912
+ result_code_ = shim_rig_get_ptt(hamlib_instance_->my_rig, vfo_, &ptt_);
1913
+ if (result_code_ != SHIM_RIG_OK) {
1914
+ error_message_ = shim_rigerror(result_code_);
1928
1915
  }
1929
1916
  }
1930
1917
 
1931
1918
  void OnOK() override {
1932
1919
  Napi::Env env = Env();
1933
- if (result_code_ != RIG_OK && !error_message_.empty()) {
1920
+ if (result_code_ != SHIM_RIG_OK && !error_message_.empty()) {
1934
1921
  deferred_.Reject(Napi::Error::New(env, error_message_).Value());
1935
1922
  } else {
1936
- deferred_.Resolve(Napi::Boolean::New(env, ptt_ == RIG_PTT_ON));
1923
+ deferred_.Resolve(Napi::Boolean::New(env, ptt_ == SHIM_RIG_PTT_ON));
1937
1924
  }
1938
1925
  }
1939
1926
 
@@ -1943,31 +1930,31 @@ public:
1943
1930
  }
1944
1931
 
1945
1932
  private:
1946
- vfo_t vfo_;
1947
- ptt_t ptt_;
1933
+ int vfo_;
1934
+ int ptt_;
1948
1935
  };
1949
1936
 
1950
1937
  // Data Carrier Detect AsyncWorker
1951
1938
  class GetDcdAsyncWorker : public HamLibAsyncWorker {
1952
1939
  public:
1953
- GetDcdAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, vfo_t vfo)
1954
- : HamLibAsyncWorker(env, hamlib_instance), vfo_(vfo), dcd_(RIG_DCD_OFF) {}
1940
+ GetDcdAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, int vfo)
1941
+ : HamLibAsyncWorker(env, hamlib_instance), vfo_(vfo), dcd_(SHIM_RIG_DCD_OFF) {}
1955
1942
 
1956
1943
  void Execute() override {
1957
1944
  CHECK_RIG_VALID();
1958
1945
 
1959
- result_code_ = rig_get_dcd(hamlib_instance_->my_rig, vfo_, &dcd_);
1960
- if (result_code_ != RIG_OK) {
1961
- error_message_ = rigerror(result_code_);
1946
+ result_code_ = shim_rig_get_dcd(hamlib_instance_->my_rig, vfo_, &dcd_);
1947
+ if (result_code_ != SHIM_RIG_OK) {
1948
+ error_message_ = shim_rigerror(result_code_);
1962
1949
  }
1963
1950
  }
1964
1951
 
1965
1952
  void OnOK() override {
1966
1953
  Napi::Env env = Env();
1967
- if (result_code_ != RIG_OK && !error_message_.empty()) {
1954
+ if (result_code_ != SHIM_RIG_OK && !error_message_.empty()) {
1968
1955
  deferred_.Reject(Napi::Error::New(env, error_message_).Value());
1969
1956
  } else {
1970
- deferred_.Resolve(Napi::Boolean::New(env, dcd_ == RIG_DCD_ON));
1957
+ deferred_.Resolve(Napi::Boolean::New(env, dcd_ == SHIM_RIG_DCD_ON));
1971
1958
  }
1972
1959
  }
1973
1960
 
@@ -1977,28 +1964,28 @@ public:
1977
1964
  }
1978
1965
 
1979
1966
  private:
1980
- vfo_t vfo_;
1981
- dcd_t dcd_;
1967
+ int vfo_;
1968
+ int dcd_;
1982
1969
  };
1983
1970
 
1984
1971
  // Tuning Step Control AsyncWorker classes
1985
1972
  class SetTuningStepAsyncWorker : public HamLibAsyncWorker {
1986
1973
  public:
1987
- SetTuningStepAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, vfo_t vfo, shortfreq_t ts)
1974
+ SetTuningStepAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, int vfo, int ts)
1988
1975
  : HamLibAsyncWorker(env, hamlib_instance), vfo_(vfo), ts_(ts) {}
1989
1976
 
1990
1977
  void Execute() override {
1991
1978
  CHECK_RIG_VALID();
1992
1979
 
1993
- result_code_ = rig_set_ts(hamlib_instance_->my_rig, vfo_, ts_);
1994
- if (result_code_ != RIG_OK) {
1995
- error_message_ = rigerror(result_code_);
1980
+ result_code_ = shim_rig_set_ts(hamlib_instance_->my_rig, vfo_, ts_);
1981
+ if (result_code_ != SHIM_RIG_OK) {
1982
+ error_message_ = shim_rigerror(result_code_);
1996
1983
  }
1997
1984
  }
1998
1985
 
1999
1986
  void OnOK() override {
2000
1987
  Napi::Env env = Env();
2001
- if (result_code_ != RIG_OK && !error_message_.empty()) {
1988
+ if (result_code_ != SHIM_RIG_OK && !error_message_.empty()) {
2002
1989
  deferred_.Reject(Napi::Error::New(env, error_message_).Value());
2003
1990
  } else {
2004
1991
  deferred_.Resolve(Napi::Number::New(env, result_code_));
@@ -2011,27 +1998,27 @@ public:
2011
1998
  }
2012
1999
 
2013
2000
  private:
2014
- vfo_t vfo_;
2015
- shortfreq_t ts_;
2001
+ int vfo_;
2002
+ int ts_;
2016
2003
  };
2017
2004
 
2018
2005
  class GetTuningStepAsyncWorker : public HamLibAsyncWorker {
2019
2006
  public:
2020
- GetTuningStepAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, vfo_t vfo)
2007
+ GetTuningStepAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, int vfo)
2021
2008
  : HamLibAsyncWorker(env, hamlib_instance), vfo_(vfo), ts_(0) {}
2022
2009
 
2023
2010
  void Execute() override {
2024
2011
  CHECK_RIG_VALID();
2025
2012
 
2026
- result_code_ = rig_get_ts(hamlib_instance_->my_rig, vfo_, &ts_);
2027
- if (result_code_ != RIG_OK) {
2028
- error_message_ = rigerror(result_code_);
2013
+ result_code_ = shim_rig_get_ts(hamlib_instance_->my_rig, vfo_, &ts_);
2014
+ if (result_code_ != SHIM_RIG_OK) {
2015
+ error_message_ = shim_rigerror(result_code_);
2029
2016
  }
2030
2017
  }
2031
2018
 
2032
2019
  void OnOK() override {
2033
2020
  Napi::Env env = Env();
2034
- if (result_code_ != RIG_OK && !error_message_.empty()) {
2021
+ if (result_code_ != SHIM_RIG_OK && !error_message_.empty()) {
2035
2022
  deferred_.Reject(Napi::Error::New(env, error_message_).Value());
2036
2023
  } else {
2037
2024
  deferred_.Resolve(Napi::Number::New(env, ts_));
@@ -2044,28 +2031,28 @@ public:
2044
2031
  }
2045
2032
 
2046
2033
  private:
2047
- vfo_t vfo_;
2048
- shortfreq_t ts_;
2034
+ int vfo_;
2035
+ int ts_;
2049
2036
  };
2050
2037
 
2051
2038
  // Repeater Control AsyncWorker classes
2052
2039
  class SetRepeaterShiftAsyncWorker : public HamLibAsyncWorker {
2053
2040
  public:
2054
- SetRepeaterShiftAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, vfo_t vfo, rptr_shift_t shift)
2041
+ SetRepeaterShiftAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, int vfo, int shift)
2055
2042
  : HamLibAsyncWorker(env, hamlib_instance), vfo_(vfo), shift_(shift) {}
2056
2043
 
2057
2044
  void Execute() override {
2058
2045
  CHECK_RIG_VALID();
2059
2046
 
2060
- result_code_ = rig_set_rptr_shift(hamlib_instance_->my_rig, vfo_, shift_);
2061
- if (result_code_ != RIG_OK) {
2062
- error_message_ = rigerror(result_code_);
2047
+ result_code_ = shim_rig_set_rptr_shift(hamlib_instance_->my_rig, vfo_, shift_);
2048
+ if (result_code_ != SHIM_RIG_OK) {
2049
+ error_message_ = shim_rigerror(result_code_);
2063
2050
  }
2064
2051
  }
2065
2052
 
2066
2053
  void OnOK() override {
2067
2054
  Napi::Env env = Env();
2068
- if (result_code_ != RIG_OK && !error_message_.empty()) {
2055
+ if (result_code_ != SHIM_RIG_OK && !error_message_.empty()) {
2069
2056
  deferred_.Reject(Napi::Error::New(env, error_message_).Value());
2070
2057
  } else {
2071
2058
  deferred_.Resolve(Napi::Number::New(env, result_code_));
@@ -2078,27 +2065,27 @@ public:
2078
2065
  }
2079
2066
 
2080
2067
  private:
2081
- vfo_t vfo_;
2082
- rptr_shift_t shift_;
2068
+ int vfo_;
2069
+ int shift_;
2083
2070
  };
2084
2071
 
2085
2072
  class GetRepeaterShiftAsyncWorker : public HamLibAsyncWorker {
2086
2073
  public:
2087
- GetRepeaterShiftAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, vfo_t vfo)
2088
- : HamLibAsyncWorker(env, hamlib_instance), vfo_(vfo), shift_(RIG_RPT_SHIFT_NONE) {}
2074
+ GetRepeaterShiftAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, int vfo)
2075
+ : HamLibAsyncWorker(env, hamlib_instance), vfo_(vfo), shift_(SHIM_RIG_RPT_SHIFT_NONE) {}
2089
2076
 
2090
2077
  void Execute() override {
2091
2078
  CHECK_RIG_VALID();
2092
2079
 
2093
- result_code_ = rig_get_rptr_shift(hamlib_instance_->my_rig, vfo_, &shift_);
2094
- if (result_code_ != RIG_OK) {
2095
- error_message_ = rigerror(result_code_);
2080
+ result_code_ = shim_rig_get_rptr_shift(hamlib_instance_->my_rig, vfo_, &shift_);
2081
+ if (result_code_ != SHIM_RIG_OK) {
2082
+ error_message_ = shim_rigerror(result_code_);
2096
2083
  }
2097
2084
  }
2098
2085
 
2099
2086
  void OnOK() override {
2100
2087
  Napi::Env env = Env();
2101
- const char* shift_str = rig_strptrshift(shift_);
2088
+ const char* shift_str = shim_rig_strptrshift(shift_);
2102
2089
  deferred_.Resolve(Napi::String::New(env, shift_str));
2103
2090
  }
2104
2091
 
@@ -2108,27 +2095,27 @@ public:
2108
2095
  }
2109
2096
 
2110
2097
  private:
2111
- vfo_t vfo_;
2112
- rptr_shift_t shift_;
2098
+ int vfo_;
2099
+ int shift_;
2113
2100
  };
2114
2101
 
2115
2102
  class SetRepeaterOffsetAsyncWorker : public HamLibAsyncWorker {
2116
2103
  public:
2117
- SetRepeaterOffsetAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, vfo_t vfo, shortfreq_t offset)
2104
+ SetRepeaterOffsetAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, int vfo, int offset)
2118
2105
  : HamLibAsyncWorker(env, hamlib_instance), vfo_(vfo), offset_(offset) {}
2119
2106
 
2120
2107
  void Execute() override {
2121
2108
  CHECK_RIG_VALID();
2122
2109
 
2123
- result_code_ = rig_set_rptr_offs(hamlib_instance_->my_rig, vfo_, offset_);
2124
- if (result_code_ != RIG_OK) {
2125
- error_message_ = rigerror(result_code_);
2110
+ result_code_ = shim_rig_set_rptr_offs(hamlib_instance_->my_rig, vfo_, offset_);
2111
+ if (result_code_ != SHIM_RIG_OK) {
2112
+ error_message_ = shim_rigerror(result_code_);
2126
2113
  }
2127
2114
  }
2128
2115
 
2129
2116
  void OnOK() override {
2130
2117
  Napi::Env env = Env();
2131
- if (result_code_ != RIG_OK && !error_message_.empty()) {
2118
+ if (result_code_ != SHIM_RIG_OK && !error_message_.empty()) {
2132
2119
  deferred_.Reject(Napi::Error::New(env, error_message_).Value());
2133
2120
  } else {
2134
2121
  deferred_.Resolve(Napi::Number::New(env, result_code_));
@@ -2141,27 +2128,27 @@ public:
2141
2128
  }
2142
2129
 
2143
2130
  private:
2144
- vfo_t vfo_;
2145
- shortfreq_t offset_;
2131
+ int vfo_;
2132
+ int offset_;
2146
2133
  };
2147
2134
 
2148
2135
  class GetRepeaterOffsetAsyncWorker : public HamLibAsyncWorker {
2149
2136
  public:
2150
- GetRepeaterOffsetAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, vfo_t vfo)
2137
+ GetRepeaterOffsetAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, int vfo)
2151
2138
  : HamLibAsyncWorker(env, hamlib_instance), vfo_(vfo), offset_(0) {}
2152
2139
 
2153
2140
  void Execute() override {
2154
2141
  CHECK_RIG_VALID();
2155
2142
 
2156
- result_code_ = rig_get_rptr_offs(hamlib_instance_->my_rig, vfo_, &offset_);
2157
- if (result_code_ != RIG_OK) {
2158
- error_message_ = rigerror(result_code_);
2143
+ result_code_ = shim_rig_get_rptr_offs(hamlib_instance_->my_rig, vfo_, &offset_);
2144
+ if (result_code_ != SHIM_RIG_OK) {
2145
+ error_message_ = shim_rigerror(result_code_);
2159
2146
  }
2160
2147
  }
2161
2148
 
2162
2149
  void OnOK() override {
2163
2150
  Napi::Env env = Env();
2164
- if (result_code_ != RIG_OK && !error_message_.empty()) {
2151
+ if (result_code_ != SHIM_RIG_OK && !error_message_.empty()) {
2165
2152
  deferred_.Reject(Napi::Error::New(env, error_message_).Value());
2166
2153
  } else {
2167
2154
  deferred_.Resolve(Napi::Number::New(env, offset_));
@@ -2174,18 +2161,18 @@ public:
2174
2161
  }
2175
2162
 
2176
2163
  private:
2177
- vfo_t vfo_;
2178
- shortfreq_t offset_;
2164
+ int vfo_;
2165
+ int offset_;
2179
2166
  };
2180
2167
 
2181
2168
  // Helper function to parse VFO parameter from JavaScript
2182
- vfo_t parseVfoParameter(const Napi::CallbackInfo& info, int index, vfo_t defaultVfo = RIG_VFO_CURR) {
2169
+ int parseVfoParameter(const Napi::CallbackInfo& info, int index, int defaultVfo = SHIM_RIG_VFO_CURR) {
2183
2170
  if (info.Length() > index && info[index].IsString()) {
2184
2171
  std::string vfoStr = info[index].As<Napi::String>().Utf8Value();
2185
2172
  if (vfoStr == "VFO-A") {
2186
- return RIG_VFO_A;
2173
+ return SHIM_RIG_VFO_A;
2187
2174
  } else if (vfoStr == "VFO-B") {
2188
- return RIG_VFO_B;
2175
+ return SHIM_RIG_VFO_B;
2189
2176
  }
2190
2177
  }
2191
2178
  return defaultVfo;
@@ -2205,35 +2192,35 @@ NodeHamLib::NodeHamLib(const Napi::CallbackInfo & info): ObjectWrap(info) {
2205
2192
  }
2206
2193
 
2207
2194
  // Set default port path if not provided
2208
- strncpy(port_path, "/dev/ttyUSB0", HAMLIB_FILPATHLEN - 1);
2209
- port_path[HAMLIB_FILPATHLEN - 1] = '\0';
2195
+ strncpy(port_path, "/dev/ttyUSB0", SHIM_HAMLIB_FILPATHLEN - 1);
2196
+ port_path[SHIM_HAMLIB_FILPATHLEN - 1] = '\0';
2210
2197
 
2211
2198
  // Check if port path is provided as second argument
2212
2199
  if (info.Length() >= 2) {
2213
2200
  if (info[1].IsString()) {
2214
2201
  std::string portStr = info[1].As<Napi::String>().Utf8Value();
2215
- strncpy(port_path, portStr.c_str(), HAMLIB_FILPATHLEN - 1);
2216
- port_path[HAMLIB_FILPATHLEN - 1] = '\0';
2202
+ strncpy(port_path, portStr.c_str(), SHIM_HAMLIB_FILPATHLEN - 1);
2203
+ port_path[SHIM_HAMLIB_FILPATHLEN - 1] = '\0';
2217
2204
  }
2218
2205
  // Note: Debug level is now controlled globally via HamLib.setDebugLevel()
2219
2206
  // and set to RIG_DEBUG_NONE by default in addon initialization
2220
2207
  }
2221
- //rig_model_t myrig_model;
2208
+ //unsigned int myrig_model;
2222
2209
  // hamlib_port_t myport;
2223
2210
  // /* may be overriden by backend probe */
2224
2211
  // myport.type.rig = RIG_PORT_SERIAL;
2225
2212
  // myport.parm.serial.rate = 38400;
2226
2213
  // myport.parm.serial.data_bits = 8;
2227
2214
  // myport.parm.serial.stop_bits = 2;
2228
- // myport.parm.serial.parity = RIG_PARITY_NONE;
2229
- // myport.parm.serial.handshake = RIG_HANDSHAKE_HARDWARE;
2230
- // strncpy(myport.pathname, "/dev/ttyUSB0", HAMLIB_FILPATHLEN - 1);
2215
+ // myport.parm.serial.parity = SHIM_RIG_PARITY_NONE;
2216
+ // myport.parm.serial.handshake = SHIM_RIG_HANDSHAKE_HARDWARE;
2217
+ // strncpy(myport.pathname, "/dev/ttyUSB0", SHIM_HAMLIB_FILPATHLEN - 1);
2231
2218
 
2232
- // rig_load_all_backends();
2219
+ // shim_rig_load_all_backends();
2233
2220
  // myrig_model = rig_probe(&myport);
2234
2221
  // fprintf(stderr, "Got Rig Model %d \n", myrig_model);
2235
2222
 
2236
- rig_model_t myrig_model = info[0].As < Napi::Number > ().DoubleValue();
2223
+ unsigned int myrig_model = info[0].As < Napi::Number > ().DoubleValue();
2237
2224
  original_model = myrig_model;
2238
2225
 
2239
2226
  // Check if port_path is a network address (contains colon)
@@ -2245,7 +2232,7 @@ NodeHamLib::NodeHamLib(const Napi::CallbackInfo & info): ObjectWrap(info) {
2245
2232
  // Network connection will be established on open()
2246
2233
  }
2247
2234
 
2248
- my_rig = rig_init(myrig_model);
2235
+ my_rig = shim_rig_init(myrig_model);
2249
2236
  //int retcode = 0;
2250
2237
  if (!my_rig) {
2251
2238
  // Create detailed error message
@@ -2256,15 +2243,15 @@ NodeHamLib::NodeHamLib(const Napi::CallbackInfo & info): ObjectWrap(info) {
2256
2243
  }
2257
2244
 
2258
2245
  // Set port path and type based on connection type
2259
- strncpy(my_rig -> state.rigport.pathname, port_path, HAMLIB_FILPATHLEN - 1);
2260
-
2246
+ shim_rig_set_port_path(my_rig, port_path);
2247
+
2261
2248
  if (is_network_rig) {
2262
- my_rig -> state.rigport.type.rig = RIG_PORT_NETWORK;
2249
+ shim_rig_set_port_type(my_rig, SHIM_RIG_PORT_NETWORK);
2263
2250
  } else {
2264
- my_rig -> state.rigport.type.rig = RIG_PORT_SERIAL;
2251
+ shim_rig_set_port_type(my_rig, SHIM_RIG_PORT_SERIAL);
2265
2252
  }
2266
2253
 
2267
- // this->freq_emit_cb = [info](freq_t freq) {
2254
+ // this->freq_emit_cb = [info](double freq) {
2268
2255
  // Napi::Env env = info.Env();
2269
2256
  // Napi::Function emit = info.This().As<Napi::Object>().Get("emit").As<Napi::Function>();
2270
2257
  // emit.Call(
@@ -2281,16 +2268,16 @@ NodeHamLib::~NodeHamLib() {
2281
2268
  if (my_rig) {
2282
2269
  // 如果rig是打开状态,先关闭
2283
2270
  if (rig_is_open) {
2284
- rig_close(my_rig);
2271
+ shim_rig_close(my_rig);
2285
2272
  rig_is_open = false;
2286
2273
  }
2287
2274
  // 清理rig资源
2288
- rig_cleanup(my_rig);
2275
+ shim_rig_cleanup(my_rig);
2289
2276
  my_rig = nullptr;
2290
2277
  }
2291
2278
  }
2292
2279
 
2293
- int NodeHamLib::freq_change_cb(RIG *rig, vfo_t vfo, freq_t freq, void* arg) {
2280
+ int NodeHamLib::freq_change_cb(void *handle, int vfo, double freq, void* arg) {
2294
2281
  auto instance = static_cast<NodeHamLib*>(arg);
2295
2282
  printf("Rig changed freq to %0.7f Hz\n", freq);
2296
2283
  Napi::Env env = instance->m_currentInfo->Env();
@@ -2336,12 +2323,12 @@ Napi::Value NodeHamLib::SetVFO(const Napi::CallbackInfo & info) {
2336
2323
  }
2337
2324
 
2338
2325
  std::string name = info[0].As<Napi::String>().Utf8Value();
2339
- vfo_t vfo;
2326
+ int vfo;
2340
2327
 
2341
2328
  if (name == "VFO-A") {
2342
- vfo = RIG_VFO_A;
2329
+ vfo = SHIM_RIG_VFO_A;
2343
2330
  } else if (name == "VFO-B") {
2344
- vfo = RIG_VFO_B;
2331
+ vfo = SHIM_RIG_VFO_B;
2345
2332
  } else {
2346
2333
  Napi::TypeError::New(env, "Invalid VFO name")
2347
2334
  .ThrowAsJavaScriptException();
@@ -2375,7 +2362,7 @@ Napi::Value NodeHamLib::SetFrequency(const Napi::CallbackInfo & info) {
2375
2362
  return env.Null();
2376
2363
  }
2377
2364
 
2378
- freq_t freq = info[0].As<Napi::Number>().DoubleValue();
2365
+ double freq = info[0].As<Napi::Number>().DoubleValue();
2379
2366
 
2380
2367
  // Basic frequency range validation
2381
2368
  if (freq < 1000 || freq > 10000000000) { // 1 kHz to 10 GHz reasonable range
@@ -2384,14 +2371,14 @@ Napi::Value NodeHamLib::SetFrequency(const Napi::CallbackInfo & info) {
2384
2371
  }
2385
2372
 
2386
2373
  // Support optional VFO parameter
2387
- vfo_t vfo = RIG_VFO_CURR;
2374
+ int vfo = SHIM_RIG_VFO_CURR;
2388
2375
 
2389
2376
  if (info.Length() >= 2 && info[1].IsString()) {
2390
2377
  std::string vfostr = info[1].As<Napi::String>().Utf8Value();
2391
2378
  if (vfostr == "VFO-A") {
2392
- vfo = RIG_VFO_A;
2379
+ vfo = SHIM_RIG_VFO_A;
2393
2380
  } else if (vfostr == "VFO-B") {
2394
- vfo = RIG_VFO_B;
2381
+ vfo = SHIM_RIG_VFO_B;
2395
2382
  }
2396
2383
  }
2397
2384
 
@@ -2423,32 +2410,32 @@ Napi::Value NodeHamLib::SetMode(const Napi::CallbackInfo & info) {
2423
2410
  }
2424
2411
 
2425
2412
  std::string modestr = info[0].As<Napi::String>().Utf8Value();
2426
- rmode_t mode = rig_parse_mode(modestr.c_str());
2413
+ int mode = shim_rig_parse_mode(modestr.c_str());
2427
2414
 
2428
- if (mode == RIG_MODE_NONE) {
2415
+ if (mode == SHIM_RIG_MODE_NONE) {
2429
2416
  Napi::Error::New(env, "Invalid mode: " + modestr).ThrowAsJavaScriptException();
2430
2417
  return env.Null();
2431
2418
  }
2432
2419
 
2433
- pbwidth_t bandwidth = RIG_PASSBAND_NORMAL;
2434
- vfo_t vfo = RIG_VFO_CURR;
2420
+ int bandwidth = SHIM_RIG_PASSBAND_NORMAL;
2421
+ int vfo = SHIM_RIG_VFO_CURR;
2435
2422
 
2436
2423
  // Parse parameters: setMode(mode) or setMode(mode, bandwidth) or setMode(mode, bandwidth, vfo)
2437
2424
  if (info.Length() >= 2 && info[1].IsString()) {
2438
2425
  std::string bandstr = info[1].As<Napi::String>().Utf8Value();
2439
2426
  if (bandstr == "narrow") {
2440
- bandwidth = rig_passband_narrow(my_rig, mode);
2427
+ bandwidth = shim_rig_passband_narrow(my_rig, mode);
2441
2428
  } else if (bandstr == "wide") {
2442
- bandwidth = rig_passband_wide(my_rig, mode);
2429
+ bandwidth = shim_rig_passband_wide(my_rig, mode);
2443
2430
  } else {
2444
2431
  // If second parameter is not "narrow" or "wide", might be VFO
2445
- vfo = parseVfoParameter(info, 1, RIG_VFO_CURR);
2432
+ vfo = parseVfoParameter(info, 1, SHIM_RIG_VFO_CURR);
2446
2433
  }
2447
2434
  }
2448
2435
 
2449
2436
  // Check for third parameter (VFO) if bandwidth was specified
2450
2437
  if (info.Length() >= 3) {
2451
- vfo = parseVfoParameter(info, 2, RIG_VFO_CURR);
2438
+ vfo = parseVfoParameter(info, 2, SHIM_RIG_VFO_CURR);
2452
2439
  }
2453
2440
 
2454
2441
  SetModeAsyncWorker* worker = new SetModeAsyncWorker(env, this, mode, bandwidth, vfo);
@@ -2480,7 +2467,7 @@ Napi::Value NodeHamLib::SetPtt(const Napi::CallbackInfo & info) {
2480
2467
 
2481
2468
  bool ptt_state = info[0].As<Napi::Boolean>();
2482
2469
 
2483
- ptt_t ptt = ptt_state ? RIG_PTT_ON : RIG_PTT_OFF;
2470
+ int ptt = ptt_state ? SHIM_RIG_PTT_ON : SHIM_RIG_PTT_OFF;
2484
2471
  SetPttAsyncWorker* worker = new SetPttAsyncWorker(env, this, ptt);
2485
2472
  worker->Queue();
2486
2473
 
@@ -2512,14 +2499,14 @@ Napi::Value NodeHamLib::GetFrequency(const Napi::CallbackInfo & info) {
2512
2499
  }
2513
2500
 
2514
2501
  // Support optional VFO parameter
2515
- vfo_t vfo = RIG_VFO_CURR;
2502
+ int vfo = SHIM_RIG_VFO_CURR;
2516
2503
 
2517
2504
  if (info.Length() >= 1 && info[0].IsString()) {
2518
2505
  std::string vfostr = info[0].As<Napi::String>().Utf8Value();
2519
2506
  if (vfostr == "VFO-A") {
2520
- vfo = RIG_VFO_A;
2507
+ vfo = SHIM_RIG_VFO_A;
2521
2508
  } else if (vfostr == "VFO-B") {
2522
- vfo = RIG_VFO_B;
2509
+ vfo = SHIM_RIG_VFO_B;
2523
2510
  }
2524
2511
  }
2525
2512
 
@@ -2554,10 +2541,10 @@ Napi::Value NodeHamLib::GetStrength(const Napi::CallbackInfo & info) {
2554
2541
  }
2555
2542
 
2556
2543
  // Support optional VFO parameter: getStrength() or getStrength(vfo)
2557
- vfo_t vfo = RIG_VFO_CURR;
2544
+ int vfo = SHIM_RIG_VFO_CURR;
2558
2545
 
2559
2546
  if (info.Length() >= 1 && info[0].IsString()) {
2560
- vfo = parseVfoParameter(info, 0, RIG_VFO_CURR);
2547
+ vfo = parseVfoParameter(info, 0, SHIM_RIG_VFO_CURR);
2561
2548
  }
2562
2549
 
2563
2550
  GetStrengthAsyncWorker* worker = new GetStrengthAsyncWorker(env, this, vfo);
@@ -2626,11 +2613,11 @@ Napi::Value NodeHamLib::SetMemoryChannel(const Napi::CallbackInfo & info) {
2626
2613
  Napi::Object chanObj = info[1].As<Napi::Object>();
2627
2614
 
2628
2615
  // Create channel structure
2629
- channel_t chan;
2616
+ shim_channel_t chan;
2630
2617
  memset(&chan, 0, sizeof(chan));
2631
2618
 
2632
2619
  chan.channel_num = channel_num;
2633
- chan.vfo = RIG_VFO_MEM;
2620
+ chan.vfo = SHIM_RIG_VFO_MEM;
2634
2621
 
2635
2622
  // Extract frequency
2636
2623
  if (chanObj.Has("frequency")) {
@@ -2640,14 +2627,14 @@ Napi::Value NodeHamLib::SetMemoryChannel(const Napi::CallbackInfo & info) {
2640
2627
  // Extract mode
2641
2628
  if (chanObj.Has("mode")) {
2642
2629
  std::string modeStr = chanObj.Get("mode").As<Napi::String>().Utf8Value();
2643
- chan.mode = rig_parse_mode(modeStr.c_str());
2630
+ chan.mode = shim_rig_parse_mode(modeStr.c_str());
2644
2631
  }
2645
2632
 
2646
2633
  // Extract bandwidth
2647
2634
  if (chanObj.Has("bandwidth")) {
2648
2635
  chan.width = chanObj.Get("bandwidth").As<Napi::Number>().Int32Value();
2649
2636
  } else {
2650
- chan.width = RIG_PASSBAND_NORMAL;
2637
+ chan.width = SHIM_RIG_PASSBAND_NORMAL;
2651
2638
  }
2652
2639
 
2653
2640
  // Extract channel description
@@ -2660,7 +2647,7 @@ Napi::Value NodeHamLib::SetMemoryChannel(const Napi::CallbackInfo & info) {
2660
2647
  // Extract TX frequency for split operation
2661
2648
  if (chanObj.Has("txFrequency")) {
2662
2649
  chan.tx_freq = chanObj.Get("txFrequency").As<Napi::Number>().DoubleValue();
2663
- chan.split = RIG_SPLIT_ON;
2650
+ chan.split = SHIM_RIG_SPLIT_ON;
2664
2651
  }
2665
2652
 
2666
2653
  // Extract CTCSS tone
@@ -2736,7 +2723,7 @@ Napi::Value NodeHamLib::SetRit(const Napi::CallbackInfo & info) {
2736
2723
  return env.Null();
2737
2724
  }
2738
2725
 
2739
- shortfreq_t rit_offset = info[0].As<Napi::Number>().Int32Value();
2726
+ int rit_offset = info[0].As<Napi::Number>().Int32Value();
2740
2727
 
2741
2728
  SetRitAsyncWorker* worker = new SetRitAsyncWorker(env, this, rit_offset);
2742
2729
  worker->Queue();
@@ -2771,7 +2758,7 @@ Napi::Value NodeHamLib::SetXit(const Napi::CallbackInfo & info) {
2771
2758
  return env.Null();
2772
2759
  }
2773
2760
 
2774
- shortfreq_t xit_offset = info[0].As<Napi::Number>().Int32Value();
2761
+ int xit_offset = info[0].As<Napi::Number>().Int32Value();
2775
2762
 
2776
2763
  SetXitAsyncWorker* worker = new SetXitAsyncWorker(env, this, xit_offset);
2777
2764
  worker->Queue();
@@ -2822,18 +2809,18 @@ Napi::Value NodeHamLib::StartScan(const Napi::CallbackInfo & info) {
2822
2809
  }
2823
2810
 
2824
2811
  std::string scanTypeStr = info[0].As<Napi::String>().Utf8Value();
2825
- scan_t scanType;
2812
+ int scanType;
2826
2813
 
2827
2814
  if (scanTypeStr == "VFO") {
2828
- scanType = RIG_SCAN_VFO;
2815
+ scanType = SHIM_RIG_SCAN_VFO;
2829
2816
  } else if (scanTypeStr == "MEM") {
2830
- scanType = RIG_SCAN_MEM;
2817
+ scanType = SHIM_RIG_SCAN_MEM;
2831
2818
  } else if (scanTypeStr == "PROG") {
2832
- scanType = RIG_SCAN_PROG;
2819
+ scanType = SHIM_RIG_SCAN_PROG;
2833
2820
  } else if (scanTypeStr == "DELTA") {
2834
- scanType = RIG_SCAN_DELTA;
2821
+ scanType = SHIM_RIG_SCAN_DELTA;
2835
2822
  } else if (scanTypeStr == "PRIO") {
2836
- scanType = RIG_SCAN_PRIO;
2823
+ scanType = SHIM_RIG_SCAN_PRIO;
2837
2824
  } else {
2838
2825
  Napi::TypeError::New(env, "Invalid scan type").ThrowAsJavaScriptException();
2839
2826
  return env.Null();
@@ -2880,56 +2867,54 @@ Napi::Value NodeHamLib::SetLevel(const Napi::CallbackInfo & info) {
2880
2867
  double levelValue = info[1].As<Napi::Number>().DoubleValue();
2881
2868
 
2882
2869
  // Map level type strings to hamlib constants
2883
- setting_t levelType;
2870
+ uint64_t levelType;
2884
2871
  if (levelTypeStr == "AF") {
2885
- levelType = RIG_LEVEL_AF;
2872
+ levelType = SHIM_RIG_LEVEL_AF;
2886
2873
  } else if (levelTypeStr == "RF") {
2887
- levelType = RIG_LEVEL_RF;
2874
+ levelType = SHIM_RIG_LEVEL_RF;
2888
2875
  } else if (levelTypeStr == "SQL") {
2889
- levelType = RIG_LEVEL_SQL;
2876
+ levelType = SHIM_RIG_LEVEL_SQL;
2890
2877
  } else if (levelTypeStr == "RFPOWER") {
2891
- levelType = RIG_LEVEL_RFPOWER;
2878
+ levelType = SHIM_RIG_LEVEL_RFPOWER;
2892
2879
  } else if (levelTypeStr == "MICGAIN") {
2893
- levelType = RIG_LEVEL_MICGAIN;
2880
+ levelType = SHIM_RIG_LEVEL_MICGAIN;
2894
2881
  } else if (levelTypeStr == "IF") {
2895
- levelType = RIG_LEVEL_IF;
2882
+ levelType = SHIM_RIG_LEVEL_IF;
2896
2883
  } else if (levelTypeStr == "APF") {
2897
- levelType = RIG_LEVEL_APF;
2884
+ levelType = SHIM_RIG_LEVEL_APF;
2898
2885
  } else if (levelTypeStr == "NR") {
2899
- levelType = RIG_LEVEL_NR;
2886
+ levelType = SHIM_RIG_LEVEL_NR;
2900
2887
  } else if (levelTypeStr == "PBT_IN") {
2901
- levelType = RIG_LEVEL_PBT_IN;
2888
+ levelType = SHIM_RIG_LEVEL_PBT_IN;
2902
2889
  } else if (levelTypeStr == "PBT_OUT") {
2903
- levelType = RIG_LEVEL_PBT_OUT;
2890
+ levelType = SHIM_RIG_LEVEL_PBT_OUT;
2904
2891
  } else if (levelTypeStr == "CWPITCH") {
2905
- levelType = RIG_LEVEL_CWPITCH;
2892
+ levelType = SHIM_RIG_LEVEL_CWPITCH;
2906
2893
  } else if (levelTypeStr == "KEYSPD") {
2907
- levelType = RIG_LEVEL_KEYSPD;
2894
+ levelType = SHIM_RIG_LEVEL_KEYSPD;
2908
2895
  } else if (levelTypeStr == "NOTCHF") {
2909
- levelType = RIG_LEVEL_NOTCHF;
2896
+ levelType = SHIM_RIG_LEVEL_NOTCHF;
2910
2897
  } else if (levelTypeStr == "COMP") {
2911
- levelType = RIG_LEVEL_COMP;
2898
+ levelType = SHIM_RIG_LEVEL_COMP;
2912
2899
  } else if (levelTypeStr == "AGC") {
2913
- levelType = RIG_LEVEL_AGC;
2900
+ levelType = SHIM_RIG_LEVEL_AGC;
2914
2901
  } else if (levelTypeStr == "BKINDL") {
2915
- levelType = RIG_LEVEL_BKINDL;
2902
+ levelType = SHIM_RIG_LEVEL_BKINDL;
2916
2903
  } else if (levelTypeStr == "BALANCE") {
2917
- levelType = RIG_LEVEL_BALANCE;
2904
+ levelType = SHIM_RIG_LEVEL_BALANCE;
2918
2905
  } else if (levelTypeStr == "VOXGAIN") {
2919
- levelType = RIG_LEVEL_VOXGAIN;
2906
+ levelType = SHIM_RIG_LEVEL_VOXGAIN;
2920
2907
  } else if (levelTypeStr == "VOXDELAY") {
2921
- levelType = RIG_LEVEL_VOXDELAY;
2908
+ levelType = SHIM_RIG_LEVEL_VOXDELAY;
2922
2909
  } else if (levelTypeStr == "ANTIVOX") {
2923
- levelType = RIG_LEVEL_ANTIVOX;
2910
+ levelType = SHIM_RIG_LEVEL_ANTIVOX;
2924
2911
  } else {
2925
2912
  Napi::TypeError::New(env, "Invalid level type").ThrowAsJavaScriptException();
2926
2913
  return env.Null();
2927
2914
  }
2928
2915
 
2929
- // Create value union
2930
- value_t val;
2931
- val.f = levelValue;
2932
-
2916
+ float val = static_cast<float>(levelValue);
2917
+
2933
2918
  SetLevelAsyncWorker* worker = new SetLevelAsyncWorker(env, this, levelType, val);
2934
2919
  worker->Queue();
2935
2920
 
@@ -2952,35 +2937,35 @@ Napi::Value NodeHamLib::GetLevel(const Napi::CallbackInfo & info) {
2952
2937
  std::string levelTypeStr = info[0].As<Napi::String>().Utf8Value();
2953
2938
 
2954
2939
  // Map level type strings to hamlib constants
2955
- setting_t levelType;
2940
+ uint64_t levelType;
2956
2941
  if (levelTypeStr == "AF") {
2957
- levelType = RIG_LEVEL_AF;
2942
+ levelType = SHIM_RIG_LEVEL_AF;
2958
2943
  } else if (levelTypeStr == "RF") {
2959
- levelType = RIG_LEVEL_RF;
2944
+ levelType = SHIM_RIG_LEVEL_RF;
2960
2945
  } else if (levelTypeStr == "SQL") {
2961
- levelType = RIG_LEVEL_SQL;
2946
+ levelType = SHIM_RIG_LEVEL_SQL;
2962
2947
  } else if (levelTypeStr == "RFPOWER") {
2963
- levelType = RIG_LEVEL_RFPOWER;
2948
+ levelType = SHIM_RIG_LEVEL_RFPOWER;
2964
2949
  } else if (levelTypeStr == "MICGAIN") {
2965
- levelType = RIG_LEVEL_MICGAIN;
2950
+ levelType = SHIM_RIG_LEVEL_MICGAIN;
2966
2951
  } else if (levelTypeStr == "SWR") {
2967
- levelType = RIG_LEVEL_SWR;
2952
+ levelType = SHIM_RIG_LEVEL_SWR;
2968
2953
  } else if (levelTypeStr == "ALC") {
2969
- levelType = RIG_LEVEL_ALC;
2954
+ levelType = SHIM_RIG_LEVEL_ALC;
2970
2955
  } else if (levelTypeStr == "STRENGTH") {
2971
- levelType = RIG_LEVEL_STRENGTH;
2956
+ levelType = SHIM_RIG_LEVEL_STRENGTH;
2972
2957
  } else if (levelTypeStr == "RAWSTR") {
2973
- levelType = RIG_LEVEL_RAWSTR;
2958
+ levelType = SHIM_RIG_LEVEL_RAWSTR;
2974
2959
  } else if (levelTypeStr == "RFPOWER_METER") {
2975
- levelType = RIG_LEVEL_RFPOWER_METER;
2960
+ levelType = SHIM_RIG_LEVEL_RFPOWER_METER;
2976
2961
  } else if (levelTypeStr == "COMP_METER") {
2977
- levelType = RIG_LEVEL_COMP_METER;
2962
+ levelType = SHIM_RIG_LEVEL_COMP_METER;
2978
2963
  } else if (levelTypeStr == "VD_METER") {
2979
- levelType = RIG_LEVEL_VD_METER;
2964
+ levelType = SHIM_RIG_LEVEL_VD_METER;
2980
2965
  } else if (levelTypeStr == "ID_METER") {
2981
- levelType = RIG_LEVEL_ID_METER;
2966
+ levelType = SHIM_RIG_LEVEL_ID_METER;
2982
2967
  } else if (levelTypeStr == "TEMP_METER") {
2983
- levelType = RIG_LEVEL_TEMP_METER;
2968
+ levelType = SHIM_RIG_LEVEL_TEMP_METER;
2984
2969
  } else {
2985
2970
  Napi::TypeError::New(env, "Invalid level type").ThrowAsJavaScriptException();
2986
2971
  return env.Null();
@@ -2996,40 +2981,40 @@ Napi::Value NodeHamLib::GetSupportedLevels(const Napi::CallbackInfo & info) {
2996
2981
  Napi::Env env = info.Env();
2997
2982
 
2998
2983
  // Get capabilities from rig caps instead of state (doesn't require rig to be open)
2999
- setting_t levels = my_rig->caps->has_get_level | my_rig->caps->has_set_level;
2984
+ uint64_t levels = shim_rig_get_caps_has_get_level(my_rig) | shim_rig_get_caps_has_set_level(my_rig);
3000
2985
  Napi::Array levelArray = Napi::Array::New(env);
3001
2986
  uint32_t index = 0;
3002
2987
 
3003
2988
  // Check each level type
3004
- if (levels & RIG_LEVEL_AF) levelArray[index++] = Napi::String::New(env, "AF");
3005
- if (levels & RIG_LEVEL_RF) levelArray[index++] = Napi::String::New(env, "RF");
3006
- if (levels & RIG_LEVEL_SQL) levelArray[index++] = Napi::String::New(env, "SQL");
3007
- if (levels & RIG_LEVEL_RFPOWER) levelArray[index++] = Napi::String::New(env, "RFPOWER");
3008
- if (levels & RIG_LEVEL_MICGAIN) levelArray[index++] = Napi::String::New(env, "MICGAIN");
3009
- if (levels & RIG_LEVEL_IF) levelArray[index++] = Napi::String::New(env, "IF");
3010
- if (levels & RIG_LEVEL_APF) levelArray[index++] = Napi::String::New(env, "APF");
3011
- if (levels & RIG_LEVEL_NR) levelArray[index++] = Napi::String::New(env, "NR");
3012
- if (levels & RIG_LEVEL_PBT_IN) levelArray[index++] = Napi::String::New(env, "PBT_IN");
3013
- if (levels & RIG_LEVEL_PBT_OUT) levelArray[index++] = Napi::String::New(env, "PBT_OUT");
3014
- if (levels & RIG_LEVEL_CWPITCH) levelArray[index++] = Napi::String::New(env, "CWPITCH");
3015
- if (levels & RIG_LEVEL_KEYSPD) levelArray[index++] = Napi::String::New(env, "KEYSPD");
3016
- if (levels & RIG_LEVEL_NOTCHF) levelArray[index++] = Napi::String::New(env, "NOTCHF");
3017
- if (levels & RIG_LEVEL_COMP) levelArray[index++] = Napi::String::New(env, "COMP");
3018
- if (levels & RIG_LEVEL_AGC) levelArray[index++] = Napi::String::New(env, "AGC");
3019
- if (levels & RIG_LEVEL_BKINDL) levelArray[index++] = Napi::String::New(env, "BKINDL");
3020
- if (levels & RIG_LEVEL_BALANCE) levelArray[index++] = Napi::String::New(env, "BALANCE");
3021
- if (levels & RIG_LEVEL_VOXGAIN) levelArray[index++] = Napi::String::New(env, "VOXGAIN");
3022
- if (levels & RIG_LEVEL_VOXDELAY) levelArray[index++] = Napi::String::New(env, "VOXDELAY");
3023
- if (levels & RIG_LEVEL_ANTIVOX) levelArray[index++] = Napi::String::New(env, "ANTIVOX");
3024
- if (levels & RIG_LEVEL_STRENGTH) levelArray[index++] = Napi::String::New(env, "STRENGTH");
3025
- if (levels & RIG_LEVEL_RAWSTR) levelArray[index++] = Napi::String::New(env, "RAWSTR");
3026
- if (levels & RIG_LEVEL_SWR) levelArray[index++] = Napi::String::New(env, "SWR");
3027
- if (levels & RIG_LEVEL_ALC) levelArray[index++] = Napi::String::New(env, "ALC");
3028
- if (levels & RIG_LEVEL_RFPOWER_METER) levelArray[index++] = Napi::String::New(env, "RFPOWER_METER");
3029
- if (levels & RIG_LEVEL_COMP_METER) levelArray[index++] = Napi::String::New(env, "COMP_METER");
3030
- if (levels & RIG_LEVEL_VD_METER) levelArray[index++] = Napi::String::New(env, "VD_METER");
3031
- if (levels & RIG_LEVEL_ID_METER) levelArray[index++] = Napi::String::New(env, "ID_METER");
3032
- if (levels & RIG_LEVEL_TEMP_METER) levelArray[index++] = Napi::String::New(env, "TEMP_METER");
2989
+ if (levels & SHIM_RIG_LEVEL_AF) levelArray[index++] = Napi::String::New(env, "AF");
2990
+ if (levels & SHIM_RIG_LEVEL_RF) levelArray[index++] = Napi::String::New(env, "RF");
2991
+ if (levels & SHIM_RIG_LEVEL_SQL) levelArray[index++] = Napi::String::New(env, "SQL");
2992
+ if (levels & SHIM_RIG_LEVEL_RFPOWER) levelArray[index++] = Napi::String::New(env, "RFPOWER");
2993
+ if (levels & SHIM_RIG_LEVEL_MICGAIN) levelArray[index++] = Napi::String::New(env, "MICGAIN");
2994
+ if (levels & SHIM_RIG_LEVEL_IF) levelArray[index++] = Napi::String::New(env, "IF");
2995
+ if (levels & SHIM_RIG_LEVEL_APF) levelArray[index++] = Napi::String::New(env, "APF");
2996
+ if (levels & SHIM_RIG_LEVEL_NR) levelArray[index++] = Napi::String::New(env, "NR");
2997
+ if (levels & SHIM_RIG_LEVEL_PBT_IN) levelArray[index++] = Napi::String::New(env, "PBT_IN");
2998
+ if (levels & SHIM_RIG_LEVEL_PBT_OUT) levelArray[index++] = Napi::String::New(env, "PBT_OUT");
2999
+ if (levels & SHIM_RIG_LEVEL_CWPITCH) levelArray[index++] = Napi::String::New(env, "CWPITCH");
3000
+ if (levels & SHIM_RIG_LEVEL_KEYSPD) levelArray[index++] = Napi::String::New(env, "KEYSPD");
3001
+ if (levels & SHIM_RIG_LEVEL_NOTCHF) levelArray[index++] = Napi::String::New(env, "NOTCHF");
3002
+ if (levels & SHIM_RIG_LEVEL_COMP) levelArray[index++] = Napi::String::New(env, "COMP");
3003
+ if (levels & SHIM_RIG_LEVEL_AGC) levelArray[index++] = Napi::String::New(env, "AGC");
3004
+ if (levels & SHIM_RIG_LEVEL_BKINDL) levelArray[index++] = Napi::String::New(env, "BKINDL");
3005
+ if (levels & SHIM_RIG_LEVEL_BALANCE) levelArray[index++] = Napi::String::New(env, "BALANCE");
3006
+ if (levels & SHIM_RIG_LEVEL_VOXGAIN) levelArray[index++] = Napi::String::New(env, "VOXGAIN");
3007
+ if (levels & SHIM_RIG_LEVEL_VOXDELAY) levelArray[index++] = Napi::String::New(env, "VOXDELAY");
3008
+ if (levels & SHIM_RIG_LEVEL_ANTIVOX) levelArray[index++] = Napi::String::New(env, "ANTIVOX");
3009
+ if (levels & SHIM_RIG_LEVEL_STRENGTH) levelArray[index++] = Napi::String::New(env, "STRENGTH");
3010
+ if (levels & SHIM_RIG_LEVEL_RAWSTR) levelArray[index++] = Napi::String::New(env, "RAWSTR");
3011
+ if (levels & SHIM_RIG_LEVEL_SWR) levelArray[index++] = Napi::String::New(env, "SWR");
3012
+ if (levels & SHIM_RIG_LEVEL_ALC) levelArray[index++] = Napi::String::New(env, "ALC");
3013
+ if (levels & SHIM_RIG_LEVEL_RFPOWER_METER) levelArray[index++] = Napi::String::New(env, "RFPOWER_METER");
3014
+ if (levels & SHIM_RIG_LEVEL_COMP_METER) levelArray[index++] = Napi::String::New(env, "COMP_METER");
3015
+ if (levels & SHIM_RIG_LEVEL_VD_METER) levelArray[index++] = Napi::String::New(env, "VD_METER");
3016
+ if (levels & SHIM_RIG_LEVEL_ID_METER) levelArray[index++] = Napi::String::New(env, "ID_METER");
3017
+ if (levels & SHIM_RIG_LEVEL_TEMP_METER) levelArray[index++] = Napi::String::New(env, "TEMP_METER");
3033
3018
 
3034
3019
  return levelArray;
3035
3020
  }
@@ -3052,63 +3037,63 @@ Napi::Value NodeHamLib::SetFunction(const Napi::CallbackInfo & info) {
3052
3037
  bool enable = info[1].As<Napi::Boolean>().Value();
3053
3038
 
3054
3039
  // Map function type strings to hamlib constants
3055
- setting_t funcType;
3040
+ uint64_t funcType;
3056
3041
  if (funcTypeStr == "FAGC") {
3057
- funcType = RIG_FUNC_FAGC;
3042
+ funcType = SHIM_RIG_FUNC_FAGC;
3058
3043
  } else if (funcTypeStr == "NB") {
3059
- funcType = RIG_FUNC_NB;
3044
+ funcType = SHIM_RIG_FUNC_NB;
3060
3045
  } else if (funcTypeStr == "COMP") {
3061
- funcType = RIG_FUNC_COMP;
3046
+ funcType = SHIM_RIG_FUNC_COMP;
3062
3047
  } else if (funcTypeStr == "VOX") {
3063
- funcType = RIG_FUNC_VOX;
3048
+ funcType = SHIM_RIG_FUNC_VOX;
3064
3049
  } else if (funcTypeStr == "TONE") {
3065
- funcType = RIG_FUNC_TONE;
3050
+ funcType = SHIM_RIG_FUNC_TONE;
3066
3051
  } else if (funcTypeStr == "TSQL") {
3067
- funcType = RIG_FUNC_TSQL;
3052
+ funcType = SHIM_RIG_FUNC_TSQL;
3068
3053
  } else if (funcTypeStr == "SBKIN") {
3069
- funcType = RIG_FUNC_SBKIN;
3054
+ funcType = SHIM_RIG_FUNC_SBKIN;
3070
3055
  } else if (funcTypeStr == "FBKIN") {
3071
- funcType = RIG_FUNC_FBKIN;
3056
+ funcType = SHIM_RIG_FUNC_FBKIN;
3072
3057
  } else if (funcTypeStr == "ANF") {
3073
- funcType = RIG_FUNC_ANF;
3058
+ funcType = SHIM_RIG_FUNC_ANF;
3074
3059
  } else if (funcTypeStr == "NR") {
3075
- funcType = RIG_FUNC_NR;
3060
+ funcType = SHIM_RIG_FUNC_NR;
3076
3061
  } else if (funcTypeStr == "AIP") {
3077
- funcType = RIG_FUNC_AIP;
3062
+ funcType = SHIM_RIG_FUNC_AIP;
3078
3063
  } else if (funcTypeStr == "APF") {
3079
- funcType = RIG_FUNC_APF;
3064
+ funcType = SHIM_RIG_FUNC_APF;
3080
3065
  } else if (funcTypeStr == "TUNER") {
3081
- funcType = RIG_FUNC_TUNER;
3066
+ funcType = SHIM_RIG_FUNC_TUNER;
3082
3067
  } else if (funcTypeStr == "XIT") {
3083
- funcType = RIG_FUNC_XIT;
3068
+ funcType = SHIM_RIG_FUNC_XIT;
3084
3069
  } else if (funcTypeStr == "RIT") {
3085
- funcType = RIG_FUNC_RIT;
3070
+ funcType = SHIM_RIG_FUNC_RIT;
3086
3071
  } else if (funcTypeStr == "LOCK") {
3087
- funcType = RIG_FUNC_LOCK;
3072
+ funcType = SHIM_RIG_FUNC_LOCK;
3088
3073
  } else if (funcTypeStr == "MUTE") {
3089
- funcType = RIG_FUNC_MUTE;
3074
+ funcType = SHIM_RIG_FUNC_MUTE;
3090
3075
  } else if (funcTypeStr == "VSC") {
3091
- funcType = RIG_FUNC_VSC;
3076
+ funcType = SHIM_RIG_FUNC_VSC;
3092
3077
  } else if (funcTypeStr == "REV") {
3093
- funcType = RIG_FUNC_REV;
3078
+ funcType = SHIM_RIG_FUNC_REV;
3094
3079
  } else if (funcTypeStr == "SQL") {
3095
- funcType = RIG_FUNC_SQL;
3080
+ funcType = SHIM_RIG_FUNC_SQL;
3096
3081
  } else if (funcTypeStr == "ABM") {
3097
- funcType = RIG_FUNC_ABM;
3082
+ funcType = SHIM_RIG_FUNC_ABM;
3098
3083
  } else if (funcTypeStr == "BC") {
3099
- funcType = RIG_FUNC_BC;
3084
+ funcType = SHIM_RIG_FUNC_BC;
3100
3085
  } else if (funcTypeStr == "MBC") {
3101
- funcType = RIG_FUNC_MBC;
3086
+ funcType = SHIM_RIG_FUNC_MBC;
3102
3087
  } else if (funcTypeStr == "AFC") {
3103
- funcType = RIG_FUNC_AFC;
3088
+ funcType = SHIM_RIG_FUNC_AFC;
3104
3089
  } else if (funcTypeStr == "SATMODE") {
3105
- funcType = RIG_FUNC_SATMODE;
3090
+ funcType = SHIM_RIG_FUNC_SATMODE;
3106
3091
  } else if (funcTypeStr == "SCOPE") {
3107
- funcType = RIG_FUNC_SCOPE;
3092
+ funcType = SHIM_RIG_FUNC_SCOPE;
3108
3093
  } else if (funcTypeStr == "RESUME") {
3109
- funcType = RIG_FUNC_RESUME;
3094
+ funcType = SHIM_RIG_FUNC_RESUME;
3110
3095
  } else if (funcTypeStr == "TBURST") {
3111
- funcType = RIG_FUNC_TBURST;
3096
+ funcType = SHIM_RIG_FUNC_TBURST;
3112
3097
  } else {
3113
3098
  Napi::TypeError::New(env, "Invalid function type").ThrowAsJavaScriptException();
3114
3099
  return env.Null();
@@ -3136,63 +3121,63 @@ Napi::Value NodeHamLib::GetFunction(const Napi::CallbackInfo & info) {
3136
3121
  std::string funcTypeStr = info[0].As<Napi::String>().Utf8Value();
3137
3122
 
3138
3123
  // Map function type strings to hamlib constants (same as SetFunction)
3139
- setting_t funcType;
3124
+ uint64_t funcType;
3140
3125
  if (funcTypeStr == "FAGC") {
3141
- funcType = RIG_FUNC_FAGC;
3126
+ funcType = SHIM_RIG_FUNC_FAGC;
3142
3127
  } else if (funcTypeStr == "NB") {
3143
- funcType = RIG_FUNC_NB;
3128
+ funcType = SHIM_RIG_FUNC_NB;
3144
3129
  } else if (funcTypeStr == "COMP") {
3145
- funcType = RIG_FUNC_COMP;
3130
+ funcType = SHIM_RIG_FUNC_COMP;
3146
3131
  } else if (funcTypeStr == "VOX") {
3147
- funcType = RIG_FUNC_VOX;
3132
+ funcType = SHIM_RIG_FUNC_VOX;
3148
3133
  } else if (funcTypeStr == "TONE") {
3149
- funcType = RIG_FUNC_TONE;
3134
+ funcType = SHIM_RIG_FUNC_TONE;
3150
3135
  } else if (funcTypeStr == "TSQL") {
3151
- funcType = RIG_FUNC_TSQL;
3136
+ funcType = SHIM_RIG_FUNC_TSQL;
3152
3137
  } else if (funcTypeStr == "SBKIN") {
3153
- funcType = RIG_FUNC_SBKIN;
3138
+ funcType = SHIM_RIG_FUNC_SBKIN;
3154
3139
  } else if (funcTypeStr == "FBKIN") {
3155
- funcType = RIG_FUNC_FBKIN;
3140
+ funcType = SHIM_RIG_FUNC_FBKIN;
3156
3141
  } else if (funcTypeStr == "ANF") {
3157
- funcType = RIG_FUNC_ANF;
3142
+ funcType = SHIM_RIG_FUNC_ANF;
3158
3143
  } else if (funcTypeStr == "NR") {
3159
- funcType = RIG_FUNC_NR;
3144
+ funcType = SHIM_RIG_FUNC_NR;
3160
3145
  } else if (funcTypeStr == "AIP") {
3161
- funcType = RIG_FUNC_AIP;
3146
+ funcType = SHIM_RIG_FUNC_AIP;
3162
3147
  } else if (funcTypeStr == "APF") {
3163
- funcType = RIG_FUNC_APF;
3148
+ funcType = SHIM_RIG_FUNC_APF;
3164
3149
  } else if (funcTypeStr == "TUNER") {
3165
- funcType = RIG_FUNC_TUNER;
3150
+ funcType = SHIM_RIG_FUNC_TUNER;
3166
3151
  } else if (funcTypeStr == "XIT") {
3167
- funcType = RIG_FUNC_XIT;
3152
+ funcType = SHIM_RIG_FUNC_XIT;
3168
3153
  } else if (funcTypeStr == "RIT") {
3169
- funcType = RIG_FUNC_RIT;
3154
+ funcType = SHIM_RIG_FUNC_RIT;
3170
3155
  } else if (funcTypeStr == "LOCK") {
3171
- funcType = RIG_FUNC_LOCK;
3156
+ funcType = SHIM_RIG_FUNC_LOCK;
3172
3157
  } else if (funcTypeStr == "MUTE") {
3173
- funcType = RIG_FUNC_MUTE;
3158
+ funcType = SHIM_RIG_FUNC_MUTE;
3174
3159
  } else if (funcTypeStr == "VSC") {
3175
- funcType = RIG_FUNC_VSC;
3160
+ funcType = SHIM_RIG_FUNC_VSC;
3176
3161
  } else if (funcTypeStr == "REV") {
3177
- funcType = RIG_FUNC_REV;
3162
+ funcType = SHIM_RIG_FUNC_REV;
3178
3163
  } else if (funcTypeStr == "SQL") {
3179
- funcType = RIG_FUNC_SQL;
3164
+ funcType = SHIM_RIG_FUNC_SQL;
3180
3165
  } else if (funcTypeStr == "ABM") {
3181
- funcType = RIG_FUNC_ABM;
3166
+ funcType = SHIM_RIG_FUNC_ABM;
3182
3167
  } else if (funcTypeStr == "BC") {
3183
- funcType = RIG_FUNC_BC;
3168
+ funcType = SHIM_RIG_FUNC_BC;
3184
3169
  } else if (funcTypeStr == "MBC") {
3185
- funcType = RIG_FUNC_MBC;
3170
+ funcType = SHIM_RIG_FUNC_MBC;
3186
3171
  } else if (funcTypeStr == "AFC") {
3187
- funcType = RIG_FUNC_AFC;
3172
+ funcType = SHIM_RIG_FUNC_AFC;
3188
3173
  } else if (funcTypeStr == "SATMODE") {
3189
- funcType = RIG_FUNC_SATMODE;
3174
+ funcType = SHIM_RIG_FUNC_SATMODE;
3190
3175
  } else if (funcTypeStr == "SCOPE") {
3191
- funcType = RIG_FUNC_SCOPE;
3176
+ funcType = SHIM_RIG_FUNC_SCOPE;
3192
3177
  } else if (funcTypeStr == "RESUME") {
3193
- funcType = RIG_FUNC_RESUME;
3178
+ funcType = SHIM_RIG_FUNC_RESUME;
3194
3179
  } else if (funcTypeStr == "TBURST") {
3195
- funcType = RIG_FUNC_TBURST;
3180
+ funcType = SHIM_RIG_FUNC_TBURST;
3196
3181
  } else {
3197
3182
  Napi::TypeError::New(env, "Invalid function type").ThrowAsJavaScriptException();
3198
3183
  return env.Null();
@@ -3208,39 +3193,39 @@ Napi::Value NodeHamLib::GetSupportedFunctions(const Napi::CallbackInfo & info) {
3208
3193
  Napi::Env env = info.Env();
3209
3194
 
3210
3195
  // Get capabilities from rig caps instead of state (doesn't require rig to be open)
3211
- setting_t functions = my_rig->caps->has_get_func | my_rig->caps->has_set_func;
3196
+ uint64_t functions = shim_rig_get_caps_has_get_func(my_rig) | shim_rig_get_caps_has_set_func(my_rig);
3212
3197
  Napi::Array funcArray = Napi::Array::New(env);
3213
3198
  uint32_t index = 0;
3214
3199
 
3215
3200
  // Check each function type
3216
- if (functions & RIG_FUNC_FAGC) funcArray[index++] = Napi::String::New(env, "FAGC");
3217
- if (functions & RIG_FUNC_NB) funcArray[index++] = Napi::String::New(env, "NB");
3218
- if (functions & RIG_FUNC_COMP) funcArray[index++] = Napi::String::New(env, "COMP");
3219
- if (functions & RIG_FUNC_VOX) funcArray[index++] = Napi::String::New(env, "VOX");
3220
- if (functions & RIG_FUNC_TONE) funcArray[index++] = Napi::String::New(env, "TONE");
3221
- if (functions & RIG_FUNC_TSQL) funcArray[index++] = Napi::String::New(env, "TSQL");
3222
- if (functions & RIG_FUNC_SBKIN) funcArray[index++] = Napi::String::New(env, "SBKIN");
3223
- if (functions & RIG_FUNC_FBKIN) funcArray[index++] = Napi::String::New(env, "FBKIN");
3224
- if (functions & RIG_FUNC_ANF) funcArray[index++] = Napi::String::New(env, "ANF");
3225
- if (functions & RIG_FUNC_NR) funcArray[index++] = Napi::String::New(env, "NR");
3226
- if (functions & RIG_FUNC_AIP) funcArray[index++] = Napi::String::New(env, "AIP");
3227
- if (functions & RIG_FUNC_APF) funcArray[index++] = Napi::String::New(env, "APF");
3228
- if (functions & RIG_FUNC_TUNER) funcArray[index++] = Napi::String::New(env, "TUNER");
3229
- if (functions & RIG_FUNC_XIT) funcArray[index++] = Napi::String::New(env, "XIT");
3230
- if (functions & RIG_FUNC_RIT) funcArray[index++] = Napi::String::New(env, "RIT");
3231
- if (functions & RIG_FUNC_LOCK) funcArray[index++] = Napi::String::New(env, "LOCK");
3232
- if (functions & RIG_FUNC_MUTE) funcArray[index++] = Napi::String::New(env, "MUTE");
3233
- if (functions & RIG_FUNC_VSC) funcArray[index++] = Napi::String::New(env, "VSC");
3234
- if (functions & RIG_FUNC_REV) funcArray[index++] = Napi::String::New(env, "REV");
3235
- if (functions & RIG_FUNC_SQL) funcArray[index++] = Napi::String::New(env, "SQL");
3236
- if (functions & RIG_FUNC_ABM) funcArray[index++] = Napi::String::New(env, "ABM");
3237
- if (functions & RIG_FUNC_BC) funcArray[index++] = Napi::String::New(env, "BC");
3238
- if (functions & RIG_FUNC_MBC) funcArray[index++] = Napi::String::New(env, "MBC");
3239
- if (functions & RIG_FUNC_AFC) funcArray[index++] = Napi::String::New(env, "AFC");
3240
- if (functions & RIG_FUNC_SATMODE) funcArray[index++] = Napi::String::New(env, "SATMODE");
3241
- if (functions & RIG_FUNC_SCOPE) funcArray[index++] = Napi::String::New(env, "SCOPE");
3242
- if (functions & RIG_FUNC_RESUME) funcArray[index++] = Napi::String::New(env, "RESUME");
3243
- if (functions & RIG_FUNC_TBURST) funcArray[index++] = Napi::String::New(env, "TBURST");
3201
+ if (functions & SHIM_RIG_FUNC_FAGC) funcArray[index++] = Napi::String::New(env, "FAGC");
3202
+ if (functions & SHIM_RIG_FUNC_NB) funcArray[index++] = Napi::String::New(env, "NB");
3203
+ if (functions & SHIM_RIG_FUNC_COMP) funcArray[index++] = Napi::String::New(env, "COMP");
3204
+ if (functions & SHIM_RIG_FUNC_VOX) funcArray[index++] = Napi::String::New(env, "VOX");
3205
+ if (functions & SHIM_RIG_FUNC_TONE) funcArray[index++] = Napi::String::New(env, "TONE");
3206
+ if (functions & SHIM_RIG_FUNC_TSQL) funcArray[index++] = Napi::String::New(env, "TSQL");
3207
+ if (functions & SHIM_RIG_FUNC_SBKIN) funcArray[index++] = Napi::String::New(env, "SBKIN");
3208
+ if (functions & SHIM_RIG_FUNC_FBKIN) funcArray[index++] = Napi::String::New(env, "FBKIN");
3209
+ if (functions & SHIM_RIG_FUNC_ANF) funcArray[index++] = Napi::String::New(env, "ANF");
3210
+ if (functions & SHIM_RIG_FUNC_NR) funcArray[index++] = Napi::String::New(env, "NR");
3211
+ if (functions & SHIM_RIG_FUNC_AIP) funcArray[index++] = Napi::String::New(env, "AIP");
3212
+ if (functions & SHIM_RIG_FUNC_APF) funcArray[index++] = Napi::String::New(env, "APF");
3213
+ if (functions & SHIM_RIG_FUNC_TUNER) funcArray[index++] = Napi::String::New(env, "TUNER");
3214
+ if (functions & SHIM_RIG_FUNC_XIT) funcArray[index++] = Napi::String::New(env, "XIT");
3215
+ if (functions & SHIM_RIG_FUNC_RIT) funcArray[index++] = Napi::String::New(env, "RIT");
3216
+ if (functions & SHIM_RIG_FUNC_LOCK) funcArray[index++] = Napi::String::New(env, "LOCK");
3217
+ if (functions & SHIM_RIG_FUNC_MUTE) funcArray[index++] = Napi::String::New(env, "MUTE");
3218
+ if (functions & SHIM_RIG_FUNC_VSC) funcArray[index++] = Napi::String::New(env, "VSC");
3219
+ if (functions & SHIM_RIG_FUNC_REV) funcArray[index++] = Napi::String::New(env, "REV");
3220
+ if (functions & SHIM_RIG_FUNC_SQL) funcArray[index++] = Napi::String::New(env, "SQL");
3221
+ if (functions & SHIM_RIG_FUNC_ABM) funcArray[index++] = Napi::String::New(env, "ABM");
3222
+ if (functions & SHIM_RIG_FUNC_BC) funcArray[index++] = Napi::String::New(env, "BC");
3223
+ if (functions & SHIM_RIG_FUNC_MBC) funcArray[index++] = Napi::String::New(env, "MBC");
3224
+ if (functions & SHIM_RIG_FUNC_AFC) funcArray[index++] = Napi::String::New(env, "AFC");
3225
+ if (functions & SHIM_RIG_FUNC_SATMODE) funcArray[index++] = Napi::String::New(env, "SATMODE");
3226
+ if (functions & SHIM_RIG_FUNC_SCOPE) funcArray[index++] = Napi::String::New(env, "SCOPE");
3227
+ if (functions & SHIM_RIG_FUNC_RESUME) funcArray[index++] = Napi::String::New(env, "RESUME");
3228
+ if (functions & SHIM_RIG_FUNC_TBURST) funcArray[index++] = Napi::String::New(env, "TBURST");
3244
3229
 
3245
3230
  return funcArray;
3246
3231
  }
@@ -3250,16 +3235,16 @@ Napi::Value NodeHamLib::GetSupportedModes(const Napi::CallbackInfo & info) {
3250
3235
  Napi::Env env = info.Env();
3251
3236
 
3252
3237
  // Get mode list from rig state (populated during rig_open from rx/tx range lists)
3253
- rmode_t modes = my_rig->state.mode_list;
3238
+ uint64_t modes = shim_rig_get_mode_list(my_rig);
3254
3239
  Napi::Array modeArray = Napi::Array::New(env);
3255
3240
  uint32_t index = 0;
3256
3241
 
3257
3242
  // Iterate through all possible mode bits (similar to rig_sprintf_mode)
3258
- for (unsigned int i = 0; i < HAMLIB_MAX_MODES; i++) {
3259
- rmode_t mode_bit = modes & (1ULL << i);
3243
+ for (unsigned int i = 0; i < SHIM_HAMLIB_MAX_MODES; i++) {
3244
+ uint64_t mode_bit = modes & (1ULL << i);
3260
3245
 
3261
3246
  if (mode_bit) {
3262
- const char* mode_str = rig_strrmode(mode_bit);
3247
+ const char* mode_str = shim_rig_strrmode(mode_bit);
3263
3248
 
3264
3249
  // Skip empty or unknown modes
3265
3250
  if (mode_str && mode_str[0] != '\0') {
@@ -3285,7 +3270,7 @@ Napi::Value NodeHamLib::SetSplitFreq(const Napi::CallbackInfo & info) {
3285
3270
  return env.Null();
3286
3271
  }
3287
3272
 
3288
- freq_t tx_freq = info[0].As<Napi::Number>().DoubleValue();
3273
+ double tx_freq = info[0].As<Napi::Number>().DoubleValue();
3289
3274
 
3290
3275
  // Basic frequency range validation
3291
3276
  if (tx_freq < 1000 || tx_freq > 10000000000) { // 1 kHz to 10 GHz reasonable range
@@ -3293,11 +3278,11 @@ Napi::Value NodeHamLib::SetSplitFreq(const Napi::CallbackInfo & info) {
3293
3278
  return env.Null();
3294
3279
  }
3295
3280
 
3296
- vfo_t vfo = RIG_VFO_CURR;
3281
+ int vfo = SHIM_RIG_VFO_CURR;
3297
3282
 
3298
3283
  if (info.Length() >= 2 && info[1].IsString()) {
3299
3284
  // setSplitFreq(freq, vfo)
3300
- vfo = parseVfoParameter(info, 1, RIG_VFO_CURR);
3285
+ vfo = parseVfoParameter(info, 1, SHIM_RIG_VFO_CURR);
3301
3286
  }
3302
3287
 
3303
3288
  SetSplitFreqAsyncWorker* asyncWorker = new SetSplitFreqAsyncWorker(env, this, tx_freq, vfo);
@@ -3313,13 +3298,13 @@ Napi::Value NodeHamLib::GetSplitFreq(const Napi::CallbackInfo & info) {
3313
3298
  return env.Null();
3314
3299
  }
3315
3300
 
3316
- vfo_t vfo = RIG_VFO_CURR;
3301
+ int vfo = SHIM_RIG_VFO_CURR;
3317
3302
 
3318
3303
  if (info.Length() >= 1 && info[0].IsString()) {
3319
3304
  // getSplitFreq(vfo)
3320
- vfo = parseVfoParameter(info, 0, RIG_VFO_CURR);
3305
+ vfo = parseVfoParameter(info, 0, SHIM_RIG_VFO_CURR);
3321
3306
  }
3322
- // Otherwise use default RIG_VFO_CURR for getSplitFreq()
3307
+ // Otherwise use default SHIM_RIG_VFO_CURR for getSplitFreq()
3323
3308
 
3324
3309
  GetSplitFreqAsyncWorker* asyncWorker = new GetSplitFreqAsyncWorker(env, this, vfo);
3325
3310
  asyncWorker->Queue();
@@ -3340,21 +3325,21 @@ Napi::Value NodeHamLib::SetSplitMode(const Napi::CallbackInfo & info) {
3340
3325
  }
3341
3326
 
3342
3327
  std::string modeStr = info[0].As<Napi::String>().Utf8Value();
3343
- rmode_t tx_mode = rig_parse_mode(modeStr.c_str());
3328
+ int tx_mode = shim_rig_parse_mode(modeStr.c_str());
3344
3329
 
3345
- if (tx_mode == RIG_MODE_NONE) {
3330
+ if (tx_mode == SHIM_RIG_MODE_NONE) {
3346
3331
  Napi::Error::New(env, "Invalid mode: " + modeStr).ThrowAsJavaScriptException();
3347
3332
  return env.Null();
3348
3333
  }
3349
3334
 
3350
- pbwidth_t tx_width = RIG_PASSBAND_NORMAL;
3351
- vfo_t vfo = RIG_VFO_CURR;
3335
+ int tx_width = SHIM_RIG_PASSBAND_NORMAL;
3336
+ int vfo = SHIM_RIG_VFO_CURR;
3352
3337
 
3353
3338
  // Parse parameters: setSplitMode(mode) | setSplitMode(mode, vfo) | setSplitMode(mode, width) | setSplitMode(mode, width, vfo)
3354
3339
  if (info.Length() == 2) {
3355
3340
  if (info[1].IsString()) {
3356
3341
  // setSplitMode(mode, vfo)
3357
- vfo = parseVfoParameter(info, 1, RIG_VFO_CURR);
3342
+ vfo = parseVfoParameter(info, 1, SHIM_RIG_VFO_CURR);
3358
3343
  } else if (info[1].IsNumber()) {
3359
3344
  // setSplitMode(mode, width)
3360
3345
  tx_width = info[1].As<Napi::Number>().Int32Value();
@@ -3362,7 +3347,7 @@ Napi::Value NodeHamLib::SetSplitMode(const Napi::CallbackInfo & info) {
3362
3347
  } else if (info.Length() == 3 && info[1].IsNumber() && info[2].IsString()) {
3363
3348
  // setSplitMode(mode, width, vfo)
3364
3349
  tx_width = info[1].As<Napi::Number>().Int32Value();
3365
- vfo = parseVfoParameter(info, 2, RIG_VFO_CURR);
3350
+ vfo = parseVfoParameter(info, 2, SHIM_RIG_VFO_CURR);
3366
3351
  }
3367
3352
 
3368
3353
  SetSplitModeAsyncWorker* asyncWorker = new SetSplitModeAsyncWorker(env, this, tx_mode, tx_width, vfo);
@@ -3378,13 +3363,13 @@ Napi::Value NodeHamLib::GetSplitMode(const Napi::CallbackInfo & info) {
3378
3363
  return env.Null();
3379
3364
  }
3380
3365
 
3381
- vfo_t vfo = RIG_VFO_CURR;
3366
+ int vfo = SHIM_RIG_VFO_CURR;
3382
3367
 
3383
3368
  if (info.Length() >= 1 && info[0].IsString()) {
3384
3369
  // getSplitMode(vfo)
3385
- vfo = parseVfoParameter(info, 0, RIG_VFO_CURR);
3370
+ vfo = parseVfoParameter(info, 0, SHIM_RIG_VFO_CURR);
3386
3371
  }
3387
- // Otherwise use default RIG_VFO_CURR for getSplitMode()
3372
+ // Otherwise use default SHIM_RIG_VFO_CURR for getSplitMode()
3388
3373
 
3389
3374
  GetSplitModeAsyncWorker* asyncWorker = new GetSplitModeAsyncWorker(env, this, vfo);
3390
3375
  asyncWorker->Queue();
@@ -3405,11 +3390,11 @@ Napi::Value NodeHamLib::SetSplit(const Napi::CallbackInfo & info) {
3405
3390
  }
3406
3391
 
3407
3392
  bool split_enabled = info[0].As<Napi::Boolean>().Value();
3408
- split_t split = split_enabled ? RIG_SPLIT_ON : RIG_SPLIT_OFF;
3393
+ int split = split_enabled ? SHIM_RIG_SPLIT_ON : SHIM_RIG_SPLIT_OFF;
3409
3394
 
3410
3395
  // Default values
3411
- vfo_t rx_vfo = RIG_VFO_CURR;
3412
- vfo_t tx_vfo = RIG_VFO_B; // Default TX VFO
3396
+ int rx_vfo = SHIM_RIG_VFO_CURR;
3397
+ int tx_vfo = SHIM_RIG_VFO_B; // Default TX VFO
3413
3398
 
3414
3399
  // ⚠️ CRITICAL HISTORICAL ISSUE WARNING ⚠️
3415
3400
  // This Split API had a severe parameter order bug that caused AI to repeatedly
@@ -3430,9 +3415,9 @@ Napi::Value NodeHamLib::SetSplit(const Napi::CallbackInfo & info) {
3430
3415
  // setSplit(enable, rxVfo) - treating vfo as RX VFO for current VFO operation
3431
3416
  std::string vfoStr = info[1].As<Napi::String>().Utf8Value();
3432
3417
  if (vfoStr == "VFO-A") {
3433
- rx_vfo = RIG_VFO_A;
3418
+ rx_vfo = SHIM_RIG_VFO_A;
3434
3419
  } else if (vfoStr == "VFO-B") {
3435
- rx_vfo = RIG_VFO_B;
3420
+ rx_vfo = SHIM_RIG_VFO_B;
3436
3421
  }
3437
3422
  } else if (info.Length() == 3 && info[1].IsString() && info[2].IsString()) {
3438
3423
  // setSplit(enable, rxVfo, txVfo)
@@ -3443,15 +3428,15 @@ Napi::Value NodeHamLib::SetSplit(const Napi::CallbackInfo & info) {
3443
3428
  std::string txVfoStr = info[2].As<Napi::String>().Utf8Value(); // ✅ CORRECT: info[2] is txVfo
3444
3429
 
3445
3430
  if (rxVfoStr == "VFO-A") {
3446
- rx_vfo = RIG_VFO_A;
3431
+ rx_vfo = SHIM_RIG_VFO_A;
3447
3432
  } else if (rxVfoStr == "VFO-B") {
3448
- rx_vfo = RIG_VFO_B;
3433
+ rx_vfo = SHIM_RIG_VFO_B;
3449
3434
  }
3450
3435
 
3451
3436
  if (txVfoStr == "VFO-A") {
3452
- tx_vfo = RIG_VFO_A;
3437
+ tx_vfo = SHIM_RIG_VFO_A;
3453
3438
  } else if (txVfoStr == "VFO-B") {
3454
- tx_vfo = RIG_VFO_B;
3439
+ tx_vfo = SHIM_RIG_VFO_B;
3455
3440
  }
3456
3441
  }
3457
3442
 
@@ -3468,13 +3453,13 @@ Napi::Value NodeHamLib::GetSplit(const Napi::CallbackInfo & info) {
3468
3453
  return env.Null();
3469
3454
  }
3470
3455
 
3471
- vfo_t vfo = RIG_VFO_CURR;
3456
+ int vfo = SHIM_RIG_VFO_CURR;
3472
3457
 
3473
3458
  if (info.Length() >= 1 && info[0].IsString()) {
3474
3459
  // getSplit(vfo)
3475
- vfo = parseVfoParameter(info, 0, RIG_VFO_CURR);
3460
+ vfo = parseVfoParameter(info, 0, SHIM_RIG_VFO_CURR);
3476
3461
  }
3477
- // Otherwise use default RIG_VFO_CURR for getSplit()
3462
+ // Otherwise use default SHIM_RIG_VFO_CURR for getSplit()
3478
3463
 
3479
3464
  GetSplitAsyncWorker* asyncWorker = new GetSplitAsyncWorker(env, this, vfo);
3480
3465
  asyncWorker->Queue();
@@ -3497,33 +3482,33 @@ Napi::Value NodeHamLib::VfoOperation(const Napi::CallbackInfo & info) {
3497
3482
 
3498
3483
  std::string vfoOpStr = info[0].As<Napi::String>().Utf8Value();
3499
3484
 
3500
- vfo_op_t vfo_op;
3485
+ int vfo_op;
3501
3486
  if (vfoOpStr == "CPY") {
3502
- vfo_op = RIG_OP_CPY;
3487
+ vfo_op = SHIM_RIG_OP_CPY;
3503
3488
  } else if (vfoOpStr == "XCHG") {
3504
- vfo_op = RIG_OP_XCHG;
3489
+ vfo_op = SHIM_RIG_OP_XCHG;
3505
3490
  } else if (vfoOpStr == "FROM_VFO") {
3506
- vfo_op = RIG_OP_FROM_VFO;
3491
+ vfo_op = SHIM_RIG_OP_FROM_VFO;
3507
3492
  } else if (vfoOpStr == "TO_VFO") {
3508
- vfo_op = RIG_OP_TO_VFO;
3493
+ vfo_op = SHIM_RIG_OP_TO_VFO;
3509
3494
  } else if (vfoOpStr == "MCL") {
3510
- vfo_op = RIG_OP_MCL;
3495
+ vfo_op = SHIM_RIG_OP_MCL;
3511
3496
  } else if (vfoOpStr == "UP") {
3512
- vfo_op = RIG_OP_UP;
3497
+ vfo_op = SHIM_RIG_OP_UP;
3513
3498
  } else if (vfoOpStr == "DOWN") {
3514
- vfo_op = RIG_OP_DOWN;
3499
+ vfo_op = SHIM_RIG_OP_DOWN;
3515
3500
  } else if (vfoOpStr == "BAND_UP") {
3516
- vfo_op = RIG_OP_BAND_UP;
3501
+ vfo_op = SHIM_RIG_OP_BAND_UP;
3517
3502
  } else if (vfoOpStr == "BAND_DOWN") {
3518
- vfo_op = RIG_OP_BAND_DOWN;
3503
+ vfo_op = SHIM_RIG_OP_BAND_DOWN;
3519
3504
  } else if (vfoOpStr == "LEFT") {
3520
- vfo_op = RIG_OP_LEFT;
3505
+ vfo_op = SHIM_RIG_OP_LEFT;
3521
3506
  } else if (vfoOpStr == "RIGHT") {
3522
- vfo_op = RIG_OP_RIGHT;
3507
+ vfo_op = SHIM_RIG_OP_RIGHT;
3523
3508
  } else if (vfoOpStr == "TUNE") {
3524
- vfo_op = RIG_OP_TUNE;
3509
+ vfo_op = SHIM_RIG_OP_TUNE;
3525
3510
  } else if (vfoOpStr == "TOGGLE") {
3526
- vfo_op = RIG_OP_TOGGLE;
3511
+ vfo_op = SHIM_RIG_OP_TOGGLE;
3527
3512
  } else {
3528
3513
  Napi::TypeError::New(env, "Invalid VFO operation").ThrowAsJavaScriptException();
3529
3514
  return env.Null();
@@ -3548,17 +3533,17 @@ Napi::Value NodeHamLib::SetAntenna(const Napi::CallbackInfo & info) {
3548
3533
  return env.Null();
3549
3534
  }
3550
3535
 
3551
- ant_t antenna = info[0].As<Napi::Number>().Int32Value();
3536
+ int antenna = info[0].As<Napi::Number>().Int32Value();
3552
3537
 
3553
3538
  // Support optional VFO parameter: setAntenna(antenna) or setAntenna(antenna, vfo)
3554
- vfo_t vfo = RIG_VFO_CURR;
3539
+ int vfo = SHIM_RIG_VFO_CURR;
3555
3540
  if (info.Length() >= 2 && info[1].IsString()) {
3556
- vfo = parseVfoParameter(info, 1, RIG_VFO_CURR);
3541
+ vfo = parseVfoParameter(info, 1, SHIM_RIG_VFO_CURR);
3557
3542
  }
3558
3543
 
3559
3544
  // Default option value (can be extended later if needed)
3560
- value_t option = {0};
3561
-
3545
+ float option = 0.0f;
3546
+
3562
3547
  SetAntennaAsyncWorker* asyncWorker = new SetAntennaAsyncWorker(env, this, antenna, vfo, option);
3563
3548
  asyncWorker->Queue();
3564
3549
  return asyncWorker->GetPromise();
@@ -3573,13 +3558,13 @@ Napi::Value NodeHamLib::GetAntenna(const Napi::CallbackInfo & info) {
3573
3558
  }
3574
3559
 
3575
3560
  // Support optional VFO parameter: getAntenna() or getAntenna(vfo)
3576
- vfo_t vfo = RIG_VFO_CURR;
3561
+ int vfo = SHIM_RIG_VFO_CURR;
3577
3562
  if (info.Length() >= 1 && info[0].IsString()) {
3578
- vfo = parseVfoParameter(info, 0, RIG_VFO_CURR);
3563
+ vfo = parseVfoParameter(info, 0, SHIM_RIG_VFO_CURR);
3579
3564
  }
3580
3565
 
3581
- // Default antenna query (RIG_ANT_CURR gets all antenna info)
3582
- ant_t antenna = RIG_ANT_CURR;
3566
+ // Default antenna query (SHIM_RIG_ANT_CURR gets all antenna info)
3567
+ int antenna = SHIM_RIG_ANT_CURR;
3583
3568
 
3584
3569
  GetAntennaAsyncWorker* asyncWorker = new GetAntennaAsyncWorker(env, this, vfo, antenna);
3585
3570
  asyncWorker->Queue();
@@ -3750,60 +3735,31 @@ bool NodeHamLib::isNetworkAddress(const char* path) {
3750
3735
  }
3751
3736
 
3752
3737
  // Static callback function for rig_list_foreach
3753
- int NodeHamLib::rig_list_callback(const struct rig_caps *caps, void *data) {
3738
+ int NodeHamLib::rig_list_callback(const shim_rig_info_t *info, void *data) {
3754
3739
  RigListData *rig_data = static_cast<RigListData*>(data);
3755
-
3740
+
3756
3741
  // Create rig info object
3757
3742
  Napi::Object rigInfo = Napi::Object::New(rig_data->env);
3758
- rigInfo.Set(Napi::String::New(rig_data->env, "rigModel"),
3759
- Napi::Number::New(rig_data->env, caps->rig_model));
3760
- rigInfo.Set(Napi::String::New(rig_data->env, "modelName"),
3761
- Napi::String::New(rig_data->env, caps->model_name ? caps->model_name : ""));
3762
- rigInfo.Set(Napi::String::New(rig_data->env, "mfgName"),
3763
- Napi::String::New(rig_data->env, caps->mfg_name ? caps->mfg_name : ""));
3764
- rigInfo.Set(Napi::String::New(rig_data->env, "version"),
3765
- Napi::String::New(rig_data->env, caps->version ? caps->version : ""));
3766
- rigInfo.Set(Napi::String::New(rig_data->env, "status"),
3767
- Napi::String::New(rig_data->env, rig_strstatus(caps->status)));
3768
-
3769
- // Determine rig type string
3770
- const char* rigType = "Unknown";
3771
- switch (caps->rig_type & RIG_TYPE_MASK) {
3772
- case RIG_TYPE_TRANSCEIVER:
3773
- rigType = "Transceiver";
3774
- break;
3775
- case RIG_TYPE_HANDHELD:
3776
- rigType = "Handheld";
3777
- break;
3778
- case RIG_TYPE_MOBILE:
3779
- rigType = "Mobile";
3780
- break;
3781
- case RIG_TYPE_RECEIVER:
3782
- rigType = "Receiver";
3783
- break;
3784
- case RIG_TYPE_PCRECEIVER:
3785
- rigType = "PC Receiver";
3786
- break;
3787
- case RIG_TYPE_SCANNER:
3788
- rigType = "Scanner";
3789
- break;
3790
- case RIG_TYPE_TRUNKSCANNER:
3791
- rigType = "Trunk Scanner";
3792
- break;
3793
- case RIG_TYPE_COMPUTER:
3794
- rigType = "Computer";
3795
- break;
3796
- case RIG_TYPE_OTHER:
3797
- rigType = "Other";
3798
- break;
3799
- }
3800
-
3801
- rigInfo.Set(Napi::String::New(rig_data->env, "rigType"),
3743
+ rigInfo.Set(Napi::String::New(rig_data->env, "rigModel"),
3744
+ Napi::Number::New(rig_data->env, info->rig_model));
3745
+ rigInfo.Set(Napi::String::New(rig_data->env, "modelName"),
3746
+ Napi::String::New(rig_data->env, info->model_name ? info->model_name : ""));
3747
+ rigInfo.Set(Napi::String::New(rig_data->env, "mfgName"),
3748
+ Napi::String::New(rig_data->env, info->mfg_name ? info->mfg_name : ""));
3749
+ rigInfo.Set(Napi::String::New(rig_data->env, "version"),
3750
+ Napi::String::New(rig_data->env, info->version ? info->version : ""));
3751
+ rigInfo.Set(Napi::String::New(rig_data->env, "status"),
3752
+ Napi::String::New(rig_data->env, shim_rig_strstatus(info->status)));
3753
+
3754
+ // Determine rig type string using shim helper
3755
+ const char* rigType = shim_rig_type_str(info->rig_type);
3756
+
3757
+ rigInfo.Set(Napi::String::New(rig_data->env, "rigType"),
3802
3758
  Napi::String::New(rig_data->env, rigType));
3803
-
3759
+
3804
3760
  // Add to list
3805
3761
  rig_data->rigList.push_back(rigInfo);
3806
-
3762
+
3807
3763
  return 1; // Continue iteration (returning 0 would stop)
3808
3764
  }
3809
3765
 
@@ -3812,15 +3768,15 @@ Napi::Value NodeHamLib::GetSupportedRigs(const Napi::CallbackInfo& info) {
3812
3768
  Napi::Env env = info.Env();
3813
3769
 
3814
3770
  // Load all backends to ensure we get the complete list
3815
- rig_load_all_backends();
3771
+ shim_rig_load_all_backends();
3816
3772
 
3817
3773
  // Prepare data structure for callback with proper initialization
3818
3774
  RigListData rigData{std::vector<Napi::Object>(), env};
3819
3775
 
3820
3776
  // Call hamlib function to iterate through all supported rigs
3821
- int result = rig_list_foreach(rig_list_callback, &rigData);
3777
+ int result = shim_rig_list_foreach(rig_list_callback, &rigData);
3822
3778
 
3823
- if (result != RIG_OK) {
3779
+ if (result != SHIM_RIG_OK) {
3824
3780
  Napi::Error::New(env, "Failed to retrieve supported rig list").ThrowAsJavaScriptException();
3825
3781
  return env.Null();
3826
3782
  }
@@ -3838,10 +3794,7 @@ Napi::Value NodeHamLib::GetSupportedRigs(const Napi::CallbackInfo& info) {
3838
3794
  Napi::Value NodeHamLib::GetHamlibVersion(const Napi::CallbackInfo& info) {
3839
3795
  Napi::Env env = info.Env();
3840
3796
 
3841
- // Reference to external hamlib_version2 variable
3842
- extern const char* hamlib_version2;
3843
-
3844
- return Napi::String::New(env, hamlib_version2);
3797
+ return Napi::String::New(env, shim_rig_get_version());
3845
3798
  }
3846
3799
 
3847
3800
  // Set Hamlib debug level
@@ -3862,7 +3815,7 @@ Napi::Value NodeHamLib::SetDebugLevel(const Napi::CallbackInfo& info) {
3862
3815
  return env.Undefined();
3863
3816
  }
3864
3817
 
3865
- rig_set_debug((enum rig_debug_level_e)level);
3818
+ shim_rig_set_debug(level);
3866
3819
 
3867
3820
  return env.Undefined();
3868
3821
  }
@@ -4027,7 +3980,7 @@ Napi::Value NodeHamLib::GetSupportedSerialConfigs(const Napi::CallbackInfo& info
4027
3980
  pttTypeOptions[5u] = Napi::String::New(env, "GPIO");
4028
3981
  pttTypeOptions[6u] = Napi::String::New(env, "GPION");
4029
3982
  pttTypeOptions[7u] = Napi::String::New(env, "NONE");
4030
- configs.Set("ptt_type", pttTypeOptions);
3983
+ configs.Set("intype", pttTypeOptions);
4031
3984
 
4032
3985
  // DCD type options
4033
3986
  Napi::Array dcdTypeOptions = Napi::Array::New(env, 9);
@@ -4040,7 +3993,7 @@ Napi::Value NodeHamLib::GetSupportedSerialConfigs(const Napi::CallbackInfo& info
4040
3993
  dcdTypeOptions[6u] = Napi::String::New(env, "GPIO");
4041
3994
  dcdTypeOptions[7u] = Napi::String::New(env, "GPION");
4042
3995
  dcdTypeOptions[8u] = Napi::String::New(env, "NONE");
4043
- configs.Set("dcd_type", dcdTypeOptions);
3996
+ configs.Set("intype", dcdTypeOptions);
4044
3997
 
4045
3998
  return configs;
4046
3999
  }
@@ -4055,7 +4008,7 @@ Napi::Value NodeHamLib::SetPowerstat(const Napi::CallbackInfo& info) {
4055
4008
  }
4056
4009
 
4057
4010
  int powerStatus = info[0].As<Napi::Number>().Int32Value();
4058
- powerstat_t status = static_cast<powerstat_t>(powerStatus);
4011
+ int status = static_cast<int>(powerStatus);
4059
4012
 
4060
4013
  SetPowerstatAsyncWorker* asyncWorker = new SetPowerstatAsyncWorker(env, this, status);
4061
4014
  asyncWorker->Queue();
@@ -4074,7 +4027,7 @@ Napi::Value NodeHamLib::GetPowerstat(const Napi::CallbackInfo& info) {
4074
4027
  Napi::Value NodeHamLib::GetPtt(const Napi::CallbackInfo& info) {
4075
4028
  Napi::Env env = info.Env();
4076
4029
 
4077
- vfo_t vfo = parseVfoParameter(info, 0, RIG_VFO_CURR);
4030
+ int vfo = parseVfoParameter(info, 0, SHIM_RIG_VFO_CURR);
4078
4031
 
4079
4032
  GetPttAsyncWorker* asyncWorker = new GetPttAsyncWorker(env, this, vfo);
4080
4033
  asyncWorker->Queue();
@@ -4085,7 +4038,7 @@ Napi::Value NodeHamLib::GetPtt(const Napi::CallbackInfo& info) {
4085
4038
  Napi::Value NodeHamLib::GetDcd(const Napi::CallbackInfo& info) {
4086
4039
  Napi::Env env = info.Env();
4087
4040
 
4088
- vfo_t vfo = parseVfoParameter(info, 0, RIG_VFO_CURR);
4041
+ int vfo = parseVfoParameter(info, 0, SHIM_RIG_VFO_CURR);
4089
4042
 
4090
4043
  GetDcdAsyncWorker* asyncWorker = new GetDcdAsyncWorker(env, this, vfo);
4091
4044
  asyncWorker->Queue();
@@ -4101,8 +4054,8 @@ Napi::Value NodeHamLib::SetTuningStep(const Napi::CallbackInfo& info) {
4101
4054
  return env.Null();
4102
4055
  }
4103
4056
 
4104
- shortfreq_t ts = info[0].As<Napi::Number>().Int32Value();
4105
- vfo_t vfo = parseVfoParameter(info, 1, RIG_VFO_CURR);
4057
+ int ts = info[0].As<Napi::Number>().Int32Value();
4058
+ int vfo = parseVfoParameter(info, 1, SHIM_RIG_VFO_CURR);
4106
4059
 
4107
4060
  SetTuningStepAsyncWorker* asyncWorker = new SetTuningStepAsyncWorker(env, this, vfo, ts);
4108
4061
  asyncWorker->Queue();
@@ -4112,7 +4065,7 @@ Napi::Value NodeHamLib::SetTuningStep(const Napi::CallbackInfo& info) {
4112
4065
  Napi::Value NodeHamLib::GetTuningStep(const Napi::CallbackInfo& info) {
4113
4066
  Napi::Env env = info.Env();
4114
4067
 
4115
- vfo_t vfo = parseVfoParameter(info, 0, RIG_VFO_CURR);
4068
+ int vfo = parseVfoParameter(info, 0, SHIM_RIG_VFO_CURR);
4116
4069
 
4117
4070
  GetTuningStepAsyncWorker* asyncWorker = new GetTuningStepAsyncWorker(env, this, vfo);
4118
4071
  asyncWorker->Queue();
@@ -4129,20 +4082,20 @@ Napi::Value NodeHamLib::SetRepeaterShift(const Napi::CallbackInfo& info) {
4129
4082
  }
4130
4083
 
4131
4084
  std::string shiftStr = info[0].As<Napi::String>().Utf8Value();
4132
- rptr_shift_t shift = RIG_RPT_SHIFT_NONE;
4085
+ int shift = SHIM_RIG_RPT_SHIFT_NONE;
4133
4086
 
4134
4087
  if (shiftStr == "NONE" || shiftStr == "none") {
4135
- shift = RIG_RPT_SHIFT_NONE;
4088
+ shift = SHIM_RIG_RPT_SHIFT_NONE;
4136
4089
  } else if (shiftStr == "MINUS" || shiftStr == "minus" || shiftStr == "-") {
4137
- shift = RIG_RPT_SHIFT_MINUS;
4090
+ shift = SHIM_RIG_RPT_SHIFT_MINUS;
4138
4091
  } else if (shiftStr == "PLUS" || shiftStr == "plus" || shiftStr == "+") {
4139
- shift = RIG_RPT_SHIFT_PLUS;
4092
+ shift = SHIM_RIG_RPT_SHIFT_PLUS;
4140
4093
  } else {
4141
4094
  Napi::TypeError::New(env, "Invalid repeater shift (must be 'NONE', 'MINUS', or 'PLUS')").ThrowAsJavaScriptException();
4142
4095
  return env.Null();
4143
4096
  }
4144
4097
 
4145
- vfo_t vfo = parseVfoParameter(info, 1, RIG_VFO_CURR);
4098
+ int vfo = parseVfoParameter(info, 1, SHIM_RIG_VFO_CURR);
4146
4099
 
4147
4100
  SetRepeaterShiftAsyncWorker* asyncWorker = new SetRepeaterShiftAsyncWorker(env, this, vfo, shift);
4148
4101
  asyncWorker->Queue();
@@ -4152,7 +4105,7 @@ Napi::Value NodeHamLib::SetRepeaterShift(const Napi::CallbackInfo& info) {
4152
4105
  Napi::Value NodeHamLib::GetRepeaterShift(const Napi::CallbackInfo& info) {
4153
4106
  Napi::Env env = info.Env();
4154
4107
 
4155
- vfo_t vfo = parseVfoParameter(info, 0, RIG_VFO_CURR);
4108
+ int vfo = parseVfoParameter(info, 0, SHIM_RIG_VFO_CURR);
4156
4109
 
4157
4110
  GetRepeaterShiftAsyncWorker* asyncWorker = new GetRepeaterShiftAsyncWorker(env, this, vfo);
4158
4111
  asyncWorker->Queue();
@@ -4167,8 +4120,8 @@ Napi::Value NodeHamLib::SetRepeaterOffset(const Napi::CallbackInfo& info) {
4167
4120
  return env.Null();
4168
4121
  }
4169
4122
 
4170
- shortfreq_t offset = info[0].As<Napi::Number>().Int32Value();
4171
- vfo_t vfo = parseVfoParameter(info, 1, RIG_VFO_CURR);
4123
+ int offset = info[0].As<Napi::Number>().Int32Value();
4124
+ int vfo = parseVfoParameter(info, 1, SHIM_RIG_VFO_CURR);
4172
4125
 
4173
4126
  SetRepeaterOffsetAsyncWorker* asyncWorker = new SetRepeaterOffsetAsyncWorker(env, this, vfo, offset);
4174
4127
  asyncWorker->Queue();
@@ -4178,7 +4131,7 @@ Napi::Value NodeHamLib::SetRepeaterOffset(const Napi::CallbackInfo& info) {
4178
4131
  Napi::Value NodeHamLib::GetRepeaterOffset(const Napi::CallbackInfo& info) {
4179
4132
  Napi::Env env = info.Env();
4180
4133
 
4181
- vfo_t vfo = parseVfoParameter(info, 0, RIG_VFO_CURR);
4134
+ int vfo = parseVfoParameter(info, 0, SHIM_RIG_VFO_CURR);
4182
4135
 
4183
4136
  GetRepeaterOffsetAsyncWorker* asyncWorker = new GetRepeaterOffsetAsyncWorker(env, this, vfo);
4184
4137
  asyncWorker->Queue();
@@ -4188,21 +4141,21 @@ Napi::Value NodeHamLib::GetRepeaterOffset(const Napi::CallbackInfo& info) {
4188
4141
  // CTCSS/DCS Tone Control AsyncWorker classes
4189
4142
  class SetCtcssToneAsyncWorker : public HamLibAsyncWorker {
4190
4143
  public:
4191
- SetCtcssToneAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, vfo_t vfo, tone_t tone)
4144
+ SetCtcssToneAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, int vfo, unsigned int tone)
4192
4145
  : HamLibAsyncWorker(env, hamlib_instance), vfo_(vfo), tone_(tone) {}
4193
4146
 
4194
4147
  void Execute() override {
4195
4148
  CHECK_RIG_VALID();
4196
4149
 
4197
- result_code_ = rig_set_ctcss_tone(hamlib_instance_->my_rig, vfo_, tone_);
4198
- if (result_code_ != RIG_OK) {
4199
- error_message_ = rigerror(result_code_);
4150
+ result_code_ = shim_rig_set_ctcss_tone(hamlib_instance_->my_rig, vfo_, tone_);
4151
+ if (result_code_ != SHIM_RIG_OK) {
4152
+ error_message_ = shim_rigerror(result_code_);
4200
4153
  }
4201
4154
  }
4202
4155
 
4203
4156
  void OnOK() override {
4204
4157
  Napi::Env env = Env();
4205
- if (result_code_ != RIG_OK && !error_message_.empty()) {
4158
+ if (result_code_ != SHIM_RIG_OK && !error_message_.empty()) {
4206
4159
  deferred_.Reject(Napi::Error::New(env, error_message_).Value());
4207
4160
  } else {
4208
4161
  deferred_.Resolve(Napi::Number::New(env, result_code_));
@@ -4215,27 +4168,27 @@ public:
4215
4168
  }
4216
4169
 
4217
4170
  private:
4218
- vfo_t vfo_;
4219
- tone_t tone_;
4171
+ int vfo_;
4172
+ unsigned int tone_;
4220
4173
  };
4221
4174
 
4222
4175
  class GetCtcssToneAsyncWorker : public HamLibAsyncWorker {
4223
4176
  public:
4224
- GetCtcssToneAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, vfo_t vfo)
4177
+ GetCtcssToneAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, int vfo)
4225
4178
  : HamLibAsyncWorker(env, hamlib_instance), vfo_(vfo), tone_(0) {}
4226
4179
 
4227
4180
  void Execute() override {
4228
4181
  CHECK_RIG_VALID();
4229
4182
 
4230
- result_code_ = rig_get_ctcss_tone(hamlib_instance_->my_rig, vfo_, &tone_);
4231
- if (result_code_ != RIG_OK) {
4232
- error_message_ = rigerror(result_code_);
4183
+ result_code_ = shim_rig_get_ctcss_tone(hamlib_instance_->my_rig, vfo_, &tone_);
4184
+ if (result_code_ != SHIM_RIG_OK) {
4185
+ error_message_ = shim_rigerror(result_code_);
4233
4186
  }
4234
4187
  }
4235
4188
 
4236
4189
  void OnOK() override {
4237
4190
  Napi::Env env = Env();
4238
- if (result_code_ != RIG_OK && !error_message_.empty()) {
4191
+ if (result_code_ != SHIM_RIG_OK && !error_message_.empty()) {
4239
4192
  deferred_.Reject(Napi::Error::New(env, error_message_).Value());
4240
4193
  } else {
4241
4194
  deferred_.Resolve(Napi::Number::New(env, tone_));
@@ -4248,27 +4201,27 @@ public:
4248
4201
  }
4249
4202
 
4250
4203
  private:
4251
- vfo_t vfo_;
4252
- tone_t tone_;
4204
+ int vfo_;
4205
+ unsigned int tone_;
4253
4206
  };
4254
4207
 
4255
4208
  class SetDcsCodeAsyncWorker : public HamLibAsyncWorker {
4256
4209
  public:
4257
- SetDcsCodeAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, vfo_t vfo, tone_t code)
4210
+ SetDcsCodeAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, int vfo, unsigned int code)
4258
4211
  : HamLibAsyncWorker(env, hamlib_instance), vfo_(vfo), code_(code) {}
4259
4212
 
4260
4213
  void Execute() override {
4261
4214
  CHECK_RIG_VALID();
4262
4215
 
4263
- result_code_ = rig_set_dcs_code(hamlib_instance_->my_rig, vfo_, code_);
4264
- if (result_code_ != RIG_OK) {
4265
- error_message_ = rigerror(result_code_);
4216
+ result_code_ = shim_rig_set_dcs_code(hamlib_instance_->my_rig, vfo_, code_);
4217
+ if (result_code_ != SHIM_RIG_OK) {
4218
+ error_message_ = shim_rigerror(result_code_);
4266
4219
  }
4267
4220
  }
4268
4221
 
4269
4222
  void OnOK() override {
4270
4223
  Napi::Env env = Env();
4271
- if (result_code_ != RIG_OK && !error_message_.empty()) {
4224
+ if (result_code_ != SHIM_RIG_OK && !error_message_.empty()) {
4272
4225
  deferred_.Reject(Napi::Error::New(env, error_message_).Value());
4273
4226
  } else {
4274
4227
  deferred_.Resolve(Napi::Number::New(env, result_code_));
@@ -4281,27 +4234,27 @@ public:
4281
4234
  }
4282
4235
 
4283
4236
  private:
4284
- vfo_t vfo_;
4285
- tone_t code_;
4237
+ int vfo_;
4238
+ unsigned int code_;
4286
4239
  };
4287
4240
 
4288
4241
  class GetDcsCodeAsyncWorker : public HamLibAsyncWorker {
4289
4242
  public:
4290
- GetDcsCodeAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, vfo_t vfo)
4243
+ GetDcsCodeAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, int vfo)
4291
4244
  : HamLibAsyncWorker(env, hamlib_instance), vfo_(vfo), code_(0) {}
4292
4245
 
4293
4246
  void Execute() override {
4294
4247
  CHECK_RIG_VALID();
4295
4248
 
4296
- result_code_ = rig_get_dcs_code(hamlib_instance_->my_rig, vfo_, &code_);
4297
- if (result_code_ != RIG_OK) {
4298
- error_message_ = rigerror(result_code_);
4249
+ result_code_ = shim_rig_get_dcs_code(hamlib_instance_->my_rig, vfo_, &code_);
4250
+ if (result_code_ != SHIM_RIG_OK) {
4251
+ error_message_ = shim_rigerror(result_code_);
4299
4252
  }
4300
4253
  }
4301
4254
 
4302
4255
  void OnOK() override {
4303
4256
  Napi::Env env = Env();
4304
- if (result_code_ != RIG_OK && !error_message_.empty()) {
4257
+ if (result_code_ != SHIM_RIG_OK && !error_message_.empty()) {
4305
4258
  deferred_.Reject(Napi::Error::New(env, error_message_).Value());
4306
4259
  } else {
4307
4260
  deferred_.Resolve(Napi::Number::New(env, code_));
@@ -4314,27 +4267,27 @@ public:
4314
4267
  }
4315
4268
 
4316
4269
  private:
4317
- vfo_t vfo_;
4318
- tone_t code_;
4270
+ int vfo_;
4271
+ unsigned int code_;
4319
4272
  };
4320
4273
 
4321
4274
  class SetCtcssSqlAsyncWorker : public HamLibAsyncWorker {
4322
4275
  public:
4323
- SetCtcssSqlAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, vfo_t vfo, tone_t tone)
4276
+ SetCtcssSqlAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, int vfo, unsigned int tone)
4324
4277
  : HamLibAsyncWorker(env, hamlib_instance), vfo_(vfo), tone_(tone) {}
4325
4278
 
4326
4279
  void Execute() override {
4327
4280
  CHECK_RIG_VALID();
4328
4281
 
4329
- result_code_ = rig_set_ctcss_sql(hamlib_instance_->my_rig, vfo_, tone_);
4330
- if (result_code_ != RIG_OK) {
4331
- error_message_ = rigerror(result_code_);
4282
+ result_code_ = shim_rig_set_ctcss_sql(hamlib_instance_->my_rig, vfo_, tone_);
4283
+ if (result_code_ != SHIM_RIG_OK) {
4284
+ error_message_ = shim_rigerror(result_code_);
4332
4285
  }
4333
4286
  }
4334
4287
 
4335
4288
  void OnOK() override {
4336
4289
  Napi::Env env = Env();
4337
- if (result_code_ != RIG_OK && !error_message_.empty()) {
4290
+ if (result_code_ != SHIM_RIG_OK && !error_message_.empty()) {
4338
4291
  deferred_.Reject(Napi::Error::New(env, error_message_).Value());
4339
4292
  } else {
4340
4293
  deferred_.Resolve(Napi::Number::New(env, result_code_));
@@ -4347,27 +4300,27 @@ public:
4347
4300
  }
4348
4301
 
4349
4302
  private:
4350
- vfo_t vfo_;
4351
- tone_t tone_;
4303
+ int vfo_;
4304
+ unsigned int tone_;
4352
4305
  };
4353
4306
 
4354
4307
  class GetCtcssSqlAsyncWorker : public HamLibAsyncWorker {
4355
4308
  public:
4356
- GetCtcssSqlAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, vfo_t vfo)
4309
+ GetCtcssSqlAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, int vfo)
4357
4310
  : HamLibAsyncWorker(env, hamlib_instance), vfo_(vfo), tone_(0) {}
4358
4311
 
4359
4312
  void Execute() override {
4360
4313
  CHECK_RIG_VALID();
4361
4314
 
4362
- result_code_ = rig_get_ctcss_sql(hamlib_instance_->my_rig, vfo_, &tone_);
4363
- if (result_code_ != RIG_OK) {
4364
- error_message_ = rigerror(result_code_);
4315
+ result_code_ = shim_rig_get_ctcss_sql(hamlib_instance_->my_rig, vfo_, &tone_);
4316
+ if (result_code_ != SHIM_RIG_OK) {
4317
+ error_message_ = shim_rigerror(result_code_);
4365
4318
  }
4366
4319
  }
4367
4320
 
4368
4321
  void OnOK() override {
4369
4322
  Napi::Env env = Env();
4370
- if (result_code_ != RIG_OK && !error_message_.empty()) {
4323
+ if (result_code_ != SHIM_RIG_OK && !error_message_.empty()) {
4371
4324
  deferred_.Reject(Napi::Error::New(env, error_message_).Value());
4372
4325
  } else {
4373
4326
  deferred_.Resolve(Napi::Number::New(env, tone_));
@@ -4380,27 +4333,27 @@ public:
4380
4333
  }
4381
4334
 
4382
4335
  private:
4383
- vfo_t vfo_;
4384
- tone_t tone_;
4336
+ int vfo_;
4337
+ unsigned int tone_;
4385
4338
  };
4386
4339
 
4387
4340
  class SetDcsSqlAsyncWorker : public HamLibAsyncWorker {
4388
4341
  public:
4389
- SetDcsSqlAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, vfo_t vfo, tone_t code)
4342
+ SetDcsSqlAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, int vfo, unsigned int code)
4390
4343
  : HamLibAsyncWorker(env, hamlib_instance), vfo_(vfo), code_(code) {}
4391
4344
 
4392
4345
  void Execute() override {
4393
4346
  CHECK_RIG_VALID();
4394
4347
 
4395
- result_code_ = rig_set_dcs_sql(hamlib_instance_->my_rig, vfo_, code_);
4396
- if (result_code_ != RIG_OK) {
4397
- error_message_ = rigerror(result_code_);
4348
+ result_code_ = shim_rig_set_dcs_sql(hamlib_instance_->my_rig, vfo_, code_);
4349
+ if (result_code_ != SHIM_RIG_OK) {
4350
+ error_message_ = shim_rigerror(result_code_);
4398
4351
  }
4399
4352
  }
4400
4353
 
4401
4354
  void OnOK() override {
4402
4355
  Napi::Env env = Env();
4403
- if (result_code_ != RIG_OK && !error_message_.empty()) {
4356
+ if (result_code_ != SHIM_RIG_OK && !error_message_.empty()) {
4404
4357
  deferred_.Reject(Napi::Error::New(env, error_message_).Value());
4405
4358
  } else {
4406
4359
  deferred_.Resolve(Napi::Number::New(env, result_code_));
@@ -4413,27 +4366,27 @@ public:
4413
4366
  }
4414
4367
 
4415
4368
  private:
4416
- vfo_t vfo_;
4417
- tone_t code_;
4369
+ int vfo_;
4370
+ unsigned int code_;
4418
4371
  };
4419
4372
 
4420
4373
  class GetDcsSqlAsyncWorker : public HamLibAsyncWorker {
4421
4374
  public:
4422
- GetDcsSqlAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, vfo_t vfo)
4375
+ GetDcsSqlAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, int vfo)
4423
4376
  : HamLibAsyncWorker(env, hamlib_instance), vfo_(vfo), code_(0) {}
4424
4377
 
4425
4378
  void Execute() override {
4426
4379
  CHECK_RIG_VALID();
4427
4380
 
4428
- result_code_ = rig_get_dcs_sql(hamlib_instance_->my_rig, vfo_, &code_);
4429
- if (result_code_ != RIG_OK) {
4430
- error_message_ = rigerror(result_code_);
4381
+ result_code_ = shim_rig_get_dcs_sql(hamlib_instance_->my_rig, vfo_, &code_);
4382
+ if (result_code_ != SHIM_RIG_OK) {
4383
+ error_message_ = shim_rigerror(result_code_);
4431
4384
  }
4432
4385
  }
4433
4386
 
4434
4387
  void OnOK() override {
4435
4388
  Napi::Env env = Env();
4436
- if (result_code_ != RIG_OK && !error_message_.empty()) {
4389
+ if (result_code_ != SHIM_RIG_OK && !error_message_.empty()) {
4437
4390
  deferred_.Reject(Napi::Error::New(env, error_message_).Value());
4438
4391
  } else {
4439
4392
  deferred_.Resolve(Napi::Number::New(env, code_));
@@ -4446,97 +4399,95 @@ public:
4446
4399
  }
4447
4400
 
4448
4401
  private:
4449
- vfo_t vfo_;
4450
- tone_t code_;
4402
+ int vfo_;
4403
+ unsigned int code_;
4451
4404
  };
4452
4405
 
4453
4406
  // Parameter Control AsyncWorker classes
4454
4407
  class SetParmAsyncWorker : public HamLibAsyncWorker {
4455
4408
  public:
4456
- SetParmAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, setting_t parm, value_t value)
4409
+ SetParmAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, uint64_t parm, float value)
4457
4410
  : HamLibAsyncWorker(env, hamlib_instance), parm_(parm), value_(value) {}
4458
-
4411
+
4459
4412
  void Execute() override {
4460
4413
  CHECK_RIG_VALID();
4461
-
4462
- result_code_ = rig_set_parm(hamlib_instance_->my_rig, parm_, value_);
4463
- if (result_code_ != RIG_OK) {
4464
- error_message_ = rigerror(result_code_);
4414
+
4415
+ result_code_ = shim_rig_set_parm_f(hamlib_instance_->my_rig, parm_, value_);
4416
+ if (result_code_ != SHIM_RIG_OK) {
4417
+ error_message_ = shim_rigerror(result_code_);
4465
4418
  }
4466
4419
  }
4467
-
4420
+
4468
4421
  void OnOK() override {
4469
4422
  Napi::Env env = Env();
4470
- if (result_code_ != RIG_OK && !error_message_.empty()) {
4423
+ if (result_code_ != SHIM_RIG_OK && !error_message_.empty()) {
4471
4424
  deferred_.Reject(Napi::Error::New(env, error_message_).Value());
4472
4425
  } else {
4473
4426
  deferred_.Resolve(Napi::Number::New(env, result_code_));
4474
4427
  }
4475
4428
  }
4476
-
4429
+
4477
4430
  void OnError(const Napi::Error& e) override {
4478
4431
  Napi::Env env = Env();
4479
4432
  deferred_.Reject(Napi::Error::New(env, error_message_).Value());
4480
4433
  }
4481
-
4434
+
4482
4435
  private:
4483
- setting_t parm_;
4484
- value_t value_;
4436
+ uint64_t parm_;
4437
+ float value_;
4485
4438
  };
4486
4439
 
4487
4440
  class GetParmAsyncWorker : public HamLibAsyncWorker {
4488
4441
  public:
4489
- GetParmAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, setting_t parm)
4490
- : HamLibAsyncWorker(env, hamlib_instance), parm_(parm) {
4491
- value_.f = 0.0;
4492
- }
4493
-
4442
+ GetParmAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, uint64_t parm)
4443
+ : HamLibAsyncWorker(env, hamlib_instance), parm_(parm), value_(0.0f) {}
4444
+
4494
4445
  void Execute() override {
4495
4446
  CHECK_RIG_VALID();
4496
-
4497
- result_code_ = rig_get_parm(hamlib_instance_->my_rig, parm_, &value_);
4498
- if (result_code_ != RIG_OK) {
4499
- error_message_ = rigerror(result_code_);
4447
+
4448
+ result_code_ = shim_rig_get_parm_f(hamlib_instance_->my_rig, parm_, &value_);
4449
+ if (result_code_ != SHIM_RIG_OK) {
4450
+ error_message_ = shim_rigerror(result_code_);
4500
4451
  }
4501
4452
  }
4502
-
4453
+
4503
4454
  void OnOK() override {
4504
4455
  Napi::Env env = Env();
4505
- if (result_code_ != RIG_OK && !error_message_.empty()) {
4456
+ if (result_code_ != SHIM_RIG_OK && !error_message_.empty()) {
4506
4457
  deferred_.Reject(Napi::Error::New(env, error_message_).Value());
4507
4458
  } else {
4508
- deferred_.Resolve(Napi::Number::New(env, value_.f));
4459
+ deferred_.Resolve(Napi::Number::New(env, value_));
4509
4460
  }
4510
4461
  }
4511
-
4462
+
4512
4463
  void OnError(const Napi::Error& e) override {
4513
4464
  Napi::Env env = Env();
4514
4465
  deferred_.Reject(Napi::Error::New(env, error_message_).Value());
4515
4466
  }
4516
-
4467
+
4517
4468
  private:
4518
- setting_t parm_;
4519
- value_t value_;
4469
+ uint64_t parm_;
4470
+ float value_;
4520
4471
  };
4521
4472
 
4522
4473
  // DTMF Support AsyncWorker classes
4523
4474
  class SendDtmfAsyncWorker : public HamLibAsyncWorker {
4524
4475
  public:
4525
- SendDtmfAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, vfo_t vfo, const std::string& digits)
4476
+ SendDtmfAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, int vfo, const std::string& digits)
4526
4477
  : HamLibAsyncWorker(env, hamlib_instance), vfo_(vfo), digits_(digits) {}
4527
4478
 
4528
4479
  void Execute() override {
4529
4480
  CHECK_RIG_VALID();
4530
4481
 
4531
- result_code_ = rig_send_dtmf(hamlib_instance_->my_rig, vfo_, digits_.c_str());
4532
- if (result_code_ != RIG_OK) {
4533
- error_message_ = rigerror(result_code_);
4482
+ result_code_ = shim_rig_send_dtmf(hamlib_instance_->my_rig, vfo_, digits_.c_str());
4483
+ if (result_code_ != SHIM_RIG_OK) {
4484
+ error_message_ = shim_rigerror(result_code_);
4534
4485
  }
4535
4486
  }
4536
4487
 
4537
4488
  void OnOK() override {
4538
4489
  Napi::Env env = Env();
4539
- if (result_code_ != RIG_OK && !error_message_.empty()) {
4490
+ if (result_code_ != SHIM_RIG_OK && !error_message_.empty()) {
4540
4491
  deferred_.Reject(Napi::Error::New(env, error_message_).Value());
4541
4492
  } else {
4542
4493
  deferred_.Resolve(Napi::Number::New(env, result_code_));
@@ -4549,13 +4500,13 @@ public:
4549
4500
  }
4550
4501
 
4551
4502
  private:
4552
- vfo_t vfo_;
4503
+ int vfo_;
4553
4504
  std::string digits_;
4554
4505
  };
4555
4506
 
4556
4507
  class RecvDtmfAsyncWorker : public HamLibAsyncWorker {
4557
4508
  public:
4558
- RecvDtmfAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, vfo_t vfo, int maxLength)
4509
+ RecvDtmfAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, int vfo, int maxLength)
4559
4510
  : HamLibAsyncWorker(env, hamlib_instance), vfo_(vfo), max_length_(maxLength), length_(0) {
4560
4511
  digits_.resize(maxLength + 1, '\0');
4561
4512
  }
@@ -4565,15 +4516,15 @@ public:
4565
4516
 
4566
4517
  length_ = max_length_;
4567
4518
  // rig_recv_dtmf expects a mutable buffer (char*). Ensure non-const pointer.
4568
- result_code_ = rig_recv_dtmf(hamlib_instance_->my_rig, vfo_, &digits_[0], &length_);
4569
- if (result_code_ != RIG_OK) {
4570
- error_message_ = rigerror(result_code_);
4519
+ result_code_ = shim_rig_recv_dtmf(hamlib_instance_->my_rig, vfo_, &digits_[0], &length_);
4520
+ if (result_code_ != SHIM_RIG_OK) {
4521
+ error_message_ = shim_rigerror(result_code_);
4571
4522
  }
4572
4523
  }
4573
4524
 
4574
4525
  void OnOK() override {
4575
4526
  Napi::Env env = Env();
4576
- if (result_code_ != RIG_OK && !error_message_.empty()) {
4527
+ if (result_code_ != SHIM_RIG_OK && !error_message_.empty()) {
4577
4528
  deferred_.Reject(Napi::Error::New(env, error_message_).Value());
4578
4529
  } else {
4579
4530
  Napi::Object obj = Napi::Object::New(env);
@@ -4589,7 +4540,7 @@ public:
4589
4540
  }
4590
4541
 
4591
4542
  private:
4592
- vfo_t vfo_;
4543
+ int vfo_;
4593
4544
  int max_length_;
4594
4545
  int length_;
4595
4546
  std::string digits_;
@@ -4598,21 +4549,21 @@ private:
4598
4549
  // Memory Channel Advanced Operations AsyncWorker classes
4599
4550
  class GetMemAsyncWorker : public HamLibAsyncWorker {
4600
4551
  public:
4601
- GetMemAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, vfo_t vfo)
4552
+ GetMemAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, int vfo)
4602
4553
  : HamLibAsyncWorker(env, hamlib_instance), vfo_(vfo), ch_(0) {}
4603
4554
 
4604
4555
  void Execute() override {
4605
4556
  CHECK_RIG_VALID();
4606
4557
 
4607
- result_code_ = rig_get_mem(hamlib_instance_->my_rig, vfo_, &ch_);
4608
- if (result_code_ != RIG_OK) {
4609
- error_message_ = rigerror(result_code_);
4558
+ result_code_ = shim_rig_get_mem(hamlib_instance_->my_rig, vfo_, &ch_);
4559
+ if (result_code_ != SHIM_RIG_OK) {
4560
+ error_message_ = shim_rigerror(result_code_);
4610
4561
  }
4611
4562
  }
4612
4563
 
4613
4564
  void OnOK() override {
4614
4565
  Napi::Env env = Env();
4615
- if (result_code_ != RIG_OK && !error_message_.empty()) {
4566
+ if (result_code_ != SHIM_RIG_OK && !error_message_.empty()) {
4616
4567
  deferred_.Reject(Napi::Error::New(env, error_message_).Value());
4617
4568
  } else {
4618
4569
  deferred_.Resolve(Napi::Number::New(env, ch_));
@@ -4625,27 +4576,27 @@ public:
4625
4576
  }
4626
4577
 
4627
4578
  private:
4628
- vfo_t vfo_;
4579
+ int vfo_;
4629
4580
  int ch_;
4630
4581
  };
4631
4582
 
4632
4583
  class SetBankAsyncWorker : public HamLibAsyncWorker {
4633
4584
  public:
4634
- SetBankAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, vfo_t vfo, int bank)
4585
+ SetBankAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, int vfo, int bank)
4635
4586
  : HamLibAsyncWorker(env, hamlib_instance), vfo_(vfo), bank_(bank) {}
4636
4587
 
4637
4588
  void Execute() override {
4638
4589
  CHECK_RIG_VALID();
4639
4590
 
4640
- result_code_ = rig_set_bank(hamlib_instance_->my_rig, vfo_, bank_);
4641
- if (result_code_ != RIG_OK) {
4642
- error_message_ = rigerror(result_code_);
4591
+ result_code_ = shim_rig_set_bank(hamlib_instance_->my_rig, vfo_, bank_);
4592
+ if (result_code_ != SHIM_RIG_OK) {
4593
+ error_message_ = shim_rigerror(result_code_);
4643
4594
  }
4644
4595
  }
4645
4596
 
4646
4597
  void OnOK() override {
4647
4598
  Napi::Env env = Env();
4648
- if (result_code_ != RIG_OK && !error_message_.empty()) {
4599
+ if (result_code_ != SHIM_RIG_OK && !error_message_.empty()) {
4649
4600
  deferred_.Reject(Napi::Error::New(env, error_message_).Value());
4650
4601
  } else {
4651
4602
  deferred_.Resolve(Napi::Number::New(env, result_code_));
@@ -4658,7 +4609,7 @@ public:
4658
4609
  }
4659
4610
 
4660
4611
  private:
4661
- vfo_t vfo_;
4612
+ int vfo_;
4662
4613
  int bank_;
4663
4614
  };
4664
4615
 
@@ -4670,18 +4621,18 @@ public:
4670
4621
  void Execute() override {
4671
4622
  CHECK_RIG_VALID();
4672
4623
 
4673
- count_ = rig_mem_count(hamlib_instance_->my_rig);
4624
+ count_ = shim_rig_mem_count(hamlib_instance_->my_rig);
4674
4625
  if (count_ < 0) {
4675
4626
  result_code_ = count_;
4676
- error_message_ = rigerror(result_code_);
4627
+ error_message_ = shim_rigerror(result_code_);
4677
4628
  } else {
4678
- result_code_ = RIG_OK;
4629
+ result_code_ = SHIM_RIG_OK;
4679
4630
  }
4680
4631
  }
4681
4632
 
4682
4633
  void OnOK() override {
4683
4634
  Napi::Env env = Env();
4684
- if (result_code_ != RIG_OK && !error_message_.empty()) {
4635
+ if (result_code_ != SHIM_RIG_OK && !error_message_.empty()) {
4685
4636
  deferred_.Reject(Napi::Error::New(env, error_message_).Value());
4686
4637
  } else {
4687
4638
  deferred_.Resolve(Napi::Number::New(env, count_));
@@ -4700,21 +4651,21 @@ private:
4700
4651
  // Morse Code Support AsyncWorker classes
4701
4652
  class SendMorseAsyncWorker : public HamLibAsyncWorker {
4702
4653
  public:
4703
- SendMorseAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, vfo_t vfo, const std::string& msg)
4654
+ SendMorseAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, int vfo, const std::string& msg)
4704
4655
  : HamLibAsyncWorker(env, hamlib_instance), vfo_(vfo), msg_(msg) {}
4705
4656
 
4706
4657
  void Execute() override {
4707
4658
  CHECK_RIG_VALID();
4708
4659
 
4709
- result_code_ = rig_send_morse(hamlib_instance_->my_rig, vfo_, msg_.c_str());
4710
- if (result_code_ != RIG_OK) {
4711
- error_message_ = rigerror(result_code_);
4660
+ result_code_ = shim_rig_send_morse(hamlib_instance_->my_rig, vfo_, msg_.c_str());
4661
+ if (result_code_ != SHIM_RIG_OK) {
4662
+ error_message_ = shim_rigerror(result_code_);
4712
4663
  }
4713
4664
  }
4714
4665
 
4715
4666
  void OnOK() override {
4716
4667
  Napi::Env env = Env();
4717
- if (result_code_ != RIG_OK && !error_message_.empty()) {
4668
+ if (result_code_ != SHIM_RIG_OK && !error_message_.empty()) {
4718
4669
  deferred_.Reject(Napi::Error::New(env, error_message_).Value());
4719
4670
  } else {
4720
4671
  deferred_.Resolve(Napi::Number::New(env, result_code_));
@@ -4727,27 +4678,27 @@ public:
4727
4678
  }
4728
4679
 
4729
4680
  private:
4730
- vfo_t vfo_;
4681
+ int vfo_;
4731
4682
  std::string msg_;
4732
4683
  };
4733
4684
 
4734
4685
  class StopMorseAsyncWorker : public HamLibAsyncWorker {
4735
4686
  public:
4736
- StopMorseAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, vfo_t vfo)
4687
+ StopMorseAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, int vfo)
4737
4688
  : HamLibAsyncWorker(env, hamlib_instance), vfo_(vfo) {}
4738
4689
 
4739
4690
  void Execute() override {
4740
4691
  CHECK_RIG_VALID();
4741
4692
 
4742
- result_code_ = rig_stop_morse(hamlib_instance_->my_rig, vfo_);
4743
- if (result_code_ != RIG_OK) {
4744
- error_message_ = rigerror(result_code_);
4693
+ result_code_ = shim_rig_stop_morse(hamlib_instance_->my_rig, vfo_);
4694
+ if (result_code_ != SHIM_RIG_OK) {
4695
+ error_message_ = shim_rigerror(result_code_);
4745
4696
  }
4746
4697
  }
4747
4698
 
4748
4699
  void OnOK() override {
4749
4700
  Napi::Env env = Env();
4750
- if (result_code_ != RIG_OK && !error_message_.empty()) {
4701
+ if (result_code_ != SHIM_RIG_OK && !error_message_.empty()) {
4751
4702
  deferred_.Reject(Napi::Error::New(env, error_message_).Value());
4752
4703
  } else {
4753
4704
  deferred_.Resolve(Napi::Number::New(env, result_code_));
@@ -4760,26 +4711,26 @@ public:
4760
4711
  }
4761
4712
 
4762
4713
  private:
4763
- vfo_t vfo_;
4714
+ int vfo_;
4764
4715
  };
4765
4716
 
4766
4717
  class WaitMorseAsyncWorker : public HamLibAsyncWorker {
4767
4718
  public:
4768
- WaitMorseAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, vfo_t vfo)
4719
+ WaitMorseAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, int vfo)
4769
4720
  : HamLibAsyncWorker(env, hamlib_instance), vfo_(vfo) {}
4770
4721
 
4771
4722
  void Execute() override {
4772
4723
  CHECK_RIG_VALID();
4773
4724
 
4774
- result_code_ = rig_wait_morse(hamlib_instance_->my_rig, vfo_);
4775
- if (result_code_ != RIG_OK) {
4776
- error_message_ = rigerror(result_code_);
4725
+ result_code_ = shim_rig_wait_morse(hamlib_instance_->my_rig, vfo_);
4726
+ if (result_code_ != SHIM_RIG_OK) {
4727
+ error_message_ = shim_rigerror(result_code_);
4777
4728
  }
4778
4729
  }
4779
4730
 
4780
4731
  void OnOK() override {
4781
4732
  Napi::Env env = Env();
4782
- if (result_code_ != RIG_OK && !error_message_.empty()) {
4733
+ if (result_code_ != SHIM_RIG_OK && !error_message_.empty()) {
4783
4734
  deferred_.Reject(Napi::Error::New(env, error_message_).Value());
4784
4735
  } else {
4785
4736
  deferred_.Resolve(Napi::Number::New(env, result_code_));
@@ -4792,27 +4743,27 @@ public:
4792
4743
  }
4793
4744
 
4794
4745
  private:
4795
- vfo_t vfo_;
4746
+ int vfo_;
4796
4747
  };
4797
4748
 
4798
4749
  // Voice Memory Support AsyncWorker classes
4799
4750
  class SendVoiceMemAsyncWorker : public HamLibAsyncWorker {
4800
4751
  public:
4801
- SendVoiceMemAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, vfo_t vfo, int ch)
4752
+ SendVoiceMemAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, int vfo, int ch)
4802
4753
  : HamLibAsyncWorker(env, hamlib_instance), vfo_(vfo), ch_(ch) {}
4803
4754
 
4804
4755
  void Execute() override {
4805
4756
  CHECK_RIG_VALID();
4806
4757
 
4807
- result_code_ = rig_send_voice_mem(hamlib_instance_->my_rig, vfo_, ch_);
4808
- if (result_code_ != RIG_OK) {
4809
- error_message_ = rigerror(result_code_);
4758
+ result_code_ = shim_rig_send_voice_mem(hamlib_instance_->my_rig, vfo_, ch_);
4759
+ if (result_code_ != SHIM_RIG_OK) {
4760
+ error_message_ = shim_rigerror(result_code_);
4810
4761
  }
4811
4762
  }
4812
4763
 
4813
4764
  void OnOK() override {
4814
4765
  Napi::Env env = Env();
4815
- if (result_code_ != RIG_OK && !error_message_.empty()) {
4766
+ if (result_code_ != SHIM_RIG_OK && !error_message_.empty()) {
4816
4767
  deferred_.Reject(Napi::Error::New(env, error_message_).Value());
4817
4768
  } else {
4818
4769
  deferred_.Resolve(Napi::Number::New(env, result_code_));
@@ -4825,34 +4776,27 @@ public:
4825
4776
  }
4826
4777
 
4827
4778
  private:
4828
- vfo_t vfo_;
4779
+ int vfo_;
4829
4780
  int ch_;
4830
4781
  };
4831
4782
 
4832
4783
  class StopVoiceMemAsyncWorker : public HamLibAsyncWorker {
4833
4784
  public:
4834
- StopVoiceMemAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, vfo_t vfo)
4785
+ StopVoiceMemAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, int vfo)
4835
4786
  : HamLibAsyncWorker(env, hamlib_instance), vfo_(vfo) {}
4836
4787
 
4837
4788
  void Execute() override {
4838
4789
  CHECK_RIG_VALID();
4839
4790
 
4840
- #if HAVE_RIG_STOP_VOICE_MEM
4841
- result_code_ = rig_stop_voice_mem(hamlib_instance_->my_rig, vfo_);
4842
- if (result_code_ != RIG_OK) {
4843
- error_message_ = rigerror(result_code_);
4791
+ result_code_ = shim_rig_stop_voice_mem(hamlib_instance_->my_rig, vfo_);
4792
+ if (result_code_ != SHIM_RIG_OK) {
4793
+ error_message_ = shim_rigerror(result_code_);
4844
4794
  }
4845
- #else
4846
- // rig_stop_voice_mem function is not available in this hamlib version
4847
- // Return not implemented for compatibility with older hamlib versions
4848
- result_code_ = -RIG_ENIMPL;
4849
- error_message_ = "rig_stop_voice_mem not available in this hamlib version";
4850
- #endif
4851
4795
  }
4852
4796
 
4853
4797
  void OnOK() override {
4854
4798
  Napi::Env env = Env();
4855
- if (result_code_ != RIG_OK && !error_message_.empty()) {
4799
+ if (result_code_ != SHIM_RIG_OK && !error_message_.empty()) {
4856
4800
  deferred_.Reject(Napi::Error::New(env, error_message_).Value());
4857
4801
  } else {
4858
4802
  deferred_.Resolve(Napi::Number::New(env, result_code_));
@@ -4865,36 +4809,29 @@ public:
4865
4809
  }
4866
4810
 
4867
4811
  private:
4868
- vfo_t vfo_;
4812
+ int vfo_;
4869
4813
  };
4870
4814
 
4871
4815
  // Complex Split Frequency/Mode Operations AsyncWorker classes
4872
4816
  class SetSplitFreqModeAsyncWorker : public HamLibAsyncWorker {
4873
4817
  public:
4874
- SetSplitFreqModeAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, vfo_t vfo,
4875
- freq_t tx_freq, rmode_t tx_mode, pbwidth_t tx_width)
4818
+ SetSplitFreqModeAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, int vfo,
4819
+ double tx_freq, int tx_mode, int tx_width)
4876
4820
  : HamLibAsyncWorker(env, hamlib_instance), vfo_(vfo), tx_freq_(tx_freq),
4877
4821
  tx_mode_(tx_mode), tx_width_(tx_width) {}
4878
4822
 
4879
4823
  void Execute() override {
4880
4824
  CHECK_RIG_VALID();
4881
4825
 
4882
- #if HAVE_RIG_SPLIT_FREQ_MODE
4883
- result_code_ = rig_set_split_freq_mode(hamlib_instance_->my_rig, vfo_, tx_freq_, tx_mode_, tx_width_);
4884
- if (result_code_ != RIG_OK) {
4885
- error_message_ = rigerror(result_code_);
4826
+ result_code_ = shim_rig_set_split_freq_mode(hamlib_instance_->my_rig, vfo_, tx_freq_, tx_mode_, tx_width_);
4827
+ if (result_code_ != SHIM_RIG_OK) {
4828
+ error_message_ = shim_rigerror(result_code_);
4886
4829
  }
4887
- #else
4888
- // rig_set_split_freq_mode function is not available in this hamlib version
4889
- // Fall back to using separate calls
4890
- result_code_ = -RIG_ENIMPL;
4891
- error_message_ = "rig_set_split_freq_mode not available - use setSplitFreq and setSplitMode separately";
4892
- #endif
4893
4830
  }
4894
4831
 
4895
4832
  void OnOK() override {
4896
4833
  Napi::Env env = Env();
4897
- if (result_code_ != RIG_OK && !error_message_.empty()) {
4834
+ if (result_code_ != SHIM_RIG_OK && !error_message_.empty()) {
4898
4835
  deferred_.Reject(Napi::Error::New(env, error_message_).Value());
4899
4836
  } else {
4900
4837
  deferred_.Resolve(Napi::Number::New(env, result_code_));
@@ -4907,41 +4844,34 @@ public:
4907
4844
  }
4908
4845
 
4909
4846
  private:
4910
- vfo_t vfo_;
4911
- freq_t tx_freq_;
4912
- rmode_t tx_mode_;
4913
- pbwidth_t tx_width_;
4847
+ int vfo_;
4848
+ double tx_freq_;
4849
+ int tx_mode_;
4850
+ int tx_width_;
4914
4851
  };
4915
4852
 
4916
4853
  class GetSplitFreqModeAsyncWorker : public HamLibAsyncWorker {
4917
4854
  public:
4918
- GetSplitFreqModeAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, vfo_t vfo)
4919
- : HamLibAsyncWorker(env, hamlib_instance), vfo_(vfo), tx_freq_(0), tx_mode_(RIG_MODE_NONE), tx_width_(0) {}
4855
+ GetSplitFreqModeAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, int vfo)
4856
+ : HamLibAsyncWorker(env, hamlib_instance), vfo_(vfo), tx_freq_(0), tx_mode_(SHIM_RIG_MODE_NONE), tx_width_(0) {}
4920
4857
 
4921
4858
  void Execute() override {
4922
4859
  CHECK_RIG_VALID();
4923
4860
 
4924
- #if HAVE_RIG_SPLIT_FREQ_MODE
4925
- result_code_ = rig_get_split_freq_mode(hamlib_instance_->my_rig, vfo_, &tx_freq_, &tx_mode_, &tx_width_);
4926
- if (result_code_ != RIG_OK) {
4927
- error_message_ = rigerror(result_code_);
4861
+ result_code_ = shim_rig_get_split_freq_mode(hamlib_instance_->my_rig, vfo_, &tx_freq_, &tx_mode_, &tx_width_);
4862
+ if (result_code_ != SHIM_RIG_OK) {
4863
+ error_message_ = shim_rigerror(result_code_);
4928
4864
  }
4929
- #else
4930
- // rig_get_split_freq_mode function is not available in this hamlib version
4931
- // Fall back to using separate calls
4932
- result_code_ = -RIG_ENIMPL;
4933
- error_message_ = "rig_get_split_freq_mode not available - use getSplitFreq and getSplitMode separately";
4934
- #endif
4935
4865
  }
4936
4866
 
4937
4867
  void OnOK() override {
4938
4868
  Napi::Env env = Env();
4939
- if (result_code_ != RIG_OK && !error_message_.empty()) {
4869
+ if (result_code_ != SHIM_RIG_OK && !error_message_.empty()) {
4940
4870
  deferred_.Reject(Napi::Error::New(env, error_message_).Value());
4941
4871
  } else {
4942
4872
  Napi::Object obj = Napi::Object::New(env);
4943
4873
  obj.Set(Napi::String::New(env, "txFrequency"), Napi::Number::New(env, static_cast<double>(tx_freq_)));
4944
- obj.Set(Napi::String::New(env, "txMode"), Napi::String::New(env, rig_strrmode(tx_mode_)));
4874
+ obj.Set(Napi::String::New(env, "txMode"), Napi::String::New(env, shim_rig_strrmode(tx_mode_)));
4945
4875
  obj.Set(Napi::String::New(env, "txWidth"), Napi::Number::New(env, static_cast<double>(tx_width_)));
4946
4876
  deferred_.Resolve(obj);
4947
4877
  }
@@ -4953,30 +4883,30 @@ public:
4953
4883
  }
4954
4884
 
4955
4885
  private:
4956
- vfo_t vfo_;
4957
- freq_t tx_freq_;
4958
- rmode_t tx_mode_;
4959
- pbwidth_t tx_width_;
4886
+ int vfo_;
4887
+ double tx_freq_;
4888
+ int tx_mode_;
4889
+ int tx_width_;
4960
4890
  };
4961
4891
 
4962
4892
  // Reset Function AsyncWorker class
4963
4893
  class ResetAsyncWorker : public HamLibAsyncWorker {
4964
4894
  public:
4965
- ResetAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, reset_t reset)
4895
+ ResetAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance, int reset)
4966
4896
  : HamLibAsyncWorker(env, hamlib_instance), reset_(reset) {}
4967
4897
 
4968
4898
  void Execute() override {
4969
4899
  CHECK_RIG_VALID();
4970
4900
 
4971
- result_code_ = rig_reset(hamlib_instance_->my_rig, reset_);
4972
- if (result_code_ != RIG_OK) {
4973
- error_message_ = rigerror(result_code_);
4901
+ result_code_ = shim_rig_reset(hamlib_instance_->my_rig, reset_);
4902
+ if (result_code_ != SHIM_RIG_OK) {
4903
+ error_message_ = shim_rigerror(result_code_);
4974
4904
  }
4975
4905
  }
4976
4906
 
4977
4907
  void OnOK() override {
4978
4908
  Napi::Env env = Env();
4979
- if (result_code_ != RIG_OK && !error_message_.empty()) {
4909
+ if (result_code_ != SHIM_RIG_OK && !error_message_.empty()) {
4980
4910
  deferred_.Reject(Napi::Error::New(env, error_message_).Value());
4981
4911
  } else {
4982
4912
  deferred_.Resolve(Napi::Number::New(env, result_code_));
@@ -4989,7 +4919,7 @@ public:
4989
4919
  }
4990
4920
 
4991
4921
  private:
4992
- reset_t reset_;
4922
+ int reset_;
4993
4923
  };
4994
4924
 
4995
4925
  // CTCSS/DCS Tone Control Methods Implementation
@@ -5001,8 +4931,8 @@ Napi::Value NodeHamLib::SetCtcssTone(const Napi::CallbackInfo& info) {
5001
4931
  return env.Null();
5002
4932
  }
5003
4933
 
5004
- tone_t tone = static_cast<tone_t>(info[0].As<Napi::Number>().Uint32Value());
5005
- vfo_t vfo = parseVfoParameter(info, 1, RIG_VFO_CURR);
4934
+ unsigned int tone = static_cast<unsigned int>(info[0].As<Napi::Number>().Uint32Value());
4935
+ int vfo = parseVfoParameter(info, 1, SHIM_RIG_VFO_CURR);
5006
4936
 
5007
4937
  SetCtcssToneAsyncWorker* asyncWorker = new SetCtcssToneAsyncWorker(env, this, vfo, tone);
5008
4938
  asyncWorker->Queue();
@@ -5012,7 +4942,7 @@ Napi::Value NodeHamLib::SetCtcssTone(const Napi::CallbackInfo& info) {
5012
4942
  Napi::Value NodeHamLib::GetCtcssTone(const Napi::CallbackInfo& info) {
5013
4943
  Napi::Env env = info.Env();
5014
4944
 
5015
- vfo_t vfo = parseVfoParameter(info, 0, RIG_VFO_CURR);
4945
+ int vfo = parseVfoParameter(info, 0, SHIM_RIG_VFO_CURR);
5016
4946
 
5017
4947
  GetCtcssToneAsyncWorker* asyncWorker = new GetCtcssToneAsyncWorker(env, this, vfo);
5018
4948
  asyncWorker->Queue();
@@ -5027,8 +4957,8 @@ Napi::Value NodeHamLib::SetDcsCode(const Napi::CallbackInfo& info) {
5027
4957
  return env.Null();
5028
4958
  }
5029
4959
 
5030
- tone_t code = static_cast<tone_t>(info[0].As<Napi::Number>().Uint32Value());
5031
- vfo_t vfo = parseVfoParameter(info, 1, RIG_VFO_CURR);
4960
+ unsigned int code = static_cast<unsigned int>(info[0].As<Napi::Number>().Uint32Value());
4961
+ int vfo = parseVfoParameter(info, 1, SHIM_RIG_VFO_CURR);
5032
4962
 
5033
4963
  SetDcsCodeAsyncWorker* asyncWorker = new SetDcsCodeAsyncWorker(env, this, vfo, code);
5034
4964
  asyncWorker->Queue();
@@ -5038,7 +4968,7 @@ Napi::Value NodeHamLib::SetDcsCode(const Napi::CallbackInfo& info) {
5038
4968
  Napi::Value NodeHamLib::GetDcsCode(const Napi::CallbackInfo& info) {
5039
4969
  Napi::Env env = info.Env();
5040
4970
 
5041
- vfo_t vfo = parseVfoParameter(info, 0, RIG_VFO_CURR);
4971
+ int vfo = parseVfoParameter(info, 0, SHIM_RIG_VFO_CURR);
5042
4972
 
5043
4973
  GetDcsCodeAsyncWorker* asyncWorker = new GetDcsCodeAsyncWorker(env, this, vfo);
5044
4974
  asyncWorker->Queue();
@@ -5053,8 +4983,8 @@ Napi::Value NodeHamLib::SetCtcssSql(const Napi::CallbackInfo& info) {
5053
4983
  return env.Null();
5054
4984
  }
5055
4985
 
5056
- tone_t tone = static_cast<tone_t>(info[0].As<Napi::Number>().Uint32Value());
5057
- vfo_t vfo = parseVfoParameter(info, 1, RIG_VFO_CURR);
4986
+ unsigned int tone = static_cast<unsigned int>(info[0].As<Napi::Number>().Uint32Value());
4987
+ int vfo = parseVfoParameter(info, 1, SHIM_RIG_VFO_CURR);
5058
4988
 
5059
4989
  SetCtcssSqlAsyncWorker* asyncWorker = new SetCtcssSqlAsyncWorker(env, this, vfo, tone);
5060
4990
  asyncWorker->Queue();
@@ -5064,7 +4994,7 @@ Napi::Value NodeHamLib::SetCtcssSql(const Napi::CallbackInfo& info) {
5064
4994
  Napi::Value NodeHamLib::GetCtcssSql(const Napi::CallbackInfo& info) {
5065
4995
  Napi::Env env = info.Env();
5066
4996
 
5067
- vfo_t vfo = parseVfoParameter(info, 0, RIG_VFO_CURR);
4997
+ int vfo = parseVfoParameter(info, 0, SHIM_RIG_VFO_CURR);
5068
4998
 
5069
4999
  GetCtcssSqlAsyncWorker* asyncWorker = new GetCtcssSqlAsyncWorker(env, this, vfo);
5070
5000
  asyncWorker->Queue();
@@ -5079,8 +5009,8 @@ Napi::Value NodeHamLib::SetDcsSql(const Napi::CallbackInfo& info) {
5079
5009
  return env.Null();
5080
5010
  }
5081
5011
 
5082
- tone_t code = static_cast<tone_t>(info[0].As<Napi::Number>().Uint32Value());
5083
- vfo_t vfo = parseVfoParameter(info, 1, RIG_VFO_CURR);
5012
+ unsigned int code = static_cast<unsigned int>(info[0].As<Napi::Number>().Uint32Value());
5013
+ int vfo = parseVfoParameter(info, 1, SHIM_RIG_VFO_CURR);
5084
5014
 
5085
5015
  SetDcsSqlAsyncWorker* asyncWorker = new SetDcsSqlAsyncWorker(env, this, vfo, code);
5086
5016
  asyncWorker->Queue();
@@ -5090,7 +5020,7 @@ Napi::Value NodeHamLib::SetDcsSql(const Napi::CallbackInfo& info) {
5090
5020
  Napi::Value NodeHamLib::GetDcsSql(const Napi::CallbackInfo& info) {
5091
5021
  Napi::Env env = info.Env();
5092
5022
 
5093
- vfo_t vfo = parseVfoParameter(info, 0, RIG_VFO_CURR);
5023
+ int vfo = parseVfoParameter(info, 0, SHIM_RIG_VFO_CURR);
5094
5024
 
5095
5025
  GetDcsSqlAsyncWorker* asyncWorker = new GetDcsSqlAsyncWorker(env, this, vfo);
5096
5026
  asyncWorker->Queue();
@@ -5107,16 +5037,15 @@ Napi::Value NodeHamLib::SetParm(const Napi::CallbackInfo& info) {
5107
5037
  }
5108
5038
 
5109
5039
  std::string parm_str = info[0].As<Napi::String>().Utf8Value();
5110
- setting_t parm = rig_parse_parm(parm_str.c_str());
5040
+ uint64_t parm = shim_rig_parse_parm(parm_str.c_str());
5111
5041
 
5112
5042
  if (parm == 0) {
5113
5043
  Napi::Error::New(env, "Invalid parameter name: " + parm_str).ThrowAsJavaScriptException();
5114
5044
  return env.Null();
5115
5045
  }
5116
5046
 
5117
- value_t value;
5118
- value.f = info[1].As<Napi::Number>().FloatValue();
5119
-
5047
+ float value = info[1].As<Napi::Number>().FloatValue();
5048
+
5120
5049
  SetParmAsyncWorker* asyncWorker = new SetParmAsyncWorker(env, this, parm, value);
5121
5050
  asyncWorker->Queue();
5122
5051
  return asyncWorker->GetPromise();
@@ -5131,7 +5060,7 @@ Napi::Value NodeHamLib::GetParm(const Napi::CallbackInfo& info) {
5131
5060
  }
5132
5061
 
5133
5062
  std::string parm_str = info[0].As<Napi::String>().Utf8Value();
5134
- setting_t parm = rig_parse_parm(parm_str.c_str());
5063
+ uint64_t parm = shim_rig_parse_parm(parm_str.c_str());
5135
5064
 
5136
5065
  if (parm == 0) {
5137
5066
  Napi::Error::New(env, "Invalid parameter name: " + parm_str).ThrowAsJavaScriptException();
@@ -5153,7 +5082,7 @@ Napi::Value NodeHamLib::SendDtmf(const Napi::CallbackInfo& info) {
5153
5082
  }
5154
5083
 
5155
5084
  std::string digits = info[0].As<Napi::String>().Utf8Value();
5156
- vfo_t vfo = parseVfoParameter(info, 1, RIG_VFO_CURR);
5085
+ int vfo = parseVfoParameter(info, 1, SHIM_RIG_VFO_CURR);
5157
5086
 
5158
5087
  SendDtmfAsyncWorker* asyncWorker = new SendDtmfAsyncWorker(env, this, vfo, digits);
5159
5088
  asyncWorker->Queue();
@@ -5168,7 +5097,7 @@ Napi::Value NodeHamLib::RecvDtmf(const Napi::CallbackInfo& info) {
5168
5097
  maxLength = info[0].As<Napi::Number>().Int32Value();
5169
5098
  }
5170
5099
 
5171
- vfo_t vfo = parseVfoParameter(info, 1, RIG_VFO_CURR);
5100
+ int vfo = parseVfoParameter(info, 1, SHIM_RIG_VFO_CURR);
5172
5101
 
5173
5102
  RecvDtmfAsyncWorker* asyncWorker = new RecvDtmfAsyncWorker(env, this, vfo, maxLength);
5174
5103
  asyncWorker->Queue();
@@ -5179,7 +5108,7 @@ Napi::Value NodeHamLib::RecvDtmf(const Napi::CallbackInfo& info) {
5179
5108
  Napi::Value NodeHamLib::GetMem(const Napi::CallbackInfo& info) {
5180
5109
  Napi::Env env = info.Env();
5181
5110
 
5182
- vfo_t vfo = parseVfoParameter(info, 0, RIG_VFO_CURR);
5111
+ int vfo = parseVfoParameter(info, 0, SHIM_RIG_VFO_CURR);
5183
5112
 
5184
5113
  GetMemAsyncWorker* asyncWorker = new GetMemAsyncWorker(env, this, vfo);
5185
5114
  asyncWorker->Queue();
@@ -5195,7 +5124,7 @@ Napi::Value NodeHamLib::SetBank(const Napi::CallbackInfo& info) {
5195
5124
  }
5196
5125
 
5197
5126
  int bank = info[0].As<Napi::Number>().Int32Value();
5198
- vfo_t vfo = parseVfoParameter(info, 1, RIG_VFO_CURR);
5127
+ int vfo = parseVfoParameter(info, 1, SHIM_RIG_VFO_CURR);
5199
5128
 
5200
5129
  SetBankAsyncWorker* asyncWorker = new SetBankAsyncWorker(env, this, vfo, bank);
5201
5130
  asyncWorker->Queue();
@@ -5220,7 +5149,7 @@ Napi::Value NodeHamLib::SendMorse(const Napi::CallbackInfo& info) {
5220
5149
  }
5221
5150
 
5222
5151
  std::string msg = info[0].As<Napi::String>().Utf8Value();
5223
- vfo_t vfo = parseVfoParameter(info, 1, RIG_VFO_CURR);
5152
+ int vfo = parseVfoParameter(info, 1, SHIM_RIG_VFO_CURR);
5224
5153
 
5225
5154
  SendMorseAsyncWorker* asyncWorker = new SendMorseAsyncWorker(env, this, vfo, msg);
5226
5155
  asyncWorker->Queue();
@@ -5230,7 +5159,7 @@ Napi::Value NodeHamLib::SendMorse(const Napi::CallbackInfo& info) {
5230
5159
  Napi::Value NodeHamLib::StopMorse(const Napi::CallbackInfo& info) {
5231
5160
  Napi::Env env = info.Env();
5232
5161
 
5233
- vfo_t vfo = parseVfoParameter(info, 0, RIG_VFO_CURR);
5162
+ int vfo = parseVfoParameter(info, 0, SHIM_RIG_VFO_CURR);
5234
5163
 
5235
5164
  StopMorseAsyncWorker* asyncWorker = new StopMorseAsyncWorker(env, this, vfo);
5236
5165
  asyncWorker->Queue();
@@ -5240,7 +5169,7 @@ Napi::Value NodeHamLib::StopMorse(const Napi::CallbackInfo& info) {
5240
5169
  Napi::Value NodeHamLib::WaitMorse(const Napi::CallbackInfo& info) {
5241
5170
  Napi::Env env = info.Env();
5242
5171
 
5243
- vfo_t vfo = parseVfoParameter(info, 0, RIG_VFO_CURR);
5172
+ int vfo = parseVfoParameter(info, 0, SHIM_RIG_VFO_CURR);
5244
5173
 
5245
5174
  WaitMorseAsyncWorker* asyncWorker = new WaitMorseAsyncWorker(env, this, vfo);
5246
5175
  asyncWorker->Queue();
@@ -5257,7 +5186,7 @@ Napi::Value NodeHamLib::SendVoiceMem(const Napi::CallbackInfo& info) {
5257
5186
  }
5258
5187
 
5259
5188
  int ch = info[0].As<Napi::Number>().Int32Value();
5260
- vfo_t vfo = parseVfoParameter(info, 1, RIG_VFO_CURR);
5189
+ int vfo = parseVfoParameter(info, 1, SHIM_RIG_VFO_CURR);
5261
5190
 
5262
5191
  SendVoiceMemAsyncWorker* asyncWorker = new SendVoiceMemAsyncWorker(env, this, vfo, ch);
5263
5192
  asyncWorker->Queue();
@@ -5267,7 +5196,7 @@ Napi::Value NodeHamLib::SendVoiceMem(const Napi::CallbackInfo& info) {
5267
5196
  Napi::Value NodeHamLib::StopVoiceMem(const Napi::CallbackInfo& info) {
5268
5197
  Napi::Env env = info.Env();
5269
5198
 
5270
- vfo_t vfo = parseVfoParameter(info, 0, RIG_VFO_CURR);
5199
+ int vfo = parseVfoParameter(info, 0, SHIM_RIG_VFO_CURR);
5271
5200
 
5272
5201
  StopVoiceMemAsyncWorker* asyncWorker = new StopVoiceMemAsyncWorker(env, this, vfo);
5273
5202
  asyncWorker->Queue();
@@ -5283,7 +5212,7 @@ Napi::Value NodeHamLib::SetSplitFreqMode(const Napi::CallbackInfo& info) {
5283
5212
  return env.Null();
5284
5213
  }
5285
5214
 
5286
- freq_t tx_freq = static_cast<freq_t>(info[0].As<Napi::Number>().DoubleValue());
5215
+ double tx_freq = static_cast<double>(info[0].As<Napi::Number>().DoubleValue());
5287
5216
 
5288
5217
  // Basic frequency range validation
5289
5218
  if (tx_freq < 1000 || tx_freq > 10000000000) { // 1 kHz to 10 GHz reasonable range
@@ -5292,11 +5221,11 @@ Napi::Value NodeHamLib::SetSplitFreqMode(const Napi::CallbackInfo& info) {
5292
5221
  }
5293
5222
 
5294
5223
  std::string mode_str = info[1].As<Napi::String>().Utf8Value();
5295
- pbwidth_t tx_width = static_cast<pbwidth_t>(info[2].As<Napi::Number>().DoubleValue());
5296
- vfo_t vfo = parseVfoParameter(info, 3, RIG_VFO_CURR);
5224
+ int tx_width = static_cast<int>(info[2].As<Napi::Number>().DoubleValue());
5225
+ int vfo = parseVfoParameter(info, 3, SHIM_RIG_VFO_CURR);
5297
5226
 
5298
- rmode_t tx_mode = rig_parse_mode(mode_str.c_str());
5299
- if (tx_mode == RIG_MODE_NONE) {
5227
+ int tx_mode = shim_rig_parse_mode(mode_str.c_str());
5228
+ if (tx_mode == SHIM_RIG_MODE_NONE) {
5300
5229
  Napi::Error::New(env, "Invalid mode: " + mode_str).ThrowAsJavaScriptException();
5301
5230
  return env.Null();
5302
5231
  }
@@ -5309,7 +5238,7 @@ Napi::Value NodeHamLib::SetSplitFreqMode(const Napi::CallbackInfo& info) {
5309
5238
  Napi::Value NodeHamLib::GetSplitFreqMode(const Napi::CallbackInfo& info) {
5310
5239
  Napi::Env env = info.Env();
5311
5240
 
5312
- vfo_t vfo = parseVfoParameter(info, 0, RIG_VFO_CURR);
5241
+ int vfo = parseVfoParameter(info, 0, SHIM_RIG_VFO_CURR);
5313
5242
 
5314
5243
  GetSplitFreqModeAsyncWorker* asyncWorker = new GetSplitFreqModeAsyncWorker(env, this, vfo);
5315
5244
  asyncWorker->Queue();
@@ -5331,7 +5260,7 @@ Napi::Value NodeHamLib::Power2mW(const Napi::CallbackInfo& info) {
5331
5260
  }
5332
5261
 
5333
5262
  float power = info[0].As<Napi::Number>().FloatValue();
5334
- freq_t freq = info[1].As<Napi::Number>().DoubleValue();
5263
+ double freq = info[1].As<Napi::Number>().DoubleValue();
5335
5264
  std::string mode_str = info[2].As<Napi::String>().Utf8Value();
5336
5265
 
5337
5266
  // Validate power (0.0 to 1.0)
@@ -5347,8 +5276,8 @@ Napi::Value NodeHamLib::Power2mW(const Napi::CallbackInfo& info) {
5347
5276
  }
5348
5277
 
5349
5278
  // Parse mode string
5350
- rmode_t mode = rig_parse_mode(mode_str.c_str());
5351
- if (mode == RIG_MODE_NONE) {
5279
+ int mode = shim_rig_parse_mode(mode_str.c_str());
5280
+ if (mode == SHIM_RIG_MODE_NONE) {
5352
5281
  Napi::Error::New(env, "Invalid mode: " + mode_str).ThrowAsJavaScriptException();
5353
5282
  return env.Null();
5354
5283
  }
@@ -5373,7 +5302,7 @@ Napi::Value NodeHamLib::MW2Power(const Napi::CallbackInfo& info) {
5373
5302
  }
5374
5303
 
5375
5304
  unsigned int mwpower = info[0].As<Napi::Number>().Uint32Value();
5376
- freq_t freq = info[1].As<Napi::Number>().DoubleValue();
5305
+ double freq = info[1].As<Napi::Number>().DoubleValue();
5377
5306
  std::string mode_str = info[2].As<Napi::String>().Utf8Value();
5378
5307
 
5379
5308
  // Validate milliwatts (reasonable range)
@@ -5389,8 +5318,8 @@ Napi::Value NodeHamLib::MW2Power(const Napi::CallbackInfo& info) {
5389
5318
  }
5390
5319
 
5391
5320
  // Parse mode string
5392
- rmode_t mode = rig_parse_mode(mode_str.c_str());
5393
- if (mode == RIG_MODE_NONE) {
5321
+ int mode = shim_rig_parse_mode(mode_str.c_str());
5322
+ if (mode == SHIM_RIG_MODE_NONE) {
5394
5323
  Napi::Error::New(env, "Invalid mode: " + mode_str).ThrowAsJavaScriptException();
5395
5324
  return env.Null();
5396
5325
  }
@@ -5404,20 +5333,20 @@ Napi::Value NodeHamLib::MW2Power(const Napi::CallbackInfo& info) {
5404
5333
  Napi::Value NodeHamLib::Reset(const Napi::CallbackInfo& info) {
5405
5334
  Napi::Env env = info.Env();
5406
5335
 
5407
- reset_t reset = RIG_RESET_SOFT; // Default to soft reset
5336
+ int reset = SHIM_RIG_RESET_SOFT; // Default to soft reset
5408
5337
 
5409
5338
  if (info.Length() > 0 && info[0].IsString()) {
5410
5339
  std::string reset_str = info[0].As<Napi::String>().Utf8Value();
5411
5340
  if (reset_str == "NONE") {
5412
- reset = RIG_RESET_NONE;
5341
+ reset = SHIM_RIG_RESET_NONE;
5413
5342
  } else if (reset_str == "SOFT") {
5414
- reset = RIG_RESET_SOFT;
5343
+ reset = SHIM_RIG_RESET_SOFT;
5415
5344
  } else if (reset_str == "MCALL") {
5416
- reset = RIG_RESET_MCALL;
5345
+ reset = SHIM_RIG_RESET_MCALL;
5417
5346
  } else if (reset_str == "MASTER") {
5418
- reset = RIG_RESET_MASTER;
5347
+ reset = SHIM_RIG_RESET_MASTER;
5419
5348
  } else if (reset_str == "VFO") {
5420
- reset = RIG_RESET_VFO;
5349
+ reset = SHIM_RIG_RESET_VFO;
5421
5350
  } else {
5422
5351
  Napi::Error::New(env, "Invalid reset type: " + reset_str +
5423
5352
  " (valid: NONE, SOFT, VFO, MCALL, MASTER)").ThrowAsJavaScriptException();