/* * aor_set_vfo * Assumes rig!=NULL */ int aor_set_vfo(RIG *rig, vfo_t vfo) { char *vfocmd; switch (vfo) { case RIG_VFO_VFO: if (rig->caps->rig_model == RIG_MODEL_AR8000) { vfocmd = "RF" EOM; } else { vfocmd = "VF" EOM; } break; case RIG_VFO_A: vfocmd = "VA" EOM; break; case RIG_VFO_B: vfocmd = "VB" EOM; break; case RIG_VFO_C: vfocmd = "VC" EOM; break; case RIG_VFO_N(3): vfocmd = "VD" EOM; break; case RIG_VFO_N(4): vfocmd = "VE" EOM; break; case RIG_VFO_MEM: vfocmd = "MR" EOM; break; default: rig_debug(RIG_DEBUG_ERR,"aor_set_vfo: unsupported vfo %d\n", vfo); return -RIG_EINVAL; } return aor_transaction (rig, vfocmd, strlen(vfocmd), NULL, NULL); }
/* * aor_get_vfo * Assumes rig!=NULL, freq!=NULL */ int aor_get_vfo(RIG *rig, vfo_t *vfo) { int vfo_len, retval; char vfobuf[BUFSZ]; retval = aor_transaction (rig, "RX" EOM, 3, vfobuf, &vfo_len); if (retval != RIG_OK) return retval; if (rig->caps->rig_model == RIG_MODEL_AR8000) { switch (vfobuf[0]) { case 'S': case 'D': *vfo = RIG_VFO_VFO; break; case 'V': *vfo = RIG_VFO_N(vfobuf[4]-'A'); break; case 'M': *vfo = RIG_VFO_MEM; break; default: rig_debug(RIG_DEBUG_ERR,"aor_get_vfo: unknown vfo %s\n", vfobuf); return -RIG_EINVAL; } } else { switch (vfobuf[1]) { case 'S': case 'V': case 'F': *vfo = RIG_VFO_VFO; break; case 'A': *vfo = RIG_VFO_A; break; case 'B': *vfo = RIG_VFO_B; break; case 'C': *vfo = RIG_VFO_C; break; case 'D': *vfo = RIG_VFO_N(3); break; case 'E': *vfo = RIG_VFO_N(4); break; case 'R': *vfo = RIG_VFO_MEM; break; default: rig_debug(RIG_DEBUG_ERR,"aor_get_vfo: unknown vfo %c\n", vfobuf[1]); return -RIG_EINVAL; } } return RIG_OK; }
int sprintf_vfo(char *str, vfo_t vfo) { int i, len = 0; const char *sv; *str = '\0'; if (vfo == RIG_VFO_NONE) { return 0; } sv = rig_strvfo(vfo & RIG_VFO_CURR); if (sv && sv[0]) { len += sprintf(str + len, "%s ", sv); } sv = rig_strvfo(vfo & RIG_VFO_MEM); if (sv && sv[0]) { len += sprintf(str + len, "%s ", sv); } sv = rig_strvfo(vfo & RIG_VFO_VFO); if (sv && sv[0]) { len += sprintf(str + len, "%s ", sv); } sv = rig_strvfo(vfo & RIG_VFO_MAIN); if (sv && sv[0]) { len += sprintf(str + len, "%s ", sv); } sv = rig_strvfo(vfo & RIG_VFO_SUB); if (sv && sv[0]) { len += sprintf(str + len, "%s ", sv); } for (i = 0; i < 16; i++) { sv = rig_strvfo(vfo & RIG_VFO_N(i)); if (sv && sv[0]) { len += sprintf(str + len, "%s ", sv); } } return len; }
/* * sr2200_get_vfo * Assumes rig!=NULL, freq!=NULL */ int sr2200_get_vfo(RIG *rig, vfo_t *vfo) { int vfo_len, retval; char vfobuf[BUFSZ]; retval = sr2200_transaction (rig, "RX" EOM, 3, vfobuf, &vfo_len); if (retval != RIG_OK) return retval; switch (vfobuf[1]) { case 'A': *vfo = RIG_VFO_A; break; case 'B': *vfo = RIG_VFO_B; break; case 'C': *vfo = RIG_VFO_C; break; case 'D': *vfo = RIG_VFO_N(3); break; case 'E': *vfo = RIG_VFO_N(4); break; case 'F': *vfo = RIG_VFO_N(5); break; case 'G': *vfo = RIG_VFO_N(6); break; case 'H': *vfo = RIG_VFO_N(7); break; case 'I': *vfo = RIG_VFO_N(8); break; case 'J': *vfo = RIG_VFO_N(9); break; default: rig_debug(RIG_DEBUG_ERR,"aor_get_vfo: unknown vfo %c\n", vfobuf[1]); return -RIG_EINVAL; } return RIG_OK; }
/* * sr2200_set_vfo * Assumes rig!=NULL */ int sr2200_set_vfo(RIG *rig, vfo_t vfo) { char *vfocmd; switch (vfo) { case RIG_VFO_A: vfocmd = "VA" EOM; break; case RIG_VFO_B: vfocmd = "VB" EOM; break; case RIG_VFO_C: vfocmd = "VC" EOM; break; case RIG_VFO_N(3): vfocmd = "VD" EOM; break; case RIG_VFO_N(4): vfocmd = "VE" EOM; break; case RIG_VFO_N(5): vfocmd = "VF" EOM; break; case RIG_VFO_N(6): vfocmd = "VG" EOM; break; case RIG_VFO_N(7): vfocmd = "VH" EOM; break; case RIG_VFO_N(8): vfocmd = "VI" EOM; break; case RIG_VFO_N(9): vfocmd = "VJ" EOM; break; default: rig_debug(RIG_DEBUG_ERR,"aor_set_vfo: unsupported vfo %d\n", vfo); return -RIG_EINVAL; } return sr2200_transaction (rig, vfocmd, strlen(vfocmd), NULL, NULL); }