diff --git a/tests/dumpcaps.c b/tests/dumpcaps.c index b8bba6bde..374639e7f 100644 --- a/tests/dumpcaps.c +++ b/tests/dumpcaps.c @@ -71,6 +71,7 @@ static int print_ext(RIG *rig, const struct confparams *cfp, rig_ptr_t ptr) int dumpcaps(RIG *rig, FILE *fout) { const struct rig_caps *caps; + struct rig_state *rs; int status, i; int can_esplit, can_echannel; char freqbuf[20]; @@ -89,6 +90,7 @@ int dumpcaps(RIG *rig, FILE *fout) } caps = rig->caps; + rs = STATE(rig); fprintf(fout, "Caps dump for model: %u\n", caps->rig_model); fprintf(fout, "Model name:\t%s\n", caps->model_name); @@ -439,10 +441,9 @@ int dumpcaps(RIG *rig, FILE *fout) fprintf(fout, "Extra parameters:\n"); rig_ext_parm_foreach(rig, print_ext, fout); - - if (rig->state.mode_list != 0) + if (rs->mode_list != 0) { - rig_sprintf_mode(prntbuf, sizeof(prntbuf), rig->state.mode_list); + rig_sprintf_mode(prntbuf, sizeof(prntbuf), rs->mode_list); } else { @@ -453,9 +454,9 @@ int dumpcaps(RIG *rig, FILE *fout) fprintf(fout, "Mode list: %s\n", prntbuf); - if (rig->state.vfo_list != 0) + if (rs->vfo_list != 0) { - rig_sprintf_vfo(prntbuf, sizeof(prntbuf), rig->state.vfo_list); + rig_sprintf_vfo(prntbuf, sizeof(prntbuf), rs->vfo_list); } else { @@ -922,7 +923,7 @@ int dumpcaps(RIG *rig, FILE *fout) can_echannel = caps->set_mem && ((caps->set_vfo - && ((rig->state.vfo_list & RIG_VFO_MEM) == RIG_VFO_MEM)) + && ((rs->vfo_list & RIG_VFO_MEM) == RIG_VFO_MEM)) || (caps->vfo_op && rig_has_vfo_op(rig, RIG_OP_TO_VFO | RIG_OP_FROM_VFO))); diff --git a/tests/dumpcaps_rot.c b/tests/dumpcaps_rot.c index 408defc70..d13dc81af 100644 --- a/tests/dumpcaps_rot.c +++ b/tests/dumpcaps_rot.c @@ -141,9 +141,9 @@ int dumpcaps_rot(ROT *rot, FILE *fout) "Post write delay:\t%dms\n", caps->post_write_delay); - if (rot->state.has_status != 0) + if (ROTSTATE(rot)->has_status != 0) { - rot_sprintf_status(prntbuf, sizeof(prntbuf), rot->state.has_status); + rot_sprintf_status(prntbuf, sizeof(prntbuf), ROTSTATE(rot)->has_status); } else { diff --git a/tests/rigctltcp.c b/tests/rigctltcp.c index c391bd509..9d4b4b9eb 100644 --- a/tests/rigctltcp.c +++ b/tests/rigctltcp.c @@ -281,6 +281,7 @@ int main(int argc, char *argv[]) int vfo_mode = 0; /* vfo_mode=0 means target VFO is current VFO */ int i; extern int is_rigctld; + struct rig_state *rs; is_rigctld = 1; @@ -689,12 +690,13 @@ int main(int argc, char *argv[]) strncpy(RIGPORT(my_rig)->pathname, rig_file, HAMLIB_FILPATHLEN - 1); } - my_rig->state.twiddle_timeout = twiddle_timeout; - my_rig->state.twiddle_rit = twiddle_rit; - my_rig->state.uplink = uplink; + rs = STATE(my_rig); + rs->twiddle_timeout = twiddle_timeout; + rs->twiddle_rit = twiddle_rit; + rs->uplink = uplink; rig_debug(RIG_DEBUG_TRACE, "%s: twiddle=%d, uplink=%d, twiddle_rit=%d\n", __func__, - my_rig->state.twiddle_timeout, my_rig->state.uplink, my_rig->state.twiddle_rit); + rs->twiddle_timeout, rs->uplink, rs->twiddle_rit); /* * ex: RIG_PTT_PARALLEL and /dev/parport0 @@ -702,29 +704,29 @@ int main(int argc, char *argv[]) if (ptt_type != RIG_PTT_NONE) { PTTPORT(my_rig)->type.ptt = ptt_type; - my_rig->state.pttport_deprecated.type.ptt = ptt_type; + rs->pttport_deprecated.type.ptt = ptt_type; // This causes segfault since backend rig_caps are const - // rigctld will use the rig->state version of this for clients + // rigctld will use the STATE(rig) version of this for clients //my_rig->caps->ptt_type = ptt_type; } if (dcd_type != RIG_DCD_NONE) { DCDPORT(my_rig)->type.dcd = dcd_type; - my_rig->state.dcdport_deprecated.type.dcd = dcd_type; + rs->dcdport_deprecated.type.dcd = dcd_type; } if (ptt_file) { strncpy(PTTPORT(my_rig)->pathname, ptt_file, HAMLIB_FILPATHLEN - 1); - strncpy(my_rig->state.pttport_deprecated.pathname, ptt_file, + strncpy(rs->pttport_deprecated.pathname, ptt_file, HAMLIB_FILPATHLEN - 1); } if (dcd_file) { strncpy(DCDPORT(my_rig)->pathname, dcd_file, HAMLIB_FILPATHLEN - 1); - strncpy(my_rig->state.dcdport_deprecated.pathname, dcd_file, + strncpy(rs->dcdport_deprecated.pathname, dcd_file, HAMLIB_FILPATHLEN - 1); } @@ -732,7 +734,7 @@ int main(int argc, char *argv[]) if (serial_rate != 0) { RIGPORT(my_rig)->parm.serial.rate = serial_rate; - my_rig->state.rigport_deprecated.parm.serial.rate = serial_rate; + rs->rigport_deprecated.parm.serial.rate = serial_rate; } if (civaddr) @@ -1229,7 +1231,7 @@ void *handle_socket(void *arg) mutex_rigctld(1); rig_get_powerstat(my_rig, &rig_powerstat); mutex_rigctld(0); - my_rig->state.powerstat = rig_powerstat; + STATE(my_rig)->powerstat = rig_powerstat; } do diff --git a/tests/rigsmtr.c b/tests/rigsmtr.c index fc258b1e0..74f8ac5b0 100644 --- a/tests/rigsmtr.c +++ b/tests/rigsmtr.c @@ -365,24 +365,24 @@ int main(int argc, char *argv[]) step = atof(argv[optind]) * 1e6; } - fprintf(stderr, "Setting rotator to azimuth %.1f°\n", rot->state.min_az); - rot_set_position(rot, rot->state.min_az, 0); + fprintf(stderr, "Setting rotator to azimuth %.1f°\n", ROTSTATE(rot)->min_az); + rot_set_position(rot, ROTSTATE(rot)->min_az, 0); fprintf(stderr, "Wait for rotator to move...\n"); rot_get_position(rot, &azimuth, &elevation); - while (fabs(azimuth - rot->state.min_az) > 1.) + while (fabs(azimuth - ROTSTATE(rot)->min_az) > 1.) { rot_get_position(rot, &azimuth, &elevation); hl_usleep(step); } fprintf(stderr, "Now initiating full 360° rotation...\n"); - rot_set_position(rot, rot->state.max_az, 0); + rot_set_position(rot, ROTSTATE(rot)->max_az, 0); /* TODO: check CW or CCW */ /* disable AGC? */ - while (fabs(rot->state.max_az - azimuth) > 1.) + while (fabs(ROTSTATE(rot)->max_az - azimuth) > 1.) { value_t strength; diff --git a/tests/rigtestmcast.c b/tests/rigtestmcast.c index 510691a7c..d6c2ffd7f 100644 --- a/tests/rigtestmcast.c +++ b/tests/rigtestmcast.c @@ -34,8 +34,8 @@ int main(int argc, const char *argv[]) // disabled until we change this to the other multicast capability #if 0 multicast_init(rig, "224.0.0.1", 4532); - printf("threadid=%lld\n", (long long)rig->state.multicast->threadid); - pthread_join(rig->state.multicast->threadid, NULL); + printf("threadid=%lld\n", (long long)STATE(rig)->multicast->threadid); + pthread_join(STATE(rig)->multicast->threadid, NULL); pthread_exit(NULL); #endif return 0;