Remove kenwood_simple_cmd as kenwood_transaction has that functionality

Hamlib-3.0
Bill Somerville 2015-02-16 18:16:10 +00:00
rodzic 51b30a8ff2
commit aa9ad54b94
17 zmienionych plików z 153 dodań i 159 usunięć

Wyświetl plik

@ -224,7 +224,7 @@ static int flex6k_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
} }
sprintf(buf, "MD%c", '0' + kmode); sprintf(buf, "MD%c", '0' + kmode);
err = kenwood_simple_cmd(rig, buf); err = kenwood_transaction(rig, buf, NULL, 0);
if (err != RIG_OK) if (err != RIG_OK)
return err; return err;
@ -252,7 +252,7 @@ static int flex6k_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
return -RIG_EINVAL; return -RIG_EINVAL;
} }
err = kenwood_simple_cmd(rig, buf); err = kenwood_transaction(rig, buf, NULL, 0);
if (err != RIG_OK) if (err != RIG_OK)
return err; return err;
return RIG_OK; return RIG_OK;

Wyświetl plik

@ -347,16 +347,16 @@ int k2_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
if (err != RIG_OK) if (err != RIG_OK)
return err; return err;
err = kenwood_simple_cmd(rig, "K22"); err = kenwood_transaction(rig, "K22", NULL, 0);
if (err != RIG_OK) if (err != RIG_OK)
return err; return err;
/* Set the filter slot */ /* Set the filter slot */
err = kenwood_simple_cmd(rig, fcmd); err = kenwood_transaction(rig, fcmd, NULL, 0);
if (err != RIG_OK) if (err != RIG_OK)
return err; return err;
err = kenwood_simple_cmd(rig, "K20"); err = kenwood_transaction(rig, "K20", NULL, 0);
if (err != RIG_OK) if (err != RIG_OK)
return err; return err;
@ -387,7 +387,7 @@ int k2_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
if (err != RIG_OK) if (err != RIG_OK)
return err; return err;
err = kenwood_simple_cmd(rig, "K22"); err = kenwood_transaction(rig, "K22", NULL, 0);
if (err != RIG_OK) if (err != RIG_OK)
return err; return err;
@ -395,7 +395,7 @@ int k2_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
if (err != RIG_OK) if (err != RIG_OK)
return err; return err;
err = kenwood_simple_cmd(rig, "K20"); err = kenwood_transaction(rig, "K20", NULL, 0);
if (err != RIG_OK) if (err != RIG_OK)
return err; return err;
@ -478,7 +478,7 @@ int k2_probe_mdfw(RIG *rig, struct kenwood_priv_data *priv)
/* The K2 extension level has been stored by elecraft_open(). Now set rig /* The K2 extension level has been stored by elecraft_open(). Now set rig
* to K22 for detailed query of mode and filter width values... * to K22 for detailed query of mode and filter width values...
*/ */
err = kenwood_simple_cmd(rig, "K22"); err = kenwood_transaction(rig, "K22", NULL, 0);
if (err != RIG_OK) if (err != RIG_OK)
return err; return err;
@ -503,7 +503,7 @@ int k2_probe_mdfw(RIG *rig, struct kenwood_priv_data *priv)
/* First try to put the K2 into RTTY mode and check if it's available. */ /* First try to put the K2 into RTTY mode and check if it's available. */
priv->k2_md_rtty = 0; /* Assume RTTY module not installed */ priv->k2_md_rtty = 0; /* Assume RTTY module not installed */
err = kenwood_simple_cmd(rig, "MD6"); err = kenwood_transaction(rig, "MD6", NULL, 0);
if (err != RIG_OK && err != -RIG_ERJCTED) if (err != RIG_OK && err != -RIG_ERJCTED)
return err; return err;
if (RIG_OK == err) if (RIG_OK == err)
@ -565,15 +565,15 @@ int k2_mdfw_rest(RIG *rig, const char *mode, const char *fw)
if (strlen(mode) != 3 || strlen(fw) != 7) if (strlen(mode) != 3 || strlen(fw) != 7)
return -RIG_EINVAL; return -RIG_EINVAL;
err = kenwood_simple_cmd(rig, mode); err = kenwood_transaction(rig, mode, NULL, 0);
if (err != RIG_OK) if (err != RIG_OK)
return err; return err;
err = kenwood_simple_cmd(rig, fw); err = kenwood_transaction(rig, fw, NULL, 0);
if (err != RIG_OK) if (err != RIG_OK)
return err; return err;
err = kenwood_simple_cmd(rig, "K20"); err = kenwood_transaction(rig, "K20", NULL, 0);
if (err != RIG_OK) if (err != RIG_OK)
return err; return err;
@ -607,14 +607,14 @@ int k2_pop_fw_lst(RIG *rig, const char *cmd)
return -RIG_EINVAL; return -RIG_EINVAL;
/* Set the mode */ /* Set the mode */
err = kenwood_simple_cmd(rig, cmd); err = kenwood_transaction(rig, cmd, NULL, 0);
if (err != RIG_OK) if (err != RIG_OK)
return err; return err;
for (f = 1; f < 5; f++) { for (f = 1; f < 5; f++) {
snprintf(fcmd, 8, "FW0000%d", f); snprintf(fcmd, 8, "FW0000%d", f);
err = kenwood_simple_cmd(rig, fcmd); err = kenwood_transaction(rig, fcmd, NULL, 0);
if (err != RIG_OK) if (err != RIG_OK)
return err; return err;

Wyświetl plik

@ -401,7 +401,7 @@ int k3_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
width = pb_wid; width = pb_wid;
sprintf(cmd_s, "BW%04ld", width / 10); sprintf(cmd_s, "BW%04ld", width / 10);
err = kenwood_simple_cmd(rig, cmd_s); err = kenwood_transaction(rig, cmd_s, NULL, 0);
if (err != RIG_OK) if (err != RIG_OK)
return err; return err;
@ -411,7 +411,7 @@ int k3_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
if (mode == RIG_MODE_PKTLSB || mode == RIG_MODE_PKTUSB if (mode == RIG_MODE_PKTLSB || mode == RIG_MODE_PKTUSB
|| mode == RIG_MODE_RTTY || mode == RIG_MODE_RTTYR) || mode == RIG_MODE_RTTY || mode == RIG_MODE_RTTYR)
{ {
err = kenwood_simple_cmd(rig, cmd_m); err = kenwood_transaction(rig, cmd_m, NULL, 0);
if (err != RIG_OK) if (err != RIG_OK)
return err; return err;
} }
@ -437,7 +437,7 @@ int k3_set_vfo(RIG *rig, vfo_t vfo)
switch (vfo) { switch (vfo) {
case RIG_VFO_B: case RIG_VFO_B:
err = kenwood_simple_cmd(rig, "SWT11"); err = kenwood_transaction(rig, "SWT11", NULL, 0);
if (err != RIG_OK) if (err != RIG_OK)
return err; return err;
break; break;
@ -473,7 +473,7 @@ int k3_set_ext_level(RIG *rig, vfo_t vfo, token_t token, value_t val)
switch(token) { switch(token) {
case TOK_RIT_CLR: case TOK_RIT_CLR:
/* Clear offset */ /* Clear offset */
err = kenwood_simple_cmd(rig, "RC"); err = kenwood_transaction(rig, "RC", NULL, 0);
if (err != RIG_OK) if (err != RIG_OK)
return err; return err;
@ -634,7 +634,7 @@ int k3_set_split_mode(RIG * rig, vfo_t vfo, rmode_t tx_mode, pbwidth_t tx_width)
} }
sprintf(buf, "MD$%c", '0' + kmode); sprintf(buf, "MD$%c", '0' + kmode);
err = kenwood_simple_cmd(rig, buf); err = kenwood_transaction(rig, buf, NULL, 0);
if (err != RIG_OK) if (err != RIG_OK)
return err; return err;
@ -663,7 +663,7 @@ int k3_set_split_mode(RIG * rig, vfo_t vfo, rmode_t tx_mode, pbwidth_t tx_width)
tx_width = pb_wid; tx_width = pb_wid;
sprintf(cmd_s, "BW$%04ld", tx_width / 10); sprintf(cmd_s, "BW$%04ld", tx_width / 10);
err = kenwood_simple_cmd(rig, cmd_s); err = kenwood_transaction(rig, cmd_s, NULL, 0);
if (err != RIG_OK) if (err != RIG_OK)
return err; return err;
@ -672,7 +672,7 @@ int k3_set_split_mode(RIG * rig, vfo_t vfo, rmode_t tx_mode, pbwidth_t tx_width)
*/ */
if (tx_mode == RIG_MODE_PKTLSB || tx_mode == RIG_MODE_PKTUSB if (tx_mode == RIG_MODE_PKTLSB || tx_mode == RIG_MODE_PKTUSB
|| tx_mode == RIG_MODE_RTTY || tx_mode == RIG_MODE_RTTYR) { || tx_mode == RIG_MODE_RTTY || tx_mode == RIG_MODE_RTTYR) {
err = kenwood_simple_cmd(rig, cmd_m); err = kenwood_transaction(rig, cmd_m, NULL, 0);
if (err != RIG_OK) if (err != RIG_OK)
return err; return err;
} }
@ -869,7 +869,7 @@ int set_rit_xit(RIG *rig, shortfreq_t rit)
if (rit == 0) { if (rit == 0) {
/* Clear offset and return */ /* Clear offset and return */
err = kenwood_simple_cmd(rig, "RC"); err = kenwood_transaction(rig, "RC", NULL, 0);
if (err != RIG_OK) if (err != RIG_OK)
return err; return err;
@ -881,7 +881,7 @@ int set_rit_xit(RIG *rig, shortfreq_t rit)
offs = (rit < 0) ? '-' : '+'; offs = (rit < 0) ? '-' : '+';
snprintf(cmd, 8, "RO%c%04d", offs, abs((int)rit)); snprintf(cmd, 8, "RO%c%04d", offs, abs((int)rit));
err = kenwood_simple_cmd(rig, cmd); err = kenwood_transaction(rig, cmd, NULL, 0);
if (err != RIG_OK) if (err != RIG_OK)
return err; return err;

Wyświetl plik

@ -691,7 +691,7 @@ int kenwood_set_vfo(RIG *rig, vfo_t vfo)
} }
/* set RX VFO */ /* set RX VFO */
retval = kenwood_simple_cmd(rig, cmdbuf); retval = kenwood_transaction(rig, cmdbuf, NULL, 0);
if (retval != RIG_OK) if (retval != RIG_OK)
return retval; return retval;
@ -702,7 +702,7 @@ int kenwood_set_vfo(RIG *rig, vfo_t vfo)
/* set TX VFO */ /* set TX VFO */
cmdbuf[1] = 'T'; cmdbuf[1] = 'T';
return kenwood_simple_cmd(rig, cmdbuf); return kenwood_transaction(rig, cmdbuf, NULL, 0);
} }
@ -735,7 +735,7 @@ int kenwood_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t txvfo)
/* set RX VFO */ /* set RX VFO */
sprintf(cmdbuf, "FR%c", vfo_function); sprintf(cmdbuf, "FR%c", vfo_function);
retval = kenwood_simple_cmd(rig, cmdbuf); retval = kenwood_transaction(rig, cmdbuf, NULL, 0);
if (retval != RIG_OK) if (retval != RIG_OK)
return retval; return retval;
} }
@ -761,7 +761,7 @@ int kenwood_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t txvfo)
} }
/* set TX VFO */ /* set TX VFO */
sprintf(cmdbuf, "FT%c", vfo_function); sprintf(cmdbuf, "FT%c", vfo_function);
retval = kenwood_simple_cmd(rig, cmdbuf); retval = kenwood_transaction(rig, cmdbuf, NULL, 0);
if (retval != RIG_OK) if (retval != RIG_OK)
return retval; return retval;
@ -788,7 +788,7 @@ int kenwood_set_split(RIG *rig, vfo_t vfo, split_t split, vfo_t txvfo)
int retval; int retval;
sprintf(cmdbuf, "SP%c", RIG_SPLIT_ON == split ? '1' : '0'); sprintf(cmdbuf, "SP%c", RIG_SPLIT_ON == split ? '1' : '0');
retval = kenwood_simple_cmd(rig, cmdbuf); retval = kenwood_transaction(rig, cmdbuf, NULL, 0);
if (retval != RIG_OK) if (retval != RIG_OK)
return retval; return retval;
@ -933,7 +933,7 @@ int kenwood_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
} }
sprintf(freqbuf, "F%c%011ld", vfo_letter, (long)freq); sprintf(freqbuf, "F%c%011ld", vfo_letter, (long)freq);
int err = kenwood_simple_cmd(rig, freqbuf); int err = kenwood_transaction(rig, freqbuf, NULL, 0);
struct kenwood_priv_data * priv = rig->state.priv; struct kenwood_priv_data * priv = rig->state.priv;
if (RIG_OK == err && RIG_MODEL_TS590S == rig->caps->rig_model && priv->fw_rev_uint <= 107 && ('A' == vfo_letter || 'B' == vfo_letter)) if (RIG_OK == err && RIG_MODEL_TS590S == rig->caps->rig_model && priv->fw_rev_uint <= 107 && ('A' == vfo_letter || 'B' == vfo_letter))
@ -967,7 +967,7 @@ int kenwood_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
{ {
return err; return err;
} }
err = kenwood_simple_cmd (rig, freqbuf); err = kenwood_transaction (rig, freqbuf, NULL, 0);
} }
} }
@ -1078,17 +1078,17 @@ int kenwood_set_rit(RIG * rig, vfo_t vfo, shortfreq_t rit)
int retval, i; int retval, i;
if (rit == 0) if (rit == 0)
return kenwood_simple_cmd(rig, "RC"); return kenwood_transaction(rig, "RC", NULL, 0);
sprintf(buf, "R%c", (rit > 0) ? 'U' : 'D'); sprintf(buf, "R%c", (rit > 0) ? 'U' : 'D');
retval = kenwood_simple_cmd(rig, "RC"); retval = kenwood_transaction(rig, "RC", NULL, 0);
if (retval != RIG_OK) if (retval != RIG_OK)
return retval; return retval;
for (i = 0; i < abs(rint(rit/10)); i++) for (i = 0; i < abs(rint(rit/10)); i++)
retval = kenwood_simple_cmd(rig, buf); retval = kenwood_transaction(rig, buf, NULL, 0);
return retval; return retval;
} }
@ -1122,7 +1122,7 @@ int kenwood_scan(RIG *rig, vfo_t vfo, scan_t scan, int ch)
if (!rig) if (!rig)
return -RIG_EINVAL; return -RIG_EINVAL;
return kenwood_simple_cmd(rig, scan == RIG_SCAN_STOP ? "SC0" : "SC1"); return kenwood_transaction(rig, scan == RIG_SCAN_STOP ? "SC0" : "SC1", NULL, 0);
} }
/* /*
@ -1156,7 +1156,7 @@ static int kenwood_set_filter(RIG *rig, pbwidth_t width)
else else
cmd = "FL002002"; cmd = "FL002002";
return kenwood_simple_cmd(rig, cmd); return kenwood_transaction(rig, cmd, NULL, 0);
} }
/* /*
@ -1208,7 +1208,7 @@ int kenwood_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
} }
sprintf(buf, "MD%c", '0' + kmode); sprintf(buf, "MD%c", '0' + kmode);
err = kenwood_simple_cmd(rig, buf); err = kenwood_transaction(rig, buf, NULL, 0);
if (err != RIG_OK) if (err != RIG_OK)
return err; return err;
@ -1217,7 +1217,7 @@ int kenwood_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
{ {
/* supports DATA sub modes - see above */ /* supports DATA sub modes - see above */
sprintf (buf, "DA%c", data_mode); sprintf (buf, "DA%c", data_mode);
int retval = kenwood_simple_cmd (rig, buf); int retval = kenwood_transaction (rig, buf, NULL, 0);
if (RIG_OK != retval) if (RIG_OK != retval)
{ {
return retval; return retval;
@ -1466,7 +1466,7 @@ int kenwood_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
return -RIG_EINVAL; return -RIG_EINVAL;
} }
return kenwood_simple_cmd(rig, levelbuf); return kenwood_transaction(rig, levelbuf, NULL, 0);
} }
int get_kenwood_level(RIG *rig, const char *cmd, int cmd_len, float *f) int get_kenwood_level(RIG *rig, const char *cmd, int cmd_len, float *f)
@ -1667,59 +1667,59 @@ int kenwood_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
switch (func) { switch (func) {
case RIG_FUNC_NB: case RIG_FUNC_NB:
sprintf(buf, "NB%c", (status == 0) ? '0' : '1'); sprintf(buf, "NB%c", (status == 0) ? '0' : '1');
return kenwood_simple_cmd(rig, buf); return kenwood_transaction(rig, buf, NULL, 0);
case RIG_FUNC_ABM: case RIG_FUNC_ABM:
sprintf(buf, "AM%c", (status == 0) ? '0' : '1'); sprintf(buf, "AM%c", (status == 0) ? '0' : '1');
return kenwood_simple_cmd(rig, buf); return kenwood_transaction(rig, buf, NULL, 0);
case RIG_FUNC_COMP: case RIG_FUNC_COMP:
sprintf(buf, "PR%c", (status == 0) ? '0' : '1'); sprintf(buf, "PR%c", (status == 0) ? '0' : '1');
return kenwood_simple_cmd(rig, buf); return kenwood_transaction(rig, buf, NULL, 0);
case RIG_FUNC_TONE: case RIG_FUNC_TONE:
sprintf(buf, "TO%c", (status == 0) ? '0' : '1'); sprintf(buf, "TO%c", (status == 0) ? '0' : '1');
return kenwood_simple_cmd(rig, buf); return kenwood_transaction(rig, buf, NULL, 0);
case RIG_FUNC_TSQL: case RIG_FUNC_TSQL:
sprintf(buf, "CT%c", (status == 0) ? '0' : '1'); sprintf(buf, "CT%c", (status == 0) ? '0' : '1');
return kenwood_simple_cmd(rig, buf); return kenwood_transaction(rig, buf, NULL, 0);
case RIG_FUNC_VOX: case RIG_FUNC_VOX:
sprintf(buf, "VX%c", (status == 0) ? '0' : '1'); sprintf(buf, "VX%c", (status == 0) ? '0' : '1');
return kenwood_simple_cmd(rig, buf); return kenwood_transaction(rig, buf, NULL, 0);
case RIG_FUNC_FAGC: case RIG_FUNC_FAGC:
sprintf(buf, "GT00%c", (status == 0) ? '4' : '2'); sprintf(buf, "GT00%c", (status == 0) ? '4' : '2');
return kenwood_simple_cmd(rig, buf); return kenwood_transaction(rig, buf, NULL, 0);
case RIG_FUNC_NR: case RIG_FUNC_NR:
sprintf(buf, "NR%c", (status == 0) ? '0' : '1'); sprintf(buf, "NR%c", (status == 0) ? '0' : '1');
return kenwood_simple_cmd(rig, buf); return kenwood_transaction(rig, buf, NULL, 0);
case RIG_FUNC_BC: case RIG_FUNC_BC:
sprintf(buf, "BC%c", (status == 0) ? '0' : '1'); sprintf(buf, "BC%c", (status == 0) ? '0' : '1');
return kenwood_simple_cmd(rig, buf); return kenwood_transaction(rig, buf, NULL, 0);
case RIG_FUNC_ANF: case RIG_FUNC_ANF:
sprintf(buf, "NT%c", (status == 0) ? '0' : '1'); sprintf(buf, "NT%c", (status == 0) ? '0' : '1');
return kenwood_simple_cmd(rig, buf); return kenwood_transaction(rig, buf, NULL, 0);
case RIG_FUNC_LOCK: case RIG_FUNC_LOCK:
sprintf(buf, "LK%c", (status == 0) ? '0' : '1'); sprintf(buf, "LK%c", (status == 0) ? '0' : '1');
return kenwood_simple_cmd(rig, buf); return kenwood_transaction(rig, buf, NULL, 0);
case RIG_FUNC_AIP: case RIG_FUNC_AIP:
sprintf(buf, "MX%c", (status == 0) ? '0' : '1'); sprintf(buf, "MX%c", (status == 0) ? '0' : '1');
return kenwood_simple_cmd(rig, buf); return kenwood_transaction(rig, buf, NULL, 0);
case RIG_FUNC_RIT: case RIG_FUNC_RIT:
sprintf(buf, "RT%c", (status == 0) ? '0' : '1'); sprintf(buf, "RT%c", (status == 0) ? '0' : '1');
return kenwood_simple_cmd(rig, buf); return kenwood_transaction(rig, buf, NULL, 0);
case RIG_FUNC_XIT: case RIG_FUNC_XIT:
sprintf(buf, "XT%c", (status == 0) ? '0' : '1'); sprintf(buf, "XT%c", (status == 0) ? '0' : '1');
return kenwood_simple_cmd(rig, buf); return kenwood_transaction(rig, buf, NULL, 0);
default: default:
rig_debug(RIG_DEBUG_ERR, "Unsupported set_func %#x", func); rig_debug(RIG_DEBUG_ERR, "Unsupported set_func %#x", func);
@ -1847,7 +1847,7 @@ int kenwood_set_ctcss_tone(RIG *rig, vfo_t vfo, tone_t tone)
/* TODO: replace menu no 57 by a define */ /* TODO: replace menu no 57 by a define */
sprintf(tonebuf, "EX%03d%04d", 57, i+1); sprintf(tonebuf, "EX%03d%04d", 57, i+1);
return kenwood_simple_cmd(rig, tonebuf); return kenwood_transaction(rig, tonebuf, NULL, 0);
} }
int kenwood_set_ctcss_tone_tn(RIG *rig, vfo_t vfo, tone_t tone) int kenwood_set_ctcss_tone_tn(RIG *rig, vfo_t vfo, tone_t tone)
@ -1872,7 +1872,7 @@ int kenwood_set_ctcss_tone_tn(RIG *rig, vfo_t vfo, tone_t tone)
sprintf(buf, "TN%02d", i + 1); sprintf(buf, "TN%02d", i + 1);
return kenwood_simple_cmd(rig, buf); return kenwood_transaction(rig, buf, NULL, 0);
} }
/* /*
@ -1943,7 +1943,7 @@ int kenwood_set_ctcss_sql(RIG *rig, vfo_t vfo, tone_t tone)
sprintf(buf, "CN%02d", i + 1); sprintf(buf, "CN%02d", i + 1);
return kenwood_simple_cmd(rig, buf); return kenwood_transaction(rig, buf, NULL, 0);
} }
int kenwood_get_ctcss_sql(RIG *rig, vfo_t vfo, tone_t *tone) int kenwood_get_ctcss_sql(RIG *rig, vfo_t vfo, tone_t *tone)
@ -2044,7 +2044,7 @@ int kenwood_set_ant_no_ack(RIG * rig, vfo_t vfo, ant_t ant)
return -RIG_EINVAL; return -RIG_EINVAL;
} }
return kenwood_simple_cmd(rig, cmd); return kenwood_transaction(rig, cmd, NULL, 0);
} }
/* /*
@ -2112,7 +2112,7 @@ int kenwood_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
case RIG_PTT_OFF: ptt_cmd = "RX"; break; case RIG_PTT_OFF: ptt_cmd = "RX"; break;
default: return -RIG_EINVAL; default: return -RIG_EINVAL;
} }
return kenwood_simple_cmd(rig, ptt_cmd); return kenwood_transaction(rig, ptt_cmd, NULL, 0);
} }
int kenwood_set_ptt_safe(RIG *rig, vfo_t vfo, ptt_t ptt) int kenwood_set_ptt_safe(RIG *rig, vfo_t vfo, ptt_t ptt)
@ -2132,8 +2132,8 @@ int kenwood_set_ptt_safe(RIG *rig, vfo_t vfo, ptt_t ptt)
if (current_ptt == ptt) if (current_ptt == ptt)
return RIG_OK; return RIG_OK;
return kenwood_simple_cmd(rig, return kenwood_transaction(rig,
(ptt == RIG_PTT_ON) ? "TX" : "RX"); (ptt == RIG_PTT_ON) ? "TX" : "RX", NULL, 0);
} }
@ -2262,7 +2262,7 @@ int kenwood_reset(RIG *rig, reset_t reset)
sprintf(rstbuf, "SR%c", rst); sprintf(rstbuf, "SR%c", rst);
/* this command has no answer */ /* this command has no answer */
return kenwood_simple_cmd(rig, rstbuf); return kenwood_transaction(rig, rstbuf, NULL, 0);
} }
/* /*
@ -2298,7 +2298,7 @@ int kenwood_send_morse(RIG *rig, vfo_t vfo, const char *msg)
/* the command must consist of 28 bytes */ /* the command must consist of 28 bytes */
sprintf(morsebuf, "KY %-24s", m2); sprintf(morsebuf, "KY %-24s", m2);
retval = kenwood_simple_cmd(rig, morsebuf); retval = kenwood_transaction(rig, morsebuf, NULL, 0);
if (retval != RIG_OK) if (retval != RIG_OK)
return retval; return retval;
@ -2321,16 +2321,16 @@ int kenwood_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op)
switch(op) { switch(op) {
case RIG_OP_UP: case RIG_OP_UP:
return kenwood_simple_cmd(rig, "UP"); return kenwood_transaction(rig, "UP", NULL, 0);
case RIG_OP_DOWN: case RIG_OP_DOWN:
return kenwood_simple_cmd(rig, "DN"); return kenwood_transaction(rig, "DN", NULL, 0);
case RIG_OP_BAND_UP: case RIG_OP_BAND_UP:
return kenwood_simple_cmd(rig, "BU"); return kenwood_transaction(rig, "BU", NULL, 0);
case RIG_OP_BAND_DOWN: case RIG_OP_BAND_DOWN:
return kenwood_simple_cmd(rig, "BD"); return kenwood_transaction(rig, "BD", NULL, 0);
default: default:
rig_debug(RIG_DEBUG_ERR, "%s: unsupported op %#x\n", rig_debug(RIG_DEBUG_ERR, "%s: unsupported op %#x\n",
@ -2357,7 +2357,7 @@ int kenwood_set_mem(RIG *rig, vfo_t vfo, int ch)
*/ */
sprintf(buf, "MC %02d", ch); sprintf(buf, "MC %02d", ch);
return kenwood_simple_cmd(rig, buf); return kenwood_transaction(rig, buf, NULL, 0);
} }
/* /*
@ -2558,7 +2558,7 @@ int kenwood_set_channel(RIG *rig, const channel_t *chan)
chan->ctcss_tone ? '1' : '0', chan->ctcss_tone ? '1' : '0',
chan->ctcss_tone ? (tone + 1) : 0); chan->ctcss_tone ? (tone + 1) : 0);
err = kenwood_simple_cmd(rig, buf); err = kenwood_transaction(rig, buf, NULL, 0);
if (err != RIG_OK) if (err != RIG_OK)
return err; return err;
@ -2571,7 +2571,7 @@ int kenwood_set_channel(RIG *rig, const channel_t *chan)
chan->ctcss_tone ? '1' : '0', chan->ctcss_tone ? '1' : '0',
chan->ctcss_tone ? (tone + 1) : 0); chan->ctcss_tone ? (tone + 1) : 0);
return kenwood_simple_cmd(rig, buf); return kenwood_transaction(rig, buf, NULL, 0);
} }
int kenwood_set_ext_parm(RIG *rig, token_t token, value_t val) int kenwood_set_ext_parm(RIG *rig, token_t token, value_t val)
@ -2585,19 +2585,19 @@ int kenwood_set_ext_parm(RIG *rig, token_t token, value_t val)
switch (token) { switch (token) {
case TOK_VOICE: case TOK_VOICE:
return kenwood_simple_cmd(rig, "VR"); return kenwood_transaction(rig, "VR", NULL, 0);
case TOK_FINE: case TOK_FINE:
sprintf(buf, "FS%c", (val.i == 0) ? '0' : '1'); sprintf(buf, "FS%c", (val.i == 0) ? '0' : '1');
return kenwood_simple_cmd(rig, buf); return kenwood_transaction(rig, buf, NULL, 0);
case TOK_XIT: case TOK_XIT:
sprintf(buf, "XT%c", (val.i == 0) ? '0' : '1'); sprintf(buf, "XT%c", (val.i == 0) ? '0' : '1');
return kenwood_simple_cmd(rig, buf); return kenwood_transaction(rig, buf, NULL, 0);
case TOK_RIT: case TOK_RIT:
sprintf(buf, "RT%c", (val.i == 0) ? '0' : '1'); sprintf(buf, "RT%c", (val.i == 0) ? '0' : '1');
return kenwood_simple_cmd(rig, buf); return kenwood_transaction(rig, buf, NULL, 0);
} }
return -RIG_EINVAL; return -RIG_EINVAL;

Wyświetl plik

@ -203,10 +203,4 @@ static int inline kenwood_simple_transaction(RIG *rig, const char *cmd, size_t e
return kenwood_safe_transaction(rig, cmd, priv->info, KENWOOD_MAX_BUF_LEN, expected); return kenwood_safe_transaction(rig, cmd, priv->info, KENWOOD_MAX_BUF_LEN, expected);
} }
/* no answer needed at all */
static int inline kenwood_simple_cmd(RIG *rig, const char *cmd)
{
return kenwood_safe_transaction(rig, cmd, NULL, 0, 0);
}
#endif /* _KENWOOD_H */ #endif /* _KENWOOD_H */

Wyświetl plik

@ -197,7 +197,7 @@ th_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
freq_sent = freq_sent >= MHz(470) ? (round(freq_sent/10000)*10000) : freq_sent; freq_sent = freq_sent >= MHz(470) ? (round(freq_sent/10000)*10000) : freq_sent;
sprintf(buf, "FQ %011"PRIll",%X", (int64_t) freq_sent, step); sprintf(buf, "FQ %011"PRIll",%X", (int64_t) freq_sent, step);
return kenwood_simple_cmd(rig, buf); return kenwood_transaction(rig, buf, NULL, 0);
} }
/* /*
@ -270,7 +270,7 @@ th_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
sprintf(mdbuf, "MD %c", kmode); sprintf(mdbuf, "MD %c", kmode);
retval = kenwood_simple_cmd(rig, mdbuf); retval = kenwood_transaction(rig, mdbuf, NULL, 0);
if (retval != RIG_OK) if (retval != RIG_OK)
return retval; return retval;
@ -403,7 +403,7 @@ th_set_vfo(RIG *rig, vfo_t vfo)
return kenwood_wrong_vfo(__func__, vfo); return kenwood_wrong_vfo(__func__, vfo);
} }
return kenwood_simple_cmd(rig, cmd); return kenwood_transaction(rig, cmd, NULL, 0);
} }
int int
@ -545,7 +545,7 @@ int tm_set_vfo_bc2 (RIG *rig, vfo_t vfo)
} }
sprintf(vfobuf, "VMC %d,%d", vfonum, vfomode); sprintf(vfobuf, "VMC %d,%d", vfonum, vfomode);
retval = kenwood_simple_cmd(rig, vfobuf); retval = kenwood_transaction(rig, vfobuf, NULL, 0);
if (retval != RIG_OK) if (retval != RIG_OK)
return retval; return retval;
@ -553,7 +553,7 @@ int tm_set_vfo_bc2 (RIG *rig, vfo_t vfo)
return RIG_OK; return RIG_OK;
sprintf(vfobuf, "BC %d,%d", vfonum, txvfonum); sprintf(vfobuf, "BC %d,%d", vfonum, txvfonum);
retval = kenwood_simple_cmd(rig, vfobuf); retval = kenwood_transaction(rig, vfobuf, NULL, 0);
if (retval != RIG_OK) if (retval != RIG_OK)
return retval; return retval;
@ -596,12 +596,12 @@ int th_set_split_vfo (RIG *rig, vfo_t vfo, split_t split, vfo_t txvfo)
/* Set VFO mode. To be done for TX vfo also? */ /* Set VFO mode. To be done for TX vfo also? */
sprintf(vfobuf, "VMC %d,0", vfonum); sprintf(vfobuf, "VMC %d,0", vfonum);
retval = kenwood_simple_cmd(rig, vfobuf); retval = kenwood_transaction(rig, vfobuf, NULL, 0);
if (retval != RIG_OK) if (retval != RIG_OK)
return retval; return retval;
sprintf(vfobuf, "BC %d,%d", vfonum, txvfonum); sprintf(vfobuf, "BC %d,%d", vfonum, txvfonum);
retval = kenwood_simple_cmd(rig, vfobuf); retval = kenwood_transaction(rig, vfobuf, NULL, 0);
if (retval != RIG_OK) if (retval != RIG_OK)
return retval; return retval;
@ -649,7 +649,7 @@ int th_get_split_vfo (RIG *rig, vfo_t vfo, split_t *split, vfo_t *txvfo)
int int
th_set_trn(RIG *rig, int trn) th_set_trn(RIG *rig, int trn)
{ {
return kenwood_simple_cmd(rig, (trn == RIG_TRN_RIG) ? "AI 1" : "AI 0"); return kenwood_transaction(rig, (trn == RIG_TRN_RIG) ? "AI 1" : "AI 0", NULL, 0);
} }
/* /*
@ -743,7 +743,7 @@ th_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status)
static int th_tburst(RIG *rig, vfo_t vfo, int status) static int th_tburst(RIG *rig, vfo_t vfo, int status)
{ {
return kenwood_simple_cmd(rig, (status == 1) ? "TT" : "RX"); return kenwood_transaction(rig, (status == 1) ? "TT" : "RX", NULL, 0);
} }
/* /*
@ -762,7 +762,7 @@ static int th_set_kenwood_func(RIG *rig, const char *cmd, int status)
buf[BUFSZ-1] = '\0'; buf[BUFSZ-1] = '\0';
strncat(buf, status ? " 1" : " 0", BUFSZ-1); strncat(buf, status ? " 1" : " 0", BUFSZ-1);
return kenwood_simple_cmd(rig, buf); return kenwood_transaction(rig, buf, NULL, 0);
} }
@ -897,12 +897,12 @@ th_set_parm(RIG *rig, setting_t parm, value_t val)
case RIG_PARM_APO: case RIG_PARM_APO:
if (val.i > 30) if (val.i > 30)
return kenwood_simple_cmd(rig, "APO 2"); return kenwood_transaction(rig, "APO 2", NULL, 0);
else if (val.i > 0) else if (val.i > 0)
return kenwood_simple_cmd(rig, "APO 1"); return kenwood_transaction(rig, "APO 1", NULL, 0);
else else
return kenwood_simple_cmd(rig, "APO 0"); return kenwood_transaction(rig, "APO 0", NULL, 0);
default: default:
rig_debug(RIG_DEBUG_ERR, "%s: Unsupported parm %#x\n", __func__, parm); rig_debug(RIG_DEBUG_ERR, "%s: Unsupported parm %#x\n", __func__, parm);
return -RIG_EINVAL; return -RIG_EINVAL;
@ -1084,29 +1084,29 @@ int th_set_level (RIG *rig, vfo_t vfo, setting_t level, value_t val)
(int)(val.f*(rig->caps->level_gran[LVL_RFPOWER].max.i - rig->caps->level_gran[LVL_RFPOWER].min.i)) (int)(val.f*(rig->caps->level_gran[LVL_RFPOWER].max.i - rig->caps->level_gran[LVL_RFPOWER].min.i))
+ rig->caps->level_gran[LVL_RFPOWER].min.i); + rig->caps->level_gran[LVL_RFPOWER].min.i);
return kenwood_simple_cmd(rig, buf); return kenwood_transaction(rig, buf, NULL, 0);
case RIG_LEVEL_SQL : case RIG_LEVEL_SQL :
sprintf(buf, "SQ %c,%02x", vch, sprintf(buf, "SQ %c,%02x", vch,
(int)(val.f*(rig->caps->level_gran[LVL_SQL].max.i-rig->caps->level_gran[LVL_SQL].min.i)) (int)(val.f*(rig->caps->level_gran[LVL_SQL].max.i-rig->caps->level_gran[LVL_SQL].min.i))
+ rig->caps->level_gran[LVL_SQL].min.i); + rig->caps->level_gran[LVL_SQL].min.i);
return kenwood_simple_cmd(rig, buf); return kenwood_transaction(rig, buf, NULL, 0);
case RIG_LEVEL_AF : case RIG_LEVEL_AF :
sprintf(buf, "AG %c,%02x", vch, (int)(val.f * 32.0)); sprintf(buf, "AG %c,%02x", vch, (int)(val.f * 32.0));
return kenwood_simple_cmd(rig, buf); return kenwood_transaction(rig, buf, NULL, 0);
case RIG_LEVEL_ATT : case RIG_LEVEL_ATT :
sprintf(buf, "ATT %c", val.i ? '1' : '0'); sprintf(buf, "ATT %c", val.i ? '1' : '0');
return kenwood_simple_cmd(rig, buf); return kenwood_transaction(rig, buf, NULL, 0);
case RIG_LEVEL_BALANCE : case RIG_LEVEL_BALANCE :
sprintf(buf, "BAL %c", '4' - (int) (val.f * ('4'-'0'))); sprintf(buf, "BAL %c", '4' - (int) (val.f * ('4'-'0')));
return kenwood_simple_cmd(rig, buf); return kenwood_transaction(rig, buf, NULL, 0);
case RIG_LEVEL_VOXGAIN: case RIG_LEVEL_VOXGAIN:
sprintf(buf, "VXG %d", (int) (val.f * 9)); sprintf(buf, "VXG %d", (int) (val.f * 9));
return kenwood_simple_cmd(rig, buf); return kenwood_transaction(rig, buf, NULL, 0);
case RIG_LEVEL_VOXDELAY: /* "VXD" */ case RIG_LEVEL_VOXDELAY: /* "VXD" */
return -RIG_ENIMPL; return -RIG_ENIMPL;
@ -1284,7 +1284,7 @@ th_set_dcs_sql(RIG *rig, vfo_t vfo, tone_t code)
caps = rig->caps; caps = rig->caps;
if (code == 0) { if (code == 0) {
return kenwood_simple_cmd(rig, "DCS 0"); return kenwood_transaction(rig, "DCS 0", NULL, 0);
} }
for (i = 0; caps->dcs_list[i] != 0 && i < RIG_CODEMAX; i++) { for (i = 0; caps->dcs_list[i] != 0 && i < RIG_CODEMAX; i++) {
@ -1295,12 +1295,12 @@ th_set_dcs_sql(RIG *rig, vfo_t vfo, tone_t code)
if (caps->dcs_list[i] != code) if (caps->dcs_list[i] != code)
return -RIG_EINVAL; return -RIG_EINVAL;
retval = kenwood_simple_cmd(rig, "DCS 1"); retval = kenwood_transaction(rig, "DCS 1", NULL, 0);
if (retval != RIG_OK) if (retval != RIG_OK)
return retval; return retval;
sprintf(codebuf, "DCSN %04d", (i+1)*10); sprintf(codebuf, "DCSN %04d", (i+1)*10);
retval = kenwood_simple_cmd(rig, codebuf); retval = kenwood_transaction(rig, codebuf, NULL, 0);
if (retval != RIG_OK) if (retval != RIG_OK)
return retval; return retval;
@ -1485,7 +1485,7 @@ th_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
{ {
rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__); rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__);
return kenwood_simple_cmd(rig, (ptt == RIG_PTT_ON) ? "TX" : "RX"); return kenwood_transaction(rig, (ptt == RIG_PTT_ON) ? "TX" : "RX", NULL, 0);
} }
int th_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd) int th_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd)
@ -1542,13 +1542,13 @@ int th_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op)
switch (op) { switch (op) {
case RIG_OP_UP: case RIG_OP_UP:
return kenwood_simple_cmd(rig, "UP"); return kenwood_transaction(rig, "UP", NULL, 0);
case RIG_OP_DOWN: case RIG_OP_DOWN:
return kenwood_simple_cmd(rig, "DW"); return kenwood_transaction(rig, "DW", NULL, 0);
case RIG_OP_TO_VFO: case RIG_OP_TO_VFO:
return kenwood_simple_cmd(rig, "MSH"); return kenwood_transaction(rig, "MSH", NULL, 0);
default: default:
return -RIG_EINVAL; return -RIG_EINVAL;
@ -2012,7 +2012,7 @@ int th_set_ant(RIG * rig, vfo_t vfo, ant_t ant)
return -RIG_EINVAL; return -RIG_EINVAL;
} }
return kenwood_simple_cmd(rig, cmd); return kenwood_transaction(rig, cmd, NULL, 0);
} }
@ -2046,10 +2046,10 @@ int th_reset(RIG *rig, reset_t reset)
{ {
switch(reset) { switch(reset) {
case RIG_RESET_VFO: case RIG_RESET_VFO:
return kenwood_simple_cmd(rig, "SR 1"); return kenwood_transaction(rig, "SR 1", NULL, 0);
case RIG_RESET_MASTER: case RIG_RESET_MASTER:
return kenwood_simple_cmd(rig, "SR 3"); return kenwood_transaction(rig, "SR 3", NULL, 0);
default: default:
rig_debug(RIG_DEBUG_ERR, "%s: unsupported reset %d\n", rig_debug(RIG_DEBUG_ERR, "%s: unsupported reset %d\n",

Wyświetl plik

@ -183,9 +183,9 @@ int thd72_open(RIG *rig)
{ {
int ret; int ret;
kenwood_simple_cmd(rig, ""); kenwood_transaction(rig, "", NULL, 0);
ret = kenwood_simple_cmd(rig, "TC1"); ret = kenwood_transaction(rig, "TC1", NULL, 0);
if (ret != RIG_OK) if (ret != RIG_OK)
return ret; return ret;
@ -247,7 +247,7 @@ int thd72_get_chan_all_cb (RIG * rig, chan_cb_t chan_cb, rig_ptr_t arg)
char block[BLOCK_SZ]; char block[BLOCK_SZ];
char resp[CMD_SZ]; char resp[CMD_SZ];
ret = kenwood_simple_cmd(rig, "0M PROGRAM"); ret = kenwood_transaction(rig, "0M PROGRAM", NULL, 0);
if (ret != RIG_OK) if (ret != RIG_OK)
return ret; return ret;

Wyświetl plik

@ -337,16 +337,16 @@ int thf6a_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op)
switch(op) { switch(op) {
case RIG_OP_UP: case RIG_OP_UP:
return kenwood_simple_cmd(rig, "UP"); return kenwood_transaction(rig, "UP", NULL, 0);
case RIG_OP_DOWN: case RIG_OP_DOWN:
return kenwood_simple_cmd(rig, "DW"); return kenwood_transaction(rig, "DW", NULL, 0);
/* Not implemented! /* Not implemented!
case RIG_OP_BAND_UP: case RIG_OP_BAND_UP:
return kenwood_simple_cmd(rig, "BU"); return kenwood_transaction(rig, "BU", NULL, 0);
case RIG_OP_BAND_DOWN: case RIG_OP_BAND_DOWN:
return kenwood_simple_cmd(rig, "BD"); return kenwood_transaction(rig, "BD", NULL, 0);
*/ */
default: default:
rig_debug(RIG_DEBUG_ERR, "%s: unsupported op %#x\n", rig_debug(RIG_DEBUG_ERR, "%s: unsupported op %#x\n",

Wyświetl plik

@ -331,16 +331,16 @@ int thf7e_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op)
switch(op) { switch(op) {
case RIG_OP_UP: case RIG_OP_UP:
return kenwood_simple_cmd(rig, "UP"); return kenwood_transaction(rig, "UP", NULL, 0);
case RIG_OP_DOWN: case RIG_OP_DOWN:
return kenwood_simple_cmd(rig, "DW"); return kenwood_transaction(rig, "DW", NULL, 0);
/* Not implemented! /* Not implemented!
case RIG_OP_BAND_UP: case RIG_OP_BAND_UP:
return kenwood_simple_cmd(rig, "BU"); return kenwood_transaction(rig, "BU", NULL, 0);
case RIG_OP_BAND_DOWN: case RIG_OP_BAND_DOWN:
return kenwood_simple_cmd(rig, "BD"); return kenwood_transaction(rig, "BD", NULL, 0);
*/ */
default: default:
rig_debug(RIG_DEBUG_ERR, "%s: unsupported op %#x\n", rig_debug(RIG_DEBUG_ERR, "%s: unsupported op %#x\n",

Wyświetl plik

@ -940,7 +940,7 @@ int tmd710_set_vfo (RIG *rig, vfo_t vfo)
} }
snprintf(vfobuf,9, "VM %d,%d", vfonum, vfomode); snprintf(vfobuf,9, "VM %d,%d", vfonum, vfomode);
retval = kenwood_simple_cmd(rig, vfobuf); retval = kenwood_transaction(rig, vfobuf, NULL, 0);
if (retval != RIG_OK) if (retval != RIG_OK)
return retval; return retval;
@ -948,7 +948,7 @@ int tmd710_set_vfo (RIG *rig, vfo_t vfo)
return RIG_OK; return RIG_OK;
snprintf(vfobuf, 15, "BC %d,%d", vfonum, txvfonum); snprintf(vfobuf, 15, "BC %d,%d", vfonum, txvfonum);
retval = kenwood_simple_cmd(rig, vfobuf); retval = kenwood_transaction(rig, vfobuf, NULL, 0);
if (retval != RIG_OK) if (retval != RIG_OK)
return retval; return retval;

Wyświetl plik

@ -219,24 +219,24 @@ int transfox_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
case RIG_LEVEL_ATT: case RIG_LEVEL_ATT:
if (val.i == 0) { if (val.i == 0) {
ret = kenwood_simple_cmd(rig, "C30"); ret = kenwood_transaction(rig, "C30", NULL, 0);
if (ret != RIG_OK) if (ret != RIG_OK)
return ret; return ret;
ret = kenwood_simple_cmd(rig, "C20"); ret = kenwood_transaction(rig, "C20", NULL, 0);
if (ret != RIG_OK) if (ret != RIG_OK)
return ret; return ret;
} else if (val.i == 10) { } else if (val.i == 10) {
ret = kenwood_simple_cmd(rig, "C30"); ret = kenwood_transaction(rig, "C30", NULL, 0);
if (ret != RIG_OK) if (ret != RIG_OK)
return ret; return ret;
ret = kenwood_simple_cmd(rig, "C21"); ret = kenwood_transaction(rig, "C21", NULL, 0);
if (ret != RIG_OK) if (ret != RIG_OK)
return ret; return ret;
} else if (val.i == 20) { } else if (val.i == 20) {
ret = kenwood_simple_cmd(rig, "C31"); ret = kenwood_transaction(rig, "C31", NULL, 0);
if (ret != RIG_OK) if (ret != RIG_OK)
return ret; return ret;
ret = kenwood_simple_cmd(rig, "C21"); ret = kenwood_transaction(rig, "C21", NULL, 0);
if (ret != RIG_OK) if (ret != RIG_OK)
return ret; return ret;
} }
@ -244,24 +244,24 @@ int transfox_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
case RIG_LEVEL_PREAMP: case RIG_LEVEL_PREAMP:
if (val.i == 0) { if (val.i == 0) {
ret = kenwood_simple_cmd(rig, "C30"); ret = kenwood_transaction(rig, "C30", NULL, 0);
if (ret != RIG_OK) if (ret != RIG_OK)
return ret; return ret;
ret = kenwood_simple_cmd(rig, "C20"); ret = kenwood_transaction(rig, "C20", NULL, 0);
if (ret != RIG_OK) if (ret != RIG_OK)
return ret; return ret;
} else if (val.i == 22) { } else if (val.i == 22) {
ret = kenwood_simple_cmd(rig, "C30"); ret = kenwood_transaction(rig, "C30", NULL, 0);
if (ret != RIG_OK) if (ret != RIG_OK)
return ret; return ret;
ret = kenwood_simple_cmd(rig, "C22"); ret = kenwood_transaction(rig, "C22", NULL, 0);
if (ret != RIG_OK) if (ret != RIG_OK)
return ret; return ret;
} else if (val.i == 44) { } else if (val.i == 44) {
ret = kenwood_simple_cmd(rig, "C32"); ret = kenwood_transaction(rig, "C32", NULL, 0);
if (ret != RIG_OK) if (ret != RIG_OK)
return ret; return ret;
ret = kenwood_simple_cmd(rig, "C22"); ret = kenwood_transaction(rig, "C22", NULL, 0);
if (ret != RIG_OK) if (ret != RIG_OK)
return ret; return ret;
} }

Wyświetl plik

@ -66,7 +66,7 @@ static int ts140_set_vfo(RIG *rig, vfo_t vfo)
} }
sprintf(cmdbuf, "FN%c", vfo_function); /* The 680 and 140 need this to set the VFO on the radio */ sprintf(cmdbuf, "FN%c", vfo_function); /* The 680 and 140 need this to set the VFO on the radio */
return kenwood_simple_cmd(rig, cmdbuf); return kenwood_transaction(rig, cmdbuf, NULL, 0);
} }
/* /*

Wyświetl plik

@ -136,7 +136,7 @@ kenwood_ts480_set_level (RIG * rig, vfo_t vfo, setting_t level, value_t val)
return -RIG_EINVAL; return -RIG_EINVAL;
} }
return kenwood_simple_cmd(rig, levelbuf); return kenwood_transaction(rig, levelbuf, NULL, 0);
} }

Wyświetl plik

@ -153,7 +153,7 @@ static int ts570_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
return -RIG_EINVAL; return -RIG_EINVAL;
sprintf(buf, "MD%c", kmode); sprintf(buf, "MD%c", kmode);
retval = kenwood_simple_cmd(rig, buf); retval = kenwood_transaction(rig, buf, NULL, 0);
if (retval != RIG_OK) return retval; if (retval != RIG_OK) return retval;
switch (mode) switch (mode)
@ -163,7 +163,7 @@ static int ts570_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
case RIG_MODE_RTTY: case RIG_MODE_RTTY:
case RIG_MODE_RTTYR: case RIG_MODE_RTTYR:
sprintf(buf, "FW%04d", (int)width); sprintf(buf, "FW%04d", (int)width);
retval = kenwood_simple_cmd(rig, buf); retval = kenwood_transaction(rig, buf, NULL, 0);
if (retval != RIG_OK) return retval; if (retval != RIG_OK) return retval;
break; break;
case RIG_MODE_USB: case RIG_MODE_USB:
@ -171,7 +171,7 @@ static int ts570_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
case RIG_MODE_FM: case RIG_MODE_FM:
case RIG_MODE_AM: case RIG_MODE_AM:
sprintf(buf, "SL%02d", (int)width/50); sprintf(buf, "SL%02d", (int)width/50);
retval = kenwood_simple_cmd(rig, buf); retval = kenwood_transaction(rig, buf, NULL, 0);
if (retval != RIG_OK) return retval; if (retval != RIG_OK) return retval;
break; break;
default: default:
@ -199,10 +199,10 @@ int ts570_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
if ((status < 0) || (status >2)) if ((status < 0) || (status >2))
return -RIG_EINVAL; return -RIG_EINVAL;
sprintf(fctbuf,"NR%01d", status); sprintf(fctbuf,"NR%01d", status);
return kenwood_simple_cmd(rig, fctbuf); return kenwood_transaction(rig, fctbuf, NULL, 0);
case RIG_FUNC_TUNER: case RIG_FUNC_TUNER:
sprintf(fctbuf,"AC %c0", (0==status)?'0':'1'); sprintf(fctbuf,"AC %c0", (0==status)?'0':'1');
return kenwood_simple_cmd(rig, fctbuf); return kenwood_transaction(rig, fctbuf, NULL, 0);
default: default:
return kenwood_set_func(rig, vfo, func, status); return kenwood_set_func(rig, vfo, func, status);
@ -291,19 +291,19 @@ ts570_set_level (RIG * rig, vfo_t vfo, setting_t level, value_t val)
} }
else else
return -RIG_EINVAL; return -RIG_EINVAL;
return kenwood_simple_cmd(rig, levelbuf); return kenwood_transaction(rig, levelbuf, NULL, 0);
case RIG_LEVEL_RFPOWER: case RIG_LEVEL_RFPOWER:
/* level for TS570D is from 0.. 100W in SSB and CW */ /* level for TS570D is from 0.. 100W in SSB and CW */
kenwood_val = val.f * 100; kenwood_val = val.f * 100;
sprintf (levelbuf, "PC%03d", kenwood_val); sprintf (levelbuf, "PC%03d", kenwood_val);
return kenwood_simple_cmd(rig, levelbuf); return kenwood_transaction(rig, levelbuf, NULL, 0);
case RIG_LEVEL_MICGAIN: case RIG_LEVEL_MICGAIN:
/* level is from 0..100 */ /* level is from 0..100 */
kenwood_val = val.f * 100; kenwood_val = val.f * 100;
sprintf (levelbuf, "MG%03d", kenwood_val); sprintf (levelbuf, "MG%03d", kenwood_val);
return kenwood_simple_cmd(rig, levelbuf); return kenwood_transaction(rig, levelbuf, NULL, 0);
default: default:
return kenwood_set_level (rig, vfo, level, val); return kenwood_set_level (rig, vfo, level, val);
@ -451,7 +451,7 @@ int ts570_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t txvfo)
if (cmd_len < 0) if (cmd_len < 0)
return -RIG_ETRUNC; return -RIG_ETRUNC;
retval = kenwood_simple_cmd(rig, cmdbuf); retval = kenwood_transaction(rig, cmdbuf, NULL, 0);
if (retval != RIG_OK) if (retval != RIG_OK)
return retval; return retval;
} }
@ -471,7 +471,7 @@ int ts570_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t txvfo)
if (cmd_len < 0) if (cmd_len < 0)
return -RIG_ETRUNC; return -RIG_ETRUNC;
retval = kenwood_simple_cmd(rig, cmdbuf); retval = kenwood_transaction(rig, cmdbuf, NULL, 0);
if (retval != RIG_OK) if (retval != RIG_OK)
return retval; return retval;
@ -488,7 +488,7 @@ int ts570_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t txvfo)
if (cmd_len < 0) if (cmd_len < 0)
return -RIG_ETRUNC; return -RIG_ETRUNC;
retval = kenwood_simple_cmd(rig, cmdbuf); retval = kenwood_transaction(rig, cmdbuf, NULL, 0);
if (retval != RIG_OK) if (retval != RIG_OK)
return retval; return retval;
} }

Wyświetl plik

@ -66,7 +66,7 @@ static int ts680_set_vfo(RIG *rig, vfo_t vfo)
} }
sprintf(cmdbuf, "FN%c", vfo_function); /* The 680 and 140 need this to set the VFO on the radio */ sprintf(cmdbuf, "FN%c", vfo_function); /* The 680 and 140 need this to set the VFO on the radio */
return kenwood_simple_cmd(rig, cmdbuf); return kenwood_transaction(rig, cmdbuf, NULL, 0);
} }
/* /*

Wyświetl plik

@ -182,7 +182,7 @@ static int ts870s_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
} }
sprintf(buf, "MD%c", kmode); sprintf(buf, "MD%c", kmode);
retval = kenwood_simple_cmd(rig, buf); retval = kenwood_transaction(rig, buf, NULL, 0);
if (retval != RIG_OK) return retval; if (retval != RIG_OK) return retval;
if (RIG_PASSBAND_NORMAL != width) /* leave well alone if default passband requested */ if (RIG_PASSBAND_NORMAL != width) /* leave well alone if default passband requested */
@ -200,7 +200,7 @@ static int ts870s_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
mode_default_hpf = 100; mode_default_hpf = 100;
} }
sprintf(buf, "IS %04d", (int)(width + mode_default_hpf)); sprintf(buf, "IS %04d", (int)(width + mode_default_hpf));
retval = kenwood_simple_cmd(rig, buf); retval = kenwood_transaction(rig, buf, NULL, 0);
} }
else else
{ {
@ -209,7 +209,7 @@ static int ts870s_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
* so we don't need to check the value... * so we don't need to check the value...
*/ */
sprintf(buf, "FW%04d", (int)width/10); sprintf(buf, "FW%04d", (int)width/10);
retval = kenwood_simple_cmd(rig, buf); retval = kenwood_transaction(rig, buf, NULL, 0);
} }
} }
@ -225,7 +225,7 @@ int ts870s_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
case RIG_LEVEL_RFPOWER: case RIG_LEVEL_RFPOWER:
intval = val.f * 100; intval = val.f * 100;
sprintf(levelbuf, "PC%03d", intval); sprintf(levelbuf, "PC%03d", intval);
return kenwood_simple_cmd(rig, levelbuf); return kenwood_transaction(rig, levelbuf, NULL, 0);
break; break;
default: default:

