From 41aa9c8ddac96a8b1a2f85087f9358e336abc379 Mon Sep 17 00:00:00 2001 From: "Terry Embry, KJ4EED" Date: Sun, 28 Dec 2008 13:53:13 +0000 Subject: [PATCH] Added get_ts, set_ts to rigs Added newcat_is_id for future reference Made Changes to newcat_valid_command git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@2535 7ae35d74-ebe9-4afe-98af-79ac388436b8 --- yaesu/ft2000.c | 4 ++- yaesu/ft450.c | 4 ++- yaesu/ft9000.c | 7 ++++- yaesu/newcat.c | 74 ++++++++++++++++++++++++++++++++++---------------- 4 files changed, 63 insertions(+), 26 deletions(-) diff --git a/yaesu/ft2000.c b/yaesu/ft2000.c index a2f7860bc..42e033181 100644 --- a/yaesu/ft2000.c +++ b/yaesu/ft2000.c @@ -9,7 +9,7 @@ * via serial interface to an FT-2000 using the "CAT" interface * * - * $Id: ft2000.c,v 1.4 2008-12-27 08:08:47 mrtembry Exp $ + * $Id: ft2000.c,v 1.5 2008-12-28 13:53:13 mrtembry Exp $ * * * This library is free software; you can redistribute it and/or @@ -195,6 +195,8 @@ const struct rig_caps ft2000_caps = { .get_ctcss_sql = newcat_get_ctcss_sql, .set_powerstat = newcat_set_powerstat, .get_powerstat = newcat_get_powerstat, + .get_ts = newcat_get_ts, + .set_ts = newcat_set_ts, }; diff --git a/yaesu/ft450.c b/yaesu/ft450.c index 7cca88a8b..bd9a8d1db 100644 --- a/yaesu/ft450.c +++ b/yaesu/ft450.c @@ -9,7 +9,7 @@ * via serial interface to an FT-450 using the "CAT" interface * * - * $Id: ft450.c,v 1.9 2008-12-27 08:08:47 mrtembry Exp $ + * $Id: ft450.c,v 1.10 2008-12-28 13:53:13 mrtembry Exp $ * * * This library is free software; you can redistribute it and/or @@ -195,6 +195,8 @@ const struct rig_caps ft450_caps = { .get_ctcss_sql = newcat_get_ctcss_sql, .set_powerstat = newcat_set_powerstat, .get_powerstat = newcat_get_powerstat, + .get_ts = newcat_get_ts, + .set_ts = newcat_set_ts, }; diff --git a/yaesu/ft9000.c b/yaesu/ft9000.c index f0f4ca016..8975e316f 100644 --- a/yaesu/ft9000.c +++ b/yaesu/ft9000.c @@ -9,7 +9,7 @@ * via serial interface to an FT-9000 using the "CAT" interface * * - * $Id: ft9000.c,v 1.3 2008-12-26 11:36:21 mrtembry Exp $ + * $Id: ft9000.c,v 1.4 2008-12-28 13:53:13 mrtembry Exp $ * * * This library is free software; you can redistribute it and/or @@ -194,5 +194,10 @@ const struct rig_caps ft9000_caps = { .get_ctcss_tone = newcat_get_ctcss_tone, .set_ctcss_sql = newcat_set_ctcss_sql, .get_ctcss_sql = newcat_get_ctcss_sql, + .set_powerstat = newcat_set_powerstat, + .get_powerstat = newcat_get_powerstat, + .get_ts = newcat_get_ts, + .set_ts = newcat_set_ts, + }; diff --git a/yaesu/newcat.c b/yaesu/newcat.c index 23c8ad49c..20c65631e 100644 --- a/yaesu/newcat.c +++ b/yaesu/newcat.c @@ -14,7 +14,7 @@ * FT-950, FT-450. Much testing remains. -N0NB * * - * $Id: newcat.c,v 1.35 2008-12-28 04:06:14 mrtembry Exp $ + * $Id: newcat.c,v 1.36 2008-12-28 13:53:13 mrtembry Exp $ * * * This library is free software; you can redistribute it and/or @@ -49,6 +49,19 @@ /* global variables */ static const char cat_term = ';'; /* Yaesu command terminator */ +typedef enum nc_id_e { +NC_ID_NONE = 0, +NC_ID_FT450 = 0241, +NC_ID_FT950 = 0310, +NC_ID_FT2000 = 0251, +NC_ID_FT2000D = 0252, /* FIXME: GUESS??? WAITING VERIFACATION */ +NC_ID_FTDX9000D = 0101, +NC_ID_FTDX9000Contest = 0102, +NC_ID_9000MP = 0103 +} nc_id_t; + +static nc_id_t nc_id; /* Different model ID;(s) */ + /* * The following table defines which commands are valid for any given * rig supporting the "new" CAT interface. @@ -103,7 +116,7 @@ static const yaesu_newcat_commands_t valid_commands[] = { {"FB", TRUE, TRUE, TRUE, TRUE }, {"FK", FALSE, TRUE, TRUE, FALSE }, {"FR", FALSE, TRUE, TRUE, TRUE }, - {"FS", TRUE, TRUE, TRUE, FALSE }, + {"FS", TRUE, TRUE, TRUE, TRUE }, {"FT", TRUE, TRUE, TRUE, TRUE }, {"GT", TRUE, TRUE, TRUE, TRUE }, {"ID", TRUE, TRUE, TRUE, FALSE }, @@ -208,6 +221,7 @@ static int newcat_set_narrow(RIG * rig, vfo_t vfo, ncboolean narrow); static int newcat_get_narrow(RIG * rig, vfo_t vfo, ncboolean * narrow); static int newcat_set_faststep(RIG * rig, ncboolean fast_step); static int newcat_get_faststep(RIG * rig, ncboolean * fast_step); +// static ncboolean newcat_is_id(RIG * rig, nc_id_t id); /* * ************************************ @@ -242,6 +256,8 @@ int newcat_init(RIG *rig) { priv->current_vfo = RIG_VFO_A; rig->state.priv = (void *)priv; + + nc_id = NC_ID_NONE; return RIG_OK; } @@ -264,6 +280,8 @@ int newcat_cleanup(RIG *rig) { if (rig->state.priv) free(rig->state.priv); rig->state.priv = NULL; + + nc_id = NC_ID_NONE; return RIG_OK; } @@ -1484,9 +1502,6 @@ int newcat_set_ctcss_tone(RIG * rig, vfo_t vfo, tone_t tone) rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); - if (rig->caps->ctcss_list == NULL) - return -RIG_ENAVAIL; - if (!newcat_valid_command(rig, "CN")) return -RIG_ENAVAIL; @@ -1534,9 +1549,6 @@ int newcat_get_ctcss_tone(RIG * rig, vfo_t vfo, tone_t * tone) rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); - if (rig->caps->ctcss_list == NULL) - return -RIG_ENAVAIL; - if (!newcat_valid_command(rig, cmd)) return -RIG_ENAVAIL; @@ -2980,13 +2992,19 @@ ncboolean newcat_valid_command(RIG *rig, char *command) { * FT-9000 variants. */ - is_ft450 = strcmp(caps->model_name, "FT-450"); - is_ft950 = strcmp(caps->model_name, "FT-950"); - is_ft2000 = strcmp(caps->model_name, "FT-2000"); - is_ft9000 = strcmp(caps->model_name, "FTDX-9000"); - is_ft9000 = strcmp(caps->model_name, "FTDX-9000 Contest"); - is_ft9000 = strcmp(caps->model_name, "FTDX9000D"); - is_ft9000 = strcmp(caps->model_name, "FTDX9000MP"); + // is_ft450 = strcmp(caps->model_name, "FT-450"); + // is_ft950 = strcmp(caps->model_name, "FT-950"); + // is_ft2000 = strcmp(caps->model_name, "FT-2000"); + // is_ft9000 = strcmp(caps->model_name, "FTDX-9000"); + // is_ft9000 = strcmp(caps->model_name, "FTDX-9000 Contest"); + // is_ft9000 = strcmp(caps->model_name, "FTDX9000D"); + // is_ft9000 = strcmp(caps->model_name, "FTDX9000MP"); + + is_ft450 = newcat_is_rig(rig, RIG_MODEL_FT450); + is_ft950 = newcat_is_rig(rig, RIG_MODEL_FT950); + is_ft2000 = newcat_is_rig(rig, RIG_MODEL_FT2000); + is_ft9000 = newcat_is_rig(rig, RIG_MODEL_FT9000); + if (!is_ft450 && !is_ft950 && !is_ft2000 && !is_ft9000) { rig_debug(RIG_DEBUG_ERR, "%s: '%s' is unknown\n", @@ -3035,13 +3053,7 @@ ncboolean newcat_valid_command(RIG *rig, char *command) { return FALSE; } -/* - * This could change to rig ID from newcat_get_info() - * Need something like model == FT2000 - * IDa== FT2000 (100W), IDb = FT2000D (200W) - * model == FT9000 - * FT9000DX, FT9000_CONTEST, etc... - */ + ncboolean newcat_is_rig(RIG * rig, rig_model_t model) { ncboolean is_rig; @@ -3214,8 +3226,10 @@ int newcat_get_rxvfo(RIG * rig, vfo_t * rxvfo) { break; case '2' : /* Main Band VFO_A RX, Sub Band VFO_B RX */ case '3' : /* Main Band VFO_A Mute, Sub Band VFO_B RX */ + //if (newcat_is_id(rig, NC_ID_FTDX9000Contest) /* Can not verify? */ + // *rxvfo = RIG_VFO_B; + //else *rxvfo = RIG_VFO_A; - /* FIXME: if (is_rig/is_rigid?(rig, RIG_MODEL_FT9000_CONTEST)) *rxvfo = RIG_VFO_B; */ break; case '4' : /* FT950 Main Band VFO_B RX */ case '5' : /* FT950 Main Band VFO_B Mute */ @@ -3807,3 +3821,17 @@ int newcat_get_faststep(RIG * rig, ncboolean * fast_step) return RIG_OK; } + +ncboolean newcat_is_id(RIG * rig, nc_id_t id) +{ + ncboolean is_my_id; + + if (nc_id == NC_ID_NONE) + nc_id = atoi(newcat_get_info(rig)); + + is_my_id = (id == nc_id) ? TRUE : FALSE; + + rig_debug(RIG_DEBUG_TRACE, "nc_id = %d, id = %d, is_my_id = %d\n", nc_id, id, is_my_id); + + return is_my_id; +}