More Kenwood rigs ported to new access macros.

pull/1455/head
George Baltz N3GB 2023-12-19 10:50:27 -05:00
rodzic 9c7a21282c
commit b38014832f
6 zmienionych plików z 21 dodań i 23 usunięć

Wyświetl plik

@ -74,7 +74,7 @@ int ic10_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
{
int retval;
int retry_cmd = 0;
struct rig_state *rs;
struct hamlib_port *rp = RIGPORT(rig);
if (cmd == NULL)
{
@ -86,12 +86,10 @@ int ic10_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
"%s: called cmd='%s', len=%d, data=%p, data_len=%p\n", __func__, cmd, cmd_len,
data, data_len);
rs = &rig->state;
transaction:
rig_flush(&rs->rigport);
rig_flush(rp);
retval = write_block(&rs->rigport, (unsigned char *) cmd, cmd_len);
retval = write_block(rp, (unsigned char *) cmd, cmd_len);
if (retval != RIG_OK)
{
@ -103,18 +101,18 @@ transaction:
char buffer[50];
const struct kenwood_priv_data *priv = rig->state.priv;
if (RIG_OK != (retval = write_block(&rs->rigport,
if (RIG_OK != (retval = write_block(rp,
(unsigned char *) priv->verify_cmd, strlen(priv->verify_cmd))))
{
return retval;
}
// this should be the ID response
retval = read_string(&rs->rigport, (unsigned char *) buffer, sizeof(buffer),
retval = read_string(rp, (unsigned char *) buffer, sizeof(buffer),
";", 1, 0, 1);
// might be ?; too
if (buffer[0] == '?' && retry_cmd++ < rs->rigport.retry)
if (buffer[0] == '?' && retry_cmd++ < rp->retry)
{
rig_debug(RIG_DEBUG_ERR, "%s: retrying cmd #%d\n", __func__, retry_cmd);
goto transaction;
@ -130,7 +128,7 @@ transaction:
return RIG_OK;
}
retval = read_string(&rs->rigport, (unsigned char *) data, 50, ";", 1, 0, 1);
retval = read_string(rp, (unsigned char *) data, 50, ";", 1, 0, 1);
if (retval == -RIG_ETIMEOUT)
{
@ -158,7 +156,7 @@ static int get_ic10_if(RIG *rig, char *data)
rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__);
for (i = 0; retval != RIG_OK && i < rig->state.rigport.retry; i++)
for (i = 0; retval != RIG_OK && i < RIGPORT(rig)->retry; i++)
{
data_len = 37;
retval = ic10_transaction(rig, "IF;", 3, data, &data_len);

Wyświetl plik

@ -1456,7 +1456,7 @@ static int thd72_get_channel(RIG *rig, vfo_t vfo, channel_t *chan,
static int thd72_get_block(RIG *rig, int block_num, char *block)
{
hamlib_port_t *rp = &rig->state.rigport;
hamlib_port_t *rp = RIGPORT(rig);
char cmd[CMD_SZ] = "R\0\0\0\0";
char resp[CMD_SZ];
int ret;
@ -1518,7 +1518,7 @@ static int thd72_get_block(RIG *rig, int block_num, char *block)
int thd72_get_chan_all_cb(RIG *rig, chan_cb_t chan_cb, rig_ptr_t arg)
{
int i, j, ret;
hamlib_port_t *rp = &rig->state.rigport;
hamlib_port_t *rp = RIGPORT(rig);
channel_t *chan;
chan_t *chan_list = rig->state.chan_list;
int chan_next = chan_list[0].start;

Wyświetl plik

@ -1448,7 +1448,7 @@ int thd74_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq)
static int thd74_get_block(RIG *rig, int block_num, char *block)
{
hamlib_port_t *rp = &rig->state.rigport;
hamlib_port_t *rp = RIGPORT(rig);
char cmd[CMD_SZ] = "R\0\0\0\0";
char resp[CMD_SZ];
int ret;
@ -1510,7 +1510,7 @@ static int thd74_get_block(RIG *rig, int block_num, char *block)
int thd74_get_chan_all_cb(RIG *rig, chan_cb_t chan_cb, rig_ptr_t arg)
{
int i, j, ret;
hamlib_port_t *rp = &rig->state.rigport;
hamlib_port_t *rp = RIGPORT(rig);
channel_t *chan;
chan_t *chan_list = rig->state.chan_list;
int chan_next = chan_list[0].start;

Wyświetl plik

@ -85,9 +85,9 @@ int ts450_open(RIG *rig)
return err;
}
maxtries = rig->state.rigport.retry;
maxtries = RIGPORT(rig)->retry;
/* no retry for this command that may be missing */
rig->state.rigport.retry = 0;
RIGPORT(rig)->retry = 0;
err = kenwood_simple_transaction(rig, "TO", 3);
@ -98,7 +98,7 @@ int ts450_open(RIG *rig)
rig->state.has_get_func &= ~RIG_FUNC_TONE;
}
rig->state.rigport.retry = maxtries;
RIGPORT(rig)->retry = maxtries;
return RIG_OK;
}

Wyświetl plik

@ -429,13 +429,13 @@ static int ts480_read_meters(RIG *rig, int *swr, int *comp, int *alc)
{
int retval;
char *cmd = "RM;";
struct rig_state *rs = &rig->state;
struct hamlib_port *rp = RIGPORT(rig);
char ackbuf[32];
int expected_len = 24;
ENTERFUNC;
retval = write_block(&rs->rigport, (unsigned char *) cmd, strlen(cmd));
retval = write_block(rp, (unsigned char *) cmd, strlen(cmd));
rig_debug(RIG_DEBUG_TRACE, "%s: write_block retval=%d\n", __func__, retval);
@ -446,7 +446,7 @@ static int ts480_read_meters(RIG *rig, int *swr, int *comp, int *alc)
// TS-480 returns values for all meters at the same time, for example: RM10000;RM20000;RM30000;
retval = read_string(&rs->rigport, (unsigned char *) ackbuf, expected_len + 1,
retval = read_string(rp, (unsigned char *) ackbuf, expected_len + 1,
NULL, 0, 0, 1);
rig_debug(RIG_DEBUG_TRACE, "%s: read_string retval=%d\n", __func__, retval);

Wyświetl plik

@ -596,13 +596,13 @@ static int ts590_read_meters(RIG *rig, int *swr, int *comp, int *alc)
{
int retval;
char *cmd = "RM;";
struct rig_state *rs = &rig->state;
struct hamlib_port *rp = RIGPORT(rig);
char ackbuf[32];
int expected_len = 24;
ENTERFUNC;
retval = write_block(&rs->rigport, (unsigned char *) cmd, strlen(cmd));
retval = write_block(rp, (unsigned char *) cmd, strlen(cmd));
rig_debug(RIG_DEBUG_TRACE, "%s: write_block retval=%d\n", __func__, retval);
@ -613,7 +613,7 @@ static int ts590_read_meters(RIG *rig, int *swr, int *comp, int *alc)
// TS-590 returns values for all meters at the same time, for example: RM10000;RM20000;RM30000;
retval = read_string(&rs->rigport, (unsigned char *) ackbuf, expected_len + 1,
retval = read_string(rp, (unsigned char *) ackbuf, expected_len + 1,
NULL, 0, 0, 1);
rig_debug(RIG_DEBUG_TRACE, "%s: read_string retval=%d\n", __func__, retval);