Wyświetl plik

@ -247,7 +247,7 @@ int xg3_set_level(RIG * rig, vfo_t vfo, setting_t level, value_t val)
return -RIG_EINVAL; return -RIG_EINVAL;
} }
return kenwood_simple_cmd(rig, levelbuf); return kenwood_transaction(rig, levelbuf, NULL, 0);
} }
/* /*
@ -386,7 +386,7 @@ int xg3_set_freq(RIG * rig, vfo_t vfo, freq_t freq)
{ {
sprintf(cmdbuf, "F,%011ld", (long)freq); sprintf(cmdbuf, "F,%011ld", (long)freq);
} }
int err = kenwood_simple_cmd(rig, cmdbuf); int err = kenwood_transaction(rig, cmdbuf, NULL, 0);
return err; return err;
} }
@ -465,7 +465,7 @@ int xg3_set_powerstat(RIG * rig, powerstat_t status)
if (status == RIG_POWER_OFF) if (status == RIG_POWER_OFF)
{ {
priv->powerstat = RIG_POWER_OFF; priv->powerstat = RIG_POWER_OFF;
return kenwood_simple_cmd(rig, cmd); return kenwood_transaction(rig, cmd, NULL, 0);
} }
rig_debug(RIG_DEBUG_VERBOSE, "%s invalid powerstat request status=%d\n", rig_debug(RIG_DEBUG_VERBOSE, "%s invalid powerstat request status=%d\n",
@ -481,7 +481,7 @@ int xg3_get_powerstat(RIG * rig, powerstat_t * status)
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
const char *cmd = "G"; // any command to test will do const char *cmd = "G"; // any command to test will do
int retval = kenwood_simple_cmd(rig, cmd); int retval = kenwood_transaction(rig, cmd, NULL, 0);
if (retval != RIG_OK) if (retval != RIG_OK)
return retval; return retval;
@ -519,7 +519,7 @@ int xg3_set_mem(RIG * rig, vfo_t vfo, int ch)
return -RIG_EINVAL; return -RIG_EINVAL;
} }
sprintf(cmdbuf, "C,%02d;", ch); sprintf(cmdbuf, "C,%02d;", ch);
retval = kenwood_simple_cmd(rig, cmdbuf); retval = kenwood_transaction(rig, cmdbuf, NULL, 0);
if (retval != RIG_OK) if (retval != RIG_OK)
{ {
rig_debug(RIG_DEBUG_VERBOSE, "%s invalid set_mem cmd=%d\n", __func__, rig_debug(RIG_DEBUG_VERBOSE, "%s invalid set_mem cmd=%d\n", __func__,
@ -542,7 +542,7 @@ int xg3_get_mem(RIG * rig, vfo_t vfo, int *ch)
struct rig_state *rs = &rig->state; struct rig_state *rs = &rig->state;
sprintf(cmdbuf, "C;"); sprintf(cmdbuf, "C;");
retval = kenwood_simple_cmd(rig, cmdbuf); retval = kenwood_transaction(rig, cmdbuf, NULL, 0);
if (retval != RIG_OK) if (retval != RIG_OK)
return retval; return retval;