From eff99058d6c38fa469ed619133d8abb21d45657e Mon Sep 17 00:00:00 2001 From: dh1tw Date: Sun, 5 Jun 2016 16:26:21 +0200 Subject: [PATCH] implemented set_conf, get_conf and Token fast_set_commands for max throughput --- yaesu/ft950.c | 3 ++- yaesu/newcat.c | 66 +++++++++++++++++++++++++++++++++++++------------- yaesu/newcat.h | 13 +++++++++- 3 files changed, 63 insertions(+), 19 deletions(-) diff --git a/yaesu/ft950.c b/yaesu/ft950.c index b0e79206a..474c9658b 100644 --- a/yaesu/ft950.c +++ b/yaesu/ft950.c @@ -190,6 +190,8 @@ const struct rig_caps ft950_caps = { .rig_open = newcat_open, /* port opened */ .rig_close = newcat_close, /* port closed */ + .set_conf = newcat_set_conf, + .get_conf = newcat_get_conf, .set_freq = newcat_set_freq, .get_freq = newcat_get_freq, .set_mode = newcat_set_mode, @@ -232,4 +234,3 @@ const struct rig_caps ft950_caps = { .get_channel = newcat_get_channel, }; - diff --git a/yaesu/newcat.c b/yaesu/newcat.c index 1636c5d17..1ebd01ead 100644 --- a/yaesu/newcat.c +++ b/yaesu/newcat.c @@ -235,7 +235,6 @@ static ncboolean newcat_valid_command(RIG *rig, char *command); int newcat_get_cmd(RIG * rig); int newcat_set_cmd (RIG *rig); - /* * ************************************ * @@ -272,6 +271,7 @@ int newcat_init(RIG *rig) { priv->rig_id = NC_RIGID_NONE; priv->current_mem = NC_MEM_CHANNEL_NONE; + priv->fast_set_commands = FALSE; return RIG_OK; } @@ -354,6 +354,48 @@ int newcat_close(RIG *rig) { return RIG_OK; } +int newcat_set_conf(RIG *rig, token_t token, const char *val){ + int ret = RIG_OK; + + if (rig == NULL){ + return -RIG_EARG; + } + + struct newcat_priv_data *priv = rig->state.priv; + switch (token) { + case TOK_FAST_SET_CMD: + priv->fast_set_commands = (int)val; + break; + + default: + ret = -RIG_EINVAL; + } + + return ret; +} + +int newcat_get_conf(RIG *rig, token_t token, char *val){ + int ret = RIG_OK; + + if (rig == NULL) { + return -RIG_EARG; + } + + struct newcat_priv_data *priv = rig->state.priv; + switch (token) { + case TOK_FAST_SET_CMD: + val = (char*)priv->fast_set_commands; + break; + default: + ret = -RIG_EINVAL; + } + + return ret; +} + + + + /* * rig_set_freq * @@ -2684,22 +2726,6 @@ int newcat_get_ext_parm(RIG *rig, token_t token, value_t *val) } -int newcat_set_conf(RIG * rig, token_t token, const char *val) -{ - rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); - - return -RIG_ENAVAIL; -} - - -int newcat_get_conf(RIG * rig, token_t token, char *val) -{ - rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); - - return -RIG_ENAVAIL; -} - - int newcat_send_dtmf(RIG * rig, vfo_t vfo, const char *digits) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); @@ -4349,6 +4375,12 @@ int newcat_set_cmd (RIG *rig) struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv; int retry_count = 0; int rc = -RIG_EPROTO; + + /* skip validation if high throughput is needed */ + if (priv->fast_set_commands == 1){ + return RIG_OK; + } + /* pick a basic quick query command for verification */ char const * const verify_cmd = RIG_MODEL_FT9000 == rig->caps->rig_model ? "AI;" : "ID;"; diff --git a/yaesu/newcat.h b/yaesu/newcat.h index b0b18b75d..b5e48967c 100644 --- a/yaesu/newcat.h +++ b/yaesu/newcat.h @@ -34,6 +34,7 @@ #define _NEWCAT_H 1 #include +#include /* Handy constants */ @@ -49,7 +50,7 @@ typedef char ncboolean; /* shared function version */ -#define NEWCAT_VER "0.22" +#define NEWCAT_VER "0.23" /* Hopefully large enough for future use, 128 chars plus '\0' */ #define NEWCAT_DATA_LEN 129 @@ -85,6 +86,7 @@ struct newcat_priv_data { int width_frequency; /* width of FA/FB freq response */ int offset_rit; /* offset of rit in response */ int trn_state; /* AI state found at startup */ + int fast_set_commands; /* do not check for ACK/NAK; needed for high throughput > 100 commands/s */ }; @@ -115,6 +117,12 @@ struct newcat_priv_data { * */ + /* + * configuration Tokens + * + */ + +#define TOK_FAST_SET_CMD TOKEN_BACKEND(1) /* * newcat function definitions. @@ -126,6 +134,9 @@ int newcat_cleanup(RIG *rig); int newcat_open(RIG *rig); int newcat_close(RIG *rig); +int newcat_set_conf(RIG *, token_t, const char *val); +int newcat_get_conf(RIG *, token_t, char *val); + int newcat_set_freq(RIG *rig, vfo_t vfo, freq_t freq); int newcat_get_freq(RIG *rig, vfo_t vfo, freq_t *freq);