hamlib 0.2.5 → 0.2.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hamlib",
3
- "version": "0.2.5",
3
+ "version": "0.2.6",
4
4
  "description": "Node.js wrapper for hamlib radio control library",
5
5
  "main": "index.js",
6
6
  "module": "lib/index.mjs",
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -405,11 +405,32 @@ SHIM_API int shim_rig_get_level_auto(hamlib_shim_handle_t h, int vfo, uint64_t l
405
405
 
406
406
  /* ===== Function control ===== */
407
407
 
408
+ /*
409
+ * Ensure RIG_TARGETABLE_FUNC is set so rig_get_func()/rig_set_func()
410
+ * skip VFO switching. Same fix as RIG_TARGETABLE_LEVEL for ICOM serial
411
+ * rigs where icom_set_vfo fails with "unsupported VFO".
412
+ *
413
+ * RIG_TARGETABLE_FUNC = (1<<4) tells Hamlib: "this rig can get/set
414
+ * functions without needing to switch VFO first".
415
+ */
416
+ #ifndef RIG_TARGETABLE_FUNC
417
+ #define RIG_TARGETABLE_FUNC (1<<4)
418
+ #endif
419
+
420
+ static void shim_ensure_targetable_func(hamlib_shim_handle_t h) {
421
+ RIG* rig = (RIG*)h;
422
+ if (rig && rig->caps && !(rig->caps->targetable_vfo & RIG_TARGETABLE_FUNC)) {
423
+ rig->caps->targetable_vfo |= RIG_TARGETABLE_FUNC;
424
+ }
425
+ }
426
+
408
427
  SHIM_API int shim_rig_set_func(hamlib_shim_handle_t h, int vfo, uint64_t func, int enable) {
428
+ shim_ensure_targetable_func(h);
409
429
  return rig_set_func((RIG*)h, (vfo_t)vfo, (setting_t)func, enable);
410
430
  }
411
431
 
412
432
  SHIM_API int shim_rig_get_func(hamlib_shim_handle_t h, int vfo, uint64_t func, int* state) {
433
+ shim_ensure_targetable_func(h);
413
434
  int s = 0;
414
435
  int ret = rig_get_func((RIG*)h, (vfo_t)vfo, (setting_t)func, &s);
415
436
  if (state) *state = s;
@@ -612,8 +633,20 @@ SHIM_API int shim_rig_scan(hamlib_shim_handle_t h, int vfo, int scan_type, int c
612
633
 
613
634
  /* ===== VFO operations ===== */
614
635
 
636
+ /*
637
+ * vfo_op with fallback for rigs with VFO switching issues.
638
+ * There is no RIG_TARGETABLE for vfo_op, so we use the same
639
+ * fallback pattern as the old getLevel fix: try standard call
640
+ * first, then direct backend call if RIG_EINVAL (-1).
641
+ */
615
642
  SHIM_API int shim_rig_vfo_op(hamlib_shim_handle_t h, int vfo, int op) {
616
- return rig_vfo_op((RIG*)h, (vfo_t)vfo, (vfo_op_t)op);
643
+ RIG* rig = (RIG*)h;
644
+ int ret = rig_vfo_op(rig, (vfo_t)vfo, (vfo_op_t)op);
645
+ if (ret == -1 && rig->caps->vfo_op) {
646
+ /* RIG_EINVAL: VFO switching failed, try direct backend call */
647
+ ret = rig->caps->vfo_op(rig, (vfo_t)vfo, (vfo_op_t)op);
648
+ }
649
+ return ret;
617
650
  }
618
651
 
619
652
  /* ===== Antenna control ===== */