Convert rigs/dorji, rigs/drake, rigs/elad.

pull/1508/head
George Baltz N3GB 2024-01-29 09:56:19 -05:00
rodzic 23d5d53248
commit f777179bc8
3 zmienionych plików z 25 dodań i 25 usunięć

Wyświetl plik

@ -52,7 +52,7 @@ struct dra818_priv
static int dra818_response(RIG *rig, const char *expected)
{
char response[80];
int r = read_string(&rig->state.rigport, (unsigned char *) response,
int r = read_string(RIGPORT(rig), (unsigned char *) response,
sizeof(response),
"\n", 1, 0, 1);
@ -114,7 +114,7 @@ static int dra818_setgroup(RIG *rig)
(int)(priv->tx_freq / 1000000), (int)((priv->tx_freq % 1000000) / 100),
(int)(priv->rx_freq / 1000000), (int)((priv->rx_freq % 1000000) / 100),
subtx, priv->sql, subrx);
write_block(&rig->state.rigport, (unsigned char *) cmd, strlen(cmd));
write_block(RIGPORT(rig), (unsigned char *) cmd, strlen(cmd));
return dra818_response(rig, dra818_setgroup_res);
}
@ -125,7 +125,7 @@ static int dra818_setvolume(RIG *rig)
char cmd[80];
SNPRINTF(cmd, sizeof(cmd), "AT+DMOSETVOLUME=%1d\r\n", priv->vol);
write_block(&rig->state.rigport, (unsigned char *) cmd, strlen(cmd));
write_block(RIGPORT(rig), (unsigned char *) cmd, strlen(cmd));
return dra818_response(rig, dra818_setvolume_res);
}
@ -186,7 +186,7 @@ int dra818_open(RIG *rig)
for (i = 0; i < 3; i++)
{
write_block(&rig->state.rigport, (unsigned char *) dra818_handshake_cmd,
write_block(RIGPORT(rig), (unsigned char *) dra818_handshake_cmd,
strlen(dra818_handshake_cmd));
r = dra818_response(rig, dra818_handshake_res);
@ -281,15 +281,16 @@ int dra818_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
int dra818_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd)
{
const struct dra818_priv *priv = rig->state.priv;
hamlib_port_t *rp = RIGPORT(rig);
char cmd[80];
char response[8];
int r;
SNPRINTF(cmd, sizeof(cmd), "S+%03d.%04d\r\n",
(int)(priv->rx_freq / 1000000), (int)((priv->rx_freq % 1000000) / 100));
write_block(&rig->state.rigport, (unsigned char *) cmd, strlen(cmd));
write_block(rp, (unsigned char *) cmd, strlen(cmd));
r = read_string(&rig->state.rigport, (unsigned char *) response,
r = read_string(rp, (unsigned char *) response,
sizeof(response),
"\n", 1, 0, 1);

Wyświetl plik

@ -59,13 +59,11 @@ int drake_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
int *data_len)
{
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(&rs->rigport, (unsigned char *) cmd, cmd_len);
retval = write_block(rp, (unsigned char *) cmd, cmd_len);
if (retval != RIG_OK)
{
@ -78,7 +76,7 @@ int drake_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
return 0;
}
retval = read_string(&rs->rigport, (unsigned char *) data, BUFSZ,
retval = read_string(rp, (unsigned char *) data, BUFSZ,
LF, 1, 0, 1);
if (retval == -RIG_ETIMEOUT)

Wyświetl plik

@ -167,6 +167,7 @@ int elad_transaction(RIG *rig, const char *cmdstr, char *data, size_t datasize)
struct elad_priv_data *priv = rig->state.priv;
const struct elad_priv_caps *caps = elad_caps(rig);
struct rig_state *rs;
hamlib_port_t *rp = RIGPORT(rig);
int retval;
char cmdtrm[2]; /* Default Command/Reply termination char */
char *cmd;
@ -189,7 +190,7 @@ int elad_transaction(RIG *rig, const char *cmdstr, char *data, size_t datasize)
rs->transaction_active = 1;
/* Emulators don't need any post_write_delay */
if (priv->is_emulation) { rs->rigport.post_write_delay = 0; }
if (priv->is_emulation) { rp->post_write_delay = 0; }
cmdtrm[0] = caps->cmdtrm;
cmdtrm[1] = '\0';
@ -220,9 +221,9 @@ transaction_write:
}
/* flush anything in the read buffer before command is sent */
rig_flush(&rs->rigport);
rig_flush(rp);
retval = write_block(&rs->rigport, (unsigned char *) cmd, len);
retval = write_block(rp, (unsigned char *) cmd, len);
free(cmd);
@ -239,7 +240,7 @@ transaction_write:
/* no reply expected so we need to write a command that always
gives a reply so we can read any error replies from the actual
command being sent without blocking */
if (RIG_OK != (retval = write_block(&rs->rigport,
if (RIG_OK != (retval = write_block(rp,
(unsigned char *) priv->verify_cmd, strlen(priv->verify_cmd))))
{
goto transaction_quit;
@ -250,12 +251,12 @@ transaction_read:
/* allow one extra byte for terminator we don't return */
len = min(datasize ? datasize + 1 : strlen(priv->verify_cmd) + 13,
ELAD_MAX_BUF_LEN);
retval = read_string(&rs->rigport, (unsigned char *) buffer, len,
retval = read_string(rp, (unsigned char *) buffer, len,
cmdtrm, strlen(cmdtrm), 0, 1);
if (retval < 0)
{
if (retry_read++ < rs->rigport.retry)
if (retry_read++ < rp->retry)
{
goto transaction_write;
}
@ -269,7 +270,7 @@ transaction_read:
rig_debug(RIG_DEBUG_ERR, "%s: Command is not correctly terminated '%s'\n",
__func__, buffer);
if (retry_read++ < rs->rigport.retry)
if (retry_read++ < rp->retry)
{
goto transaction_write;
}
@ -301,7 +302,7 @@ transaction_read:
rig_debug(RIG_DEBUG_VERBOSE, "%s: Overflow for '%s'\n", __func__, cmdstr);
}
if (retry_read++ < rs->rigport.retry)
if (retry_read++ < rp->retry)
{
goto transaction_write;
}
@ -318,7 +319,7 @@ transaction_read:
cmdstr);
}
if (retry_read++ < rs->rigport.retry)
if (retry_read++ < rp->retry)
{
goto transaction_write;
}
@ -335,7 +336,7 @@ transaction_read:
cmdstr);
}
if (retry_read++ < rs->rigport.retry)
if (retry_read++ < rp->retry)
{
rig_debug(RIG_DEBUG_ERR, "%s: Retrying shortly\n", __func__);
hl_usleep(rig->caps->timeout * 1000);
@ -365,7 +366,7 @@ transaction_read:
rig_debug(RIG_DEBUG_ERR, "%s: Wrong reply %c%c for command %c%c\n",
__func__, buffer[0], buffer[1], cmdstr[0], cmdstr[1]);
if (retry_read++ < rs->rigport.retry)
if (retry_read++ < rp->retry)
{
goto transaction_write;
}
@ -398,7 +399,7 @@ transaction_read:
__func__, buffer[0], buffer[1]
, priv->verify_cmd[0], priv->verify_cmd[1], (int)datasize);
if (retry_read++ < rs->rigport.retry)
if (retry_read++ < rp->retry)
{
goto transaction_write;
}
@ -470,7 +471,7 @@ int elad_safe_transaction(RIG *rig, const char *cmd, char *buf,
hl_usleep(rig->caps->timeout * 1000);
}
}
while (err != RIG_OK && ++retry < rig->state.rigport.retry);
while (err != RIG_OK && ++retry < RIGPORT(rig)->retry);
return err;
}