Convert rigs/dummy/

pull/1508/head
George Baltz N3GB 2024-01-29 16:22:32 -05:00
rodzic f777179bc8
commit 1e552b557f
12 zmienionych plików z 150 dodań i 196 usunięć

Wyświetl plik

@ -137,7 +137,6 @@ static int read_transaction(RIG *rig, char *xml, int xml_len)
int retry;
char *delims;
char *terminator = "</CMD>\r\n";
struct rig_state *rs = &rig->state;
ENTERFUNC;
@ -154,7 +153,7 @@ static int read_transaction(RIG *rig, char *xml, int xml_len)
rig_debug(RIG_DEBUG_WARN, "%s: retry needed? retry=%d\n", __func__, retry);
}
int len = read_string(&rs->rigport, (unsigned char *) tmp_buf, sizeof(tmp_buf),
int len = read_string(RIGPORT(rig), (unsigned char *) tmp_buf, sizeof(tmp_buf),
delims,
strlen(delims), 0, 1);
rig_debug(RIG_DEBUG_TRACE, "%s: string='%s'\n", __func__, tmp_buf);
@ -215,12 +214,9 @@ static int read_transaction(RIG *rig, char *xml, int xml_len)
*/
static int write_transaction(RIG *rig, char *xml, int xml_len)
{
int try = rig->caps->retry;
int retval = -RIG_EPROTO;
struct rig_state *rs = &rig->state;
hamlib_port_t *rp = RIGPORT(rig);
ENTERFUNC;
@ -234,11 +230,11 @@ static int write_transaction(RIG *rig, char *xml, int xml_len)
// appears we can lose sync if we don't clear things out
// shouldn't be anything for us now anyways
rig_flush(&rig->state.rigport);
rig_flush(rp);
while (try-- >= 0 && retval != RIG_OK)
{
retval = write_block(&rs->rigport, (unsigned char *) xml, strlen(xml));
retval = write_block(rp, (unsigned char *) xml, strlen(xml));
if (retval < 0)
{
@ -320,6 +316,7 @@ static int aclog_transaction(RIG *rig, char *cmd, char *value,
static int aclog_init(RIG *rig)
{
struct aclog_priv_data *priv;
hamlib_port_t *rp = RIGPORT(rig);
ENTERFUNC;
rig_debug(RIG_DEBUG_TRACE, "%s version %s\n", __func__, rig->caps->version);
@ -353,8 +350,7 @@ static int aclog_init(RIG *rig)
RETURNFUNC(-RIG_EINVAL);
}
strncpy(rig->state.rigport.pathname, DEFAULTPATH,
sizeof(rig->state.rigport.pathname));
strncpy(rp->pathname, DEFAULTPATH, sizeof(rp->pathname));
RETURNFUNC(RIG_OK);
}

Wyświetl plik

@ -62,7 +62,7 @@ static int dummy_amp_init(AMP *amp)
priv = amp->state.priv;
amp->state.ampport.type.rig = RIG_PORT_NONE;
AMPPORT(amp)->type.rig = RIG_PORT_NONE;
priv->freq = 0;

Wyświetl plik

@ -231,7 +231,7 @@ static int dummy_init(RIG *rig)
rig->state.priv = (void *)priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
rig->state.rigport.type.rig = RIG_PORT_NONE;
RIGPORT(rig)->type.rig = RIG_PORT_NONE;
priv->split = RIG_SPLIT_OFF;
priv->ptt = RIG_PTT_OFF;
@ -743,6 +743,7 @@ static int dummy_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
static int dummy_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt)
{
const struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv;
hamlib_port_t *pttp = PTTPORT(rig);
int rc;
int status = 0;
@ -751,12 +752,12 @@ static int dummy_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt)
// sneak a look at the hardware PTT and OR that in with our result
// as if it had keyed us
switch (rig->state.pttport.type.ptt)
switch (pttp->type.ptt)
{
case RIG_PTT_SERIAL_DTR:
if (rig->state.pttport.fd >= 0)
if (pttp->fd >= 0)
{
if (RIG_OK != (rc = ser_get_dtr(&rig->state.pttport, &status))) { RETURNFUNC(rc); }
if (RIG_OK != (rc = ser_get_dtr(pttp, &status))) { RETURNFUNC(rc); }
*ptt = status ? RIG_PTT_ON : RIG_PTT_OFF;
}
@ -768,9 +769,9 @@ static int dummy_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt)
break;
case RIG_PTT_SERIAL_RTS:
if (rig->state.pttport.fd >= 0)
if (pttp->fd >= 0)
{
if (RIG_OK != (rc = ser_get_rts(&rig->state.pttport, &status))) { RETURNFUNC(rc); }
if (RIG_OK != (rc = ser_get_rts(pttp, &status))) { RETURNFUNC(rc); }
*ptt = status ? RIG_PTT_ON : RIG_PTT_OFF;
}
@ -782,26 +783,26 @@ static int dummy_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt)
break;
case RIG_PTT_PARALLEL:
if (rig->state.pttport.fd >= 0)
if (pttp->fd >= 0)
{
if (RIG_OK != (rc = par_ptt_get(&rig->state.pttport, ptt))) { RETURNFUNC(rc); }
if (RIG_OK != (rc = par_ptt_get(pttp, ptt))) { RETURNFUNC(rc); }
}
break;
case RIG_PTT_CM108:
if (rig->state.pttport.fd >= 0)
if (pttp->fd >= 0)
{
if (RIG_OK != (rc = cm108_ptt_get(&rig->state.pttport, ptt))) { RETURNFUNC(rc); }
if (RIG_OK != (rc = cm108_ptt_get(pttp, ptt))) { RETURNFUNC(rc); }
}
break;
case RIG_PTT_GPIO:
case RIG_PTT_GPION:
if (rig->state.pttport.fd >= 0)
if (pttp->fd >= 0)
{
if (RIG_OK != (rc = gpio_ptt_get(&rig->state.pttport, ptt))) { RETURNFUNC(rc); }
if (RIG_OK != (rc = gpio_ptt_get(pttp, ptt))) { RETURNFUNC(rc); }
}
break;

Wyświetl plik

@ -297,7 +297,7 @@ static char *xml_build(RIG *rig, char *cmd, char *value, char *xmlbuf,
SNPRINTF(xml, sizeof(xml),
"<?xml version=\"1.0\"?>\r\n<?clientid=\"hamlib(%d)\"?>\r\n",
rig->state.rigport.client_port);
RIGPORT(rig)->client_port);
strncat(xml, "<methodCall><methodName>", sizeof(xml) - 1);
strncat(xml, cmd, sizeof(xml) - strlen(xml) - 1);
@ -430,7 +430,6 @@ static int read_transaction(RIG *rig, char *xml, int xml_len)
int retry;
char *delims;
char *terminator = "</methodResponse>";
struct rig_state *rs = &rig->state;
ENTERFUNC;
@ -448,7 +447,7 @@ static int read_transaction(RIG *rig, char *xml, int xml_len)
}
rig_debug(RIG_DEBUG_TRACE, "%s: before read_string\n", __func__);
int len = read_string(&rs->rigport, (unsigned char *) tmp_buf, sizeof(tmp_buf),
int len = read_string(RIGPORT(rig), (unsigned char *) tmp_buf, sizeof(tmp_buf),
delims,
strlen(delims), 0, 1);
// "</methodResponse>", 17,0,1);
@ -517,7 +516,7 @@ static int write_transaction(RIG *rig, char *xml, int xml_len)
int retval = -RIG_EPROTO;
struct rig_state *rs = &rig->state;
hamlib_port_t *rp = RIGPORT(rig);
ENTERFUNC;
@ -531,11 +530,11 @@ static int write_transaction(RIG *rig, char *xml, int xml_len)
// appears we can lose sync if we don't clear things out
// shouldn't be anything for us now anyways
rig_flush(&rig->state.rigport);
rig_flush(rp);
while (try-- >= 0 && retval != RIG_OK)
{
retval = write_block(&rs->rigport, (unsigned char *) xml, strlen(xml));
retval = write_block(rp, (unsigned char *) xml, strlen(xml));
if (retval < 0)
{
@ -619,6 +618,7 @@ static int flrig_transaction(RIG *rig, char *cmd, char *cmd_arg, char *value,
static int flrig_init(RIG *rig)
{
struct flrig_priv_data *priv;
hamlib_port_t *rp = RIGPORT(rig);
ENTERFUNC;
rig_debug(RIG_DEBUG_TRACE, "%s version %s\n", __func__, rig->caps->version);
@ -653,8 +653,7 @@ static int flrig_init(RIG *rig)
RETURNFUNC(-RIG_EINVAL);
}
strncpy(rig->state.rigport.pathname, DEFAULTPATH,
sizeof(rig->state.rigport.pathname));
strncpy(rp->pathname, DEFAULTPATH, sizeof(rp->pathname));
priv->ext_parms = alloc_init_ext(flrig_ext_parms);

Wyświetl plik

@ -34,15 +34,16 @@
static int netampctl_transaction(AMP *amp, char *cmd, int len, char *buf)
{
int ret;
hamlib_port_t *ampp = AMPPORT(amp);
ret = write_block(&amp->state.ampport, (unsigned char *) cmd, len);
ret = write_block(ampp, (unsigned char *) cmd, len);
if (ret != RIG_OK)
{
return ret;
}
ret = read_string(&amp->state.ampport, (unsigned char *) buf, BUF_MAX, "\n",
ret = read_string(ampp, (unsigned char *) buf, BUF_MAX, "\n",
sizeof("\n"), 0, 1);
if (ret < 0)
@ -62,6 +63,7 @@ static int netampctl_open(AMP *amp)
{
int ret;
//struct amp_state *rs = &amp->state;
hamlib_port_t *ampp = AMPPORT(amp);
int pamp_ver;
char cmd[CMD_MAX];
char buf[BUF_MAX];
@ -86,9 +88,10 @@ static int netampctl_open(AMP *amp)
return -RIG_EPROTO;
}
ret = read_string(&amp->state.ampport, (unsigned char *) buf, BUF_MAX, "\n",
ret = read_string(ampp, (unsigned char *) buf, BUF_MAX, "\n",
sizeof("\n"), 0, 1);
if (ret <= 0)
{
return (ret < 0) ? ret : -RIG_EPROTO;
@ -96,7 +99,7 @@ static int netampctl_open(AMP *amp)
do
{
ret = read_string(&amp->state.ampport, (unsigned char *) buf, BUF_MAX, "\n",
ret = read_string(ampp, (unsigned char *) buf, BUF_MAX, "\n",
sizeof("\n"), 0, 1);
if (ret > 0)
@ -120,7 +123,7 @@ static int netampctl_close(AMP *amp)
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
/* clean signoff, no read back */
write_block(&amp->state.ampport, (unsigned char *) "q\n", 2);
write_block(AMPPORT(amp), (unsigned char *) "q\n", 2);
return RIG_OK;
}

Wyświetl plik

@ -58,21 +58,21 @@ int netrigctl_get_vfo_mode(RIG *rig)
static int netrigctl_transaction(RIG *rig, char *cmd, int len, char *buf)
{
int ret;
hamlib_port_t *rp = RIGPORT(rig);
rig_debug(RIG_DEBUG_VERBOSE, "%s: called len=%d\n", __func__, len);
/* flush anything in the read buffer before command is sent */
rig_flush(&rig->state.rigport);
rig_flush(rp);
ret = write_block(&rig->state.rigport, (unsigned char *) cmd, len);
ret = write_block(rp, (unsigned char *) cmd, len);
if (ret != RIG_OK)
{
return ret;
}
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
ret = read_string(rp, (unsigned char *) buf, BUF_MAX, "\n", 1, 0, 1);
if (ret < 0)
{
@ -248,6 +248,7 @@ static int netrigctl_open(RIG *rig)
{
int ret, i;
struct rig_state *rs = &rig->state;
hamlib_port_t *rp = RIGPORT(rig);
int prot_ver;
char cmd[CMD_MAX];
char buf[BUF_MAX];
@ -303,16 +304,14 @@ static int netrigctl_open(RIG *rig)
RETURNFUNC(-RIG_EPROTO);
}
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
ret = read_string(rp, (unsigned char *) buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
RETURNFUNC((ret < 0) ? ret : -RIG_EPROTO);
}
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
ret = read_string(rp, (unsigned char *) buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -323,8 +322,7 @@ static int netrigctl_open(RIG *rig)
for (i = 0; i < HAMLIB_FRQRANGESIZ; i++)
{
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
ret = read_string(rp, (unsigned char *) buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -354,8 +352,7 @@ static int netrigctl_open(RIG *rig)
for (i = 0; i < HAMLIB_FRQRANGESIZ; i++)
{
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
ret = read_string(rp, (unsigned char *) buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -397,8 +394,7 @@ static int netrigctl_open(RIG *rig)
for (i = 0; i < HAMLIB_TSLSTSIZ; i++)
{
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
ret = read_string(rp, (unsigned char *) buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -422,8 +418,7 @@ static int netrigctl_open(RIG *rig)
for (i = 0; i < HAMLIB_FLTLSTSIZ; i++)
{
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
ret = read_string(rp, (unsigned char *) buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -450,8 +445,7 @@ static int netrigctl_open(RIG *rig)
chan_t chan_list[HAMLIB_CHANLSTSIZ]; /*!< Channel list, zero ended */
#endif
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
ret = read_string(rp, (unsigned char *) buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -460,8 +454,7 @@ static int netrigctl_open(RIG *rig)
rig->caps->max_rit = rs->max_rit = atol(buf);
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
ret = read_string(rp, (unsigned char *) buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -470,8 +463,7 @@ static int netrigctl_open(RIG *rig)
rig->caps->max_xit = rs->max_xit = atol(buf);
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
ret = read_string(rp, (unsigned char *) buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -480,8 +472,7 @@ static int netrigctl_open(RIG *rig)
rig->caps->max_ifshift = rs->max_ifshift = atol(buf);
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
ret = read_string(rp, (unsigned char *) buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -490,8 +481,7 @@ static int netrigctl_open(RIG *rig)
rs->announces = atoi(buf);
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
ret = read_string(rp, (unsigned char *) buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -518,8 +508,7 @@ static int netrigctl_open(RIG *rig)
rig->caps->preamp[ret] = rs->preamp[ret] = RIG_DBLST_END;
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
ret = read_string(rp, (unsigned char *) buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -546,8 +535,7 @@ static int netrigctl_open(RIG *rig)
rig->caps->attenuator[ret] = rs->attenuator[ret] = RIG_DBLST_END;
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
ret = read_string(rp, (unsigned char *) buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -556,8 +544,7 @@ static int netrigctl_open(RIG *rig)
rig->caps->has_get_func = rs->has_get_func = strtoll(buf, NULL, 0);
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
ret = read_string(rp, (unsigned char *) buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -566,8 +553,7 @@ static int netrigctl_open(RIG *rig)
rig->caps->has_set_func = rs->has_set_func = strtoll(buf, NULL, 0);
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
ret = read_string(rp, (unsigned char *) buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -589,8 +575,7 @@ static int netrigctl_open(RIG *rig)
#endif
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
ret = read_string(rp, (unsigned char *) buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -599,8 +584,7 @@ static int netrigctl_open(RIG *rig)
rig->caps->has_set_level = rs->has_set_level = strtoll(buf, NULL, 0);
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
ret = read_string(rp, (unsigned char *) buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -609,8 +593,7 @@ static int netrigctl_open(RIG *rig)
rs->has_get_parm = strtoll(buf, NULL, 0);
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
ret = read_string(rp, (unsigned char *) buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -648,8 +631,8 @@ static int netrigctl_open(RIG *rig)
do
{
char setting[32], value[1024];
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
hamlib_port_t *pttp = PTTPORT(rig);
ret = read_string(rp, (unsigned char *) buf, BUF_MAX, "\n", 1, 0, 1);
strtok(buf, "\r\n"); // chop the EOL
if (ret <= 0)
@ -672,7 +655,7 @@ static int netrigctl_open(RIG *rig)
ptt_type_t temp = (ptt_type_t)strtol(value, NULL, 0);
rig_debug(RIG_DEBUG_VERBOSE, "%s: ptt_type='%s'(%d)\n", __func__, value, temp);
if (RIG_PTT_RIG_MICDATA == rig->state.pttport.type.ptt
if (RIG_PTT_RIG_MICDATA == pttp->type.ptt
|| temp == RIG_PTT_RIG_MICDATA)
{
/*
@ -680,15 +663,15 @@ static int netrigctl_open(RIG *rig)
* if there is any PTT capability and we have not
* locally overridden it
*/
rig->state.pttport.type.ptt = RIG_PTT_RIG_MICDATA;
pttp->type.ptt = RIG_PTT_RIG_MICDATA;
rig->caps->ptt_type = RIG_PTT_RIG_MICDATA;
rig_debug(RIG_DEBUG_TRACE, "%s: %s set to %d\n", __func__, setting,
rig->state.pttport.type.ptt);
pttp->type.ptt);
}
else
{
rig_debug(RIG_DEBUG_VERBOSE, "%s: ptt_type= %d\n", __func__, temp);
rig->state.pttport.type.ptt = temp;
pttp->type.ptt = temp;
rig->caps->ptt_type = temp;
}
}
@ -1016,7 +999,7 @@ static int netrigctl_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
CHKSCN1ARG(num_sscanf(buf, "%"SCNfreq, freq));
#if 0 // implement set_freq VFO later if it can be detected
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1, 0, 1);
ret = read_string(RIGPORT(rig), buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -1087,7 +1070,7 @@ static int netrigctl_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode,
*mode = rig_parse_mode(buf);
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
ret = read_string(RIGPORT(rig), (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
if (ret <= 0)
@ -1170,12 +1153,13 @@ static int netrigctl_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
char cmd[CMD_MAX];
char buf[BUF_MAX];
char vfostr[16] = "";
hamlib_port_t *pttp = PTTPORT(rig);
rig_debug(RIG_DEBUG_VERBOSE, "%s called vfo=%s, ptt=%d, ptt_type=%d\n",
__func__,
rig_strvfo(vfo), ptt, rig->state.pttport.type.ptt);
rig_strvfo(vfo), ptt, pttp->type.ptt);
if (rig->state.pttport.type.ptt == RIG_PTT_NONE) { return RIG_OK; }
if (pttp->type.ptt == RIG_PTT_NONE) { return RIG_OK; }
ret = netrigctl_vfostr(rig, vfostr, sizeof(vfostr), RIG_VFO_A);
@ -1703,7 +1687,7 @@ static int netrigctl_get_split_mode(RIG *rig, vfo_t vfo, rmode_t *tx_mode,
*tx_mode = rig_parse_mode(buf);
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
ret = read_string(RIGPORT(rig), (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
if (ret <= 0)
@ -1771,7 +1755,7 @@ static int netrigctl_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split,
*split = atoi(buf);
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
ret = read_string(RIGPORT(rig), (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
if (ret <= 0)
@ -2318,7 +2302,7 @@ static int netrigctl_get_ant(RIG *rig, vfo_t vfo, ant_t ant, value_t *option,
ret);
}
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
ret = read_string(RIGPORT(rig), (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
if (ret <= 0)

Wyświetl plik

@ -35,18 +35,19 @@
static int netrotctl_transaction(ROT *rot, char *cmd, int len, char *buf)
{
int ret;
hamlib_port_t *rotp = ROTPORT(rot);
/* flush anything in the read buffer before command is sent */
rig_flush(&rot->state.rotport);
rig_flush(rotp);
ret = write_block(&rot->state.rotport, (unsigned char *) cmd, len);
ret = write_block(rotp, (unsigned char *) cmd, len);
if (ret != RIG_OK)
{
return ret;
}
ret = read_string(&rot->state.rotport, (unsigned char *) buf, BUF_MAX, "\n",
ret = read_string(rotp, (unsigned char *) buf, BUF_MAX, "\n",
sizeof("\n"), 0, 1);
if (ret < 0)
@ -66,6 +67,7 @@ static int netrotctl_open(ROT *rot)
{
int ret;
struct rot_state *rs = &rot->state;
hamlib_port_t *rotp = ROTPORT(rot);
int prot_ver;
char cmd[CMD_MAX];
char buf[BUF_MAX];
@ -85,7 +87,7 @@ static int netrotctl_open(ROT *rot)
prot_ver = atoi(buf);
#define ROTCTLD_PROT_VER 1
ret = read_string(&rot->state.rotport, (unsigned char *) buf, BUF_MAX, "\n",
ret = read_string(rotp, (unsigned char *) buf, BUF_MAX, "\n",
sizeof("\n"), 0, 1);
if (ret <= 0)
@ -100,7 +102,7 @@ static int netrotctl_open(ROT *rot)
{
char setting[32], value[1024];
ret = read_string(&rot->state.rotport, (unsigned char *) buf, BUF_MAX, "\n",
ret = read_string(rotp, (unsigned char *) buf, BUF_MAX, "\n",
sizeof("\n"), 0, 1);
if (ret <= 0)
@ -158,7 +160,7 @@ static int netrotctl_close(ROT *rot)
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
/* clean signoff, no read back */
write_block(&rot->state.rotport, (unsigned char *) "q\n", 2);
write_block(ROTPORT(rot), (unsigned char *) "q\n", 2);
return RIG_OK;
}
@ -205,7 +207,7 @@ static int netrotctl_get_position(ROT *rot, azimuth_t *az, elevation_t *el)
*az = atof(buf);
ret = read_string(&rot->state.rotport, (unsigned char *) buf, BUF_MAX, "\n",
ret = read_string(ROTPORT(rot), (unsigned char *) buf, BUF_MAX, "\n",
sizeof("\n"), 0, 1);
if (ret <= 0)

Wyświetl plik

@ -61,20 +61,21 @@ int quisk_get_vfo_mode(RIG *rig)
static int quisk_transaction(RIG *rig, char *cmd, int len, char *buf)
{
int ret;
hamlib_port_t *rp = RIGPORT(rig);
rig_debug(RIG_DEBUG_VERBOSE, "%s: called len=%d\n", __func__, len);
/* flush anything in the read buffer before command is sent */
rig_flush(&rig->state.rigport);
rig_flush(rp);
ret = write_block(&rig->state.rigport, (unsigned char *) cmd, len);
ret = write_block(rp, (unsigned char *) cmd, len);
if (ret != RIG_OK)
{
return ret;
}
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
ret = read_string(rp, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
if (ret < 0)
@ -212,6 +213,7 @@ static int quisk_open(RIG *rig)
char cmd[CMD_MAX];
char buf[BUF_MAX];
struct quisk_priv_data *priv;
hamlib_port_t *rp = RIGPORT(rig);
ENTERFUNC;
@ -237,16 +239,14 @@ static int quisk_open(RIG *rig)
RETURNFUNC(-RIG_EPROTO);
}
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
ret = read_string(rp, (unsigned char *) buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
RETURNFUNC((ret < 0) ? ret : -RIG_EPROTO);
}
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
ret = read_string(rp, (unsigned char *) buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -257,8 +257,7 @@ static int quisk_open(RIG *rig)
for (i = 0; i < HAMLIB_FRQRANGESIZ; i++)
{
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
ret = read_string(rp, (unsigned char *) buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -288,8 +287,7 @@ static int quisk_open(RIG *rig)
for (i = 0; i < HAMLIB_FRQRANGESIZ; i++)
{
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
ret = read_string(rp, (unsigned char *) buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -331,8 +329,7 @@ static int quisk_open(RIG *rig)
for (i = 0; i < HAMLIB_TSLSTSIZ; i++)
{
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
ret = read_string(rp, (unsigned char *) buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -356,8 +353,7 @@ static int quisk_open(RIG *rig)
for (i = 0; i < HAMLIB_FLTLSTSIZ; i++)
{
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
ret = read_string(rp, (unsigned char *) buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -384,8 +380,7 @@ static int quisk_open(RIG *rig)
chan_t chan_list[HAMLIB_CHANLSTSIZ]; /*!< Channel list, zero ended */
#endif
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
ret = read_string(rp, (unsigned char *) buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -394,8 +389,7 @@ static int quisk_open(RIG *rig)
rig->caps->max_rit = rs->max_rit = atol(buf);
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
ret = read_string(rp, (unsigned char *) buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -404,8 +398,7 @@ static int quisk_open(RIG *rig)
rig->caps->max_xit = rs->max_xit = atol(buf);
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
ret = read_string(rp, (unsigned char *) buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -414,8 +407,7 @@ static int quisk_open(RIG *rig)
rig->caps->max_ifshift = rs->max_ifshift = atol(buf);
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
ret = read_string(rp, (unsigned char *) buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -424,8 +416,7 @@ static int quisk_open(RIG *rig)
rs->announces = atoi(buf);
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
ret = read_string(rp, (unsigned char *) buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -452,8 +443,7 @@ static int quisk_open(RIG *rig)
rig->caps->preamp[ret] = rs->preamp[ret] = RIG_DBLST_END;
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
ret = read_string(rp, (unsigned char *) buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -480,8 +470,7 @@ static int quisk_open(RIG *rig)
rig->caps->attenuator[ret] = rs->attenuator[ret] = RIG_DBLST_END;
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
ret = read_string(rp, (unsigned char *) buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -491,8 +480,7 @@ static int quisk_open(RIG *rig)
rig->caps->has_get_func = rs->has_get_func = strtoll(buf, NULL, 0);
HAMLIB_TRACE;
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
ret = read_string(rp, (unsigned char *) buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -502,8 +490,7 @@ static int quisk_open(RIG *rig)
rig->caps->has_set_func = rs->has_set_func = strtoll(buf, NULL, 0);
HAMLIB_TRACE;
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
ret = read_string(rp, (unsigned char *) buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -526,8 +513,7 @@ static int quisk_open(RIG *rig)
#endif
HAMLIB_TRACE;
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
ret = read_string(rp, (unsigned char *) buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -537,8 +523,7 @@ static int quisk_open(RIG *rig)
rig->caps->has_set_level = rs->has_set_level = strtoll(buf, NULL, 0);
HAMLIB_TRACE;
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
ret = read_string(rp, (unsigned char *) buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -549,8 +534,7 @@ static int quisk_open(RIG *rig)
#if 0
HAMLIB_TRACE;
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
ret = read_string(rp, (unsigned char *) buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -599,8 +583,8 @@ static int quisk_open(RIG *rig)
do
{
char setting[32], value[1024];
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
hamlib_port_t *pttp = PTTPORT(rig);
ret = read_string(rp, (unsigned char *) buf, BUF_MAX, "\n", 1, 0, 1);
strtok(buf, "\r\n"); // chop the EOL
if (ret <= 0)
@ -623,7 +607,7 @@ static int quisk_open(RIG *rig)
ptt_type_t temp = (ptt_type_t)strtol(value, NULL, 0);
rig_debug(RIG_DEBUG_VERBOSE, "%s: ptt_type='%s'(%d)\n", __func__, value, temp);
if (RIG_PTT_RIG_MICDATA == rig->state.pttport.type.ptt
if (RIG_PTT_RIG_MICDATA == pttp->type.ptt
|| temp == RIG_PTT_RIG_MICDATA)
{
/*
@ -631,15 +615,15 @@ static int quisk_open(RIG *rig)
* if there is any PTT capability and we have not
* locally overridden it
*/
rig->state.pttport.type.ptt = RIG_PTT_RIG_MICDATA;
pttp->type.ptt = RIG_PTT_RIG_MICDATA;
rig->caps->ptt_type = RIG_PTT_RIG_MICDATA;
rig_debug(RIG_DEBUG_TRACE, "%s: %s set to %d\n", __func__, setting,
rig->state.pttport.type.ptt);
pttp->type.ptt);
}
else
{
rig_debug(RIG_DEBUG_VERBOSE, "%s: ptt_type= %d\n", __func__, temp);
rig->state.pttport.type.ptt = temp;
pttp->type.ptt = temp;
rig->caps->ptt_type = temp;
}
}
@ -955,7 +939,7 @@ static int quisk_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
CHKSCN1ARG(num_sscanf(buf, "%"SCNfreq, freq));
#if 0 // implement set_freq VFO later if it can be detected
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1, 0, 1);
ret = read_string(RIGPORT(rig), buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -1026,7 +1010,7 @@ static int quisk_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode,
*mode = rig_parse_mode(buf);
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
ret = read_string(RIGPORT(rig), (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
if (ret <= 0)
@ -1114,9 +1098,9 @@ static int quisk_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
rig_debug(RIG_DEBUG_VERBOSE, "%s called vfo=%s, ptt=%d, ptt_type=%d\n",
__func__,
rig_strvfo(vfo), ptt, rig->state.pttport.type.ptt);
rig_strvfo(vfo), ptt, PTTPORT(rig)->type.ptt);
if (rig->state.pttport.type.ptt == RIG_PTT_NONE) { return RIG_OK; }
if (PTTPORT(rig)->type.ptt == RIG_PTT_NONE) { return RIG_OK; }
ret = quisk_vfostr(rig, vfostr, sizeof(vfostr), RIG_VFO_A);
@ -1645,8 +1629,7 @@ static int quisk_get_split_mode(RIG *rig, vfo_t vfo, rmode_t *tx_mode,
*tx_mode = rig_parse_mode(buf);
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
ret = read_string(RIGPORT(rig), (unsigned char *) buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -1713,8 +1696,7 @@ static int quisk_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split,
*split = atoi(buf);
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
ret = read_string(RIGPORT(rig), (unsigned char *) buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -2268,8 +2250,7 @@ static int quisk_get_ant(RIG *rig, vfo_t vfo, ant_t ant, value_t *option,
ret);
}
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
ret = read_string(RIGPORT(rig), (unsigned char *) buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{

Wyświetl plik

@ -151,7 +151,7 @@ static int dummy_rot_init(ROT *rot)
return -RIG_ENOMEM;
}
rot->state.rotport.type.rig = RIG_PORT_NONE;
ROTPORT(rot)->type.rig = RIG_PORT_NONE;
priv->az = priv->el = 0;

Wyświetl plik

@ -101,7 +101,6 @@ static int read_transaction(RIG *rig, char *xml, int xml_len)
int retry;
char *delims;
char *terminator = "\n";
struct rig_state *rs = &rig->state;
ENTERFUNC;
@ -118,7 +117,7 @@ static int read_transaction(RIG *rig, char *xml, int xml_len)
rig_debug(RIG_DEBUG_WARN, "%s: retry needed? retry=%d\n", __func__, retry);
}
int len = read_string(&rs->rigport, (unsigned char *) tmp_buf, sizeof(tmp_buf),
int len = read_string(RIGPORT(rig), (unsigned char *) tmp_buf, sizeof(tmp_buf),
delims,
strlen(delims), 0, 1);
@ -175,7 +174,7 @@ static int write_transaction(RIG *rig, char *xml, int xml_len)
int retval = -RIG_EPROTO;
struct rig_state *rs = &rig->state;
hamlib_port_t *rp = RIGPORT(rig);
ENTERFUNC;
@ -189,11 +188,11 @@ static int write_transaction(RIG *rig, char *xml, int xml_len)
// appears we can lose sync if we don't clear things out
// shouldn't be anything for us now anyways
rig_flush(&rig->state.rigport);
rig_flush(rp);
while (try-- >= 0 && retval != RIG_OK)
{
retval = write_block(&rs->rigport, (unsigned char *) xml, strlen(xml));
retval = write_block(rp, (unsigned char *) xml, strlen(xml));
if (retval < 0)
{
@ -270,6 +269,7 @@ static int sdrsharp_transaction(RIG *rig, char *cmd, char *value,
static int sdrsharp_init(RIG *rig)
{
struct sdrsharp_priv_data *priv;
hamlib_port_t *rp = RIGPORT(rig);
ENTERFUNC;
rig_debug(RIG_DEBUG_TRACE, "%s version %s\n", __func__, rig->caps->version);
@ -303,8 +303,7 @@ static int sdrsharp_init(RIG *rig)
RETURNFUNC(-RIG_EINVAL);
}
strncpy(rig->state.rigport.pathname, DEFAULTPATH,
sizeof(rig->state.rigport.pathname));
strncpy(rp->pathname, DEFAULTPATH, sizeof(rp->pathname));
RETURNFUNC(RIG_OK);
}

Wyświetl plik

@ -273,7 +273,6 @@ static int check_vfo(vfo_t vfo)
static int read_transaction(RIG *rig, unsigned char *buf, int buf_len)
{
int retry;
struct rig_state *rs = &rig->state;
char *delims = ";";
ENTERFUNC;
@ -287,7 +286,7 @@ static int read_transaction(RIG *rig, unsigned char *buf, int buf_len)
rig_debug(RIG_DEBUG_WARN, "%s: retry needed? retry=%d\n", __func__, retry);
}
int len = read_string(&rs->rigport, buf, buf_len, delims,
int len = read_string(RIGPORT(rig), buf, buf_len, delims,
strlen(delims), 0, 1);
rig_debug(RIG_DEBUG_TRACE, "%s: string='%s'\n", __func__, buf);
@ -320,7 +319,7 @@ static int write_transaction(RIG *rig, const unsigned char *buf, int buf_len)
int retval = -RIG_EPROTO;
struct rig_state *rs = &rig->state;
hamlib_port_t *rp = RIGPORT(rig);
ENTERFUNC;
@ -334,11 +333,11 @@ static int write_transaction(RIG *rig, const unsigned char *buf, int buf_len)
// appears we can lose sync if we don't clear things out
// shouldn't be anything for us now anyways
rig_flush(&rig->state.rigport);
rig_flush(rp);
while (try-- >= 0 && retval != RIG_OK)
{
retval = write_block(&rs->rigport, buf, buf_len);
retval = write_block(rp, buf, buf_len);
if (retval < 0)
{
@ -420,6 +419,7 @@ static int tci1x_transaction(RIG *rig, char *cmd, char *cmd_arg, char *value,
static int tci1x_init(RIG *rig)
{
struct tci1x_priv_data *priv;
hamlib_port_t *rp = RIGPORT(rig);
ENTERFUNC;
rig_debug(RIG_DEBUG_TRACE, "%s version %s\n", __func__, rig->caps->version);
@ -453,8 +453,7 @@ static int tci1x_init(RIG *rig)
RETURNFUNC(-RIG_EINVAL);
}
strncpy(rig->state.rigport.pathname, DEFAULTPATH,
sizeof(rig->state.rigport.pathname));
strncpy(rp->pathname, DEFAULTPATH, sizeof(rp->pathname));
priv->ext_parms = alloc_init_ext(tci1x_ext_parms);

Wyświetl plik

@ -228,13 +228,12 @@ static int vfo_curr(RIG *rig, vfo_t vfo)
*/
static int read_transaction(RIG *rig, char *response, int response_len)
{
struct rig_state *rs = &rig->state;
const char *delims = "\n";
int len;
rig_debug(RIG_DEBUG_TRACE, "%s\n", __func__);
len = read_string(&rs->rigport, (unsigned char *) response, response_len,
len = read_string(RIGPORT(rig), (unsigned char *) response, response_len,
delims,
strlen(delims), 0, 1);
@ -254,6 +253,7 @@ static int read_transaction(RIG *rig, char *response, int response_len)
static int trxmanager_init(RIG *rig)
{
struct trxmanager_priv_data *priv;
hamlib_port_t *rp = RIGPORT(rig);
rig_debug(RIG_DEBUG_TRACE, "%s version %s\n", __func__, BACKEND_VER);
@ -280,8 +280,7 @@ static int trxmanager_init(RIG *rig)
return -RIG_EINVAL;
}
strncpy(rig->state.rigport.pathname, DEFAULTPATH,
sizeof(rig->state.rigport.pathname));
strncpy(rp->pathname, DEFAULTPATH, sizeof(rp->pathname));
return RIG_OK;
}
@ -296,13 +295,13 @@ static int trxmanager_open(RIG *rig)
char *cmd;
char *saveptr;
char response[MAXCMDLEN] = "";
struct rig_state *rs = &rig->state;
hamlib_port_t *rp = RIGPORT(rig);
struct trxmanager_priv_data *priv = (struct trxmanager_priv_data *)
rig->state.priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s version %s\n", __func__, BACKEND_VER);
rs->rigport.timeout = 10000; // long timeout for antenna switching/tuning
rp->timeout = 10000; // long timeout for antenna switching/tuning
retval = read_transaction(rig, response, sizeof(response));
if (retval != RIG_OK)
@ -323,7 +322,7 @@ static int trxmanager_open(RIG *rig)
// Turn off active messages
cmd = "AI0;";
retval = write_block(&rs->rigport, (unsigned char *) cmd, strlen(cmd));
retval = write_block(rp, (unsigned char *) cmd, strlen(cmd));
if (retval < 0)
{
@ -346,7 +345,7 @@ static int trxmanager_open(RIG *rig)
rig_debug(RIG_DEBUG_VERBOSE, "%s AI response=%s\n", __func__, response);
cmd = "FN;";
retval = write_block(&rs->rigport, (unsigned char *) cmd, strlen(cmd));
retval = write_block(rp, (unsigned char *) cmd, strlen(cmd));
if (retval != RIG_OK)
{
@ -405,7 +404,6 @@ static int trxmanager_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
char vfoab;
char cmd[MAXCMDLEN];
char response[MAXCMDLEN] = "";
struct rig_state *rs = &rig->state;
struct trxmanager_priv_data *priv = (struct trxmanager_priv_data *)
rig->state.priv;
@ -434,7 +432,7 @@ static int trxmanager_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
vfoab = vfo == RIG_VFO_A ? 'R' : 'T';
SNPRINTF(cmd, sizeof(cmd), "X%c;", vfoab);
retval = write_block(&rs->rigport, (unsigned char *) cmd, strlen(cmd));
retval = write_block(RIGPORT(rig), (unsigned char *) cmd, strlen(cmd));
if (retval < 0)
{
@ -475,7 +473,6 @@ static int trxmanager_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
char vfoab;
char cmd[MAXCMDLEN];
char response[MAXCMDLEN] = "";
struct rig_state *rs = &rig->state;
const struct trxmanager_priv_data *priv = (struct trxmanager_priv_data *)
rig->state.priv;
@ -504,7 +501,7 @@ static int trxmanager_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
vfoab = vfo == RIG_VFO_A ? 'A' : 'B';
SNPRINTF(cmd, sizeof(cmd), "F%c%011lu;", vfoab, (unsigned long)freq);
retval = write_block(&rs->rigport, (unsigned char *) cmd, strlen(cmd));
retval = write_block(RIGPORT(rig), (unsigned char *) cmd, strlen(cmd));
if (retval < 0)
{
@ -531,7 +528,6 @@ static int trxmanager_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
int retval;
char cmd[MAXCMDLEN];
char response[MAXCMDLEN] = "";
struct rig_state *rs = &rig->state;
rig_debug(RIG_DEBUG_TRACE, "%s: ptt=%d\n", __func__, ptt);
@ -543,7 +539,7 @@ static int trxmanager_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
}
SNPRINTF(cmd, sizeof(cmd), "%s;", ptt == 1 ? "TX" : "RX");
retval = write_block(&rs->rigport, (unsigned char *) cmd, strlen(cmd));
retval = write_block(RIGPORT(rig), (unsigned char *) cmd, strlen(cmd));
if (retval < 0)
{
@ -576,13 +572,12 @@ static int trxmanager_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt)
char cptt;
char cmd[MAXCMDLEN];
char response[MAXCMDLEN] = "";
struct rig_state *rs = &rig->state;
rig_debug(RIG_DEBUG_TRACE, "%s: vfo=%s\n", __func__,
rig_strvfo(vfo));
SNPRINTF(cmd, sizeof(cmd), "IF;");
retval = write_block(&rs->rigport, (unsigned char *) cmd, strlen(cmd));
retval = write_block(RIGPORT(rig), (unsigned char *) cmd, strlen(cmd));
if (retval < 0)
{
@ -635,7 +630,6 @@ static int trxmanager_set_mode(RIG *rig, vfo_t vfo, rmode_t mode,
char ttmode;
char cmd[MAXCMDLEN];
char response[MAXCMDLEN] = "";
struct rig_state *rs = &rig->state;
rig_debug(RIG_DEBUG_TRACE, "%s: vfo=%s mode=%s width=%d\n",
__func__, rig_strvfo(vfo), rig_strrmode(mode), (int)width);
@ -707,7 +701,7 @@ static int trxmanager_set_mode(RIG *rig, vfo_t vfo, rmode_t mode,
}
SNPRINTF(cmd, sizeof(cmd), "MD%c;", ttmode);
retval = write_block(&rs->rigport, (unsigned char *) cmd, strlen(cmd));
retval = write_block(RIGPORT(rig), (unsigned char *) cmd, strlen(cmd));
if (retval < 0)
{
@ -742,7 +736,7 @@ static int trxmanager_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode,
char tmode;
char cmd[MAXCMDLEN];
char response[MAXCMDLEN] = "";
struct rig_state *rs = &rig->state;
hamlib_port_t *rp = RIGPORT(rig);
struct trxmanager_priv_data *priv = (struct trxmanager_priv_data *)
rig->state.priv;
@ -770,7 +764,7 @@ static int trxmanager_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode,
rig_strvfo(vfo));
SNPRINTF(cmd, sizeof(cmd), "MD;");
retval = write_block(&rs->rigport, (unsigned char *) cmd, strlen(cmd));
retval = write_block(rp, (unsigned char *) cmd, strlen(cmd));
if (retval < 0)
{
@ -843,7 +837,7 @@ static int trxmanager_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode,
// now get the bandwidth
SNPRINTF(cmd, sizeof(cmd), "BW;");
retval = write_block(&rs->rigport, (unsigned char *) cmd, strlen(cmd));
retval = write_block(rp, (unsigned char *) cmd, strlen(cmd));
if (retval < 0)
{
@ -910,7 +904,7 @@ static int trxmanager_set_vfo(RIG *rig, vfo_t vfo)
}
SNPRINTF(cmd, sizeof(cmd), "FN%d;", vfo == RIG_VFO_A ? 0 : 1);
retval = write_block(&rs->rigport, (unsigned char *) cmd, strlen(cmd));
retval = write_block(RIGPORT(rig), (unsigned char *) cmd, strlen(cmd));
if (retval < 0)
{
@ -982,7 +976,6 @@ static int trxmanager_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq)
int retval;
char cmd[MAXCMDLEN];
char response[MAXCMDLEN] = "";
struct rig_state *rs = &rig->state;
rig_debug(RIG_DEBUG_TRACE, "%s: vfo=%s freq=%.1f\n", __func__,
rig_strvfo(vfo), tx_freq);
@ -995,7 +988,7 @@ static int trxmanager_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq)
}
SNPRINTF(cmd, sizeof(cmd), "XT%011lu;", (unsigned long) tx_freq);
retval = write_block(&rs->rigport, (unsigned char *) cmd, strlen(cmd));
retval = write_block(RIGPORT(rig), (unsigned char *) cmd, strlen(cmd));
if (retval < 0)
{
@ -1038,7 +1031,6 @@ static int trxmanager_set_split_vfo(RIG *rig, vfo_t vfo, split_t split,
char response[MAXCMDLEN] = "";
split_t tsplit;
vfo_t ttx_vfo;
struct rig_state *rs = &rig->state;
rig_debug(RIG_DEBUG_TRACE, "%s: tx_vfo=%s\n", __func__,
rig_strvfo(tx_vfo));
@ -1063,7 +1055,7 @@ static int trxmanager_set_split_vfo(RIG *rig, vfo_t vfo, split_t split,
if (tsplit == split) { return RIG_OK; } // don't need to change it
SNPRINTF(cmd, sizeof(cmd), "SP%c;", split ? '1' : '0');
retval = write_block(&rs->rigport, (unsigned char *) cmd, strlen(cmd));
retval = write_block(RIGPORT(rig), (unsigned char *) cmd, strlen(cmd));
if (retval < 0)
{
@ -1099,13 +1091,12 @@ static int trxmanager_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split,
int n;
char cmd[MAXCMDLEN];
char response[MAXCMDLEN] = "";
struct rig_state *rs = &rig->state;
struct trxmanager_priv_data *priv = (struct trxmanager_priv_data *)
rig->state.priv;
rig_debug(RIG_DEBUG_TRACE, "%s\n", __func__);
SNPRINTF(cmd, sizeof(cmd), "SP;");
retval = write_block(&rs->rigport, (unsigned char *) cmd, strlen(cmd));
retval = write_block(RIGPORT(rig), (unsigned char *) cmd, strlen(cmd));
if (retval < 0)
{
@ -1144,7 +1135,6 @@ static int trxmanager_set_split_freq_mode(RIG *rig, vfo_t vfo, freq_t freq,
int retval;
char cmd[MAXCMDLEN];
char response[MAXCMDLEN] = "";
struct rig_state *rs = &rig->state;
struct trxmanager_priv_data *priv = (struct trxmanager_priv_data *)
rig->state.priv;
@ -1158,7 +1148,7 @@ static int trxmanager_set_split_freq_mode(RIG *rig, vfo_t vfo, freq_t freq,
// assume split is on B
//
SNPRINTF(cmd, sizeof(cmd), "XT%011lu;", (unsigned long)freq);
retval = write_block(&rs->rigport, (unsigned char *) cmd, strlen(cmd));
retval = write_block(RIGPORT(rig), (unsigned char *) cmd, strlen(cmd));
if (retval < 0)
{