Convert rigs/loew/, rigs/pcr/, rigs/prm80/, rigs/racal/ and rigs/rs/

pull/1508/head
George Baltz N3GB 2024-02-03 20:53:17 -05:00
rodzic 464eea58e7
commit eb94ce2b94
9 zmienionych plików z 72 dodań i 79 usunięć

Wyświetl plik

@ -52,13 +52,11 @@ int lowe_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
int *data_len) int *data_len)
{ {
int retval; int retval;
struct rig_state *rs; hamlib_port_t *rp = RIGPORT(rig);
rs = &rig->state; rig_flush(rp);
rig_flush(&rs->rigport); retval = write_block(rp, (unsigned char *) cmd, cmd_len);
retval = write_block(&rs->rigport, (unsigned char *) cmd, cmd_len);
if (retval != RIG_OK) if (retval != RIG_OK)
{ {
@ -72,7 +70,7 @@ int lowe_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
return 0; return 0;
} }
retval = read_string(&rs->rigport, (unsigned char *) data, BUFSZ, CR, 1, 0, 1); retval = read_string(rp, (unsigned char *) data, BUFSZ, CR, 1, 0, 1);
if (retval == -RIG_ETIMEOUT) if (retval == -RIG_ETIMEOUT)
{ {

Wyświetl plik

@ -164,6 +164,7 @@ pcr_read_block(RIG *rig, char *rxbuffer, size_t count)
int read = 0, tries = 4; int read = 0, tries = 4;
struct rig_state *rs = &rig->state; struct rig_state *rs = &rig->state;
hamlib_port_t *rp = RIGPORT(rig);
const struct pcr_priv_caps *caps = pcr_caps(rig); const struct pcr_priv_caps *caps = pcr_caps(rig);
struct pcr_priv_data *priv = (struct pcr_priv_data *) rs->priv; struct pcr_priv_data *priv = (struct pcr_priv_data *) rs->priv;
@ -172,7 +173,7 @@ pcr_read_block(RIG *rig, char *rxbuffer, size_t count)
/* already in sync? */ /* already in sync? */
if (priv->sync && !caps->always_sync) if (priv->sync && !caps->always_sync)
{ {
return read_block(&rs->rigport, (unsigned char *) rxbuffer, count); return read_block(rp, (unsigned char *) rxbuffer, count);
} }
/* read first char */ /* read first char */
@ -181,7 +182,7 @@ pcr_read_block(RIG *rig, char *rxbuffer, size_t count)
char *p = &rxbuffer[0]; char *p = &rxbuffer[0];
/* read first char */ /* read first char */
int err = read_block(&rs->rigport, (unsigned char *) p, 1); int err = read_block(rp, (unsigned char *) p, 1);
if (err < 0) if (err < 0)
{ {
@ -204,7 +205,7 @@ pcr_read_block(RIG *rig, char *rxbuffer, size_t count)
count--; count--;
p++; p++;
err = read_block(&rs->rigport, (unsigned char *) p, count); err = read_block(rp, (unsigned char *) p, count);
if (err < 0) if (err < 0)
{ {
@ -358,7 +359,7 @@ pcr_send(RIG *rig, const char *cmd)
rs->transaction_active = 1; rs->transaction_active = 1;
err = write_block(&rs->rigport, (unsigned char *) priv->cmd_buf, len + 1); err = write_block(RIGPORT(rig), (unsigned char *) priv->cmd_buf, len + 1);
rs->transaction_active = 0; rs->transaction_active = 0;
@ -379,7 +380,7 @@ pcr_transaction(RIG *rig, const char *cmd)
if (!priv->auto_update) if (!priv->auto_update)
{ {
rig_flush(&rs->rigport); rig_flush(RIGPORT(rig));
} }
pcr_send(rig, cmd); pcr_send(rig, cmd);
@ -461,8 +462,8 @@ pcr_set_comm_speed(RIG *rig, int rate)
return err; return err;
} }
rig->state.rigport.parm.serial.rate = rate; RIGPORT(rig)->parm.serial.rate = rate;
serial_setup(&rig->state.rigport); serial_setup(RIGPORT(rig));
/* check if the pcr is still alive */ /* check if the pcr is still alive */
return pcr_check_ok(rig); return pcr_check_ok(rig);
@ -549,6 +550,7 @@ int
pcr_open(RIG *rig) pcr_open(RIG *rig)
{ {
struct rig_state *rs = &rig->state; struct rig_state *rs = &rig->state;
hamlib_port_t *rp = RIGPORT(rig);
struct pcr_priv_data *priv = (struct pcr_priv_data *) rs->priv; struct pcr_priv_data *priv = (struct pcr_priv_data *) rs->priv;
int err; int err;
@ -569,14 +571,14 @@ pcr_open(RIG *rig)
startup_serial_rate = 9600; startup_serial_rate = 9600;
} }
wanted_serial_rate = rs->rigport.parm.serial.rate; wanted_serial_rate = rp->parm.serial.rate;
rs->rigport.parm.serial.rate = startup_serial_rate; rp->parm.serial.rate = startup_serial_rate;
serial_setup(&rs->rigport); serial_setup(rp);
/* let the pcr settle and flush any remaining data*/ /* let the pcr settle and flush any remaining data*/
hl_usleep(100 * 1000); hl_usleep(100 * 1000);
rig_flush(&rs->rigport); rig_flush(rp);
/* try powering on twice, sometimes the pcr answers H100 (off) */ /* try powering on twice, sometimes the pcr answers H100 (off) */
pcr_send(rig, "H101"); pcr_send(rig, "H101");
@ -585,7 +587,7 @@ pcr_open(RIG *rig)
pcr_send(rig, "H101"); pcr_send(rig, "H101");
hl_usleep(100 * 250); hl_usleep(100 * 250);
rig_flush(&rs->rigport); rig_flush(rp);
/* return RIG_ERJCTED if power is off */ /* return RIG_ERJCTED if power is off */
err = pcr_transaction(rig, "H1?"); err = pcr_transaction(rig, "H1?");

Wyświetl plik

@ -245,13 +245,13 @@ static int prm80_transaction(RIG *rig, const char *cmd,
const char *arg1, int wait_prompt) const char *arg1, int wait_prompt)
{ {
int retval; int retval;
struct rig_state *rs = &rig->state; hamlib_port_t *rp = RIGPORT(rig);
// Get rid of possible prompt sent by the rig // Get rid of possible prompt sent by the rig
rig_flush(&rs->rigport); rig_flush(rp);
// Start with the command // Start with the command
retval = write_block(&rs->rigport, (unsigned char *) cmd, strlen(cmd)); retval = write_block(rp, (unsigned char *) cmd, strlen(cmd));
if (retval != RIG_OK) if (retval != RIG_OK)
{ {
@ -260,7 +260,7 @@ static int prm80_transaction(RIG *rig, const char *cmd,
if (arg1 != NULL) if (arg1 != NULL)
{ {
retval = read_colon_prompt_and_send(&rs->rigport, NULL, NULL, arg1); retval = read_colon_prompt_and_send(rp, NULL, NULL, arg1);
if (retval < 0) if (retval < 0)
{ {
@ -270,7 +270,7 @@ static int prm80_transaction(RIG *rig, const char *cmd,
if (wait_prompt) if (wait_prompt)
{ {
prm80_wait_for_prompt(&rs->rigport); prm80_wait_for_prompt(rp);
} }
return RIG_OK; return RIG_OK;
@ -374,7 +374,7 @@ static freq_t pll_value_to_rx_freq(unsigned pll_value)
*/ */
int prm80_set_rx_tx_freq(RIG *rig, freq_t rx_freq, freq_t tx_freq) int prm80_set_rx_tx_freq(RIG *rig, freq_t rx_freq, freq_t tx_freq)
{ {
struct rig_state *rs = &rig->state; hamlib_port_t *rp = RIGPORT(rig);
char rx_freq_buf[BUFSZ]; char rx_freq_buf[BUFSZ];
char tx_freq_buf[BUFSZ]; char tx_freq_buf[BUFSZ];
int rc; int rc;
@ -397,7 +397,7 @@ int prm80_set_rx_tx_freq(RIG *rig, freq_t rx_freq, freq_t tx_freq)
} }
// There's a second line to process after prm80_transaction() // There's a second line to process after prm80_transaction()
rc = read_colon_prompt_and_send(&rs->rigport, NULL, NULL, tx_freq_buf); rc = read_colon_prompt_and_send(rp, NULL, NULL, tx_freq_buf);
if (rc != RIG_OK) if (rc != RIG_OK)
{ {
@ -408,7 +408,7 @@ int prm80_set_rx_tx_freq(RIG *rig, freq_t rx_freq, freq_t tx_freq)
// NB: the [R] command does not update the checksum of the RAM! // NB: the [R] command does not update the checksum of the RAM!
prm80_wait_for_prompt(&rs->rigport); prm80_wait_for_prompt(rp);
return rc; return rc;
} }
@ -699,7 +699,7 @@ static int prm80_read_system_state(RIG *rig, char *statebuf)
if (rig_check_cache_timeout(&priv->status_tv, PRM80_CACHE_TIMEOUT)) if (rig_check_cache_timeout(&priv->status_tv, PRM80_CACHE_TIMEOUT))
{ {
ret = prm80_do_read_system_state(&rig->state.rigport, statebuf); ret = prm80_do_read_system_state(RIGPORT(rig), statebuf);
if (ret == RIG_OK) if (ret == RIG_OK)
{ {
@ -822,7 +822,7 @@ int prm80_get_channel(RIG *rig, vfo_t vfo, channel_t *chan, int read_only)
int prm80_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan) int prm80_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan)
{ {
struct prm80_priv_data *priv = (struct prm80_priv_data *)rig->state.priv; struct prm80_priv_data *priv = (struct prm80_priv_data *)rig->state.priv;
struct rig_state *rs = &rig->state; hamlib_port_t *rp = RIGPORT(rig);
char buf[BUFSZ]; char buf[BUFSZ];
int ret, chanstate; int ret, chanstate;
freq_t tx_freq; freq_t tx_freq;
@ -859,7 +859,7 @@ int prm80_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan)
SNPRINTF(buf, sizeof(buf), "%04X", rx_freq_to_pll_value(chan->freq)); SNPRINTF(buf, sizeof(buf), "%04X", rx_freq_to_pll_value(chan->freq));
// "PLL value to load : $" // "PLL value to load : $"
ret = read_dollar_prompt_and_send(&rs->rigport, NULL, NULL, buf); ret = read_dollar_prompt_and_send(rp, NULL, NULL, buf);
if (ret != RIG_OK) if (ret != RIG_OK)
{ {
@ -883,7 +883,7 @@ int prm80_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan)
SNPRINTF(buf, sizeof(buf), "%02X", chanstate); SNPRINTF(buf, sizeof(buf), "%02X", chanstate);
// "Channel state : $" // "Channel state : $"
ret = read_dollar_prompt_and_send(&rs->rigport, NULL, NULL, buf); ret = read_dollar_prompt_and_send(rp, NULL, NULL, buf);
if (ret != RIG_OK) if (ret != RIG_OK)
{ {
@ -893,7 +893,7 @@ int prm80_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan)
// Determine if prompt came back (CRLF'>') or have to // Determine if prompt came back (CRLF'>') or have to
// handle the possible query from the rig: // handle the possible query from the rig:
// "This channel number doesn't exist. Add new channel (Y/N) ? " // "This channel number doesn't exist. Add new channel (Y/N) ? "
ret = read_block(&rs->rigport, (unsigned char *) buf, 3); ret = read_block(rp, (unsigned char *) buf, 3);
if (ret < 0) if (ret < 0)
{ {
@ -903,7 +903,7 @@ int prm80_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan)
if (ret == 3 && buf[2] == 'T') if (ret == 3 && buf[2] == 'T')
{ {
// Read the question // Read the question
ret = read_string(&rs->rigport, (unsigned char *) buf, sizeof(buf), "?", 1, 0, ret = read_string(rp, (unsigned char *) buf, sizeof(buf), "?", 1, 0,
1); 1);
if (ret < 0) if (ret < 0)
@ -912,7 +912,7 @@ int prm80_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan)
} }
// Read extra space // Read extra space
ret = read_block(&rs->rigport, (unsigned char *) buf, 1); ret = read_block(rp, (unsigned char *) buf, 1);
if (ret < 0) if (ret < 0)
{ {
@ -920,7 +920,7 @@ int prm80_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan)
} }
// Send confirmation // Send confirmation
ret = write_block(&rs->rigport, (unsigned char *) "Y", 1); ret = write_block(rp, (unsigned char *) "Y", 1);
if (ret < 0) if (ret < 0)
{ {
@ -928,7 +928,7 @@ int prm80_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan)
} }
} }
prm80_wait_for_prompt(&rs->rigport); prm80_wait_for_prompt(rp);
} }
else else
{ {
@ -1108,6 +1108,7 @@ static int prm80_get_rawstr_RAM(RIG *rig, value_t *val)
{ {
char buf[BUFSZ]; char buf[BUFSZ];
struct rig_state *rs = &rig->state; struct rig_state *rs = &rig->state;
hamlib_port_t *rp = RIGPORT(rig);
int ret, i; int ret, i;
/* [U] = Print 80c552 internal RAM. */ /* [U] = Print 80c552 internal RAM. */
@ -1121,7 +1122,7 @@ static int prm80_get_rawstr_RAM(RIG *rig, value_t *val)
} }
// Read CRLF // Read CRLF
ret = read_string(&rs->rigport, buf, BUFSZ, "\n", 1, 0, 1); ret = read_string(rp, buf, BUFSZ, "\n", 1, 0, 1);
if (ret < 0) if (ret < 0)
{ {
@ -1137,7 +1138,7 @@ static int prm80_get_rawstr_RAM(RIG *rig, value_t *val)
for (i = 0; i < (RSSI_HOLD_ADDR / 16) + 1; i++) for (i = 0; i < (RSSI_HOLD_ADDR / 16) + 1; i++)
{ {
ret = read_string(&rs->rigport, buf, BUFSZ, "\n", 1, 0, 1); ret = read_string(rp, buf, BUFSZ, "\n", 1, 0, 1);
if (ret < 0) if (ret < 0)
{ {
@ -1153,10 +1154,10 @@ static int prm80_get_rawstr_RAM(RIG *rig, value_t *val)
// discard the remaining content of RAM print // discard the remaining content of RAM print
for (i = 0; i < (16 - RSSI_HOLD_ADDR / 16) - 1; i++) for (i = 0; i < (16 - RSSI_HOLD_ADDR / 16) - 1; i++)
{ {
read_string(&rs->rigport, buf, BUFSZ, "\n", 1, 0, 1); read_string(rp, buf, BUFSZ, "\n", 1, 0, 1);
} }
prm80_wait_for_prompt(&rs->rigport); prm80_wait_for_prompt(rp);
return RIG_OK; return RIG_OK;
} }
@ -1261,22 +1262,22 @@ int prm80_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd)
const char *prm80_get_info(RIG *rig) const char *prm80_get_info(RIG *rig)
{ {
static char s_buf[BUFSZ]; static char s_buf[BUFSZ];
struct rig_state *rs = &rig->state; hamlib_port_t *rp = RIGPORT(rig);
char *p; char *p;
int ret; int ret;
// Get rid of possible prompt sent by the rig // Get rid of possible prompt sent by the rig
rig_flush(&rs->rigport); rig_flush(rp);
/* [V] = Print firmware version. */ /* [V] = Print firmware version. */
ret = write_block(&rs->rigport, (unsigned char *) "V", 1); ret = write_block(rp, (unsigned char *) "V", 1);
if (ret < 0) if (ret < 0)
{ {
return NULL; return NULL;
} }
ret = read_string(&rs->rigport, (unsigned char *) s_buf, BUFSZ, ">", 1, 0, 1); ret = read_string(rp, (unsigned char *) s_buf, BUFSZ, ">", 1, 0, 1);
if (ret < 0) if (ret < 0)
{ {

Wyświetl plik

@ -70,7 +70,7 @@ static int ra37xx_one_transaction(RIG *rig, const char *cmd, char *data,
{ {
const struct ra37xx_priv_data *priv = (struct ra37xx_priv_data *) const struct ra37xx_priv_data *priv = (struct ra37xx_priv_data *)
rig->state.priv; rig->state.priv;
struct rig_state *rs = &rig->state; hamlib_port_t *rp = RIGPORT(rig);
char cmdbuf[BUFSZ]; char cmdbuf[BUFSZ];
char respbuf[BUFSZ]; char respbuf[BUFSZ];
int retval; int retval;
@ -95,9 +95,9 @@ static int ra37xx_one_transaction(RIG *rig, const char *cmd, char *data,
SNPRINTF(cmdbuf, sizeof(cmdbuf), SOM "%s" EOM, cmd); SNPRINTF(cmdbuf, sizeof(cmdbuf), SOM "%s" EOM, cmd);
} }
rig_flush(&rs->rigport); rig_flush(rp);
retval = write_block(&rs->rigport, (unsigned char *) cmdbuf, strlen(cmdbuf)); retval = write_block(rp, (unsigned char *) cmdbuf, strlen(cmdbuf));
if (retval != RIG_OK) if (retval != RIG_OK)
{ {
@ -113,7 +113,7 @@ static int ra37xx_one_transaction(RIG *rig, const char *cmd, char *data,
do do
{ {
retval = read_string(&rs->rigport, (unsigned char *) respbuf, BUFSZ, EOM, retval = read_string(rp, (unsigned char *) respbuf, BUFSZ, EOM,
strlen(EOM), 0, 1); strlen(EOM), 0, 1);
if (retval < 0) if (retval < 0)
@ -124,7 +124,7 @@ static int ra37xx_one_transaction(RIG *rig, const char *cmd, char *data,
/* drop short/invalid packets */ /* drop short/invalid packets */
if (retval <= pkt_header_len + 1 || respbuf[0] != '\x0a') if (retval <= pkt_header_len + 1 || respbuf[0] != '\x0a')
{ {
if (!rig_check_cache_timeout(&tv, rs->rigport.timeout)) if (!rig_check_cache_timeout(&tv, rp->timeout))
{ {
continue; continue;
} }
@ -137,7 +137,7 @@ static int ra37xx_one_transaction(RIG *rig, const char *cmd, char *data,
/* drop other receiver id, and "pause" (empty) packets */ /* drop other receiver id, and "pause" (empty) packets */
if ((priv->receiver_id != -1 && (respbuf[1] - '0') != priv->receiver_id)) if ((priv->receiver_id != -1 && (respbuf[1] - '0') != priv->receiver_id))
{ {
if (!rig_check_cache_timeout(&tv, rs->rigport.timeout)) if (!rig_check_cache_timeout(&tv, rp->timeout))
{ {
continue; continue;
} }
@ -165,7 +165,7 @@ static int ra37xx_one_transaction(RIG *rig, const char *cmd, char *data,
rig_debug(RIG_DEBUG_WARN, "%s: unexpected revertive frame\n", rig_debug(RIG_DEBUG_WARN, "%s: unexpected revertive frame\n",
__func__); __func__);
if (!rig_check_cache_timeout(&tv, rs->rigport.timeout)) if (!rig_check_cache_timeout(&tv, rp->timeout))
{ {
continue; continue;
} }
@ -189,7 +189,7 @@ static int ra37xx_transaction(RIG *rig, const char *cmd, char *data,
{ {
int retval, retry; int retval, retry;
retry = rig->state.rigport.retry; retry = RIGPORT(rig)->retry;
do do
{ {

Wyświetl plik

@ -69,15 +69,15 @@ static int racal_transaction(RIG *rig, const char *cmd, char *data,
int *data_len) int *data_len)
{ {
const struct racal_priv_data *priv = (struct racal_priv_data *)rig->state.priv; const struct racal_priv_data *priv = (struct racal_priv_data *)rig->state.priv;
struct rig_state *rs = &rig->state; hamlib_port_t *rp = RIGPORT(rig);
char cmdbuf[BUFSZ + 1]; char cmdbuf[BUFSZ + 1];
int retval; int retval;
SNPRINTF(cmdbuf, sizeof(cmdbuf), SOM "%u%s" EOM, priv->receiver_id, cmd); SNPRINTF(cmdbuf, sizeof(cmdbuf), SOM "%u%s" EOM, priv->receiver_id, cmd);
rig_flush(&rs->rigport); rig_flush(rp);
retval = write_block(&rs->rigport, (unsigned char *) cmdbuf, strlen(cmdbuf)); retval = write_block(rp, (unsigned char *) cmdbuf, strlen(cmdbuf));
if (retval != RIG_OK) if (retval != RIG_OK)
{ {
@ -91,7 +91,7 @@ static int racal_transaction(RIG *rig, const char *cmd, char *data,
return retval; return retval;
} }
retval = read_string(&rs->rigport, (unsigned char *) data, BUFSZ, EOM, retval = read_string(rp, (unsigned char *) data, BUFSZ, EOM,
strlen(EOM), 0, 1); strlen(EOM), 0, 1);
if (retval <= 0) if (retval <= 0)

Wyświetl plik

@ -42,13 +42,11 @@ int rft_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
int *data_len) int *data_len)
{ {
int retval; int retval;
struct rig_state *rs; hamlib_port_t *rp = RIGPORT(rig);
rs = &rig->state; rig_flush(rp);
rig_flush(&rs->rigport); retval = write_block(rp, (unsigned char *) cmd, cmd_len);
retval = write_block(&rs->rigport, (unsigned char *) cmd, cmd_len);
if (retval != RIG_OK) if (retval != RIG_OK)
{ {
@ -62,7 +60,7 @@ int rft_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
return 0; return 0;
} }
retval = read_string(&rs->rigport, (unsigned char *) data, BUFSZ, CR, 1, 0, 1); retval = read_string(rp, (unsigned char *) data, BUFSZ, CR, 1, 0, 1);
if (retval == -RIG_ETIMEOUT) if (retval == -RIG_ETIMEOUT)
{ {

Wyświetl plik

@ -54,18 +54,16 @@ ek89x_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
int *data_len) int *data_len)
{ {
int retval; int retval;
struct rig_state *rs; hamlib_port_t *rp = RIGPORT(rig);
rig_debug(RIG_DEBUG_VERBOSE, "%s: len=%d,cmd=%s\n", __func__, cmd_len, rig_debug(RIG_DEBUG_VERBOSE, "%s: len=%d,cmd=%s\n", __func__, cmd_len,
cmd); cmd);
rs = &rig->state; rig_flush(rp);
rig_flush(&rs->rigport);
rig_debug(RIG_DEBUG_VERBOSE, "ek89x_transaction: len=%d,cmd=%s\n", rig_debug(RIG_DEBUG_VERBOSE, "ek89x_transaction: len=%d,cmd=%s\n",
cmd_len, cmd); cmd_len, cmd);
retval = write_block(&rs->rigport, (unsigned char *) cmd, cmd_len); retval = write_block(rp, (unsigned char *) cmd, cmd_len);
if (retval != RIG_OK) if (retval != RIG_OK)
{ {
@ -79,7 +77,7 @@ ek89x_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
return RIG_OK; return RIG_OK;
} }
retval = read_string(&rs->rigport, (unsigned char *) data, RESPSZ, retval = read_string(rp, (unsigned char *) data, RESPSZ,
CR, 1, 0, 1); CR, 1, 0, 1);
if (retval < 0) if (retval < 0)

Wyświetl plik

@ -59,18 +59,16 @@ gp2000_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
int *data_len) int *data_len)
{ {
int retval; int retval;
struct rig_state *rs; hamlib_port_t *rp = RIGPORT(rig);
rig_debug(RIG_DEBUG_VERBOSE, "%s: len=%d,cmd=%s\n", __func__, cmd_len, rig_debug(RIG_DEBUG_VERBOSE, "%s: len=%d,cmd=%s\n", __func__, cmd_len,
cmd); cmd);
rs = &rig->state; rig_flush(rp);
rig_flush(&rs->rigport);
rig_debug(RIG_DEBUG_VERBOSE, "gp2000_transaction: len=%d,cmd=%s\n", rig_debug(RIG_DEBUG_VERBOSE, "gp2000_transaction: len=%d,cmd=%s\n",
cmd_len, cmd); cmd_len, cmd);
retval = write_block(&rs->rigport, (unsigned char *) cmd, cmd_len); retval = write_block(rp, (unsigned char *) cmd, cmd_len);
if (retval != RIG_OK) if (retval != RIG_OK)
{ {
@ -84,7 +82,7 @@ gp2000_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
return RIG_OK; return RIG_OK;
} }
retval = read_string(&rs->rigport, (unsigned char *) data, RESPSZ, retval = read_string(rp, (unsigned char *) data, RESPSZ,
CR, 1, 0, 1); CR, 1, 0, 1);
if (retval < 0) if (retval < 0)

Wyświetl plik

@ -56,13 +56,11 @@ int rs_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
int *data_len) int *data_len)
{ {
int retval; int retval;
struct rig_state *rs; hamlib_port_t *rp = RIGPORT(rig);
rs = &rig->state; rig_flush(rp);
rig_flush(&rs->rigport); retval = write_block(rp, (unsigned char *) cmd, cmd_len);
retval = write_block(&rs->rigport, (unsigned char *) cmd, cmd_len);
if (retval != RIG_OK) if (retval != RIG_OK)
{ {
@ -76,7 +74,7 @@ int rs_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
return RIG_OK; return RIG_OK;
} }
retval = read_string(&rs->rigport, (unsigned char *) data, BUFSZ, CR, 1, 0, 1); retval = read_string(rp, (unsigned char *) data, BUFSZ, CR, 1, 0, 1);
if (retval < 0) if (retval < 0)
{ {