kopia lustrzana https://github.com/Hamlib/Hamlib
Added newcat_set_ctcss_tone, newcat_get_ctcss_tone,
newcat_set_ctcss_sql, newcat_get_ctcss_sql git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@2527 7ae35d74-ebe9-4afe-98af-79ac388436b8Hamlib-1.2.9
rodzic
88fce68620
commit
1a34f231ab
|
@ -3,12 +3,13 @@
|
|||
*
|
||||
* ft950.c - (C) Nate Bargmann 2007 (n0nb at arrl.net)
|
||||
* (C) Stephane Fillod 2008
|
||||
* (C) Terry Embry 2008
|
||||
*
|
||||
* This shared library provides an API for communicating
|
||||
* via serial interface to an FT-950 using the "CAT" interface
|
||||
*
|
||||
*
|
||||
* $Id: ft950.c,v 1.10 2008-12-25 14:44:59 mrtembry Exp $
|
||||
* $Id: ft950.c,v 1.11 2008-12-26 00:05:02 mrtembry Exp $
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
|
@ -78,7 +79,7 @@ const struct rig_caps ft950_caps = {
|
|||
[LVL_RAWSTR] = { .min = { .i = 0 }, .max = { .i = 255 } },
|
||||
[LVL_CWPITCH] = { .min = { .i = 300 }, .max = { .i = 1050 }, .step = { .i = 50 } },
|
||||
},
|
||||
.ctcss_list = NULL, /* TODO */
|
||||
.ctcss_list = common_ctcss_list,
|
||||
.dcs_list = NULL,
|
||||
.preamp = { 10, 20, RIG_DBLST_END, }, /* TBC */
|
||||
.attenuator = { 6, 12, 18, RIG_DBLST_END, },
|
||||
|
@ -176,7 +177,7 @@ const struct rig_caps ft950_caps = {
|
|||
{RIG_MODE_AM, Hz(6000)}, /* Narrow AM */
|
||||
{FT950_FM_RX_MODES, Hz(16000)}, /* Normal FM */
|
||||
{FT950_FM_RX_MODES, Hz(9000)}, /* Narrow FM */
|
||||
|
||||
|
||||
RIG_FLT_END,
|
||||
},
|
||||
|
||||
|
@ -217,5 +218,11 @@ const struct rig_caps ft950_caps = {
|
|||
.mW2power = newcat_mW2power,
|
||||
.set_rptr_shift = newcat_set_rptr_shift,
|
||||
.get_rptr_shift = newcat_get_rptr_shift,
|
||||
.set_ctcss_tone = newcat_set_ctcss_tone,
|
||||
.get_ctcss_tone = newcat_get_ctcss_tone,
|
||||
.set_ctcss_sql = newcat_set_ctcss_sql,
|
||||
.get_ctcss_sql = newcat_get_ctcss_sql,
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
|
123
yaesu/newcat.c
123
yaesu/newcat.c
|
@ -4,6 +4,7 @@
|
|||
*
|
||||
* newcat.c - (C) Nate Bargmann 2007 (n0nb at arrl.net)
|
||||
* (C) Stephane Fillod 2008
|
||||
* (C) Terry Embry 2008
|
||||
*
|
||||
* This shared library provides an API for communicating
|
||||
* via serial interface to any newer Yaesu radio using the
|
||||
|
@ -13,7 +14,7 @@
|
|||
* FT-950, FT-450. Much testing remains. -N0NB
|
||||
*
|
||||
*
|
||||
* $Id: newcat.c,v 1.30 2008-12-25 14:45:00 mrtembry Exp $
|
||||
* $Id: newcat.c,v 1.31 2008-12-26 00:05:02 mrtembry Exp $
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
|
@ -1427,17 +1428,112 @@ int newcat_get_tone(RIG * rig, vfo_t vfo, tone_t * tone)
|
|||
|
||||
int newcat_set_ctcss_tone(RIG * rig, vfo_t vfo, tone_t tone)
|
||||
{
|
||||
struct newcat_priv_data *priv;
|
||||
struct rig_state *state;
|
||||
int err;
|
||||
char main_sub_vfo = '0';
|
||||
int i, t;
|
||||
priv = (struct newcat_priv_data *)rig->state.priv;
|
||||
state = &rig->state;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||
|
||||
return -RIG_ENAVAIL;
|
||||
if (!newcat_valid_command(rig, "CN"))
|
||||
return -RIG_ENAVAIL;
|
||||
|
||||
err = newcat_set_vfo_from_alias(rig, &vfo);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
if (newcat_is_rig(rig, RIG_MODEL_FT9000) || newcat_is_rig(rig, RIG_MODEL_FT2000))
|
||||
main_sub_vfo = (RIG_VFO_B == vfo) ? '1' : '0';
|
||||
|
||||
for (i = 0, t = 0; rig->caps->ctcss_list[i] != 0; i++)
|
||||
if (tone == rig->caps->ctcss_list[i]) {
|
||||
t = i;
|
||||
break;
|
||||
}
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: tone = %d, t = %02d, i = %d", __func__, tone, t, i);
|
||||
|
||||
if (t == 0) /* no match */
|
||||
return -RIG_ENAVAIL;
|
||||
|
||||
if (tone == 0) /* turn off ctcss */
|
||||
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "CT%c0%c", main_sub_vfo, cat_term);
|
||||
else {
|
||||
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "CN%c%02d%cCT%c2%c", main_sub_vfo, t, cat_term, main_sub_vfo, cat_term);
|
||||
}
|
||||
err = write_block(&state->rigport, priv->cmd_str, strlen(priv->cmd_str));
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
int newcat_get_ctcss_tone(RIG * rig, vfo_t vfo, tone_t * tone)
|
||||
{
|
||||
struct newcat_priv_data *priv;
|
||||
struct rig_state *state;
|
||||
int err;
|
||||
int ret_data_len;
|
||||
char *retlvl;
|
||||
char cmd[] = "CN";
|
||||
char main_sub_vfo = '0';
|
||||
int t;
|
||||
priv = (struct newcat_priv_data *)rig->state.priv;
|
||||
state = &rig->state;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||
|
||||
return -RIG_ENAVAIL;
|
||||
if (!newcat_valid_command(rig, cmd))
|
||||
return -RIG_ENAVAIL;
|
||||
|
||||
err = newcat_set_vfo_from_alias(rig, &vfo);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
if (newcat_is_rig(rig, RIG_MODEL_FT9000) || newcat_is_rig(rig, RIG_MODEL_FT2000))
|
||||
main_sub_vfo = (RIG_VFO_B == vfo) ? '1' : '0';
|
||||
|
||||
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "%s%c%c", cmd, main_sub_vfo, cat_term);
|
||||
|
||||
/* Get RX BANDWIDTH */
|
||||
err = write_block(&state->rigport, priv->cmd_str, strlen(priv->cmd_str));
|
||||
if (err != RIG_OK)
|
||||
return err;
|
||||
|
||||
err = read_string(&state->rigport, priv->ret_data, sizeof(priv->ret_data), &cat_term, sizeof(cat_term));
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
/* Check that command termination is correct */
|
||||
if (strchr(&cat_term, priv->ret_data[strlen(priv->ret_data) - 1]) == NULL) {
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: Command is not correctly terminated '%s'\n", __func__, priv->ret_data);
|
||||
|
||||
return -RIG_EPROTO;
|
||||
}
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: read count = %d, ret_data = %s\n",
|
||||
__func__, err, priv->ret_data);
|
||||
|
||||
ret_data_len = strlen(priv->ret_data);
|
||||
if (ret_data_len <= strlen(priv->cmd_str) ||
|
||||
priv->ret_data[ret_data_len-1] != ';')
|
||||
return -RIG_EPROTO;
|
||||
|
||||
/* skip command */
|
||||
retlvl = priv->ret_data + strlen(priv->cmd_str)-1;
|
||||
/* chop term */
|
||||
priv->ret_data[ret_data_len-1] = '\0';
|
||||
|
||||
t = atoi(retlvl); /* tone index */
|
||||
|
||||
if (t < 0 || t > 49)
|
||||
return -RIG_ENAVAIL;
|
||||
|
||||
*tone = rig->caps->ctcss_list[t];
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1476,16 +1572,28 @@ int newcat_get_tone_sql(RIG * rig, vfo_t vfo, tone_t * tone)
|
|||
int newcat_set_ctcss_sql(RIG * rig, vfo_t vfo, tone_t tone)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||
int err;
|
||||
err = newcat_set_ctcss_tone(rig, vfo, tone);
|
||||
if (err != RIG_OK)
|
||||
return err;
|
||||
|
||||
return -RIG_ENAVAIL;
|
||||
/* Change to sql */
|
||||
if (tone) {
|
||||
err = newcat_set_func(rig, vfo, RIG_FUNC_TSQL, TRUE);
|
||||
if (err != RIG_OK)
|
||||
return err;
|
||||
}
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
|
||||
int newcat_get_ctcss_sql(RIG * rig, vfo_t vfo, tone_t * tone)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||
|
||||
return -RIG_ENAVAIL;
|
||||
int err;
|
||||
err = newcat_get_ctcss_tone(rig, vfo, tone);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
|
@ -3199,7 +3307,6 @@ int newcat_set_rxbandwidth(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
|
|||
char narrow = '0';
|
||||
priv = (struct newcat_priv_data *)rig->state.priv;
|
||||
state = &rig->state;
|
||||
sprintf(width_str, "16"); /* Normal mode for other rigs? */
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
* and the Hamlib Group (hamlib-developer at lists.sourceforge.net)
|
||||
*
|
||||
* newcat.h - (C) Nate Bargmann 2007 (n0nb at arrl.net)
|
||||
* (C) Terry Embry 2008
|
||||
*
|
||||
* This shared library provides the backend API for communicating
|
||||
* via serial interface to any Yaesu radio using the new "CAT"
|
||||
|
@ -12,7 +13,7 @@
|
|||
* FT-950, FT-450. Much testing remains. -N0NB
|
||||
*
|
||||
*
|
||||
* $Id: newcat.h,v 1.13 2008-12-25 14:44:59 mrtembry Exp $
|
||||
* $Id: newcat.h,v 1.14 2008-12-26 00:05:02 mrtembry Exp $
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
|
@ -35,6 +36,7 @@
|
|||
#ifndef _NEWCAT_H
|
||||
#define _NEWCAT_H 1
|
||||
|
||||
#include <tones.h>
|
||||
|
||||
/* Handy constants */
|
||||
|
||||
|
@ -143,6 +145,10 @@ int newcat_set_split_vfo(RIG * rig, vfo_t vfo, split_t split, vfo_t tx_vfo);
|
|||
int newcat_get_split_vfo(RIG * rig, vfo_t vfo, split_t * split, vfo_t *tx_vfo);
|
||||
int newcat_set_rptr_shift(RIG * rig, vfo_t vfo, rptr_shift_t rptr_shift);
|
||||
int newcat_get_rptr_shift(RIG * rig, vfo_t vfo, rptr_shift_t * rptr_shift);
|
||||
int newcat_set_ctcss_tone(RIG * rig, vfo_t vfo, tone_t tone);
|
||||
int newcat_get_ctcss_tone(RIG * rig, vfo_t vfo, tone_t * tone);
|
||||
int newcat_set_ctcss_sql(RIG * rig, vfo_t vfo, tone_t tone);
|
||||
int newcat_get_ctcss_sql(RIG * rig, vfo_t vfo, tone_t * tone);
|
||||
|
||||
|
||||
#endif /* _NEWCAT_H */
|
||||
|
|
Ładowanie…
Reference in New Issue