diff --git a/icom/ic910.c b/icom/ic910.c index ef77a7df3..32a88ae4d 100644 --- a/icom/ic910.c +++ b/icom/ic910.c @@ -3,7 +3,7 @@ * Contributed by Francois Retief * Copyright (c) 2000-2004 by Stephane Fillod * - * $Id: ic910.c,v 1.15 2008-11-02 16:14:57 y32kn Exp $ + * $Id: ic910.c,v 1.16 2008-11-13 20:29:43 y32kn Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -29,6 +29,8 @@ #include #include "icom.h" +#include "icom_defs.h" +#include "frame.h" #include "idx_builtin.h" /* @@ -175,6 +177,23 @@ static int ic910_set_freq(RIG* rig, vfo_t vfo, freq_t freq) return icom_set_freq(rig, RIG_VFO_CURR, freq); } +/* + * This function does the special bandwidth coding for IC-910 + * (1 - normal, 2 - narrow) + */ +int ic910_r2i_mode(RIG *rig, rmode_t mode, pbwidth_t width, + unsigned char *md, signed char *pd) +{ + int err; + + err = rig2icom_mode(rig, mode, width, md, pd); + + if (*pd == PD_NARROW_3) + *pd = PD_NARROW_2; + + return err; +} + #define IC910_MODES (RIG_MODE_SSB|RIG_MODE_CW|RIG_MODE_FM) @@ -221,12 +240,14 @@ static int ic910_set_freq(RIG* rig, vfo_t vfo, freq_t freq) #define IC910_STR_CAL UNKNOWN_IC_STR_CAL /* FIXME */ + /* */ static const struct icom_priv_caps ic910_priv_caps = { 0x60, /* default address */ 0, /* 731 mode */ - ic910_ts_sc_list + ic910_ts_sc_list, + .r2i_mode = ic910_r2i_mode }; const struct rig_caps ic910_caps = { diff --git a/icom/icom.c b/icom/icom.c index e2a38492e..4a37c95f1 100644 --- a/icom/icom.c +++ b/icom/icom.c @@ -2,7 +2,7 @@ * Hamlib CI-V backend - main file * Copyright (c) 2000-2005 by Stephane Fillod * - * $Id: icom.c,v 1.106 2008-09-21 19:36:50 fillods Exp $ + * $Id: icom.c,v 1.107 2008-11-13 20:29:43 y32kn Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -510,6 +510,7 @@ pbwidth_t icom_get_dsp_flt(RIG *rig, rmode_t mode) { int icom_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) { struct icom_priv_data *priv; + const struct icom_priv_caps *priv_caps; struct rig_state *rs; unsigned char ackbuf[MAXFRAMELEN]; unsigned char icmode; @@ -519,7 +520,17 @@ int icom_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) rs = &rig->state; priv = (struct icom_priv_data*)rs->priv; - err = rig2icom_mode(rig, mode, width, &icmode, &icmode_ext); + priv_caps = (const struct icom_priv_caps *) rig->caps->priv; + + if (priv_caps->r2i_mode != NULL) { /* call priv code if defined */ + err = priv_caps->r2i_mode(rig, mode, width, + &icmode, &icmode_ext); + } + else { /* else call default */ + err = rig2icom_mode(rig, mode, width, + &icmode, &icmode_ext); + } + if (err < 0) return err; diff --git a/icom/icom.h b/icom/icom.h index d7035f843..c225d6574 100644 --- a/icom/icom.h +++ b/icom/icom.h @@ -2,7 +2,7 @@ * Hamlib CI-V backend - main header * Copyright (c) 2000-2004 by Stephane Fillod * - * $Id: icom.h,v 1.76 2008-02-13 22:04:52 fillods Exp $ + * $Id: icom.h,v 1.77 2008-11-13 20:29:43 y32kn Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -101,6 +101,15 @@ struct icom_priv_caps { int civ_731_mode; /* Off: freqs on 10 digits, On: freqs on 8 digits */ const struct ts_sc_list *ts_sc_list; int settle_time; /*!< Receiver settle time, in ms */ + int (*r2i_mode)(RIG *rig, rmode_t mode, pbwidth_t width, + unsigned char *md, signed char *pd); /*< backend specific code + to convert bandwidth and + mode to cmd tokens */ + void (*i2r_mode)(RIG *rig, unsigned char md, int pd, + rmode_t *mode, pbwidth_t *width); /*< backend specific code + to convert response + tokes to bandwidth and + mdoe */ };