kopia lustrzana https://github.com/Hamlib/Hamlib
First set of rigs/icom/* state pointer macros.
rodzic
1557ad70f7
commit
f5870c84ef
|
@ -116,7 +116,7 @@ int icom_frame_fix_preamble(int frame_len, unsigned char *frame)
|
||||||
/*
|
/*
|
||||||
* icom_one_transaction
|
* icom_one_transaction
|
||||||
*
|
*
|
||||||
* We assume that rig!=NULL, rig->state!= NULL, payload!=NULL, data!=NULL, data_len!=NULL
|
* We assume that rig!=NULL, STATE(rig)!= NULL, payload!=NULL, data!=NULL, data_len!=NULL
|
||||||
* Otherwise, you'll get a nice seg fault. You've been warned!
|
* Otherwise, you'll get a nice seg fault. You've been warned!
|
||||||
* payload can be NULL if payload_len == 0
|
* payload can be NULL if payload_len == 0
|
||||||
* subcmd can be equal to -1 (no subcmd wanted)
|
* subcmd can be equal to -1 (no subcmd wanted)
|
||||||
|
@ -131,7 +131,7 @@ int icom_one_transaction(RIG *rig, unsigned char cmd, int subcmd,
|
||||||
{
|
{
|
||||||
struct icom_priv_data *priv;
|
struct icom_priv_data *priv;
|
||||||
const struct icom_priv_caps *priv_caps;
|
const struct icom_priv_caps *priv_caps;
|
||||||
struct rig_state *rs;
|
struct rig_state *rs = STATE(rig);
|
||||||
hamlib_port_t *rp = RIGPORT(rig);
|
hamlib_port_t *rp = RIGPORT(rig);
|
||||||
struct timeval start_time, current_time, elapsed_time;
|
struct timeval start_time, current_time, elapsed_time;
|
||||||
// this buf needs to be large enough for 0xfe strings for power up
|
// this buf needs to be large enough for 0xfe strings for power up
|
||||||
|
@ -145,7 +145,6 @@ int icom_one_transaction(RIG *rig, unsigned char cmd, int subcmd,
|
||||||
ENTERFUNC;
|
ENTERFUNC;
|
||||||
memset(buf, 0, 200);
|
memset(buf, 0, 200);
|
||||||
memset(sendbuf, 0, MAXFRAMELEN);
|
memset(sendbuf, 0, MAXFRAMELEN);
|
||||||
rs = &rig->state;
|
|
||||||
priv = (struct icom_priv_data *)rs->priv;
|
priv = (struct icom_priv_data *)rs->priv;
|
||||||
priv_caps = (struct icom_priv_caps *)rig->caps->priv;
|
priv_caps = (struct icom_priv_caps *)rig->caps->priv;
|
||||||
|
|
||||||
|
@ -461,7 +460,7 @@ again2:
|
||||||
*
|
*
|
||||||
* This function honors rigport.retry count.
|
* This function honors rigport.retry count.
|
||||||
*
|
*
|
||||||
* We assume that rig!=NULL, rig->state!= NULL, payload!=NULL, data!=NULL, data_len!=NULL
|
* We assume that rig!=NULL, STATE(rig)!= NULL, payload!=NULL, data!=NULL, data_len!=NULL
|
||||||
* Otherwise, you'll get a nice seg fault. You've been warned!
|
* Otherwise, you'll get a nice seg fault. You've been warned!
|
||||||
* payload can be NULL if payload_len == 0
|
* payload can be NULL if payload_len == 0
|
||||||
* subcmd can be equal to -1 (no subcmd wanted)
|
* subcmd can be equal to -1 (no subcmd wanted)
|
||||||
|
@ -613,7 +612,7 @@ int rig2icom_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width,
|
||||||
signed char icmode_ext;
|
signed char icmode_ext;
|
||||||
pbwidth_t width_tmp = width;
|
pbwidth_t width_tmp = width;
|
||||||
const struct icom_priv_data *priv_data = (struct icom_priv_data *)
|
const struct icom_priv_data *priv_data = (struct icom_priv_data *)
|
||||||
rig->state.priv;
|
STATE(rig)->priv;
|
||||||
|
|
||||||
ENTERFUNC;
|
ENTERFUNC;
|
||||||
rig_debug(RIG_DEBUG_TRACE, "%s: mode=%d, width=%d\n", __func__, (int)mode,
|
rig_debug(RIG_DEBUG_TRACE, "%s: mode=%d, width=%d\n", __func__, (int)mode,
|
||||||
|
|
|
@ -601,7 +601,7 @@ struct rig_caps ic746pro_caps =
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Assumes rig!=NULL, rig->state.priv!=NULL
|
* Assumes rig!=NULL, STATE(rig)->priv!=NULL
|
||||||
*/
|
*/
|
||||||
static int ic746pro_set_ext_parm(RIG *rig, hamlib_token_t token, value_t val)
|
static int ic746pro_set_ext_parm(RIG *rig, hamlib_token_t token, value_t val)
|
||||||
{
|
{
|
||||||
|
@ -664,7 +664,7 @@ static int ic746pro_set_ext_parm(RIG *rig, hamlib_token_t token, value_t val)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Assumes rig!=NULL, rig->state.priv!=NULL
|
* Assumes rig!=NULL, STATE(rig)->priv!=NULL
|
||||||
* and val points to a buffer big enough to hold the conf value.
|
* and val points to a buffer big enough to hold the conf value.
|
||||||
*/
|
*/
|
||||||
static int ic746pro_get_ext_parm(RIG *rig, hamlib_token_t token, value_t *val)
|
static int ic746pro_get_ext_parm(RIG *rig, hamlib_token_t token, value_t *val)
|
||||||
|
@ -918,7 +918,7 @@ int ic746_get_parm(RIG *rig, setting_t parm, value_t *val)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ic746pro_get_channel
|
* ic746pro_get_channel
|
||||||
* Assumes rig!=NULL, rig->state.priv!=NULL, chan!=NULL
|
* Assumes rig!=NULL, STATE(rig)->priv!=NULL, chan!=NULL
|
||||||
*
|
*
|
||||||
* If memory is empty it will return RIG_OK,but every thing will be null. Where do we boundary check?
|
* If memory is empty it will return RIG_OK,but every thing will be null. Where do we boundary check?
|
||||||
*/
|
*/
|
||||||
|
@ -929,7 +929,7 @@ int ic746pro_get_channel(RIG *rig, vfo_t vfo, channel_t *chan, int read_only)
|
||||||
unsigned char chanbuf[MAXFRAMELEN];
|
unsigned char chanbuf[MAXFRAMELEN];
|
||||||
int chan_len, freq_len, retval, data_len;
|
int chan_len, freq_len, retval, data_len;
|
||||||
|
|
||||||
rs = &rig->state;
|
rs = STATE(rig);
|
||||||
priv = (struct icom_priv_data *)rs->priv;
|
priv = (struct icom_priv_data *)rs->priv;
|
||||||
|
|
||||||
to_bcd_be(chanbuf, chan->channel_num, 4);
|
to_bcd_be(chanbuf, chan->channel_num, 4);
|
||||||
|
@ -1086,7 +1086,7 @@ int ic746pro_get_channel(RIG *rig, vfo_t vfo, channel_t *chan, int read_only)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ic746pro_set_channel
|
* ic746pro_set_channel
|
||||||
* Assumes rig!=NULL, rig->state.priv!=NULL, chan!=NULL
|
* Assumes rig!=NULL, STATE(rig)->priv!=NULL, chan!=NULL
|
||||||
*/
|
*/
|
||||||
int ic746pro_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan)
|
int ic746pro_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan)
|
||||||
{
|
{
|
||||||
|
@ -1096,7 +1096,7 @@ int ic746pro_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan)
|
||||||
unsigned char chanbuf[MAXFRAMELEN], ackbuf[MAXFRAMELEN];
|
unsigned char chanbuf[MAXFRAMELEN], ackbuf[MAXFRAMELEN];
|
||||||
int chan_len, ack_len, freq_len, retval;
|
int chan_len, ack_len, freq_len, retval;
|
||||||
|
|
||||||
rs = &rig->state;
|
rs = STATE(rig);
|
||||||
priv = (struct icom_priv_data *)rs->priv;
|
priv = (struct icom_priv_data *)rs->priv;
|
||||||
|
|
||||||
freq_len = priv->civ_731_mode ? 4 : 5;
|
freq_len = priv->civ_731_mode ? 4 : 5;
|
||||||
|
|
|
@ -697,7 +697,7 @@ struct rig_caps ic756pro2_caps =
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Assumes rig!=NULL, rig->state.priv!=NULL
|
* Assumes rig!=NULL, STATE(rig)->priv!=NULL
|
||||||
*/
|
*/
|
||||||
static int ic756pro2_set_ext_parm(RIG *rig, hamlib_token_t token, value_t val)
|
static int ic756pro2_set_ext_parm(RIG *rig, hamlib_token_t token, value_t val)
|
||||||
{
|
{
|
||||||
|
@ -777,7 +777,7 @@ static int ic756pro2_set_ext_parm(RIG *rig, hamlib_token_t token, value_t val)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Assumes rig!=NULL, rig->state.priv!=NULL
|
* Assumes rig!=NULL, STATE(rig)->priv!=NULL
|
||||||
* and val points to a buffer big enough to hold the conf value.
|
* and val points to a buffer big enough to hold the conf value.
|
||||||
*/
|
*/
|
||||||
static int ic756pro2_get_ext_parm(RIG *rig, hamlib_token_t token, value_t *val)
|
static int ic756pro2_get_ext_parm(RIG *rig, hamlib_token_t token, value_t *val)
|
||||||
|
|
|
@ -267,7 +267,7 @@ int ic7700_get_clock(RIG *rig, int *year, int *month, int *day, int *hour,
|
||||||
static int ic7700_rig_open(RIG *rig)
|
static int ic7700_rig_open(RIG *rig)
|
||||||
{
|
{
|
||||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: enter\n", __func__);
|
rig_debug(RIG_DEBUG_VERBOSE, "%s: enter\n", __func__);
|
||||||
struct icom_priv_data *priv = (struct icom_priv_data *) rig->state.priv;
|
struct icom_priv_data *priv = (struct icom_priv_data *) STATE(rig)->priv;
|
||||||
priv->x26cmdfails = priv->x25cmdfails = 1;
|
priv->x26cmdfails = priv->x25cmdfails = 1;
|
||||||
return icom_rig_open(rig);
|
return icom_rig_open(rig);
|
||||||
}
|
}
|
||||||
|
|
|
@ -371,7 +371,7 @@ int ic7800_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
|
||||||
|
|
||||||
for (i = 0; i < 7; i++)
|
for (i = 0; i < 7; i++)
|
||||||
{
|
{
|
||||||
if (val.i == rig->state.attenuator[i])
|
if (val.i == STATE(rig)->attenuator[i])
|
||||||
{
|
{
|
||||||
val.i = i + 1;
|
val.i = i + 1;
|
||||||
break;
|
break;
|
||||||
|
@ -412,7 +412,7 @@ int ic7800_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
|
||||||
*/
|
*/
|
||||||
if (val->i > 0 && val->i <= 7)
|
if (val->i > 0 && val->i <= 7)
|
||||||
{
|
{
|
||||||
val->i = rig->state.attenuator[val->i - 1];
|
val->i = STATE(rig)->attenuator[val->i - 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -68,14 +68,14 @@ int ic821h_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
|
||||||
split; // we emulate satmode of other rigs since we apparently can't query
|
split; // we emulate satmode of other rigs since we apparently can't query
|
||||||
rig_debug(RIG_DEBUG_TRACE, "%s: tx_vfo==MAIN so assuming sat mode=%d\n",
|
rig_debug(RIG_DEBUG_TRACE, "%s: tx_vfo==MAIN so assuming sat mode=%d\n",
|
||||||
__func__, CACHE(rig)->satmode);
|
__func__, CACHE(rig)->satmode);
|
||||||
rig->state.tx_vfo = split == RIG_SPLIT_ON ? RIG_VFO_SUB : RIG_VFO_MAIN;
|
STATE(rig)->tx_vfo = split == RIG_SPLIT_ON ? RIG_VFO_SUB : RIG_VFO_MAIN;
|
||||||
// the IC821 seems to be backwards in satmode -- setting Main select Sub and vice versa
|
// the IC821 seems to be backwards in satmode -- setting Main select Sub and vice versa
|
||||||
retval = rig_set_vfo(rig, RIG_VFO_SUB);
|
retval = rig_set_vfo(rig, RIG_VFO_SUB);
|
||||||
}
|
}
|
||||||
else if (tx_vfo == RIG_VFO_A)
|
else if (tx_vfo == RIG_VFO_A)
|
||||||
{
|
{
|
||||||
retval = rig_set_vfo(rig, RIG_VFO_A);
|
retval = rig_set_vfo(rig, RIG_VFO_A);
|
||||||
rig->state.tx_vfo = split == RIG_SPLIT_ON ? RIG_VFO_B : RIG_VFO_A;
|
STATE(rig)->tx_vfo = split == RIG_SPLIT_ON ? RIG_VFO_B : RIG_VFO_A;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -225,7 +225,7 @@ const char *ic92d_get_info(RIG *rig)
|
||||||
int ack_len, retval;
|
int ack_len, retval;
|
||||||
static char info[64];
|
static char info[64];
|
||||||
|
|
||||||
rs = &rig->state;
|
rs = STATE(rig);
|
||||||
priv = (struct icom_priv_data *)rs->priv;
|
priv = (struct icom_priv_data *)rs->priv;
|
||||||
|
|
||||||
// 018019fd
|
// 018019fd
|
||||||
|
|
|
@ -42,7 +42,7 @@ static int icf8101_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
||||||
int freq_len = 5;
|
int freq_len = 5;
|
||||||
int ack_len;
|
int ack_len;
|
||||||
unsigned char freqbuf[MAXFRAMELEN], ackbuf[MAXFRAMELEN];
|
unsigned char freqbuf[MAXFRAMELEN], ackbuf[MAXFRAMELEN];
|
||||||
vfo_t vfo_save = rig->state.current_vfo;
|
vfo_t vfo_save = STATE(rig)->current_vfo;
|
||||||
|
|
||||||
if (vfo != vfo_save)
|
if (vfo != vfo_save)
|
||||||
{
|
{
|
||||||
|
@ -348,7 +348,7 @@ int icf8101_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* icf8101_get_ptt
|
* icf8101_get_ptt
|
||||||
* Assumes rig!=NULL, rig->state.priv!=NULL, ptt!=NULL
|
* Assumes rig!=NULL, STATE(rig)->priv!=NULL, ptt!=NULL
|
||||||
*/
|
*/
|
||||||
int icf8101_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt)
|
int icf8101_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt)
|
||||||
{
|
{
|
||||||
|
|
|
@ -250,7 +250,7 @@ struct rig_caps icr75_caps =
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* icr75_set_channel
|
* icr75_set_channel
|
||||||
* Assumes rig!=NULL, rig->state.priv!=NULL, chan!=NULL
|
* Assumes rig!=NULL, STATE(rig)->priv!=NULL, chan!=NULL
|
||||||
* TODO: still a WIP --SF
|
* TODO: still a WIP --SF
|
||||||
*/
|
*/
|
||||||
int icr75_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan)
|
int icr75_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan)
|
||||||
|
@ -263,7 +263,7 @@ int icr75_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan)
|
||||||
signed char icmode_ext;
|
signed char icmode_ext;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
rs = &rig->state;
|
rs = STATE(rig);
|
||||||
priv = (struct icom_priv_data *)rs->priv;
|
priv = (struct icom_priv_data *)rs->priv;
|
||||||
|
|
||||||
to_bcd_be(chanbuf, chan->channel_num, 4);
|
to_bcd_be(chanbuf, chan->channel_num, 4);
|
||||||
|
@ -319,7 +319,7 @@ int icr75_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* icr75_get_channel
|
* icr75_get_channel
|
||||||
* Assumes rig!=NULL, rig->state.priv!=NULL, chan!=NULL
|
* Assumes rig!=NULL, STATE(rig)->priv!=NULL, chan!=NULL
|
||||||
* TODO: still a WIP --SF
|
* TODO: still a WIP --SF
|
||||||
*/
|
*/
|
||||||
int icr75_get_channel(RIG *rig, vfo_t vfo, channel_t *chan, int read_only)
|
int icr75_get_channel(RIG *rig, vfo_t vfo, channel_t *chan, int read_only)
|
||||||
|
@ -329,7 +329,7 @@ int icr75_get_channel(RIG *rig, vfo_t vfo, channel_t *chan, int read_only)
|
||||||
unsigned char chanbuf[24];
|
unsigned char chanbuf[24];
|
||||||
int chan_len, freq_len, retval;
|
int chan_len, freq_len, retval;
|
||||||
|
|
||||||
rs = &rig->state;
|
rs = STATE(rig);
|
||||||
priv = (struct icom_priv_data *)rs->priv;
|
priv = (struct icom_priv_data *)rs->priv;
|
||||||
|
|
||||||
to_bcd_be(chanbuf, chan->channel_num, 4);
|
to_bcd_be(chanbuf, chan->channel_num, 4);
|
||||||
|
|
|
@ -75,14 +75,14 @@ int id5100_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo);
|
||||||
|
|
||||||
int id5100_set_vfo(RIG *rig, vfo_t vfo)
|
int id5100_set_vfo(RIG *rig, vfo_t vfo)
|
||||||
{
|
{
|
||||||
struct rig_state *rs = &rig->state;
|
struct rig_state *rs = STATE(rig);
|
||||||
struct icom_priv_data *priv = (struct icom_priv_data *) rs->priv;
|
struct icom_priv_data *priv = (struct icom_priv_data *) rs->priv;
|
||||||
unsigned char ackbuf[MAXFRAMELEN];
|
unsigned char ackbuf[MAXFRAMELEN];
|
||||||
int ack_len = sizeof(ackbuf), retval;
|
int ack_len = sizeof(ackbuf), retval;
|
||||||
|
|
||||||
ENTERFUNC;
|
ENTERFUNC;
|
||||||
|
|
||||||
if (vfo == RIG_VFO_CURR) { vfo = rig->state.current_vfo; }
|
if (vfo == RIG_VFO_CURR) { vfo = rs->current_vfo; }
|
||||||
|
|
||||||
// if user requests VFOA/B we automatically turn of dual watch mode
|
// if user requests VFOA/B we automatically turn of dual watch mode
|
||||||
// if user requests Main/Sub we automatically turn on dual watch mode
|
// if user requests Main/Sub we automatically turn on dual watch mode
|
||||||
|
@ -127,13 +127,13 @@ int id5100_set_vfo(RIG *rig, vfo_t vfo)
|
||||||
|
|
||||||
int myvfo = S_MAIN;
|
int myvfo = S_MAIN;
|
||||||
priv->dual_watch_main_sub = MAIN_ON_LEFT;
|
priv->dual_watch_main_sub = MAIN_ON_LEFT;
|
||||||
rig->state.current_vfo = RIG_VFO_A;
|
rs->current_vfo = RIG_VFO_A;
|
||||||
|
|
||||||
if (vfo == RIG_VFO_B || vfo == RIG_VFO_SUB)
|
if (vfo == RIG_VFO_B || vfo == RIG_VFO_SUB)
|
||||||
{
|
{
|
||||||
myvfo = S_SUB;
|
myvfo = S_SUB;
|
||||||
priv->dual_watch_main_sub = MAIN_ON_RIGHT;
|
priv->dual_watch_main_sub = MAIN_ON_RIGHT;
|
||||||
rig->state.current_vfo = vfo;
|
rs->current_vfo = vfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (RIG_OK != (retval = icom_transaction(rig, C_SET_VFO, myvfo, NULL, 0, ackbuf,
|
if (RIG_OK != (retval = icom_transaction(rig, C_SET_VFO, myvfo, NULL, 0, ackbuf,
|
||||||
|
@ -153,12 +153,12 @@ int id5100_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
||||||
unsigned char freqbuf[MAXFRAMELEN];
|
unsigned char freqbuf[MAXFRAMELEN];
|
||||||
int freq_len = 5;
|
int freq_len = 5;
|
||||||
int retval;
|
int retval;
|
||||||
struct rig_state *rs = &rig->state;
|
struct rig_state *rs = STATE(rig);
|
||||||
//struct icom_priv_data *priv = (struct icom_priv_data *) rs->priv;
|
//struct icom_priv_data *priv = (struct icom_priv_data *) rs->priv;
|
||||||
|
|
||||||
vfo_t currvfo = rig->state.current_vfo;
|
vfo_t currvfo = rs->current_vfo;
|
||||||
|
|
||||||
if (vfo == RIG_VFO_CURR) { vfo = rig->state.current_vfo; }
|
if (vfo == RIG_VFO_CURR) { vfo = rs->current_vfo; }
|
||||||
|
|
||||||
if (rs->dual_watch == 0 && (vfo == RIG_VFO_MAIN || vfo == RIG_VFO_SUB)) { id5100_set_split_vfo(rig, RIG_VFO_SUB, 1, RIG_VFO_MAIN); }
|
if (rs->dual_watch == 0 && (vfo == RIG_VFO_MAIN || vfo == RIG_VFO_SUB)) { id5100_set_split_vfo(rig, RIG_VFO_SUB, 1, RIG_VFO_MAIN); }
|
||||||
|
|
||||||
|
@ -209,13 +209,13 @@ static int id5100_get_freq2(RIG *rig, vfo_t vfo, freq_t *freq)
|
||||||
|
|
||||||
int id5100_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
|
int id5100_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
|
||||||
{
|
{
|
||||||
struct rig_state *rs = &rig->state;
|
struct rig_state *rs = STATE(rig);
|
||||||
struct icom_priv_data *priv = (struct icom_priv_data *) rs->priv;
|
struct icom_priv_data *priv = (struct icom_priv_data *) rs->priv;
|
||||||
int retval;
|
int retval;
|
||||||
|
|
||||||
vfo_t currvfo = rig->state.current_vfo;
|
vfo_t currvfo = rs->current_vfo;
|
||||||
|
|
||||||
if (rs->dual_watch == 1 && rig->state.current_vfo != RIG_VFO_SUB) { id5100_set_split_vfo(rig, RIG_VFO_SUB, 0, RIG_VFO_MAIN); }
|
if (rs->dual_watch == 1 && rs->current_vfo != RIG_VFO_SUB) { id5100_set_split_vfo(rig, RIG_VFO_SUB, 0, RIG_VFO_MAIN); }
|
||||||
|
|
||||||
if (rs->dual_watch) // dual watch is different
|
if (rs->dual_watch) // dual watch is different
|
||||||
{
|
{
|
||||||
|
@ -298,7 +298,7 @@ int id5100_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
|
||||||
{
|
{
|
||||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: Dual watch is off\n", __func__);
|
rig_debug(RIG_DEBUG_VERBOSE, "%s: Dual watch is off\n", __func__);
|
||||||
}
|
}
|
||||||
if (vfo == RIG_VFO_CURR) { vfo = rig->state.current_vfo; }
|
if (vfo == RIG_VFO_CURR) { vfo = rs->current_vfo; }
|
||||||
if (vfo == RIG_VFO_MAIN && priv->dual_watch_main_sub == MAIN_ON_LEFT)
|
if (vfo == RIG_VFO_MAIN && priv->dual_watch_main_sub == MAIN_ON_LEFT)
|
||||||
{
|
{
|
||||||
rig_debug(RIG_DEBUG_VERBOSE, "%s(%d): Main/A vfo=%s\n", __func__, __LINE__,
|
rig_debug(RIG_DEBUG_VERBOSE, "%s(%d): Main/A vfo=%s\n", __func__, __LINE__,
|
||||||
|
@ -422,7 +422,7 @@ int id5100_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
|
||||||
|
|
||||||
int id5100_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
|
int id5100_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
|
||||||
{
|
{
|
||||||
struct rig_state *rs = &rig->state;
|
struct rig_state *rs = STATE(rig);
|
||||||
struct icom_priv_data *priv = (struct icom_priv_data *) rs->priv;
|
struct icom_priv_data *priv = (struct icom_priv_data *) rs->priv;
|
||||||
int retval;
|
int retval;
|
||||||
|
|
||||||
|
@ -486,14 +486,14 @@ int id5100_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq)
|
||||||
int id5100_get_split_freq(RIG *rig, vfo_t vfo, freq_t *tx_freq)
|
int id5100_get_split_freq(RIG *rig, vfo_t vfo, freq_t *tx_freq)
|
||||||
{
|
{
|
||||||
int retval;
|
int retval;
|
||||||
//struct rig_state *rs = &rig->state;
|
//struct rig_state *rs = STATE(rig);
|
||||||
//struct icom_priv_data *priv = (struct icom_priv_data *) rs->priv;
|
//struct icom_priv_data *priv = (struct icom_priv_data *) rs->priv;
|
||||||
//vfo_t currvfo;
|
//vfo_t currvfo;
|
||||||
|
|
||||||
rig_debug(RIG_DEBUG_VERBOSE, "%s(%d): vfo=%s\n", __func__, __LINE__,
|
rig_debug(RIG_DEBUG_VERBOSE, "%s(%d): vfo=%s\n", __func__, __LINE__,
|
||||||
rig_strvfo(vfo));
|
rig_strvfo(vfo));
|
||||||
#if 0
|
#if 0
|
||||||
currvfo = rig->state.current_vfo;
|
currvfo = rs->current_vfo;
|
||||||
|
|
||||||
if (priv->dual_watch_main_sub == MAIN_ON_LEFT && (currvfo == RIG_VFO_MAIN
|
if (priv->dual_watch_main_sub == MAIN_ON_LEFT && (currvfo == RIG_VFO_MAIN
|
||||||
|| currvfo == RIG_VFO_A) && vfo == RIG_VFO_TX)
|
|| currvfo == RIG_VFO_A) && vfo == RIG_VFO_TX)
|
||||||
|
|
|
@ -179,7 +179,7 @@ struct rig_caps omnivip_caps =
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* omni6_set_ptt based on icom_set_ptt
|
* omni6_set_ptt based on icom_set_ptt
|
||||||
* Assumes rig!=NULL, rig->state.priv!=NULL
|
* Assumes rig!=NULL, STATE(rig)->priv!=NULL
|
||||||
*/
|
*/
|
||||||
int omni6_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
|
int omni6_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
|
||||||
{
|
{
|
||||||
|
|
|
@ -60,7 +60,7 @@ static int optoscan_wait_timer(RIG *rig, pltstate_t *state);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* optoscan_open
|
* optoscan_open
|
||||||
* Assumes rig!=NULL, rig->state.priv!=NULL
|
* Assumes rig!=NULL, STATE(rig)->priv!=NULL
|
||||||
*/
|
*/
|
||||||
int optoscan_open(RIG *rig)
|
int optoscan_open(RIG *rig)
|
||||||
{
|
{
|
||||||
|
@ -70,7 +70,7 @@ int optoscan_open(RIG *rig)
|
||||||
unsigned char ackbuf[16];
|
unsigned char ackbuf[16];
|
||||||
int ack_len, retval;
|
int ack_len, retval;
|
||||||
|
|
||||||
rs = &rig->state;
|
rs = STATE(rig);
|
||||||
priv = (struct icom_priv_data *)rs->priv;
|
priv = (struct icom_priv_data *)rs->priv;
|
||||||
|
|
||||||
pltstate = calloc(1, sizeof(pltstate_t));
|
pltstate = calloc(1, sizeof(pltstate_t));
|
||||||
|
@ -106,7 +106,7 @@ int optoscan_open(RIG *rig)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* optoscan_close
|
* optoscan_close
|
||||||
* Assumes rig!=NULL, rig->state.priv!=NULL
|
* Assumes rig!=NULL, STATE(rig)->priv!=NULL
|
||||||
*/
|
*/
|
||||||
int optoscan_close(RIG *rig)
|
int optoscan_close(RIG *rig)
|
||||||
{
|
{
|
||||||
|
@ -115,7 +115,7 @@ int optoscan_close(RIG *rig)
|
||||||
unsigned char ackbuf[16];
|
unsigned char ackbuf[16];
|
||||||
int ack_len, retval;
|
int ack_len, retval;
|
||||||
|
|
||||||
rs = &rig->state;
|
rs = STATE(rig);
|
||||||
priv = (struct icom_priv_data *)rs->priv;
|
priv = (struct icom_priv_data *)rs->priv;
|
||||||
|
|
||||||
/* select LOCAL control */
|
/* select LOCAL control */
|
||||||
|
@ -141,7 +141,7 @@ int optoscan_close(RIG *rig)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* optoscan_get_info
|
* optoscan_get_info
|
||||||
* Assumes rig!=NULL, rig->state.priv!=NULL
|
* Assumes rig!=NULL, STATE(rig)->priv!=NULL
|
||||||
*/
|
*/
|
||||||
const char *optoscan_get_info(RIG *rig)
|
const char *optoscan_get_info(RIG *rig)
|
||||||
{
|
{
|
||||||
|
@ -176,7 +176,7 @@ const char *optoscan_get_info(RIG *rig)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* optoscan_get_ctcss_tone
|
* optoscan_get_ctcss_tone
|
||||||
* Assumes rig!=NULL, rig->state.priv!=NULL
|
* Assumes rig!=NULL, STATE(rig)->priv!=NULL
|
||||||
*/
|
*/
|
||||||
int optoscan_get_ctcss_tone(RIG *rig, vfo_t vfo, tone_t *tone)
|
int optoscan_get_ctcss_tone(RIG *rig, vfo_t vfo, tone_t *tone)
|
||||||
{
|
{
|
||||||
|
@ -209,7 +209,7 @@ int optoscan_get_ctcss_tone(RIG *rig, vfo_t vfo, tone_t *tone)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* optoscan_get_dcs_code
|
* optoscan_get_dcs_code
|
||||||
* Assumes rig!=NULL, rig->state.priv!=NULL
|
* Assumes rig!=NULL, STATE(rig)->priv!=NULL
|
||||||
*/
|
*/
|
||||||
int optoscan_get_dcs_code(RIG *rig, vfo_t vfo, tone_t *code)
|
int optoscan_get_dcs_code(RIG *rig, vfo_t vfo, tone_t *code)
|
||||||
{
|
{
|
||||||
|
@ -292,7 +292,7 @@ int optoscan_recv_dtmf(RIG *rig, vfo_t vfo, char *digits, int *length)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Assumes rig!=NULL, rig->state.priv!=NULL
|
* Assumes rig!=NULL, STATE(rig)->priv!=NULL
|
||||||
*/
|
*/
|
||||||
int optoscan_set_ext_parm(RIG *rig, hamlib_token_t token, value_t val)
|
int optoscan_set_ext_parm(RIG *rig, hamlib_token_t token, value_t val)
|
||||||
{
|
{
|
||||||
|
@ -364,7 +364,7 @@ int optoscan_set_ext_parm(RIG *rig, hamlib_token_t token, value_t val)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Assumes rig!=NULL, rig->state.priv!=NULL
|
* Assumes rig!=NULL, STATE(rig)->priv!=NULL
|
||||||
* and val points to a buffer big enough to hold the conf value.
|
* and val points to a buffer big enough to hold the conf value.
|
||||||
*/
|
*/
|
||||||
int optoscan_get_ext_parm(RIG *rig, hamlib_token_t token, value_t *val)
|
int optoscan_get_ext_parm(RIG *rig, hamlib_token_t token, value_t *val)
|
||||||
|
@ -422,7 +422,7 @@ int optoscan_get_ext_parm(RIG *rig, hamlib_token_t token, value_t *val)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* optoscan_set_level
|
* optoscan_set_level
|
||||||
* Assumes rig!=NULL, rig->state.priv!=NULL
|
* Assumes rig!=NULL, STATE(rig)->priv!=NULL
|
||||||
*/
|
*/
|
||||||
int optoscan_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
|
int optoscan_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
|
||||||
{
|
{
|
||||||
|
@ -487,7 +487,7 @@ int optoscan_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* optoscan_get_level
|
* optoscan_get_level
|
||||||
* Assumes rig!=NULL, rig->state.priv!=NULL, val!=NULL
|
* Assumes rig!=NULL, STATE(rig)->priv!=NULL, val!=NULL
|
||||||
*/
|
*/
|
||||||
int optoscan_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
|
int optoscan_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
|
||||||
{
|
{
|
||||||
|
@ -618,7 +618,7 @@ int optoscan_scan(RIG *rig, vfo_t vfo, scan_t scan, int ch)
|
||||||
return -RIG_ENAVAIL;
|
return -RIG_ENAVAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
rs = &rig->state;
|
rs = STATE(rig);
|
||||||
cb = rig->callbacks.pltune;
|
cb = rig->callbacks.pltune;
|
||||||
state = ((struct icom_priv_data *)rs->priv)->pltstate;
|
state = ((struct icom_priv_data *)rs->priv)->pltstate;
|
||||||
|
|
||||||
|
|
|
@ -917,7 +917,7 @@ struct rig_caps x5105_caps =
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* x108g_set_ptt
|
* x108g_set_ptt
|
||||||
* Assumes rig!=NULL, rig->state.priv!=NULL
|
* Assumes rig!=NULL, STATE(rig)->priv!=NULL
|
||||||
* The response from the x108g isn't quite right at this time
|
* The response from the x108g isn't quite right at this time
|
||||||
* Eventually they may fix their firmware and we can use the icom_set_split_vfo
|
* Eventually they may fix their firmware and we can use the icom_set_split_vfo
|
||||||
*/
|
*/
|
||||||
|
@ -953,7 +953,7 @@ int x108g_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
|
||||||
* The response from the x108g isn't quite right at this time
|
* The response from the x108g isn't quite right at this time
|
||||||
* Eventually they may fix their firmware and we can use the icom_set_split_vfo
|
* Eventually they may fix their firmware and we can use the icom_set_split_vfo
|
||||||
* x108g_set_split
|
* x108g_set_split
|
||||||
* Assumes rig!=NULL, rig->state.priv!=NULL
|
* Assumes rig!=NULL, STATE(rig)->priv!=NULL
|
||||||
*/
|
*/
|
||||||
static int x108g_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
|
static int x108g_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
|
||||||
{
|
{
|
||||||
|
@ -976,7 +976,7 @@ static int x108g_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
|
||||||
if (cachep->split == RIG_SPLIT_OFF)
|
if (cachep->split == RIG_SPLIT_OFF)
|
||||||
{
|
{
|
||||||
/* ensure VFO A is Rx and VFO B is Tx as we assume that elsewhere */
|
/* ensure VFO A is Rx and VFO B is Tx as we assume that elsewhere */
|
||||||
if ((rig->state.vfo_list & (RIG_VFO_A | RIG_VFO_B)) == (RIG_VFO_A | RIG_VFO_B))
|
if ((STATE(rig)->vfo_list & (RIG_VFO_A | RIG_VFO_B)) == (RIG_VFO_A | RIG_VFO_B))
|
||||||
{
|
{
|
||||||
if (RIG_OK != (rc = icom_set_vfo(rig, RIG_VFO_A))) { return rc; }
|
if (RIG_OK != (rc = icom_set_vfo(rig, RIG_VFO_A))) { return rc; }
|
||||||
}
|
}
|
||||||
|
@ -1006,7 +1006,7 @@ static int x108g_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* x108g_set_split_freq
|
* x108g_set_split_freq
|
||||||
* Assumes rig!=NULL, rig->state.priv!=NULL,
|
* Assumes rig!=NULL, STATE(rig)->priv!=NULL,
|
||||||
*
|
*
|
||||||
* Assumes also that the current VFO is the rx VFO.
|
* Assumes also that the current VFO is the rx VFO.
|
||||||
*/
|
*/
|
||||||
|
@ -1040,7 +1040,7 @@ static int x108g_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq)
|
||||||
assumptions allow us to deal with the lack of VFO and split
|
assumptions allow us to deal with the lack of VFO and split
|
||||||
queries */
|
queries */
|
||||||
/* broken if user changes split on rig :( */
|
/* broken if user changes split on rig :( */
|
||||||
if ((rig->state.vfo_list & (RIG_VFO_A | RIG_VFO_B)) == (RIG_VFO_A | RIG_VFO_B)
|
if ((STATE(rig)->vfo_list & (RIG_VFO_A | RIG_VFO_B)) == (RIG_VFO_A | RIG_VFO_B)
|
||||||
&& cachep->split != RIG_SPLIT_OFF)
|
&& cachep->split != RIG_SPLIT_OFF)
|
||||||
{
|
{
|
||||||
/* VFO A/B style rigs swap VFO on split Tx so we need to disable
|
/* VFO A/B style rigs swap VFO on split Tx so we need to disable
|
||||||
|
@ -1067,7 +1067,7 @@ static int x108g_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq)
|
||||||
|
|
||||||
if (RIG_OK != (rc = icom_set_vfo(rig, rx_vfo))) { return rc; }
|
if (RIG_OK != (rc = icom_set_vfo(rig, rx_vfo))) { return rc; }
|
||||||
|
|
||||||
if ((rig->state.vfo_list & (RIG_VFO_A | RIG_VFO_B)) == (RIG_VFO_A | RIG_VFO_B)
|
if ((STATE(rig)->vfo_list & (RIG_VFO_A | RIG_VFO_B)) == (RIG_VFO_A | RIG_VFO_B)
|
||||||
&& cachep->split != RIG_SPLIT_OFF)
|
&& cachep->split != RIG_SPLIT_OFF)
|
||||||
{
|
{
|
||||||
/* Re-enable split */
|
/* Re-enable split */
|
||||||
|
@ -1083,7 +1083,7 @@ static int x108g_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* x108g_set_split_mode
|
* x108g_set_split_mode
|
||||||
* Assumes rig!=NULL, rig->state.priv!=NULL,
|
* Assumes rig!=NULL, STATE(rig)->priv!=NULL,
|
||||||
*/
|
*/
|
||||||
static int x108g_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode,
|
static int x108g_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode,
|
||||||
pbwidth_t tx_width)
|
pbwidth_t tx_width)
|
||||||
|
@ -1117,7 +1117,7 @@ static int x108g_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode,
|
||||||
assumptions allow us to deal with the lack of VFO and split
|
assumptions allow us to deal with the lack of VFO and split
|
||||||
queries */
|
queries */
|
||||||
/* broken if user changes split on rig :( */
|
/* broken if user changes split on rig :( */
|
||||||
if ((rig->state.vfo_list & (RIG_VFO_A | RIG_VFO_B)) == (RIG_VFO_A | RIG_VFO_B)
|
if ((STATE(rig)->vfo_list & (RIG_VFO_A | RIG_VFO_B)) == (RIG_VFO_A | RIG_VFO_B)
|
||||||
&& cachep->split != RIG_SPLIT_OFF)
|
&& cachep->split != RIG_SPLIT_OFF)
|
||||||
{
|
{
|
||||||
/* VFO A/B style rigs swap VFO on split Tx so we need to disable
|
/* VFO A/B style rigs swap VFO on split Tx so we need to disable
|
||||||
|
@ -1145,7 +1145,7 @@ static int x108g_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode,
|
||||||
|
|
||||||
if (RIG_OK != (rc = icom_set_vfo(rig, rx_vfo))) { return rc; }
|
if (RIG_OK != (rc = icom_set_vfo(rig, rx_vfo))) { return rc; }
|
||||||
|
|
||||||
if ((rig->state.vfo_list & (RIG_VFO_A | RIG_VFO_B)) == (RIG_VFO_A | RIG_VFO_B)
|
if ((STATE(rig)->vfo_list & (RIG_VFO_A | RIG_VFO_B)) == (RIG_VFO_A | RIG_VFO_B)
|
||||||
&& cachep->split != RIG_SPLIT_OFF)
|
&& cachep->split != RIG_SPLIT_OFF)
|
||||||
{
|
{
|
||||||
/* Re-enable split */
|
/* Re-enable split */
|
||||||
|
|
Ładowanie…
Reference in New Issue