Merge pull request #1563 from GeoBaltz/rp11

Convert all rig->state references in rigs/*/* to macro calls
pull/1565/head
Michael Black 2024-06-08 11:09:02 -05:00 zatwierdzone przez GitHub
commit ff0ed58edf
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: B5690EEEBB952194
42 zmienionych plików z 919 dodań i 912 usunięć

Wyświetl plik

@ -163,18 +163,19 @@ static int write_transaction(ROT *rot, char *cmd)
static int pstrotator_rot_init(ROT *rot)
{
struct pstrotator_rot_priv_data *priv;
struct rot_state *rs = ROTSTATE(rot);
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
rot->state.priv = (struct pstrotator_rot_priv_data *)
rs->priv = (struct pstrotator_rot_priv_data *)
calloc(1, sizeof(struct pstrotator_rot_priv_data));
if (!rot->state.priv)
if (!rs->priv)
{
return -RIG_ENOMEM;
}
priv = rot->state.priv;
priv = rs->priv;
priv->ext_funcs = alloc_init_ext(pstrotator_ext_funcs);
@ -212,8 +213,9 @@ static int pstrotator_rot_init(ROT *rot)
static int pstrotator_rot_cleanup(ROT *rot)
{
struct rot_state *rs = ROTSTATE(rot);
struct pstrotator_rot_priv_data *priv = (struct pstrotator_rot_priv_data *)
rot->state.priv;
rs->priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
@ -221,9 +223,9 @@ static int pstrotator_rot_cleanup(ROT *rot)
free(priv->ext_levels);
free(priv->ext_parms);
free(priv->magic_conf);
free(rot->state.priv);
free(rs->priv);
rot->state.priv = NULL;
rs->priv = NULL;
return RIG_OK;
}
@ -251,11 +253,12 @@ static int pstrotator_rot_open(ROT *rot)
int n1, n2, n3, n4;
int sockfd;
struct sockaddr_in clientAddr;
struct rot_state *rs = ROTSTATE(rot);
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
priv = (struct pstrotator_rot_priv_data *)rot->state.priv;
//priv->port2 = rot->state.rotport;
priv = (struct pstrotator_rot_priv_data *)rs->priv;
//priv->port2 = rs->rotport;
//priv->port2.type.rig = RIG_PORT_UDP_NETWORK;
rig_debug(RIG_DEBUG_VERBOSE, "%s: pathname=%s\n", __func__,
@ -300,7 +303,7 @@ static int pstrotator_set_conf(ROT *rot, hamlib_token_t token, const char *val)
{
struct pstrotator_rot_priv_data *priv;
priv = (struct pstrotator_rot_priv_data *)rot->state.priv;
priv = (struct pstrotator_rot_priv_data *)ROTSTATE(rot)->priv;
switch (token)
{
@ -326,7 +329,7 @@ static int pstrotator_get_conf2(ROT *rot, hamlib_token_t token, char *val,
{
struct pstrotator_rot_priv_data *priv;
priv = (struct pstrotator_rot_priv_data *)rot->state.priv;
priv = (struct pstrotator_rot_priv_data *)ROTSTATE(rot)->priv;
switch (token)
{
@ -351,7 +354,7 @@ static int pstrotator_get_conf(ROT *rot, hamlib_token_t token, char *val)
static int pstrotator_rot_set_position(ROT *rot, azimuth_t az, elevation_t el)
{
struct pstrotator_rot_priv_data *priv = (struct pstrotator_rot_priv_data *)
rot->state.priv;
ROTSTATE(rot)->priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s called: %.2f %.2f\n", __func__,
az, el);
@ -442,7 +445,7 @@ void readPacket(int sockfd, char *buf, int buf_len, int expected)
static int pstrotator_rot_get_position(ROT *rot, azimuth_t *az, elevation_t *el)
{
struct pstrotator_rot_priv_data *priv = (struct pstrotator_rot_priv_data *)
rot->state.priv;
ROTSTATE(rot)->priv;
char buf[64];
int n = 0;
fd_set rfds, efds;
@ -519,7 +522,7 @@ static int pstrotator_rot_get_status(ROT *rot, rot_status_t *status)
{
const struct pstrotator_rot_priv_data *priv = (struct pstrotator_rot_priv_data
*)
rot->state.priv;
ROTSTATE(rot)->priv;
*status = priv->status;

Wyświetl plik

@ -116,7 +116,7 @@ int icom_frame_fix_preamble(int frame_len, unsigned char *frame)
/*
* 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!
* payload can be NULL if payload_len == 0
* 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;
const struct icom_priv_caps *priv_caps;
struct rig_state *rs;
struct rig_state *rs = STATE(rig);
hamlib_port_t *rp = RIGPORT(rig);
struct timeval start_time, current_time, elapsed_time;
// 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;
memset(buf, 0, 200);
memset(sendbuf, 0, MAXFRAMELEN);
rs = &rig->state;
priv = (struct icom_priv_data *)rs->priv;
priv_caps = (struct icom_priv_caps *)rig->caps->priv;
@ -461,7 +460,7 @@ again2:
*
* 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!
* payload can be NULL if payload_len == 0
* 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;
pbwidth_t width_tmp = width;
const struct icom_priv_data *priv_data = (struct icom_priv_data *)
rig->state.priv;
STATE(rig)->priv;
ENTERFUNC;
rig_debug(RIG_DEBUG_TRACE, "%s: mode=%d, width=%d\n", __func__, (int)mode,

Wyświetl plik

@ -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)
{
@ -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.
*/
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
* 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?
*/
@ -929,7 +929,7 @@ int ic746pro_get_channel(RIG *rig, vfo_t vfo, channel_t *chan, int read_only)
unsigned char chanbuf[MAXFRAMELEN];
int chan_len, freq_len, retval, data_len;
rs = &rig->state;
rs = STATE(rig);
priv = (struct icom_priv_data *)rs->priv;
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
* 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)
{
@ -1096,7 +1096,7 @@ int ic746pro_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan)
unsigned char chanbuf[MAXFRAMELEN], ackbuf[MAXFRAMELEN];
int chan_len, ack_len, freq_len, retval;
rs = &rig->state;
rs = STATE(rig);
priv = (struct icom_priv_data *)rs->priv;
freq_len = priv->civ_731_mode ? 4 : 5;

Wyświetl plik

@ -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)
{
@ -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.
*/
static int ic756pro2_get_ext_parm(RIG *rig, hamlib_token_t token, value_t *val)

Wyświetl plik

@ -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)
{
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;
return icom_rig_open(rig);
}

Wyświetl plik

@ -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++)
{
if (val.i == rig->state.attenuator[i])
if (val.i == STATE(rig)->attenuator[i])
{
val.i = i + 1;
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)
{
val->i = rig->state.attenuator[val->i - 1];
val->i = STATE(rig)->attenuator[val->i - 1];
}
break;

Wyświetl plik

@ -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
rig_debug(RIG_DEBUG_TRACE, "%s: tx_vfo==MAIN so assuming sat mode=%d\n",
__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
retval = rig_set_vfo(rig, RIG_VFO_SUB);
}
else if (tx_vfo == 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
{

Wyświetl plik

@ -225,7 +225,7 @@ const char *ic92d_get_info(RIG *rig)
int ack_len, retval;
static char info[64];
rs = &rig->state;
rs = STATE(rig);
priv = (struct icom_priv_data *)rs->priv;
// 018019fd

Wyświetl plik

@ -42,7 +42,7 @@ static int icf8101_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
int freq_len = 5;
int ack_len;
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)
{
@ -348,7 +348,7 @@ int icf8101_set_ptt(RIG *rig, vfo_t vfo, ptt_t 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)
{

Plik diff jest za duży Load Diff

Wyświetl plik

@ -521,87 +521,87 @@ extern struct rig_caps x5105_caps;
extern struct rig_caps icr8600_caps;
extern struct rig_caps icr30_caps;
#define RIG_IS_IC1271 (rig->state.rig_model == RIG_MODEL_IC1271)
#define RIG_IS_IC1275 (rig->state.rig_model == RIG_MODEL_IC1275)
#define RIG_IS_IC271 (rig->state.rig_model == RIG_MODEL_IC271)
#define RIG_IS_IC2730 (rig->state.rig_model == RIG_MODEL_IC2730)
#define RIG_IS_IC275 (rig->state.rig_model == RIG_MODEL_IC275)
#define RIG_IS_IC375 (rig->state.rig_model == RIG_MODEL_IC375)
#define RIG_IS_IC471 (rig->state.rig_model == RIG_MODEL_IC471)
#define RIG_IS_IC475 (rig->state.rig_model == RIG_MODEL_IC475)
#define RIG_IS_IC575 (rig->state.rig_model == RIG_MODEL_IC575)
#define RIG_IS_IC7000 (rig->state.rig_model == RIG_MODEL_IC7000)
#define RIG_IS_IC703 (rig->state.rig_model == RIG_MODEL_IC703)
#define RIG_IS_IC705 (rig->state.rig_model == RIG_MODEL_IC705)
#define RIG_IS_IC706 (rig->state.rig_model == RIG_MODEL_IC706)
#define RIG_IS_IC706MKII (rig->state.rig_model == RIG_MODEL_IC706MKII)
#define RIG_IS_IC706MKIIG (rig->state.rig_model == RIG_MODEL_IC706MKIIG)
#define RIG_IS_IC707 (rig->state.rig_model == RIG_MODEL_IC707)
#define RIG_IS_IC7100 (rig->state.rig_model == RIG_MODEL_IC7100)
#define RIG_IS_IC718 (rig->state.rig_model == RIG_MODEL_IC718)
#define RIG_IS_IC7200 (rig->state.rig_model == RIG_MODEL_IC7200)
#define RIG_IS_IC725 (rig->state.rig_model == RIG_MODEL_IC725)
#define RIG_IS_IC726 (rig->state.rig_model == RIG_MODEL_IC726)
#define RIG_IS_IC728 (rig->state.rig_model == RIG_MODEL_IC728)
#define RIG_IS_IC729 (rig->state.rig_model == RIG_MODEL_IC729)
#define RIG_IS_IC7300 (rig->state.rig_model == RIG_MODEL_IC7300)
#define RIG_IS_IC731 (rig->state.rig_model == RIG_MODEL_IC731)
#define RIG_IS_IC735 (rig->state.rig_model == RIG_MODEL_IC735)
#define RIG_IS_IC736 (rig->state.rig_model == RIG_MODEL_IC736)
#define RIG_IS_IC737 (rig->state.rig_model == RIG_MODEL_IC737)
#define RIG_IS_IC738 (rig->state.rig_model == RIG_MODEL_IC738)
#define RIG_IS_IC7410 (rig->state.rig_model == RIG_MODEL_IC7410)
#define RIG_IS_IC746 (rig->state.rig_model == RIG_MODEL_IC746)
#define RIG_IS_IC746PRO (rig->state.rig_model == RIG_MODEL_IC746PRO)
#define RIG_IS_IC751 (rig->state.rig_model == RIG_MODEL_IC751)
#define RIG_IS_IC751A (rig->state.rig_model == RIG_MODEL_IC751A)
#define RIG_IS_IC756 (rig->state.rig_model == RIG_MODEL_IC756)
#define RIG_IS_IC756PRO (rig->state.rig_model == RIG_MODEL_IC756PRO)
#define RIG_IS_IC756PROII (rig->state.rig_model == RIG_MODEL_IC756PROII)
#define RIG_IS_IC756PROIII (rig->state.rig_model == RIG_MODEL_IC756PROIII)
#define RIG_IS_IC7600 (rig->state.rig_model == RIG_MODEL_IC7600)
#define RIG_IS_IC761 (rig->state.rig_model == RIG_MODEL_IC761)
#define RIG_IS_IC7610 (rig->state.rig_model == RIG_MODEL_IC7610)
#define RIG_IS_IC765 (rig->state.rig_model == RIG_MODEL_IC765)
#define RIG_IS_IC7700 (rig->state.rig_model == RIG_MODEL_IC7700)
#define RIG_IS_IC775 (rig->state.rig_model == RIG_MODEL_IC775)
#define RIG_IS_IC78 (rig->state.rig_model == RIG_MODEL_IC78)
#define RIG_IS_IC7800 (rig->state.rig_model == RIG_MODEL_IC7800)
#define RIG_IS_IC781 (rig->state.rig_model == RIG_MODEL_IC781)
#define RIG_IS_IC785X (rig->state.rig_model == RIG_MODEL_IC785x)
#define RIG_IS_IC820 (rig->state.rig_model == RIG_MODEL_IC820)
#define RIG_IS_IC821 (rig->state.rig_model == RIG_MODEL_IC821)
#define RIG_IS_IC821H (rig->state.rig_model == RIG_MODEL_IC821H)
#define RIG_IS_IC905 (rig->state.rig_model == RIG_MODEL_IC905)
#define RIG_IS_IC910 (rig->state.rig_model == RIG_MODEL_IC910)
#define RIG_IS_IC9100 (rig->state.rig_model == RIG_MODEL_IC9100)
#define RIG_IS_IC92D (rig->state.rig_model == RIG_MODEL_IC92D)
#define RIG_IS_IC970 (rig->state.rig_model == RIG_MODEL_IC970)
#define RIG_IS_IC9700 (rig->state.rig_model == RIG_MODEL_IC9700)
#define RIG_IS_IC8101 (rig->state.rig_model == RIG_MODEL_ICF8101)
#define RIG_IS_ICID1 (rig->state.rig_model == RIG_MODEL_ICID1)
#define RIG_IS_ICM700PRO (rig->state.rig_model == RIG_MODEL_IC_M700PRO)
#define RIG_IS_ICM710 (rig->state.rig_model == RIG_MODEL_IC_M710)
#define RIG_IS_ICM802 (rig->state.rig_model == RIG_MODEL_IC_M802)
#define RIG_IS_ICM803 (rig->state.rig_model == RIG_MODEL_IC_M803)
#define RIG_IS_ICR10 (rig->state.rig_model == RIG_MODEL_ICR10)
#define RIG_IS_ICR20 (rig->state.rig_model == RIG_MODEL_ICR20)
#define RIG_IS_ICR30 (rig->state.rig_model == RIG_MODEL_ICR30)
#define RIG_IS_ICR6 (rig->state.rig_model == RIG_MODEL_ICR6)
#define RIG_IS_ICR7000 (rig->state.rig_model == RIG_MODEL_ICR7000)
#define RIG_IS_ICR71 (rig->state.rig_model == RIG_MODEL_ICR71)
#define RIG_IS_ICR7100 (rig->state.rig_model == RIG_MODEL_ICR7100)
#define RIG_IS_ICR72 (rig->state.rig_model == RIG_MODEL_ICR72)
#define RIG_IS_ICR75 (rig->state.rig_model == RIG_MODEL_ICR75)
#define RIG_IS_ICR8500 (rig->state.rig_model == RIG_MODEL_ICR8500)
#define RIG_IS_ICR8600 (rig->state.rig_model == RIG_MODEL_ICR8600)
#define RIG_IS_ICR9000 (rig->state.rig_model == RIG_MODEL_ICR9000)
#define RIG_IS_ICR9500 (rig->state.rig_model == RIG_MODEL_ICR9500)
#define RIG_IS_ICRX7 (rig->state.rig_model == RIG_MODEL_ICRX7)
#define RIG_IS_ID5100 (rig->state.rig_model == RIG_MODEL_ID5100)
#define RIG_IS_OMNIVIP (rig->state.rig_model == RIG_MODEL_OMNIVIP)
#define RIG_IS_OS456 (rig->state.rig_model == RIG_MODEL_OS456)
#define RIG_IS_X5105 (rig->state.rig_model == RIG_MODEL_X5105)
#define RIG_IS_X6100 (rig->state.rig_model == RIG_MODEL_X6100)
#define RIG_IS_IC1271 (STATE(rig)->rig_model == RIG_MODEL_IC1271)
#define RIG_IS_IC1275 (STATE(rig)->rig_model == RIG_MODEL_IC1275)
#define RIG_IS_IC271 (STATE(rig)->rig_model == RIG_MODEL_IC271)
#define RIG_IS_IC2730 (STATE(rig)->rig_model == RIG_MODEL_IC2730)
#define RIG_IS_IC275 (STATE(rig)->rig_model == RIG_MODEL_IC275)
#define RIG_IS_IC375 (STATE(rig)->rig_model == RIG_MODEL_IC375)
#define RIG_IS_IC471 (STATE(rig)->rig_model == RIG_MODEL_IC471)
#define RIG_IS_IC475 (STATE(rig)->rig_model == RIG_MODEL_IC475)
#define RIG_IS_IC575 (STATE(rig)->rig_model == RIG_MODEL_IC575)
#define RIG_IS_IC7000 (STATE(rig)->rig_model == RIG_MODEL_IC7000)
#define RIG_IS_IC703 (STATE(rig)->rig_model == RIG_MODEL_IC703)
#define RIG_IS_IC705 (STATE(rig)->rig_model == RIG_MODEL_IC705)
#define RIG_IS_IC706 (STATE(rig)->rig_model == RIG_MODEL_IC706)
#define RIG_IS_IC706MKII (STATE(rig)->rig_model == RIG_MODEL_IC706MKII)
#define RIG_IS_IC706MKIIG (STATE(rig)->rig_model == RIG_MODEL_IC706MKIIG)
#define RIG_IS_IC707 (STATE(rig)->rig_model == RIG_MODEL_IC707)
#define RIG_IS_IC7100 (STATE(rig)->rig_model == RIG_MODEL_IC7100)
#define RIG_IS_IC718 (STATE(rig)->rig_model == RIG_MODEL_IC718)
#define RIG_IS_IC7200 (STATE(rig)->rig_model == RIG_MODEL_IC7200)
#define RIG_IS_IC725 (STATE(rig)->rig_model == RIG_MODEL_IC725)
#define RIG_IS_IC726 (STATE(rig)->rig_model == RIG_MODEL_IC726)
#define RIG_IS_IC728 (STATE(rig)->rig_model == RIG_MODEL_IC728)
#define RIG_IS_IC729 (STATE(rig)->rig_model == RIG_MODEL_IC729)
#define RIG_IS_IC7300 (STATE(rig)->rig_model == RIG_MODEL_IC7300)
#define RIG_IS_IC731 (STATE(rig)->rig_model == RIG_MODEL_IC731)
#define RIG_IS_IC735 (STATE(rig)->rig_model == RIG_MODEL_IC735)
#define RIG_IS_IC736 (STATE(rig)->rig_model == RIG_MODEL_IC736)
#define RIG_IS_IC737 (STATE(rig)->rig_model == RIG_MODEL_IC737)
#define RIG_IS_IC738 (STATE(rig)->rig_model == RIG_MODEL_IC738)
#define RIG_IS_IC7410 (STATE(rig)->rig_model == RIG_MODEL_IC7410)
#define RIG_IS_IC746 (STATE(rig)->rig_model == RIG_MODEL_IC746)
#define RIG_IS_IC746PRO (STATE(rig)->rig_model == RIG_MODEL_IC746PRO)
#define RIG_IS_IC751 (STATE(rig)->rig_model == RIG_MODEL_IC751)
#define RIG_IS_IC751A (STATE(rig)->rig_model == RIG_MODEL_IC751A)
#define RIG_IS_IC756 (STATE(rig)->rig_model == RIG_MODEL_IC756)
#define RIG_IS_IC756PRO (STATE(rig)->rig_model == RIG_MODEL_IC756PRO)
#define RIG_IS_IC756PROII (STATE(rig)->rig_model == RIG_MODEL_IC756PROII)
#define RIG_IS_IC756PROIII (STATE(rig)->rig_model == RIG_MODEL_IC756PROIII)
#define RIG_IS_IC7600 (STATE(rig)->rig_model == RIG_MODEL_IC7600)
#define RIG_IS_IC761 (STATE(rig)->rig_model == RIG_MODEL_IC761)
#define RIG_IS_IC7610 (STATE(rig)->rig_model == RIG_MODEL_IC7610)
#define RIG_IS_IC765 (STATE(rig)->rig_model == RIG_MODEL_IC765)
#define RIG_IS_IC7700 (STATE(rig)->rig_model == RIG_MODEL_IC7700)
#define RIG_IS_IC775 (STATE(rig)->rig_model == RIG_MODEL_IC775)
#define RIG_IS_IC78 (STATE(rig)->rig_model == RIG_MODEL_IC78)
#define RIG_IS_IC7800 (STATE(rig)->rig_model == RIG_MODEL_IC7800)
#define RIG_IS_IC781 (STATE(rig)->rig_model == RIG_MODEL_IC781)
#define RIG_IS_IC785X (STATE(rig)->rig_model == RIG_MODEL_IC785x)
#define RIG_IS_IC820 (STATE(rig)->rig_model == RIG_MODEL_IC820)
#define RIG_IS_IC821 (STATE(rig)->rig_model == RIG_MODEL_IC821)
#define RIG_IS_IC821H (STATE(rig)->rig_model == RIG_MODEL_IC821H)
#define RIG_IS_IC905 (STATE(rig)->rig_model == RIG_MODEL_IC905)
#define RIG_IS_IC910 (STATE(rig)->rig_model == RIG_MODEL_IC910)
#define RIG_IS_IC9100 (STATE(rig)->rig_model == RIG_MODEL_IC9100)
#define RIG_IS_IC92D (STATE(rig)->rig_model == RIG_MODEL_IC92D)
#define RIG_IS_IC970 (STATE(rig)->rig_model == RIG_MODEL_IC970)
#define RIG_IS_IC9700 (STATE(rig)->rig_model == RIG_MODEL_IC9700)
#define RIG_IS_IC8101 (STATE(rig)->rig_model == RIG_MODEL_ICF8101)
#define RIG_IS_ICID1 (STATE(rig)->rig_model == RIG_MODEL_ICID1)
#define RIG_IS_ICM700PRO (STATE(rig)->rig_model == RIG_MODEL_IC_M700PRO)
#define RIG_IS_ICM710 (STATE(rig)->rig_model == RIG_MODEL_IC_M710)
#define RIG_IS_ICM802 (STATE(rig)->rig_model == RIG_MODEL_IC_M802)
#define RIG_IS_ICM803 (STATE(rig)->rig_model == RIG_MODEL_IC_M803)
#define RIG_IS_ICR10 (STATE(rig)->rig_model == RIG_MODEL_ICR10)
#define RIG_IS_ICR20 (STATE(rig)->rig_model == RIG_MODEL_ICR20)
#define RIG_IS_ICR30 (STATE(rig)->rig_model == RIG_MODEL_ICR30)
#define RIG_IS_ICR6 (STATE(rig)->rig_model == RIG_MODEL_ICR6)
#define RIG_IS_ICR7000 (STATE(rig)->rig_model == RIG_MODEL_ICR7000)
#define RIG_IS_ICR71 (STATE(rig)->rig_model == RIG_MODEL_ICR71)
#define RIG_IS_ICR7100 (STATE(rig)->rig_model == RIG_MODEL_ICR7100)
#define RIG_IS_ICR72 (STATE(rig)->rig_model == RIG_MODEL_ICR72)
#define RIG_IS_ICR75 (STATE(rig)->rig_model == RIG_MODEL_ICR75)
#define RIG_IS_ICR8500 (STATE(rig)->rig_model == RIG_MODEL_ICR8500)
#define RIG_IS_ICR8600 (STATE(rig)->rig_model == RIG_MODEL_ICR8600)
#define RIG_IS_ICR9000 (STATE(rig)->rig_model == RIG_MODEL_ICR9000)
#define RIG_IS_ICR9500 (STATE(rig)->rig_model == RIG_MODEL_ICR9500)
#define RIG_IS_ICRX7 (STATE(rig)->rig_model == RIG_MODEL_ICRX7)
#define RIG_IS_ID5100 (STATE(rig)->rig_model == RIG_MODEL_ID5100)
#define RIG_IS_OMNIVIP (STATE(rig)->rig_model == RIG_MODEL_OMNIVIP)
#define RIG_IS_OS456 (STATE(rig)->rig_model == RIG_MODEL_OS456)
#define RIG_IS_X5105 (STATE(rig)->rig_model == RIG_MODEL_X5105)
#define RIG_IS_X6100 (STATE(rig)->rig_model == RIG_MODEL_X6100)
#endif /* _ICOM_H */

Wyświetl plik

@ -250,7 +250,7 @@ struct rig_caps icr75_caps =
/*
* 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
*/
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;
int err;
rs = &rig->state;
rs = STATE(rig);
priv = (struct icom_priv_data *)rs->priv;
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
* Assumes rig!=NULL, rig->state.priv!=NULL, chan!=NULL
* Assumes rig!=NULL, STATE(rig)->priv!=NULL, chan!=NULL
* TODO: still a WIP --SF
*/
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];
int chan_len, freq_len, retval;
rs = &rig->state;
rs = STATE(rig);
priv = (struct icom_priv_data *)rs->priv;
to_bcd_be(chanbuf, chan->channel_num, 4);

Wyświetl plik

@ -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)
{
struct rig_state *rs = &rig->state;
struct rig_state *rs = STATE(rig);
struct icom_priv_data *priv = (struct icom_priv_data *) rs->priv;
unsigned char ackbuf[MAXFRAMELEN];
int ack_len = sizeof(ackbuf), retval;
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 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;
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)
{
myvfo = S_SUB;
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,
@ -153,12 +153,12 @@ int id5100_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
unsigned char freqbuf[MAXFRAMELEN];
int freq_len = 5;
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;
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); }
@ -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)
{
struct rig_state *rs = &rig->state;
struct rig_state *rs = STATE(rig);
struct icom_priv_data *priv = (struct icom_priv_data *) rs->priv;
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
{
@ -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__);
}
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)
{
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)
{
struct rig_state *rs = &rig->state;
struct rig_state *rs = STATE(rig);
struct icom_priv_data *priv = (struct icom_priv_data *) rs->priv;
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 retval;
//struct rig_state *rs = &rig->state;
//struct rig_state *rs = STATE(rig);
//struct icom_priv_data *priv = (struct icom_priv_data *) rs->priv;
//vfo_t currvfo;
rig_debug(RIG_DEBUG_VERBOSE, "%s(%d): vfo=%s\n", __func__, __LINE__,
rig_strvfo(vfo));
#if 0
currvfo = rig->state.current_vfo;
currvfo = rs->current_vfo;
if (priv->dual_watch_main_sub == MAIN_ON_LEFT && (currvfo == RIG_VFO_MAIN
|| currvfo == RIG_VFO_A) && vfo == RIG_VFO_TX)

Wyświetl plik

@ -179,7 +179,7 @@ struct rig_caps omnivip_caps =
/*
* 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)
{

Wyświetl plik

@ -60,7 +60,7 @@ static int optoscan_wait_timer(RIG *rig, pltstate_t *state);
/*
* optoscan_open
* Assumes rig!=NULL, rig->state.priv!=NULL
* Assumes rig!=NULL, STATE(rig)->priv!=NULL
*/
int optoscan_open(RIG *rig)
{
@ -70,7 +70,7 @@ int optoscan_open(RIG *rig)
unsigned char ackbuf[16];
int ack_len, retval;
rs = &rig->state;
rs = STATE(rig);
priv = (struct icom_priv_data *)rs->priv;
pltstate = calloc(1, sizeof(pltstate_t));
@ -106,7 +106,7 @@ int optoscan_open(RIG *rig)
/*
* optoscan_close
* Assumes rig!=NULL, rig->state.priv!=NULL
* Assumes rig!=NULL, STATE(rig)->priv!=NULL
*/
int optoscan_close(RIG *rig)
{
@ -115,7 +115,7 @@ int optoscan_close(RIG *rig)
unsigned char ackbuf[16];
int ack_len, retval;
rs = &rig->state;
rs = STATE(rig);
priv = (struct icom_priv_data *)rs->priv;
/* select LOCAL control */
@ -141,7 +141,7 @@ int optoscan_close(RIG *rig)
/*
* optoscan_get_info
* Assumes rig!=NULL, rig->state.priv!=NULL
* Assumes rig!=NULL, STATE(rig)->priv!=NULL
*/
const char *optoscan_get_info(RIG *rig)
{
@ -176,7 +176,7 @@ const char *optoscan_get_info(RIG *rig)
/*
* 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)
{
@ -209,7 +209,7 @@ int optoscan_get_ctcss_tone(RIG *rig, vfo_t vfo, tone_t *tone)
/*
* 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)
{
@ -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)
{
@ -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.
*/
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
* 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)
{
@ -487,7 +487,7 @@ int optoscan_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
/*
* 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)
{
@ -618,7 +618,7 @@ int optoscan_scan(RIG *rig, vfo_t vfo, scan_t scan, int ch)
return -RIG_ENAVAIL;
}
rs = &rig->state;
rs = STATE(rig);
cb = rig->callbacks.pltune;
state = ((struct icom_priv_data *)rs->priv)->pltstate;

Wyświetl plik

@ -917,7 +917,7 @@ struct rig_caps x5105_caps =
/*
* 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
* 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
* Eventually they may fix their firmware and we can use the icom_set_split_vfo
* 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)
{
@ -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)
{
/* 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; }
}
@ -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
* Assumes rig!=NULL, rig->state.priv!=NULL,
* Assumes rig!=NULL, STATE(rig)->priv!=NULL,
*
* 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
queries */
/* 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)
{
/* 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->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)
{
/* 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
* 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,
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
queries */
/* 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)
{
/* 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->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)
{
/* Re-enable split */

Wyświetl plik

@ -694,6 +694,7 @@ int tt565_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
char ttmode, ttreceiver;
int retry;
int timeout;
struct rig_state *rs = STATE(rig);
ttreceiver = which_receiver(rig, vfo);
@ -743,15 +744,15 @@ int tt565_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
/* Query passband width (filter) */
// since this fails at 80ms sometimes we won't retry and will reduce the timeout
// Normally this comes back in about 30ms
retry = rig->state.retry;
timeout = rig->state.timeout;
rig->state.retry = 0;
rig->state.timeout = 100;
retry = rs->retry;
timeout = rs->timeout;
rs->retry = 0;
rs->timeout = 100;
SNPRINTF(cmdbuf, sizeof(cmdbuf), "?R%cF" EOM, ttreceiver);
resp_len = sizeof(respbuf);
retval = tt565_transaction(rig, cmdbuf, strlen(cmdbuf), respbuf, &resp_len);
rig->state.retry = retry;
rig->state.timeout = timeout;
rs->retry = retry;
rs->timeout = timeout;
if (retval != RIG_OK)
{

Wyświetl plik

@ -471,10 +471,10 @@ int ft100_init(RIG *rig)
{
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
rig->state.priv = (struct ft100_priv_data *) calloc(1,
STATE(rig)->priv = (struct ft100_priv_data *) calloc(1,
sizeof(struct ft100_priv_data));
if (!rig->state.priv) { return -RIG_ENOMEM; }
if (!STATE(rig)->priv) { return -RIG_ENOMEM; }
return RIG_OK;
}
@ -486,12 +486,12 @@ int ft100_cleanup(RIG *rig)
return -RIG_EINVAL;
}
if (rig->state.priv)
if (STATE(rig)->priv)
{
free(rig->state.priv);
free(STATE(rig)->priv);
}
rig->state.priv = NULL;
STATE(rig)->priv = NULL;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
@ -538,7 +538,7 @@ static int ft100_read_status(RIG *rig)
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
priv = (struct ft100_priv_data *)rig->state.priv;
priv = (struct ft100_priv_data *)STATE(rig)->priv;
rig_flush(rp);
@ -563,7 +563,7 @@ static int ft100_read_status(RIG *rig)
static int ft100_read_flags(RIG *rig)
{
struct ft100_priv_data *priv = (struct ft100_priv_data *)rig->state.priv;
struct ft100_priv_data *priv = (struct ft100_priv_data *)STATE(rig)->priv;
int ret;
hamlib_port_t *rp = RIGPORT(rig);
@ -613,7 +613,7 @@ int ft100_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
int ft100_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
{
struct ft100_priv_data *priv = (struct ft100_priv_data *)rig->state.priv;
struct ft100_priv_data *priv = (struct ft100_priv_data *)STATE(rig)->priv;
freq_t d1, d2;
char freq_str[10];
int ret;
@ -757,7 +757,7 @@ int ft100_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
int ft100_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
{
struct ft100_priv_data *priv = (struct ft100_priv_data *)rig->state.priv;
struct ft100_priv_data *priv = (struct ft100_priv_data *)STATE(rig)->priv;
int ret;
if (!mode || !width) { return -RIG_EINVAL; }
@ -883,7 +883,7 @@ int ft100_set_vfo(RIG *rig, vfo_t vfo)
int ft100_get_vfo(RIG *rig, vfo_t *vfo)
{
struct ft100_priv_data *priv = (struct ft100_priv_data *)rig->state.priv;
struct ft100_priv_data *priv = (struct ft100_priv_data *)STATE(rig)->priv;
int ret;
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
@ -947,7 +947,7 @@ int ft100_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
int ft100_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt)
{
struct ft100_priv_data *priv = (struct ft100_priv_data *)rig->state.priv;
struct ft100_priv_data *priv = (struct ft100_priv_data *)STATE(rig)->priv;
int ret;
if (!ptt) { return -RIG_EINVAL; }
@ -1104,7 +1104,7 @@ int ft100_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
int ft100_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo)
{
struct ft100_priv_data *priv = (struct ft100_priv_data *)rig->state.priv;
struct ft100_priv_data *priv = (struct ft100_priv_data *)STATE(rig)->priv;
int ret;
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
@ -1158,7 +1158,7 @@ int ft100_set_rptr_shift(RIG *rig, vfo_t vfo, rptr_shift_t shift)
int ft100_get_rptr_shift(RIG *rig, vfo_t vfo, rptr_shift_t *shift)
{
int ret;
struct ft100_priv_data *priv = (struct ft100_priv_data *)rig->state.priv;
struct ft100_priv_data *priv = (struct ft100_priv_data *)STATE(rig)->priv;
ret = ft100_read_status(rig);
@ -1217,7 +1217,7 @@ int ft100_set_dcs_code(RIG *rig, vfo_t vfo, tone_t code)
int ft100_get_dcs_code(RIG *rig, vfo_t vfo, tone_t *code)
{
int ret;
struct ft100_priv_data *priv = (struct ft100_priv_data *)rig->state.priv;
struct ft100_priv_data *priv = (struct ft100_priv_data *)STATE(rig)->priv;
ret = ft100_read_status(rig);
@ -1271,7 +1271,7 @@ int ft100_set_ctcss_tone(RIG *rig, vfo_t vfo, tone_t tone)
int ft100_get_ctcss_tone(RIG *rig, vfo_t vfo, tone_t *tone)
{
int ret;
struct ft100_priv_data *priv = (struct ft100_priv_data *)rig->state.priv;
struct ft100_priv_data *priv = (struct ft100_priv_data *)STATE(rig)->priv;
ret = ft100_read_status(rig);

Wyświetl plik

@ -584,15 +584,15 @@ static int ft1000d_init(RIG *rig)
return -RIG_EINVAL;
}
rig->state.priv = (struct ft1000d_priv_data *) calloc(1,
STATE(rig)->priv = (struct ft1000d_priv_data *) calloc(1,
sizeof(struct ft1000d_priv_data));
if (!rig->state.priv)
if (!STATE(rig)->priv)
{
return -RIG_ENOMEM;
}
priv = rig->state.priv;
priv = STATE(rig)->priv;
// Set default pacing value
priv->pacing = FT1000D_PACING_DEFAULT_VALUE;
@ -617,12 +617,12 @@ static int ft1000d_cleanup(RIG *rig)
return -RIG_EINVAL;
}
if (rig->state.priv)
if (STATE(rig)->priv)
{
free(rig->state.priv);
free(STATE(rig)->priv);
}
rig->state.priv = NULL;
STATE(rig)->priv = NULL;
return RIG_OK;
}
@ -643,7 +643,7 @@ static int ft1000d_open(RIG *rig)
return -RIG_EINVAL;
}
priv = (struct ft1000d_priv_data *)rig->state.priv;
priv = (struct ft1000d_priv_data *)STATE(rig)->priv;
rig_debug(RIG_DEBUG_TRACE, "%s: write_delay = %i msec\n",
__func__, RIGPORT(rig)->write_delay);
@ -729,7 +729,7 @@ static int ft1000d_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
return -RIG_EINVAL;
}
priv = (struct ft1000d_priv_data *)rig->state.priv;
priv = (struct ft1000d_priv_data *)STATE(rig)->priv;
// Set to selected VFO
if (vfo == RIG_VFO_CURR)
@ -795,7 +795,7 @@ static int ft1000d_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
return -RIG_EINVAL;
}
priv = (struct ft1000d_priv_data *)rig->state.priv;
priv = (struct ft1000d_priv_data *)STATE(rig)->priv;
if (vfo == RIG_VFO_CURR)
{
@ -888,7 +888,7 @@ static int ft1000d_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo);
rig_debug(RIG_DEBUG_TRACE, "%s: passed ptt = 0x%02x\n", __func__, ptt);
priv = (struct ft1000d_priv_data *) rig->state.priv;
priv = (struct ft1000d_priv_data *) STATE(rig)->priv;
// Set to selected VFO
if (vfo == RIG_VFO_CURR)
@ -964,7 +964,7 @@ static int ft1000d_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt)
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo);
priv = (struct ft1000d_priv_data *) rig->state.priv;
priv = (struct ft1000d_priv_data *) STATE(rig)->priv;
err = ft1000d_get_update_data(rig, FT1000D_NATIVE_READ_FLAGS, 0);
@ -1019,7 +1019,7 @@ static int ft1000d_set_rptr_shift(RIG *rig, vfo_t vfo, rptr_shift_t rptr_shift)
rig_debug(RIG_DEBUG_TRACE, "%s: passed rptr_shift = 0x%02x\n", __func__,
rptr_shift);
priv = (struct ft1000d_priv_data *) rig->state.priv;
priv = (struct ft1000d_priv_data *) STATE(rig)->priv;
// Set to selected VFO
if (vfo == RIG_VFO_CURR)
@ -1146,7 +1146,7 @@ static int ft1000d_get_rptr_shift(RIG *rig, vfo_t vfo, rptr_shift_t *rptr_shift)
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo);
priv = (struct ft1000d_priv_data *) rig->state.priv;
priv = (struct ft1000d_priv_data *) STATE(rig)->priv;
if (vfo == RIG_VFO_CURR)
{
@ -1301,7 +1301,7 @@ static int ft1000d_set_split_vfo(RIG *rig, vfo_t vfo, split_t split,
rig_debug(RIG_DEBUG_TRACE, "%s: passed split = 0x%02x\n", __func__, split);
rig_debug(RIG_DEBUG_TRACE, "%s: passed tx_vfo = 0x%02x\n", __func__, tx_vfo);
priv = (struct ft1000d_priv_data *) rig->state.priv;
priv = (struct ft1000d_priv_data *) STATE(rig)->priv;
if (vfo == RIG_VFO_CURR)
{
@ -1400,7 +1400,7 @@ static int ft1000d_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split,
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo);
priv = (struct ft1000d_priv_data *) rig->state.priv;
priv = (struct ft1000d_priv_data *) STATE(rig)->priv;
// Read status flags
err = ft1000d_get_update_data(rig, FT1000D_NATIVE_READ_FLAGS, 0);
@ -1508,7 +1508,7 @@ static int ft1000d_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit)
return -RIG_EINVAL;
}
priv = (struct ft1000d_priv_data *) rig->state.priv;
priv = (struct ft1000d_priv_data *) STATE(rig)->priv;
// Set to selected VFO
if (vfo == RIG_VFO_CURR)
@ -1615,7 +1615,7 @@ static int ft1000d_get_rit(RIG *rig, vfo_t vfo, shortfreq_t *rit)
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo);
priv = (struct ft1000d_priv_data *) rig->state.priv;
priv = (struct ft1000d_priv_data *) STATE(rig)->priv;
if (vfo == RIG_VFO_CURR)
{
@ -1714,7 +1714,7 @@ static int ft1000d_set_xit(RIG *rig, vfo_t vfo, shortfreq_t xit)
return -RIG_EINVAL;
}
priv = (struct ft1000d_priv_data *) rig->state.priv;
priv = (struct ft1000d_priv_data *) STATE(rig)->priv;
// Set to selected VFO
if (vfo == RIG_VFO_CURR)
@ -1820,7 +1820,7 @@ static int ft1000d_get_xit(RIG *rig, vfo_t vfo, shortfreq_t *xit)
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo);
priv = (struct ft1000d_priv_data *) rig->state.priv;
priv = (struct ft1000d_priv_data *) STATE(rig)->priv;
if (vfo == RIG_VFO_CURR)
{
@ -1980,7 +1980,7 @@ static int ft1000d_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status)
rig_debug(RIG_DEBUG_TRACE, "%s: passed func = %s\n", __func__,
rig_strfunc(func));
priv = (struct ft1000d_priv_data *)rig->state.priv;
priv = (struct ft1000d_priv_data *)STATE(rig)->priv;
err = ft1000d_get_update_data(rig, FT1000D_NATIVE_READ_FLAGS, 0);
@ -2105,7 +2105,7 @@ static int ft1000d_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
rig_strrmode(mode));
rig_debug(RIG_DEBUG_TRACE, "%s: passed width = %d Hz\n", __func__, (int)width);
priv = (struct ft1000d_priv_data *)rig->state.priv;
priv = (struct ft1000d_priv_data *)STATE(rig)->priv;
// Set to selected VFO
if (vfo == RIG_VFO_CURR)
@ -2259,7 +2259,7 @@ static int ft1000d_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode,
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo);
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, RIG_VFO_CURR);
priv = (struct ft1000d_priv_data *)rig->state.priv;
priv = (struct ft1000d_priv_data *)STATE(rig)->priv;
if (vfo == RIG_VFO_CURR)
{
@ -2438,8 +2438,8 @@ static int ft1000d_set_vfo(RIG *rig, vfo_t vfo)
return -RIG_EINVAL;
}
priv = (struct ft1000d_priv_data *)rig->state.priv;
rig_debug(RIG_DEBUG_TRACE, "%s: MADE IT TO rig.state.priv = 0x%02x\n", __func__,
priv = (struct ft1000d_priv_data *)STATE(rig)->priv;
rig_debug(RIG_DEBUG_TRACE, "%s: MADE IT TO STATE(rig)->priv = 0x%02x\n", __func__,
RIG_VFO_CURR);
// if (vfo == RIG_VFO_CURR) {
@ -2531,7 +2531,7 @@ static int ft1000d_get_vfo(RIG *rig, vfo_t *vfo)
return -RIG_EINVAL;
}
priv = (struct ft1000d_priv_data *)rig->state.priv;
priv = (struct ft1000d_priv_data *)STATE(rig)->priv;
/* Get flags for VFO status */
err = ft1000d_get_update_data(rig, FT1000D_NATIVE_READ_FLAGS, 0);
@ -2618,7 +2618,7 @@ static int ft1000d_get_level(RIG *rig, vfo_t vfo, setting_t level,
rig_debug(RIG_DEBUG_TRACE, "%s: passed level %s\n", __func__,
rig_strlevel(level));
priv = (struct ft1000d_priv_data *) rig->state.priv;
priv = (struct ft1000d_priv_data *) STATE(rig)->priv;
if (vfo == RIG_VFO_CURR)
{
@ -2717,7 +2717,7 @@ static int ft1000d_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op)
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo %s\n", __func__, rig_strvfo(vfo));
rig_debug(RIG_DEBUG_TRACE, "%s: passed op %sn", __func__, rig_strvfop(op));
priv = (struct ft1000d_priv_data *) rig->state.priv;
priv = (struct ft1000d_priv_data *) STATE(rig)->priv;
if (vfo == RIG_VFO_CURR)
{
@ -2838,7 +2838,7 @@ static int ft1000d_set_mem(RIG *rig, vfo_t vfo, int ch)
rig_debug(RIG_DEBUG_TRACE, "%s: passed ch = %i\n", __func__, ch);
priv = (struct ft1000d_priv_data *) rig->state.priv;
priv = (struct ft1000d_priv_data *) STATE(rig)->priv;
// Check for valid channel number
if (ch < 1 || ch > 90)
@ -2890,7 +2890,7 @@ static int ft1000d_get_mem(RIG *rig, vfo_t vfo, int *ch)
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo);
priv = (struct ft1000d_priv_data *) rig->state.priv;
priv = (struct ft1000d_priv_data *) STATE(rig)->priv;
if (vfo == RIG_VFO_CURR)
{
@ -2985,7 +2985,7 @@ static int ft1000d_get_channel(RIG *rig, vfo_t vfo, channel_t *chan,
rig_debug(RIG_DEBUG_TRACE, "%s: passed chan->channel_num = %i\n",
__func__, chan->channel_num);
priv = (struct ft1000d_priv_data *) rig->state.priv;
priv = (struct ft1000d_priv_data *) STATE(rig)->priv;
if (chan->channel_num < 0 || chan->channel_num > 90)
{
@ -3467,7 +3467,7 @@ static int ft1000d_get_update_data(RIG *rig, unsigned char ci,
return -RIG_EINVAL;
}
priv = (struct ft1000d_priv_data *)rig->state.priv;
priv = (struct ft1000d_priv_data *)STATE(rig)->priv;
retry = rp->retry;
@ -3634,7 +3634,7 @@ static int ft1000d_send_dynamic_cmd(RIG *rig, unsigned char ci,
"%s: passed p1 = 0x%02x, p2 = 0x%02x, p3 = 0x%02x, p4 = 0x%02x,\n",
__func__, p1, p2, p3, p4);
priv = (struct ft1000d_priv_data *)rig->state.priv;
priv = (struct ft1000d_priv_data *)STATE(rig)->priv;
if (ncmd[ci].ncomp)
{
@ -3691,7 +3691,7 @@ static int ft1000d_send_dial_freq(RIG *rig, unsigned char ci, freq_t freq)
rig_debug(RIG_DEBUG_TRACE, "%s: passed ci = 0x%02x\n", __func__, ci);
rig_debug(RIG_DEBUG_TRACE, "%s: passed freq = %"PRIfreq" Hz\n", __func__, freq);
priv = (struct ft1000d_priv_data *)rig->state.priv;
priv = (struct ft1000d_priv_data *)STATE(rig)->priv;
if (ncmd[ci].ncomp)
{
@ -3747,7 +3747,7 @@ static int ft1000d_send_rit_freq(RIG *rig, unsigned char ci, shortfreq_t rit)
rig_debug(RIG_DEBUG_TRACE, "%s: passed ci = 0x%02x\n", __func__, ci);
rig_debug(RIG_DEBUG_TRACE, "%s: passed rit = %li Hz\n", __func__, rit);
priv = (struct ft1000d_priv_data *) rig->state.priv;
priv = (struct ft1000d_priv_data *) STATE(rig)->priv;
if (ncmd[ci].ncomp)
{
@ -3829,7 +3829,7 @@ static int ft1000d_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq)
if (err != RIG_OK) { RETURNFUNC(err); }
// priv = (struct ft1000d_priv_data *)rig->state.priv;
// priv = (struct ft1000d_priv_data *)STATE(rig)->priv;
err = ft1000d_send_dial_freq(rig, FT1000D_NATIVE_SET_SUB_VFO_FREQ, tx_freq);
@ -3884,7 +3884,7 @@ static int ft1000d_get_split_freq(RIG *rig, vfo_t vfo, freq_t *tx_freq)
return -RIG_EINVAL;
}
priv = (struct ft1000d_priv_data *) rig->state.priv;
priv = (struct ft1000d_priv_data *) STATE(rig)->priv;
err = ft1000d_get_split_vfo(rig, vfo, &priv->split, &priv->split_vfo);
@ -3955,7 +3955,7 @@ static int ft1000d_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode,
rig_debug(RIG_DEBUG_TRACE, "%s: passed width = %d Hz\n", __func__,
(int)tx_width);
// priv = (struct ft1000d_priv_data *)rig->state.priv;
// priv = (struct ft1000d_priv_data *)STATE(rig)->priv;
switch (tx_mode)
{
@ -4080,7 +4080,7 @@ static int ft1000d_get_split_mode(RIG *rig, vfo_t vfo, rmode_t *tx_mode,
return -RIG_EINVAL;
}
priv = (struct ft1000d_priv_data *)rig->state.priv;
priv = (struct ft1000d_priv_data *)STATE(rig)->priv;
err = ft1000d_get_split_vfo(rig, vfo, &priv->split, &priv->split_vfo);
@ -4115,8 +4115,8 @@ static int ft1000_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
if (vfo == RIG_VFO_CURR)
{
rig_debug(RIG_DEBUG_TRACE, "%s: current_vfo=%s\n", __func__,
rig_strvfo(rig->state.current_vfo));
vfo = rig->state.current_vfo;
rig_strvfo(STATE(rig)->current_vfo));
vfo = STATE(rig)->current_vfo;
}
if (vfo == RIG_VFO_A)
@ -4147,7 +4147,7 @@ static int ft1000_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
static int ft1000_get_vfo(RIG *rig, vfo_t *vfo)
{
*vfo = rig->state.current_vfo;
*vfo = STATE(rig)->current_vfo;
return RIG_OK;
}

Wyświetl plik

@ -749,15 +749,15 @@ static int ft1000mp_init(RIG *rig)
ENTERFUNC;
rig->state.priv = (struct ft1000mp_priv_data *) calloc(1,
STATE(rig)->priv = (struct ft1000mp_priv_data *) calloc(1,
sizeof(struct ft1000mp_priv_data));
if (!rig->state.priv) /* whoops! memory shortage! */
if (!STATE(rig)->priv) /* whoops! memory shortage! */
{
RETURNFUNC(-RIG_ENOMEM);
}
priv = rig->state.priv;
priv = STATE(rig)->priv;
/* TODO: read pacing from preferences */
priv->pacing =
@ -777,12 +777,12 @@ static int ft1000mp_cleanup(RIG *rig)
{
ENTERFUNC;
if (rig->state.priv)
if (STATE(rig)->priv)
{
free(rig->state.priv);
free(STATE(rig)->priv);
}
rig->state.priv = NULL;
STATE(rig)->priv = NULL;
RETURNFUNC(RIG_OK);
}
@ -802,7 +802,7 @@ static int ft1000mp_open(RIG *rig)
ENTERFUNC;
rig_s = &rig->state;
rig_s = STATE(rig);
p = (struct ft1000mp_priv_data *)rig_s->priv;
rig_debug(RIG_DEBUG_TRACE, "%s: rig_open: write_delay = %i msec \n", __func__,
@ -822,7 +822,7 @@ static int ft1000mp_open(RIG *rig)
cmd = p->p_cmd;
write_block(rp, cmd, YAESU_CMD_LENGTH);
ft1000mp_get_vfo(rig, &rig->state.current_vfo);
ft1000mp_get_vfo(rig, &rig_s->current_vfo);
/* TODO */
RETURNFUNC(RIG_OK);
@ -838,7 +838,7 @@ static int ft1000mp_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
ENTERFUNC;
p = (struct ft1000mp_priv_data *)rig->state.priv;
p = (struct ft1000mp_priv_data *)STATE(rig)->priv;
rig_debug(RIG_DEBUG_TRACE, "%s: requested freq on %s = %"PRIfreq" Hz \n",
__func__,
@ -846,7 +846,7 @@ static int ft1000mp_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
if (vfo == RIG_VFO_CURR)
{
vfo = rig->state.current_vfo;
vfo = STATE(rig)->current_vfo;
}
// round freq to 10Hz intervals due to rig restriction
@ -929,8 +929,8 @@ static int ft1000mp_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
if (vfo == RIG_VFO_CURR)
{
rig_debug(RIG_DEBUG_TRACE, "%s: current_vfo=%s\n", __func__,
rig_strvfo(rig->state.current_vfo));
vfo = rig->state.current_vfo;
rig_strvfo(STATE(rig)->current_vfo));
vfo = STATE(rig)->current_vfo;
}
if (vfo == RIG_VFO_A)
@ -966,8 +966,8 @@ static int ft1000mp_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
if (vfo == RIG_VFO_CURR)
{
rig_debug(RIG_DEBUG_TRACE, "%s: current_vfo=%s\n", __func__,
rig_strvfo(rig->state.current_vfo));
vfo = rig->state.current_vfo;
rig_strvfo(STATE(rig)->current_vfo));
vfo = STATE(rig)->current_vfo;
}
/*
@ -1081,14 +1081,15 @@ static int ft1000mp_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode,
unsigned char mymode; /* ft1000mp mode */
unsigned char mymode_ext; /* ft1000mp extra mode bit mode */
int retval;
struct rig_state *rs = STATE(rig);
ENTERFUNC;
if (vfo == RIG_VFO_CURR)
{
rig_debug(RIG_DEBUG_TRACE, "%s: current_vfo=%s\n", __func__,
rig_strvfo(rig->state.current_vfo));
vfo = rig->state.current_vfo;
rig_strvfo(rs->current_vfo));
vfo = rs->current_vfo;
}
retval = ft1000mp_get_vfo_data(rig, vfo);
@ -1098,7 +1099,7 @@ static int ft1000mp_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode,
RETURNFUNC(retval);
}
priv = (struct ft1000mp_priv_data *)rig->state.priv;
priv = (struct ft1000mp_priv_data *)rs->priv;
if (vfo == RIG_VFO_B)
{
@ -1188,7 +1189,7 @@ static int ft1000mp_set_vfo(RIG *rig, vfo_t vfo)
if (vfo == RIG_VFO_VFO)
{
vfo = rig->state.current_vfo;
vfo = STATE(rig)->current_vfo;
}
#if 0 // seems switching VFOs like this changes the frequencies in the response
@ -1197,13 +1198,13 @@ static int ft1000mp_set_vfo(RIG *rig, vfo_t vfo)
{
case RIG_VFO_A:
cmd_index = FT1000MP_NATIVE_VFO_A;
rig->state.current_vfo = vfo; /* update active VFO */
STATE(rig)->current_vfo = vfo; /* update active VFO */
rig_debug(RIG_DEBUG_TRACE, "%s: vfo == RIG_VFO_A\n", __func__);
break;
case RIG_VFO_B:
cmd_index = FT1000MP_NATIVE_VFO_B;
rig->state.current_vfo = vfo; /* update active VFO */
STATE(rig)->current_vfo = vfo; /* update active VFO */
rig_debug(RIG_DEBUG_TRACE, "%s: vfo == RIG_VFO_B\n", __func__);
break;
@ -1223,7 +1224,7 @@ static int ft1000mp_set_vfo(RIG *rig, vfo_t vfo)
#endif
// we just store the requested vfo in our internal state
rig->state.current_vfo = vfo;
STATE(rig)->current_vfo = vfo;
RETURNFUNC(RIG_OK);
@ -1243,7 +1244,7 @@ static int ft1000mp_get_vfo(RIG *rig, vfo_t *vfo)
ENTERFUNC;
p = (struct ft1000mp_priv_data *)rig->state.priv;
p = (struct ft1000mp_priv_data *)STATE(rig)->priv;
/* Get flags for VFO status */
retval = ft1000mp_get_update_data(rig, FT1000MP_NATIVE_UPDATE,
@ -1260,7 +1261,7 @@ static int ft1000mp_get_vfo(RIG *rig, vfo_t *vfo)
}
else // we are emulating vfo status
{
*vfo = rig->state.current_vfo;
*vfo = STATE(rig)->current_vfo;
if (*vfo == RIG_VFO_CURR)
{
@ -1272,11 +1273,11 @@ static int ft1000mp_get_vfo(RIG *rig, vfo_t *vfo)
#if 0
else if (p->update_data[FT1000MP_SUMO_DISPLAYED_STATUS] & SF_VFOAB)
{
*vfo = rig->state.current_vfo = RIG_VFO_B;
*vfo = STATE(rig)->current_vfo = RIG_VFO_B;
}
else
{
*vfo = rig->state.current_vfo = RIG_VFO_A;
*vfo = STATE(rig)->current_vfo = RIG_VFO_A;
}
#endif
@ -1294,7 +1295,7 @@ static int ft1000mp_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
unsigned char *cmd;
ENTERFUNC;
priv = (struct ft1000mp_priv_data *)rig->state.priv;
priv = (struct ft1000mp_priv_data *)STATE(rig)->priv;
switch (func)
{
@ -1343,7 +1344,7 @@ static int ft1000mp_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status)
unsigned char *p;
ENTERFUNC;
priv = (struct ft1000mp_priv_data *)rig->state.priv;
priv = (struct ft1000mp_priv_data *)STATE(rig)->priv;
if (!status)
{
@ -1438,7 +1439,7 @@ static int ft1000mp_set_rxit(RIG *rig, vfo_t vfo, shortfreq_t rit)
ENTERFUNC;
rs = &rig->state;
rs = STATE(rig);
priv = (struct ft1000mp_priv_data *)rs->priv;
rig_debug(RIG_DEBUG_TRACE, "%s: requested freq = %d Hz\n", __func__, (int)rit);
@ -1487,7 +1488,7 @@ static int ft1000mp_get_rxit(RIG *rig, vfo_t vfo, shortfreq_t *rit)
ENTERFUNC;
priv = (struct ft1000mp_priv_data *)rig->state.priv;
priv = (struct ft1000mp_priv_data *)STATE(rig)->priv;
retval = ft1000mp_get_vfo_data(rig, vfo);
@ -1536,7 +1537,7 @@ static int ft1000mp_get_level(RIG *rig, vfo_t vfo, setting_t level,
int retry = rp->retry;
ENTERFUNC;
rs = &rig->state;
rs = STATE(rig);
priv = (struct ft1000mp_priv_data *)rs->priv;
@ -1548,7 +1549,7 @@ static int ft1000mp_get_level(RIG *rig, vfo_t vfo, setting_t level,
case RIG_LEVEL_RAWSTR:
if (vfo == RIG_VFO_CURR)
{
vfo = rig->state.current_vfo;
vfo = rs->current_vfo;
}
m = vfo == RIG_VFO_B ? 0x01 : 0x00;
@ -1663,7 +1664,7 @@ static int ft1000mp_get_update_data(RIG *rig, unsigned char ci,
ENTERFUNC;
p = (struct ft1000mp_priv_data *)rig->state.priv;
p = (struct ft1000mp_priv_data *)STATE(rig)->priv;
// timeout retries are done in read_block now
// based on rig backed retry value
@ -1709,6 +1710,7 @@ static int ft1000mp_set_split_vfo(RIG *rig, vfo_t vfo, split_t split,
vfo_t tx_vfo)
{
unsigned char cmd_index = 0; /* index of sequence to send */
struct rig_state *rs = STATE(rig);
ENTERFUNC;
rig_debug(RIG_DEBUG_TRACE, "%s called rx_vfo=%s, tx_vfo=%s\n", __func__,
@ -1730,9 +1732,9 @@ static int ft1000mp_set_split_vfo(RIG *rig, vfo_t vfo, split_t split,
}
// manual says VFO_A=Tx and VFO_B=Rx but testing shows otherwise
rig->state.current_vfo = RIG_VFO_A;
rig->state.rx_vfo = RIG_VFO_B;
rig->state.tx_vfo = RIG_VFO_B;
rs->current_vfo = RIG_VFO_A;
rs->rx_vfo = RIG_VFO_B;
rs->tx_vfo = RIG_VFO_B;
ft1000mp_send_priv_cmd(rig, cmd_index);
RETURNFUNC(RIG_OK);
@ -1751,7 +1753,7 @@ static int ft1000mp_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split,
ENTERFUNC;
p = (struct ft1000mp_priv_data *)rig->state.priv;
p = (struct ft1000mp_priv_data *)STATE(rig)->priv;
/* Get flags for split status */
retval = ft1000mp_get_update_data(rig, FT1000MP_NATIVE_UPDATE,

Wyświetl plik

@ -148,7 +148,7 @@ int ft3000_set_ant(RIG *rig, vfo_t vfo, ant_t ant, value_t option)
{
char *cmd;
int err;
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv;
ENTERFUNC;
@ -184,7 +184,7 @@ int ft3000_set_ant(RIG *rig, vfo_t vfo, ant_t ant, value_t option)
int ft3000_get_ant(RIG *rig, vfo_t vfo, ant_t dummy, value_t *option,
ant_t *ant_curr, ant_t *ant_tx, ant_t *ant_rx)
{
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv;
int err;
ENTERFUNC;

Wyświetl plik

@ -340,10 +340,10 @@ static int ft600_init(RIG *rig)
{
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
rig->state.priv = (struct ft600_priv_data *) calloc(1,
STATE(rig)->priv = (struct ft600_priv_data *) calloc(1,
sizeof(struct ft600_priv_data));
if (!rig->state.priv) { return -RIG_ENOMEM; }
if (!STATE(rig)->priv) { return -RIG_ENOMEM; }
return RIG_OK;
}
@ -355,12 +355,12 @@ static int ft600_cleanup(RIG *rig)
return -RIG_EINVAL;
}
if (rig->state.priv)
if (STATE(rig)->priv)
{
free(rig->state.priv);
free(STATE(rig)->priv);
}
rig->state.priv = NULL;
STATE(rig)->priv = NULL;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
@ -401,7 +401,7 @@ static int ft600_read_status(RIG *rig)
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
priv = (struct ft600_priv_data *)rig->state.priv;
priv = (struct ft600_priv_data *)STATE(rig)->priv;
rig_flush(rp);
@ -434,7 +434,7 @@ static int ft600_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
priv = (struct ft600_priv_data *)rig->state.priv;
priv = (struct ft600_priv_data *)STATE(rig)->priv;
ret = ft600_send_priv_cmd(rig, FT600_NATIVE_CAT_READ_METERS);
@ -482,7 +482,7 @@ static int ft600_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
static int ft600_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
{
struct ft600_priv_data *priv = (struct ft600_priv_data *)rig->state.priv;
struct ft600_priv_data *priv = (struct ft600_priv_data *)STATE(rig)->priv;
freq_t f;
int ret;
rig_debug(RIG_DEBUG_VERBOSE, "%s: get_freq\n", __func__);
@ -533,7 +533,7 @@ static int ft600_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
static int ft600_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
{
struct ft600_priv_data *priv = (struct ft600_priv_data *)rig->state.priv;
struct ft600_priv_data *priv = (struct ft600_priv_data *)STATE(rig)->priv;
int ret;
if (!mode)

Wyświetl plik

@ -226,15 +226,15 @@ int ft736_open(RIG *rig)
rig_debug(RIG_DEBUG_TRACE, "%s called\n", __func__);
rig->state.priv = (struct ft736_priv_data *) calloc(1,
STATE(rig)->priv = (struct ft736_priv_data *) calloc(1,
sizeof(struct ft736_priv_data));
if (!rig->state.priv)
if (!STATE(rig)->priv)
{
return -RIG_ENOMEM;
}
priv = rig->state.priv;
priv = STATE(rig)->priv;
priv->split = RIG_SPLIT_OFF;
@ -256,7 +256,7 @@ int ft736_close(RIG *rig)
rig_debug(RIG_DEBUG_TRACE, "%s called\n", __func__);
free(rig->state.priv);
free(STATE(rig)->priv);
/* send Ext Cntl OFF: Deactivate CAT */
return write_block(RIGPORT(rig), cmd, YAESU_CMD_LENGTH);
@ -267,7 +267,7 @@ int ft736_close(RIG *rig)
int ft736_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
{
unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0x01};
const struct ft736_priv_data *priv = (struct ft736_priv_data *)rig->state.priv;
const struct ft736_priv_data *priv = (struct ft736_priv_data *)STATE(rig)->priv;
int retval;
// we will assume requesting to set VFOB is split mode
@ -318,7 +318,7 @@ int ft736_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
{
unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0x07};
unsigned char md;
const struct ft736_priv_data *priv = (struct ft736_priv_data *)rig->state.priv;
const struct ft736_priv_data *priv = (struct ft736_priv_data *)STATE(rig)->priv;
if (vfo == RIG_VFO_B) { return ft736_set_split_mode(rig, vfo, mode, width); }
@ -366,7 +366,7 @@ int ft736_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
int ft736_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
{
unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0x8e};
struct ft736_priv_data *priv = (struct ft736_priv_data *)rig->state.priv;
struct ft736_priv_data *priv = (struct ft736_priv_data *)STATE(rig)->priv;
int ret;
/*

Wyświetl plik

@ -441,10 +441,10 @@ struct rig_caps ft747_caps =
int ft747_init(RIG *rig)
{
rig->state.priv = (struct ft747_priv_data *) calloc(1,
STATE(rig)->priv = (struct ft747_priv_data *) calloc(1,
sizeof(struct ft747_priv_data));
if (!rig->state.priv) /* whoops! memory shortage! */
if (!STATE(rig)->priv) /* whoops! memory shortage! */
{
return -RIG_ENOMEM;
}
@ -465,12 +465,12 @@ int ft747_cleanup(RIG *rig)
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
if (rig->state.priv)
if (STATE(rig)->priv)
{
free(rig->state.priv);
free(STATE(rig)->priv);
}
rig->state.priv = NULL;
STATE(rig)->priv = NULL;
return RIG_OK;
}
@ -487,7 +487,7 @@ int ft747_open(RIG *rig)
struct ft747_priv_data *p;
int ret;
rig_s = &rig->state;
rig_s = STATE(rig);
p = (struct ft747_priv_data *)rig_s->priv;
rig_debug(RIG_DEBUG_VERBOSE, "ft747:rig_open: write_delay = %i msec \n",
@ -547,7 +547,7 @@ int ft747_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
// cppcheck-suppress *
char *fmt = "%s: requested freq after conversion = %"PRIll" Hz \n";
p = (struct ft747_priv_data *)rig->state.priv;
p = (struct ft747_priv_data *)STATE(rig)->priv;
rig_debug(RIG_DEBUG_VERBOSE,
"ft747: requested freq = %"PRIfreq" Hz vfo = %s \n", freq, rig_strvfo(vfo));
@ -595,7 +595,7 @@ int ft747_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
return RIG_OK;
}
p = (struct ft747_priv_data *)rig->state.priv;
p = (struct ft747_priv_data *)STATE(rig)->priv;
ret = ft747_get_update_data(rig); /* get whole shebang from rig */
if (ret < 0)
@ -712,7 +712,7 @@ int ft747_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
rig_debug(RIG_DEBUG_VERBOSE, "ft747: cmd_index = %i \n", cmd_index);
rig_force_cache_timeout(&((struct ft747_priv_data *)
rig->state.priv)->status_tv);
STATE(rig)->priv)->status_tv);
/*
* phew! now send cmd to rig
@ -728,7 +728,7 @@ int ft747_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
unsigned char mymode; /* ft747 mode */
int ret;
p = (struct ft747_priv_data *)rig->state.priv;
p = (struct ft747_priv_data *)STATE(rig)->priv;
ret = ft747_get_update_data(rig); /* get whole shebang from rig */
@ -798,7 +798,7 @@ int ft747_set_vfo(RIG *rig, vfo_t vfo)
struct ft747_priv_data *p;
unsigned char cmd_index; /* index of sequence to send */
p = (struct ft747_priv_data *)rig->state.priv;
p = (struct ft747_priv_data *)STATE(rig)->priv;
switch (vfo)
{
@ -831,7 +831,7 @@ int ft747_get_vfo(RIG *rig, vfo_t *vfo)
unsigned char status; /* ft747 status flag */
int ret;
p = (struct ft747_priv_data *)rig->state.priv;
p = (struct ft747_priv_data *)STATE(rig)->priv;
ret = ft747_get_update_data(rig); /* get whole shebang from rig */
@ -872,7 +872,7 @@ int ft747_set_split(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
FT_747_NATIVE_SPLIT_OFF;
rig_force_cache_timeout(&((struct ft747_priv_data *)
rig->state.priv)->status_tv);
STATE(rig)->priv)->status_tv);
return ft747_send_priv_cmd(rig, cmd_index);
@ -884,7 +884,7 @@ int ft747_get_split(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo)
unsigned char status; /* ft747 status flag */
int ret;
p = (struct ft747_priv_data *)rig->state.priv;
p = (struct ft747_priv_data *)STATE(rig)->priv;
ret = ft747_get_update_data(rig); /* get whole shebang from rig */
@ -930,7 +930,7 @@ int ft747_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
}
rig_force_cache_timeout(&((struct ft747_priv_data *)
rig->state.priv)->status_tv);
STATE(rig)->priv)->status_tv);
/*
* phew! now send cmd to rig
@ -943,7 +943,7 @@ int ft747_set_mem(RIG *rig, vfo_t vfo, int ch)
{
struct ft747_priv_data *p;
p = (struct ft747_priv_data *)rig->state.priv;
p = (struct ft747_priv_data *)STATE(rig)->priv;
if (ch < 0 || ch > 0x13)
{
@ -968,7 +968,7 @@ int ft747_get_mem(RIG *rig, vfo_t vfo, int *ch)
unsigned char mem_nb;
int ret;
p = (struct ft747_priv_data *)rig->state.priv;
p = (struct ft747_priv_data *)STATE(rig)->priv;
ret = ft747_get_update_data(rig); /* get whole shebang from rig */
@ -1003,7 +1003,7 @@ static int ft747_get_update_data(RIG *rig)
struct ft747_priv_data *p;
//unsigned char last_byte;
p = (struct ft747_priv_data *)rig->state.priv;
p = (struct ft747_priv_data *)STATE(rig)->priv;
rigport = RIGPORT(rig);
if (CACHE(rig)->ptt == RIG_PTT_ON
@ -1012,7 +1012,7 @@ static int ft747_get_update_data(RIG *rig)
return RIG_OK;
}
if (!rig->state.transmit) /* rig doesn't respond in Tx mode */
if (!STATE(rig)->transmit) /* rig doesn't respond in Tx mode */
{
int ret;
//int port_timeout;

Wyświetl plik

@ -365,15 +365,15 @@ static int ft757_init(RIG *rig)
return -RIG_EINVAL;
}
rig->state.priv = (struct ft757_priv_data *) calloc(1,
STATE(rig)->priv = (struct ft757_priv_data *) calloc(1,
sizeof(struct ft757_priv_data));
if (!rig->state.priv) /* whoops! memory shortage! */
if (!STATE(rig)->priv) /* whoops! memory shortage! */
{
return -RIG_ENOMEM;
}
priv = rig->state.priv;
priv = STATE(rig)->priv;
priv->curfreq = 1e6;
@ -396,12 +396,12 @@ static int ft757_cleanup(RIG *rig)
{
rig_debug(RIG_DEBUG_VERBOSE, "%s called.\n", __func__);
if (rig->state.priv)
if (STATE(rig)->priv)
{
free(rig->state.priv);
free(STATE(rig)->priv);
}
rig->state.priv = NULL;
STATE(rig)->priv = NULL;
return RIG_OK;
}
@ -413,7 +413,7 @@ static int ft757_cleanup(RIG *rig)
static int ft757_open(RIG *rig)
{
struct ft757_priv_data *priv = (struct ft757_priv_data *)rig->state.priv;
struct ft757_priv_data *priv = (struct ft757_priv_data *)STATE(rig)->priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s called.\n", __func__);
@ -456,7 +456,7 @@ static int ft757_open(RIG *rig)
static int ft757_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
{
struct ft757_priv_data *priv = (struct ft757_priv_data *)rig->state.priv;
struct ft757_priv_data *priv = (struct ft757_priv_data *)STATE(rig)->priv;
unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0x0a};
rig_debug(RIG_DEBUG_VERBOSE, "%s called. Freq=%"PRIfreq"\n", __func__, freq);
@ -497,7 +497,7 @@ static int ft757_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
static int ft757gx_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
{
struct ft757_priv_data *priv = (struct ft757_priv_data *)rig->state.priv;
struct ft757_priv_data *priv = (struct ft757_priv_data *)STATE(rig)->priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s called. fakefreq=%d\n", __func__,
priv->fakefreq);
@ -517,7 +517,7 @@ static int ft757gx_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
static int ft757_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
{
struct ft757_priv_data *priv = (struct ft757_priv_data *)rig->state.priv;
struct ft757_priv_data *priv = (struct ft757_priv_data *)STATE(rig)->priv;
int retval;
rig_debug(RIG_DEBUG_VERBOSE, "%s called.\n", __func__);
@ -556,7 +556,7 @@ static int ft757_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
static int ft757_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
{
const struct ft757_priv_data *priv = (struct ft757_priv_data *)rig->state.priv;
const struct ft757_priv_data *priv = (struct ft757_priv_data *)STATE(rig)->priv;
int retval;
rig_debug(RIG_DEBUG_VERBOSE, "%s called.\n", __func__);
@ -599,7 +599,7 @@ static int ft757_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
static int ft757_set_vfo(RIG *rig, vfo_t vfo)
{
unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0x05};
struct ft757_priv_data *priv = (struct ft757_priv_data *)rig->state.priv;
struct ft757_priv_data *priv = (struct ft757_priv_data *)STATE(rig)->priv;
ENTERFUNC;
@ -627,7 +627,7 @@ static int ft757_set_vfo(RIG *rig, vfo_t vfo)
static int ft757gx_get_vfo(RIG *rig, vfo_t *vfo)
{
const struct ft757_priv_data *priv = (struct ft757_priv_data *)rig->state.priv;
const struct ft757_priv_data *priv = (struct ft757_priv_data *)STATE(rig)->priv;
// we'll just use the cached vfo for the 757GX since we can't read it
*vfo = priv->current_vfo;
return RIG_OK;
@ -635,7 +635,7 @@ static int ft757gx_get_vfo(RIG *rig, vfo_t *vfo)
static int ft757_get_vfo(RIG *rig, vfo_t *vfo)
{
const struct ft757_priv_data *priv = (struct ft757_priv_data *)rig->state.priv;
const struct ft757_priv_data *priv = (struct ft757_priv_data *)STATE(rig)->priv;
int retval;
rig_debug(RIG_DEBUG_VERBOSE, "%s called.\n", __func__);
@ -666,7 +666,7 @@ static int ft757_get_vfo(RIG *rig, vfo_t *vfo)
static int ft757_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt)
{
struct ft757_priv_data *priv = (struct ft757_priv_data *)rig->state.priv;
struct ft757_priv_data *priv = (struct ft757_priv_data *)STATE(rig)->priv;
int retval;
rig_debug(RIG_DEBUG_VERBOSE, "%s called.\n", __func__);
@ -738,7 +738,7 @@ static int ft757_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
static int ft757_get_update_data(RIG *rig)
{
const unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0x10};
struct ft757_priv_data *priv = (struct ft757_priv_data *)rig->state.priv;
struct ft757_priv_data *priv = (struct ft757_priv_data *)STATE(rig)->priv;
hamlib_port_t *rp = RIGPORT(rig);
int retval = 0;
long nbtries;
@ -897,7 +897,7 @@ static int rig2mode(RIG *rig, int md, rmode_t *mode, pbwidth_t *width)
}
/*
* Assumes rig!=NULL, rig->state.priv!=NULL
* Assumes rig!=NULL, STATE(rig)->priv!=NULL
*/
static int ft757gx_get_conf2(RIG *rig, hamlib_token_t token, char *val, int val_len)
{
@ -907,7 +907,7 @@ static int ft757gx_get_conf2(RIG *rig, hamlib_token_t token, char *val, int val_
rig_debug(RIG_DEBUG_VERBOSE, "%s called.\n", __func__);
rs = &rig->state;
rs = STATE(rig);
priv = (struct ft757_priv_data *)rs->priv;
@ -931,7 +931,7 @@ static int ft757gx_get_conf(RIG *rig, hamlib_token_t token, char *val)
}
/*
* Assumes rig!=NULL, rig->state.priv!=NULL
* Assumes rig!=NULL, STATE(rig)->priv!=NULL
*/
static int ft757gx_set_conf(RIG *rig, hamlib_token_t token, const char *val)
{
@ -941,7 +941,7 @@ static int ft757gx_set_conf(RIG *rig, hamlib_token_t token, const char *val)
rig_debug(RIG_DEBUG_VERBOSE, "%s called. val=%s\n", __func__, val);
rs = &rig->state;
rs = STATE(rig);
priv = (struct ft757_priv_data *)rs->priv;
switch (token)

Wyświetl plik

@ -396,15 +396,15 @@ int ft767_init(RIG *rig)
return -RIG_EINVAL;
}
rig->state.priv = (struct ft767_priv_data *) calloc(1,
STATE(rig)->priv = (struct ft767_priv_data *) calloc(1,
sizeof(struct ft767_priv_data));
if (!rig->state.priv) /* whoops! memory shortage! */
if (!STATE(rig)->priv) /* whoops! memory shortage! */
{
return -RIG_ENOMEM;
}
priv = rig->state.priv;
priv = STATE(rig)->priv;
rig_debug(RIG_DEBUG_TRACE, "%s called\n", __func__);
@ -436,12 +436,12 @@ int ft767_cleanup(RIG *rig)
rig_debug(RIG_DEBUG_TRACE, "%s called\n", __func__);
if (rig->state.priv)
if (STATE(rig)->priv)
{
free(rig->state.priv);
free(STATE(rig)->priv);
}
rig->state.priv = NULL;
STATE(rig)->priv = NULL;
return RIG_OK;
}
@ -453,7 +453,7 @@ int ft767_cleanup(RIG *rig)
int ft767_open(RIG *rig)
{
struct ft767_priv_data *priv = (struct ft767_priv_data *)rig->state.priv;
struct ft767_priv_data *priv = (struct ft767_priv_data *)STATE(rig)->priv;
int retval;
rig_flush(RIGPORT(rig));
@ -477,7 +477,7 @@ int ft767_open(RIG *rig)
return retval;
}
rig->state.vfo_list = RIG_VFO_A | RIG_VFO_B;
STATE(rig)->vfo_list = RIG_VFO_A | RIG_VFO_B;
return RIG_OK;
}
@ -581,7 +581,7 @@ int ft767_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
int ft767_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
{
struct ft767_priv_data *priv = (struct ft767_priv_data *)rig->state.priv;
struct ft767_priv_data *priv = (struct ft767_priv_data *)STATE(rig)->priv;
int retval;
retval = ft767_get_update_data(rig); /* get whole shebang from rig */
@ -620,7 +620,7 @@ int ft767_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
int ft767_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
{
const struct ft767_priv_data *priv = (struct ft767_priv_data *)rig->state.priv;
const struct ft767_priv_data *priv = (struct ft767_priv_data *)STATE(rig)->priv;
int retval;
retval = ft767_get_update_data(rig); /* get whole shebang from rig */
@ -659,7 +659,7 @@ int ft767_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
int ft767_set_vfo(RIG *rig, vfo_t vfo)
{
unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, CMD_VFOMR};
struct ft767_priv_data *priv = (struct ft767_priv_data *)rig->state.priv;
struct ft767_priv_data *priv = (struct ft767_priv_data *)STATE(rig)->priv;
int retval;
switch (vfo)
@ -710,7 +710,7 @@ int ft767_set_vfo(RIG *rig, vfo_t vfo)
int ft767_get_vfo(RIG *rig, vfo_t *vfo)
{
const struct ft767_priv_data *priv = (struct ft767_priv_data *)rig->state.priv;
const struct ft767_priv_data *priv = (struct ft767_priv_data *)STATE(rig)->priv;
int retval;
retval = ft767_get_update_data(rig); /* get whole shebang from rig */
@ -727,7 +727,7 @@ int ft767_get_vfo(RIG *rig, vfo_t *vfo)
int ft767_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt)
{
struct ft767_priv_data *priv = (struct ft767_priv_data *)rig->state.priv;
struct ft767_priv_data *priv = (struct ft767_priv_data *)STATE(rig)->priv;
int retval;
retval = ft767_get_update_data(rig); /* get whole shebang from rig */
@ -797,7 +797,7 @@ int ft767_set_ctcss_tone(RIG *rig, vfo_t vfo, tone_t tone)
int ft767_get_ctcss_tone(RIG *rig, vfo_t vfo, tone_t *tone)
{
const struct ft767_priv_data *priv = (struct ft767_priv_data *)rig->state.priv;
const struct ft767_priv_data *priv = (struct ft767_priv_data *)STATE(rig)->priv;
int retval;
retval = ft767_get_update_data(rig); /* get whole shebang from rig */
@ -827,7 +827,7 @@ int ft767_get_ctcss_sql(RIG *rig, vfo_t vfo, tone_t *tone)
int ft767_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq)
{
struct ft767_priv_data *priv = (struct ft767_priv_data *)rig->state.priv;
struct ft767_priv_data *priv = (struct ft767_priv_data *)STATE(rig)->priv;
unsigned char freq_cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, CMD_FREQ_SET};
unsigned char vfo_cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, CMD_VFOMR};
vfo_t curr_vfo;
@ -938,7 +938,7 @@ int ft767_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq)
int ft767_get_split_freq(RIG *rig, vfo_t vfo, freq_t *tx_freq)
{
struct ft767_priv_data *priv = (struct ft767_priv_data *)rig->state.priv;
struct ft767_priv_data *priv = (struct ft767_priv_data *)STATE(rig)->priv;
int retval;
unsigned int offset;
vfo_t curr_vfo;
@ -994,7 +994,7 @@ int ft767_get_split_freq(RIG *rig, vfo_t vfo, freq_t *tx_freq)
int ft767_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode,
pbwidth_t tx_width)
{
struct ft767_priv_data *priv = (struct ft767_priv_data *)rig->state.priv;
struct ft767_priv_data *priv = (struct ft767_priv_data *)STATE(rig)->priv;
unsigned char mode_cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, CMD_MULTICMD};
unsigned char vfo_cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, CMD_VFOMR};
vfo_t curr_vfo;
@ -1102,7 +1102,7 @@ int ft767_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode,
int ft767_get_split_mode(RIG *rig, vfo_t vfo, rmode_t *tx_mode,
pbwidth_t *tx_width)
{
struct ft767_priv_data *priv = (struct ft767_priv_data *)rig->state.priv;
struct ft767_priv_data *priv = (struct ft767_priv_data *)STATE(rig)->priv;
int retval;
unsigned int offset;
vfo_t curr_vfo;
@ -1157,7 +1157,7 @@ int ft767_get_split_mode(RIG *rig, vfo_t vfo, rmode_t *tx_mode,
int ft767_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
{
struct ft767_priv_data *priv = (struct ft767_priv_data *)rig->state.priv;
struct ft767_priv_data *priv = (struct ft767_priv_data *)STATE(rig)->priv;
unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0x00};
int retval;
vfo_t curr_vfo;
@ -1310,7 +1310,7 @@ int ft767_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
int ft767_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo)
{
const struct ft767_priv_data *priv = (struct ft767_priv_data *)rig->state.priv;
const struct ft767_priv_data *priv = (struct ft767_priv_data *)STATE(rig)->priv;
int retval;
vfo_t curr_vfo;
@ -1406,7 +1406,7 @@ int ft767_leave_CAT(RIG *rig)
int ft767_send_block_and_ack(RIG *rig, unsigned char *cmd, size_t length)
{
struct ft767_priv_data *priv = (struct ft767_priv_data *)rig->state.priv;
struct ft767_priv_data *priv = (struct ft767_priv_data *)STATE(rig)->priv;
hamlib_port_t *rp = RIGPORT(rig);
size_t replylen, cpycnt;
unsigned char cmd_echo_buf[5];
@ -1539,7 +1539,7 @@ int ft767_send_block_and_ack(RIG *rig, unsigned char *cmd, size_t length)
int ft767_get_update_data(RIG *rig)
{
/* unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x01, CMD_CHECK}; */
struct ft767_priv_data *priv = (struct ft767_priv_data *)rig->state.priv;
struct ft767_priv_data *priv = (struct ft767_priv_data *)STATE(rig)->priv;
int retval;
rig_flush(RIGPORT(rig));
@ -1569,7 +1569,7 @@ int ft767_get_update_data(RIG *rig)
int ft767_set_split(RIG *rig, unsigned int split)
{
struct ft767_priv_data *priv = (struct ft767_priv_data *)rig->state.priv;
struct ft767_priv_data *priv = (struct ft767_priv_data *)STATE(rig)->priv;
int retval;
unsigned int curr_split;

Wyświetl plik

@ -753,7 +753,7 @@ static int ft817_init(RIG *rig)
rig_debug(RIG_DEBUG_VERBOSE, "%s: called, version %s\n", __func__,
rig->caps->version);
if ((rig->state.priv = calloc(1, sizeof(struct ft817_priv_data))) == NULL)
if ((STATE(rig)->priv = calloc(1, sizeof(struct ft817_priv_data))) == NULL)
{
return -RIG_ENOMEM;
}
@ -765,9 +765,9 @@ static int ft817_cleanup(RIG *rig)
{
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
free(rig->state.priv);
free(STATE(rig)->priv);
rig->state.priv = NULL;
STATE(rig)->priv = NULL;
return RIG_OK;
}
@ -869,7 +869,7 @@ static int ft817_read_eeprom(RIG *rig, unsigned short addr, unsigned char *out)
static int ft817_get_status(RIG *rig, int status)
{
struct ft817_priv_data *p = (struct ft817_priv_data *) rig->state.priv;
struct ft817_priv_data *p = (struct ft817_priv_data *) STATE(rig)->priv;
hamlib_port_t *rp = RIGPORT(rig);
struct timeval *tv;
unsigned char *data;
@ -986,7 +986,7 @@ static int ft817_get_status(RIG *rig, int status)
static int ft817_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
{
struct ft817_priv_data *p = (struct ft817_priv_data *) rig->state.priv;
struct ft817_priv_data *p = (struct ft817_priv_data *) STATE(rig)->priv;
freq_t f1 = 0, f2 = 0;
struct rig_cache *cachep = CACHE(rig);
int retries = RIGPORT(rig)->retry +
@ -1039,7 +1039,7 @@ static int ft817_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
static int ft817_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
{
struct ft817_priv_data *p = (struct ft817_priv_data *) rig->state.priv;
struct ft817_priv_data *p = (struct ft817_priv_data *) STATE(rig)->priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
@ -1125,7 +1125,7 @@ static int ft817_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
static int ft817_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split,
vfo_t *tx_vfo)
{
const struct ft817_priv_data *p = (struct ft817_priv_data *) rig->state.priv;
const struct ft817_priv_data *p = (struct ft817_priv_data *) STATE(rig)->priv;
ptt_t ptt;
int n;
@ -1164,7 +1164,7 @@ static int ft817_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split,
static int ft817_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt)
{
struct ft817_priv_data *p = (struct ft817_priv_data *) rig->state.priv;
struct ft817_priv_data *p = (struct ft817_priv_data *) STATE(rig)->priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
@ -1186,7 +1186,7 @@ static int ft817_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt)
static int ft817_get_tx_level(RIG *rig, value_t *val, unsigned char *tx_level,
const cal_table_float_t *cal)
{
struct ft817_priv_data *p = (struct ft817_priv_data *) rig->state.priv;
struct ft817_priv_data *p = (struct ft817_priv_data *) STATE(rig)->priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
@ -1233,7 +1233,7 @@ static int ft817_get_tx_level(RIG *rig, value_t *val, unsigned char *tx_level,
/* frontend will always use RAWSTR+cal_table */
static int ft817_get_smeter_level(RIG *rig, value_t *val)
{
struct ft817_priv_data *p = (struct ft817_priv_data *) rig->state.priv;
struct ft817_priv_data *p = (struct ft817_priv_data *) STATE(rig)->priv;
int n;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
@ -1274,7 +1274,7 @@ static int ft817_get_smeter_level(RIG *rig, value_t *val)
static int ft817_get_raw_smeter_level(RIG *rig, value_t *val)
{
struct ft817_priv_data *p = (struct ft817_priv_data *) rig->state.priv;
struct ft817_priv_data *p = (struct ft817_priv_data *) STATE(rig)->priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
@ -1296,7 +1296,7 @@ static int ft817_get_raw_smeter_level(RIG *rig, value_t *val)
static int ft817_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
{
struct ft817_priv_data *p = (struct ft817_priv_data *) rig->state.priv;
struct ft817_priv_data *p = (struct ft817_priv_data *) STATE(rig)->priv;
switch (level)
{
@ -1327,7 +1327,7 @@ static int ft817_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
static int ft817_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd)
{
struct ft817_priv_data *p = (struct ft817_priv_data *) rig->state.priv;
struct ft817_priv_data *p = (struct ft817_priv_data *) STATE(rig)->priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
@ -1383,7 +1383,7 @@ static int ft818_817_get_ant(RIG *rig, vfo_t vfo, ant_t ant, value_t *option,
/* if CURR then get real VFO before parsing EEPROM */
if (vfo == RIG_VFO_CURR)
{
vfo = rig->state.current_vfo;
vfo = STATE(rig)->current_vfo;
}
/* band info is 4 bit per VFO, for A lower nibble, B is upper nible */
@ -1623,7 +1623,7 @@ static int ft817_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
to_bcd_be(data, (freq + 5) / 10, 8);
rig_force_cache_timeout(
&((struct ft817_priv_data *)rig->state.priv)->fm_status_tv);
&((struct ft817_priv_data *)STATE(rig)->priv)->fm_status_tv);
retval = ft817_send_icmd(rig, FT817_NATIVE_CAT_SET_FREQ, data);
hl_usleep(50 * 1000); // FT817 needs a little time after setting freq
@ -1743,7 +1743,7 @@ static int ft817_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
/* return -RIG_EINVAL; */
rig_force_cache_timeout(
&((struct ft817_priv_data *)rig->state.priv)->fm_status_tv);
&((struct ft817_priv_data *)STATE(rig)->priv)->fm_status_tv);
return ft817_send_cmd(rig, index);
}
@ -2088,7 +2088,7 @@ static int ft817_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op)
case RIG_OP_TOGGLE:
rig_force_cache_timeout(&((struct ft817_priv_data *)
rig->state.priv)->fm_status_tv);
STATE(rig)->priv)->fm_status_tv);
n = ft817_send_cmd(rig, FT817_NATIVE_CAT_SET_VFOAB);
hl_usleep(100 * 1000); // rig needs a little time to do this
return n;

Wyświetl plik

@ -387,15 +387,15 @@ static int ft840_init(RIG *rig)
return -RIG_EINVAL;
}
rig->state.priv = (struct ft840_priv_data *) calloc(1,
STATE(rig)->priv = (struct ft840_priv_data *) calloc(1,
sizeof(struct ft840_priv_data));
if (!rig->state.priv) /* whoops! memory shortage! */
if (!STATE(rig)->priv) /* whoops! memory shortage! */
{
return -RIG_ENOMEM;
}
priv = rig->state.priv;
priv = STATE(rig)->priv;
/* TODO: read pacing from preferences */
priv->pacing = FT840_PACING_DEFAULT_VALUE; /* set pacing to minimum for now */
@ -422,12 +422,12 @@ static int ft840_cleanup(RIG *rig)
return -RIG_EINVAL;
}
if (rig->state.priv)
if (STATE(rig)->priv)
{
free(rig->state.priv);
free(STATE(rig)->priv);
}
rig->state.priv = NULL;
STATE(rig)->priv = NULL;
return RIG_OK;
}
@ -450,7 +450,7 @@ static int ft840_open(RIG *rig)
return -RIG_EINVAL;
}
priv = (struct ft840_priv_data *)rig->state.priv;
priv = (struct ft840_priv_data *)STATE(rig)->priv;
rig_debug(RIG_DEBUG_TRACE, "%s: write_delay = %i msec\n",
__func__, RIGPORT(rig)->write_delay);
@ -513,7 +513,7 @@ static int ft840_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
return -RIG_EINVAL;
}
priv = (struct ft840_priv_data *)rig->state.priv;
priv = (struct ft840_priv_data *)STATE(rig)->priv;
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo);
rig_debug(RIG_DEBUG_TRACE, "%s: passed freq = %"PRIfreq" Hz\n", __func__, freq);
@ -569,7 +569,7 @@ static int ft840_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
return -RIG_EINVAL;
}
priv = (struct ft840_priv_data *)rig->state.priv;
priv = (struct ft840_priv_data *)STATE(rig)->priv;
if (vfo == RIG_VFO_CURR)
{
@ -660,7 +660,7 @@ static int ft840_set_mode(RIG *rig, vfo_t vfo, rmode_t mode,
rig_strrmode(mode));
rig_debug(RIG_DEBUG_TRACE, "%s: passed width = %d Hz\n", __func__, (int)width);
priv = (struct ft840_priv_data *)rig->state.priv;
priv = (struct ft840_priv_data *)STATE(rig)->priv;
if (vfo == RIG_VFO_CURR)
{
@ -797,7 +797,7 @@ static int ft840_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo);
priv = (struct ft840_priv_data *)rig->state.priv;
priv = (struct ft840_priv_data *)STATE(rig)->priv;
if (vfo == RIG_VFO_CURR)
{
@ -941,7 +941,7 @@ static int ft840_set_vfo(RIG *rig, vfo_t vfo)
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo);
priv = (struct ft840_priv_data *)rig->state.priv;
priv = (struct ft840_priv_data *)STATE(rig)->priv;
if (vfo == RIG_VFO_CURR)
{
@ -1021,7 +1021,7 @@ static int ft840_get_vfo(RIG *rig, vfo_t *vfo)
return -RIG_EINVAL;
}
priv = (struct ft840_priv_data *)rig->state.priv;
priv = (struct ft840_priv_data *)STATE(rig)->priv;
/* Get flags for VFO status */
err = ft840_get_update_data(rig, FT840_NATIVE_READ_FLAGS,
@ -1127,7 +1127,7 @@ static int ft840_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
return -RIG_EINVAL;
}
priv = (struct ft840_priv_data *)rig->state.priv;
priv = (struct ft840_priv_data *)STATE(rig)->priv;
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo);
rig_debug(RIG_DEBUG_TRACE, "%s: passed ptt = 0x%02x\n", __func__, ptt);
@ -1190,7 +1190,7 @@ static int ft840_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt)
return -RIG_EINVAL;
}
priv = (struct ft840_priv_data *)rig->state.priv;
priv = (struct ft840_priv_data *)STATE(rig)->priv;
/* Get flags for VFO status */
err = ft840_get_update_data(rig, FT840_NATIVE_READ_FLAGS,
@ -1303,7 +1303,7 @@ static int ft840_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split,
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo);
priv = (struct ft840_priv_data *)rig->state.priv;
priv = (struct ft840_priv_data *)STATE(rig)->priv;
/* Get flags for VFO split status */
err = ft840_get_update_data(rig, FT840_NATIVE_READ_FLAGS,
@ -1370,7 +1370,7 @@ static int ft840_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit)
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo);
rig_debug(RIG_DEBUG_TRACE, "%s: passed rit = %li\n", __func__, rit);
priv = (struct ft840_priv_data *)rig->state.priv;
priv = (struct ft840_priv_data *)STATE(rig)->priv;
/*
* The assumption here is that the user hasn't changed
@ -1450,7 +1450,7 @@ static int ft840_get_rit(RIG *rig, vfo_t vfo, shortfreq_t *rit)
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo);
priv = (struct ft840_priv_data *)rig->state.priv;
priv = (struct ft840_priv_data *)STATE(rig)->priv;
if (vfo == RIG_VFO_CURR)
{
@ -1602,7 +1602,7 @@ static int ft840_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
rig_debug(RIG_DEBUG_TRACE, "%s: passed level = %s\n", __func__,
rig_strlevel(level));
priv = (struct ft840_priv_data *)rig->state.priv;
priv = (struct ft840_priv_data *)STATE(rig)->priv;
switch (level)
{
@ -1735,7 +1735,7 @@ static int ft840_get_update_data(RIG *rig, unsigned char ci, unsigned char rl)
return -RIG_EINVAL;
}
priv = (struct ft840_priv_data *)rig->state.priv;
priv = (struct ft840_priv_data *)STATE(rig)->priv;
err = ft840_send_static_cmd(rig, ci);
@ -1832,7 +1832,7 @@ static int ft840_send_dynamic_cmd(RIG *rig, unsigned char ci,
"%s: passed p1 = 0x%02x, p2 = 0x%02x, p3 = 0x%02x, p4 = 0x%02x,\n",
__func__, p1, p2, p3, p4);
priv = (struct ft840_priv_data *)rig->state.priv;
priv = (struct ft840_priv_data *)STATE(rig)->priv;
if (ncmd[ci].ncomp)
{
@ -1891,7 +1891,7 @@ static int ft840_send_dial_freq(RIG *rig, unsigned char ci, freq_t freq)
rig_debug(RIG_DEBUG_TRACE, "%s: passed ci = %i\n", __func__, ci);
rig_debug(RIG_DEBUG_TRACE, "%s: passed freq = %"PRIfreq" Hz\n", __func__, freq);
priv = (struct ft840_priv_data *)rig->state.priv;
priv = (struct ft840_priv_data *)STATE(rig)->priv;
if (ncmd[ci].ncomp)
{
@ -1957,7 +1957,7 @@ static int ft840_send_rit_freq(RIG *rig, unsigned char ci, shortfreq_t rit)
rig_debug(RIG_DEBUG_TRACE, "%s: passed ci = %i\n", __func__, ci);
rig_debug(RIG_DEBUG_TRACE, "%s: passed rit = %li Hz\n", __func__, rit);
priv = (struct ft840_priv_data *)rig->state.priv;
priv = (struct ft840_priv_data *)STATE(rig)->priv;
if (ncmd[ci].ncomp)
{

Wyświetl plik

@ -1005,7 +1005,7 @@ struct rig_caps ft847uni_caps =
/*
* setup *priv
* serial port is already open (rig->state->fd)
* serial port is already open (STATE(rig)->fd)
*/
static int ft847_init(RIG *rig)
@ -1019,16 +1019,16 @@ static int ft847_init(RIG *rig)
return -RIG_EINVAL;
}
rig->state.priv = (struct ft847_priv_data *) calloc(1,
STATE(rig)->priv = (struct ft847_priv_data *) calloc(1,
sizeof(struct ft847_priv_data));
if (!rig->state.priv)
if (!STATE(rig)->priv)
{
/* whoops! memory shortage! */
return -RIG_ENOMEM;
}
priv = rig->state.priv;
priv = STATE(rig)->priv;
priv->sat_mode = RIG_SPLIT_OFF;
@ -1057,12 +1057,12 @@ static int ft847_cleanup(RIG *rig)
return -RIG_EINVAL;
}
if (rig->state.priv)
if (STATE(rig)->priv)
{
free(rig->state.priv);
free(STATE(rig)->priv);
}
rig->state.priv = NULL;
STATE(rig)->priv = NULL;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called \n", __func__);
@ -1130,7 +1130,7 @@ static int ft847_send_priv_cmd(RIG *rig, int cmd_index)
*/
static int opcode_vfo(RIG *rig, unsigned char *cmd, int cmd_index, vfo_t vfo)
{
struct ft847_priv_data *p = (struct ft847_priv_data *)rig->state.priv;
struct ft847_priv_data *p = (struct ft847_priv_data *)STATE(rig)->priv;
memcpy(cmd, &ncmd[cmd_index].nseq, YAESU_CMD_LENGTH);
@ -1199,7 +1199,7 @@ static int ft847_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
if (UNIDIRECTIONAL)
{
struct ft847_priv_data *priv = (struct ft847_priv_data *)rig->state.priv;
struct ft847_priv_data *priv = (struct ft847_priv_data *)STATE(rig)->priv;
if (vfo == RIG_VFO_MAIN)
{
@ -1235,7 +1235,7 @@ static int get_freq_and_mode(RIG *rig, vfo_t vfo, freq_t *freq, rmode_t *mode,
unsigned char cmd_index; /* index of sequence to send */
unsigned char data[8];
int n;
struct ft847_priv_data *priv = (struct ft847_priv_data *)rig->state.priv;
struct ft847_priv_data *priv = (struct ft847_priv_data *)STATE(rig)->priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s: vfo =%s \n",
__func__, rig_strvfo(vfo));
@ -1370,7 +1370,7 @@ static int ft847_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
if (UNIDIRECTIONAL)
{
struct ft847_priv_data *priv = (struct ft847_priv_data *)rig->state.priv;
struct ft847_priv_data *priv = (struct ft847_priv_data *)STATE(rig)->priv;
priv->mode = mode;
priv->width = width;
}
@ -1482,7 +1482,7 @@ static int ft847_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
*/
static int ft847_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
{
struct ft847_priv_data *priv = (struct ft847_priv_data *)rig->state.priv;
struct ft847_priv_data *priv = (struct ft847_priv_data *)STATE(rig)->priv;
unsigned char cmd_index; /* index of sequence to send */
int ret;
@ -1515,7 +1515,7 @@ static int ft847_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
static int ft847_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split,
vfo_t *tx_vfo)
{
struct ft847_priv_data *priv = (struct ft847_priv_data *)rig->state.priv;
struct ft847_priv_data *priv = (struct ft847_priv_data *)STATE(rig)->priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
@ -1565,7 +1565,7 @@ static int ft847_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
if (UNIDIRECTIONAL)
{
struct ft847_priv_data *priv = (struct ft847_priv_data *)rig->state.priv;
struct ft847_priv_data *priv = (struct ft847_priv_data *)STATE(rig)->priv;
priv->ptt = ptt;
}
@ -1593,7 +1593,7 @@ static int ft847_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
static int ft847_get_status(RIG *rig, int status_ci)
{
struct ft847_priv_data *p = (struct ft847_priv_data *) rig->state.priv;
struct ft847_priv_data *p = (struct ft847_priv_data *) STATE(rig)->priv;
hamlib_port_t *rp = RIGPORT(rig);
unsigned char *data;
int len;
@ -1648,12 +1648,12 @@ static int ft847_get_status(RIG *rig, int status_ci)
static int ft847_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt)
{
struct ft847_priv_data *p = (struct ft847_priv_data *) rig->state.priv;
struct ft847_priv_data *p = (struct ft847_priv_data *) STATE(rig)->priv;
int n;
if (UNIDIRECTIONAL)
{
struct ft847_priv_data *priv = (struct ft847_priv_data *)rig->state.priv;
struct ft847_priv_data *priv = (struct ft847_priv_data *)STATE(rig)->priv;
*ptt = priv->ptt;
return RIG_OK;
}
@ -1673,7 +1673,7 @@ static int ft847_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt)
socket DTR or RTS PTT on the rear PACKET PTT pin is likely. So we
override if we know PTT was asserted via rig_set_ptt for any type
of PTT */
if (RIG_PTT_OFF == *ptt && rig->state.transmit) { *ptt = RIG_PTT_ON; }
if (RIG_PTT_OFF == *ptt && STATE(rig)->transmit) { *ptt = RIG_PTT_ON; }
return RIG_OK;
}
@ -1682,7 +1682,7 @@ static int ft847_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt)
static int ft847_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd)
{
struct ft847_priv_data *p = (struct ft847_priv_data *) rig->state.priv;
struct ft847_priv_data *p = (struct ft847_priv_data *) STATE(rig)->priv;
int n;
if (UNIDIRECTIONAL)
@ -1711,7 +1711,7 @@ static int ft847_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd)
*/
static int ft847_get_rawstr_level(RIG *rig, value_t *val)
{
struct ft847_priv_data *p = (struct ft847_priv_data *) rig->state.priv;
struct ft847_priv_data *p = (struct ft847_priv_data *) STATE(rig)->priv;
int n;
if (UNIDIRECTIONAL)
@ -1783,7 +1783,7 @@ static int ft847_get_smeter_level(RIG *rig, value_t *val)
*/
static int ft847_get_alc_level(RIG *rig, value_t *val)
{
struct ft847_priv_data *p = (struct ft847_priv_data *) rig->state.priv;
struct ft847_priv_data *p = (struct ft847_priv_data *) STATE(rig)->priv;
int n;
if (UNIDIRECTIONAL)

Wyświetl plik

@ -393,7 +393,7 @@ int ft857_init(RIG *rig)
{
rig_debug(RIG_DEBUG_VERBOSE, "%s: called \n", __func__);
if ((rig->state.priv = calloc(1, sizeof(struct ft857_priv_data))) == NULL)
if ((STATE(rig)->priv = calloc(1, sizeof(struct ft857_priv_data))) == NULL)
{
return -RIG_ENOMEM;
}
@ -405,12 +405,12 @@ int ft857_cleanup(RIG *rig)
{
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
if (rig->state.priv)
if (STATE(rig)->priv)
{
free(rig->state.priv);
free(STATE(rig)->priv);
}
rig->state.priv = NULL;
STATE(rig)->priv = NULL;
return RIG_OK;
}
@ -499,7 +499,7 @@ static int ft857_read_eeprom(RIG *rig, unsigned short addr, unsigned char *out)
static int ft857_get_status(RIG *rig, int status)
{
struct ft857_priv_data *p = (struct ft857_priv_data *) rig->state.priv;
struct ft857_priv_data *p = (struct ft857_priv_data *) STATE(rig)->priv;
hamlib_port_t *rp = RIGPORT(rig);
struct timeval *tv;
unsigned char *data;
@ -649,7 +649,7 @@ int ft857_set_vfo(RIG *rig, vfo_t vfo)
int ft857_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
{
struct ft857_priv_data *p = (struct ft857_priv_data *) rig->state.priv;
struct ft857_priv_data *p = (struct ft857_priv_data *) STATE(rig)->priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called \n", __func__);
@ -742,7 +742,7 @@ static void get_mode(RIG *rig, const struct ft857_priv_data *priv,
int ft857_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
{
struct ft857_priv_data *p = (struct ft857_priv_data *) rig->state.priv;
struct ft857_priv_data *p = (struct ft857_priv_data *) STATE(rig)->priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called \n", __func__);
@ -779,7 +779,7 @@ int ft857_get_split_freq_mode(RIG *rig, vfo_t vfo, freq_t *freq, rmode_t *mode,
if (RIG_OK == retcode)
{
get_mode(rig, (struct ft857_priv_data *)rig->state.priv, mode, width);
get_mode(rig, (struct ft857_priv_data *)STATE(rig)->priv, mode, width);
}
ft857_send_cmd(rig, FT857_NATIVE_CAT_SET_VFOAB); /* always try and
@ -789,7 +789,7 @@ int ft857_get_split_freq_mode(RIG *rig, vfo_t vfo, freq_t *freq, rmode_t *mode,
int ft857_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo)
{
struct ft857_priv_data *p = (struct ft857_priv_data *) rig->state.priv;
struct ft857_priv_data *p = (struct ft857_priv_data *) STATE(rig)->priv;
int n;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called \n", __func__);
@ -822,7 +822,7 @@ int ft857_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo)
int ft857_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt)
{
struct ft857_priv_data *p = (struct ft857_priv_data *) rig->state.priv;
struct ft857_priv_data *p = (struct ft857_priv_data *) STATE(rig)->priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called \n", __func__);
@ -843,7 +843,7 @@ int ft857_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt)
static int ft857_get_pometer_level(RIG *rig, value_t *val)
{
struct ft857_priv_data *p = (struct ft857_priv_data *) rig->state.priv;
struct ft857_priv_data *p = (struct ft857_priv_data *) STATE(rig)->priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called \n", __func__);
if (check_cache_timeout(&p->tx_status_tv))
@ -873,7 +873,7 @@ static int ft857_get_pometer_level(RIG *rig, value_t *val)
static int ft857_get_smeter_level(RIG *rig, value_t *val)
{
struct ft857_priv_data *p = (struct ft857_priv_data *) rig->state.priv;
struct ft857_priv_data *p = (struct ft857_priv_data *) STATE(rig)->priv;
int n;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called \n", __func__);
@ -913,7 +913,7 @@ int ft857_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
int ft857_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd)
{
struct ft857_priv_data *p = (struct ft857_priv_data *) rig->state.priv;
struct ft857_priv_data *p = (struct ft857_priv_data *) STATE(rig)->priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called \n", __func__);
@ -964,7 +964,7 @@ int ft857_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
to_bcd_be(data, (freq + 5) / 10, 8);
rig_force_cache_timeout(&((struct ft857_priv_data *)
rig->state.priv)->fm_status_tv);
STATE(rig)->priv)->fm_status_tv);
return ft857_send_icmd(rig, FT857_NATIVE_CAT_SET_FREQ, data);
}
@ -1028,7 +1028,7 @@ int ft857_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
}
rig_force_cache_timeout(&((struct ft857_priv_data *)
rig->state.priv)->fm_status_tv);
STATE(rig)->priv)->fm_status_tv);
return ft857_send_cmd(rig, index);
}
@ -1087,7 +1087,7 @@ int ft857_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
n = ft857_send_cmd(rig, index);
rig_force_cache_timeout(&((struct ft857_priv_data *)
rig->state.priv)->tx_status_tv);
STATE(rig)->priv)->tx_status_tv);
if (n < 0 && n != -RIG_ERJCTED)
{
@ -1122,7 +1122,7 @@ int ft857_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
if (ptt == RIG_PTT_OFF) { hl_usleep(200 * 1000); } // FT857 takes a bit to come out of PTT
rig_force_cache_timeout(&((struct ft857_priv_data *)
rig->state.priv)->tx_status_tv);
STATE(rig)->priv)->tx_status_tv);
if (n < 0 && n != -RIG_ERJCTED)
{

Wyświetl plik

@ -537,15 +537,15 @@ static int ft890_init(RIG *rig)
return -RIG_EINVAL;
}
rig->state.priv = (struct ft890_priv_data *) calloc(1,
STATE(rig)->priv = (struct ft890_priv_data *) calloc(1,
sizeof(struct ft890_priv_data));
if (!rig->state.priv) /* whoops! memory shortage! */
if (!STATE(rig)->priv) /* whoops! memory shortage! */
{
return -RIG_ENOMEM;
}
priv = rig->state.priv;
priv = STATE(rig)->priv;
/* TODO: read pacing from preferences */
priv->pacing = FT890_PACING_DEFAULT_VALUE; /* set pacing to minimum for now */
@ -572,12 +572,12 @@ static int ft890_cleanup(RIG *rig)
return -RIG_EINVAL;
}
if (rig->state.priv)
if (STATE(rig)->priv)
{
free(rig->state.priv);
free(STATE(rig)->priv);
}
rig->state.priv = NULL;
STATE(rig)->priv = NULL;
return RIG_OK;
}
@ -601,7 +601,7 @@ static int ft890_open(RIG *rig)
return -RIG_EINVAL;
}
priv = (struct ft890_priv_data *)rig->state.priv;
priv = (struct ft890_priv_data *)STATE(rig)->priv;
rig_debug(RIG_DEBUG_TRACE, "%s: write_delay = %i msec\n",
__func__, rp->write_delay);
@ -664,7 +664,7 @@ static int ft890_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
return -RIG_EINVAL;
}
priv = (struct ft890_priv_data *)rig->state.priv;
priv = (struct ft890_priv_data *)STATE(rig)->priv;
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo);
rig_debug(RIG_DEBUG_TRACE, "%s: passed freq = %"PRIfreq" Hz\n", __func__, freq);
@ -720,7 +720,7 @@ static int ft890_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
return -RIG_EINVAL;
}
priv = (struct ft890_priv_data *)rig->state.priv;
priv = (struct ft890_priv_data *)STATE(rig)->priv;
if (vfo == RIG_VFO_CURR)
{
@ -811,7 +811,7 @@ static int ft890_set_mode(RIG *rig, vfo_t vfo, rmode_t mode,
rig_strrmode(mode));
rig_debug(RIG_DEBUG_TRACE, "%s: passed width = %li Hz\n", __func__, width);
priv = (struct ft890_priv_data *)rig->state.priv;
priv = (struct ft890_priv_data *)STATE(rig)->priv;
if (vfo == RIG_VFO_CURR)
{
@ -948,7 +948,7 @@ static int ft890_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo);
priv = (struct ft890_priv_data *)rig->state.priv;
priv = (struct ft890_priv_data *)STATE(rig)->priv;
if (vfo == RIG_VFO_CURR)
{
@ -1092,7 +1092,7 @@ static int ft890_set_vfo(RIG *rig, vfo_t vfo)
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo);
priv = (struct ft890_priv_data *)rig->state.priv;
priv = (struct ft890_priv_data *)STATE(rig)->priv;
if (vfo == RIG_VFO_CURR)
{
@ -1172,7 +1172,7 @@ static int ft890_get_vfo(RIG *rig, vfo_t *vfo)
return -RIG_EINVAL;
}
priv = (struct ft890_priv_data *)rig->state.priv;
priv = (struct ft890_priv_data *)STATE(rig)->priv;
/* Get flags for VFO status */
err = ft890_get_update_data(rig, FT890_NATIVE_READ_FLAGS,
@ -1278,7 +1278,7 @@ static int ft890_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
return -RIG_EINVAL;
}
priv = (struct ft890_priv_data *)rig->state.priv;
priv = (struct ft890_priv_data *)STATE(rig)->priv;
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo);
rig_debug(RIG_DEBUG_TRACE, "%s: passed ptt = 0x%02x\n", __func__, ptt);
@ -1340,7 +1340,7 @@ static int ft890_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt)
return -RIG_EINVAL;
}
priv = (struct ft890_priv_data *)rig->state.priv;
priv = (struct ft890_priv_data *)STATE(rig)->priv;
/* Get flags for VFO status */
err = ft890_get_update_data(rig, FT890_NATIVE_READ_FLAGS,
@ -1452,7 +1452,7 @@ static int ft890_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split,
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo);
priv = (struct ft890_priv_data *)rig->state.priv;
priv = (struct ft890_priv_data *)STATE(rig)->priv;
/* Get flags for VFO split status */
err = ft890_get_update_data(rig, FT890_NATIVE_READ_FLAGS,
@ -1518,7 +1518,7 @@ static int ft890_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit)
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo);
rig_debug(RIG_DEBUG_TRACE, "%s: passed rit = %li\n", __func__, rit);
priv = (struct ft890_priv_data *)rig->state.priv;
priv = (struct ft890_priv_data *)STATE(rig)->priv;
/*
* The assumption here is that the user hasn't changed
@ -1604,7 +1604,7 @@ static int ft890_get_rit(RIG *rig, vfo_t vfo, shortfreq_t *rit)
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo);
priv = (struct ft890_priv_data *)rig->state.priv;
priv = (struct ft890_priv_data *)STATE(rig)->priv;
if (vfo == RIG_VFO_CURR)
{
@ -1756,7 +1756,7 @@ static int ft890_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
rig_debug(RIG_DEBUG_TRACE, "%s: passed level = %s\n", __func__,
rig_strlevel(level));
priv = (struct ft890_priv_data *)rig->state.priv;
priv = (struct ft890_priv_data *)STATE(rig)->priv;
switch (level)
{
@ -1889,7 +1889,7 @@ static int ft890_get_update_data(RIG *rig, unsigned char ci, unsigned char rl)
return -RIG_EINVAL;
}
priv = (struct ft890_priv_data *)rig->state.priv;
priv = (struct ft890_priv_data *)STATE(rig)->priv;
err = ft890_send_static_cmd(rig, ci);
@ -1985,7 +1985,7 @@ static int ft890_send_dynamic_cmd(RIG *rig, unsigned char ci,
"%s: passed p1 = 0x%02x, p2 = 0x%02x, p3 = 0x%02x, p4 = 0x%02x,\n",
__func__, p1, p2, p3, p4);
priv = (struct ft890_priv_data *)rig->state.priv;
priv = (struct ft890_priv_data *)STATE(rig)->priv;
if (ncmd[ci].ncomp)
{
@ -2044,7 +2044,7 @@ static int ft890_send_dial_freq(RIG *rig, unsigned char ci, freq_t freq)
rig_debug(RIG_DEBUG_TRACE, "%s: passed ci = %i\n", __func__, ci);
rig_debug(RIG_DEBUG_TRACE, "%s: passed freq = %"PRIfreq" Hz\n", __func__, freq);
priv = (struct ft890_priv_data *)rig->state.priv;
priv = (struct ft890_priv_data *)STATE(rig)->priv;
if (ncmd[ci].ncomp)
{
@ -2109,7 +2109,7 @@ static int ft890_send_rit_freq(RIG *rig, unsigned char ci, shortfreq_t rit)
rig_debug(RIG_DEBUG_TRACE, "%s: passed ci = %i\n", __func__, ci);
rig_debug(RIG_DEBUG_TRACE, "%s: passed rit = %li Hz\n", __func__, rit);
priv = (struct ft890_priv_data *)rig->state.priv;
priv = (struct ft890_priv_data *)STATE(rig)->priv;
if (ncmd[ci].ncomp)
{

Wyświetl plik

@ -371,7 +371,7 @@ static int ft891_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
rig_debug(RIG_DEBUG_TRACE, "%s: passed split = 0x%02x\n", __func__, split);
rig_debug(RIG_DEBUG_TRACE, "%s: passed tx_vfo = 0x%02x\n", __func__, tx_vfo);
priv = (struct newcat_priv_data *)rig->state.priv;
priv = (struct newcat_priv_data *)STATE(rig)->priv;
// RX VFO and TX VFO cannot be the same, no support for MEM as TX VFO
if (vfo == tx_vfo || tx_vfo == RIG_VFO_MEM)
@ -436,7 +436,7 @@ static int ft891_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split,
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo);
priv = (struct newcat_priv_data *)rig->state.priv;
priv = (struct newcat_priv_data *)STATE(rig)->priv;
SNPRINTF(priv->cmd_str, sizeof(priv->cmd_str), "ST;");
@ -493,7 +493,7 @@ static int ft891_get_split_mode(RIG *rig, vfo_t vfo, rmode_t *tx_mode,
return -RIG_EINVAL;
}
priv = (struct newcat_priv_data *)rig->state.priv;
priv = (struct newcat_priv_data *)STATE(rig)->priv;
SNPRINTF(priv->cmd_str, sizeof(priv->cmd_str), "OI;");
@ -547,7 +547,7 @@ static int ft891_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode,
rig_debug(RIG_DEBUG_TRACE, "%s: passed width = %d Hz\n", __func__,
(int)tx_width);
priv = (struct newcat_priv_data *)rig->state.priv;
priv = (struct newcat_priv_data *)STATE(rig)->priv;
// Remember VFOB frequency
if (RIG_OK != (err = newcat_get_freq(rig, RIG_VFO_B, &b_freq)))
@ -599,7 +599,7 @@ static int ft891_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
// We will always make VFOB match VFOA mode
newcat_set_mode(rig, RIG_VFO_A, mode, width);
priv = (struct newcat_priv_data *)rig->state.priv;
priv = (struct newcat_priv_data *)STATE(rig)->priv;
// Copy A to B
SNPRINTF(priv->cmd_str, sizeof(priv->cmd_str), "AB;");
@ -621,6 +621,6 @@ static int ft891_init(RIG *rig)
if (ret != RIG_OK) { return ret; }
rig->state.current_vfo = RIG_VFO_A;
STATE(rig)->current_vfo = RIG_VFO_A;
return RIG_OK;
}

Wyświetl plik

@ -545,7 +545,7 @@ int ft897_init(RIG *rig)
{
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
if ((rig->state.priv = calloc(1, sizeof(struct ft897_priv_data))) == NULL)
if ((STATE(rig)->priv = calloc(1, sizeof(struct ft897_priv_data))) == NULL)
{
return -RIG_ENOMEM;
}
@ -557,12 +557,12 @@ int ft897_cleanup(RIG *rig)
{
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
if (rig->state.priv)
if (STATE(rig)->priv)
{
free(rig->state.priv);
free(STATE(rig)->priv);
}
rig->state.priv = NULL;
STATE(rig)->priv = NULL;
return RIG_OK;
}
@ -651,7 +651,7 @@ static int ft897_read_eeprom(RIG *rig, unsigned short addr, unsigned char *out)
static int ft897_get_status(RIG *rig, int status)
{
struct ft897_priv_data *p = (struct ft897_priv_data *) rig->state.priv;
struct ft897_priv_data *p = (struct ft897_priv_data *) STATE(rig)->priv;
hamlib_port_t *rp = RIGPORT(rig);
struct timeval *tv;
unsigned char *data;
@ -725,7 +725,7 @@ static int ft897_get_status(RIG *rig, int status)
int ft897_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
{
struct ft897_priv_data *p = (struct ft897_priv_data *) rig->state.priv;
struct ft897_priv_data *p = (struct ft897_priv_data *) STATE(rig)->priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
@ -746,7 +746,7 @@ int ft897_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
int ft897_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
{
struct ft897_priv_data *p = (struct ft897_priv_data *) rig->state.priv;
struct ft897_priv_data *p = (struct ft897_priv_data *) STATE(rig)->priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
@ -830,7 +830,7 @@ int ft897_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
int ft897_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt)
{
struct ft897_priv_data *p = (struct ft897_priv_data *) rig->state.priv;
struct ft897_priv_data *p = (struct ft897_priv_data *) STATE(rig)->priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
@ -851,7 +851,7 @@ int ft897_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt)
static int ft897_get_pometer_level(RIG *rig, value_t *val)
{
struct ft897_priv_data *p = (struct ft897_priv_data *) rig->state.priv;
struct ft897_priv_data *p = (struct ft897_priv_data *) STATE(rig)->priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
@ -880,7 +880,7 @@ static int ft897_get_pometer_level(RIG *rig, value_t *val)
static int ft897_get_swr_level(RIG *rig, value_t *val)
{
struct ft897_priv_data *p = (struct ft897_priv_data *) rig->state.priv;
struct ft897_priv_data *p = (struct ft897_priv_data *) STATE(rig)->priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
@ -909,7 +909,7 @@ static int ft897_get_swr_level(RIG *rig, value_t *val)
static int ft897_get_smeter_level(RIG *rig, value_t *val)
{
struct ft897_priv_data *p = (struct ft897_priv_data *) rig->state.priv;
struct ft897_priv_data *p = (struct ft897_priv_data *) STATE(rig)->priv;
int n;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
@ -929,7 +929,7 @@ static int ft897_get_smeter_level(RIG *rig, value_t *val)
static int ft897_get_rawstr_level(RIG *rig, value_t *val)
{
struct ft897_priv_data *p = (struct ft897_priv_data *) rig->state.priv;
struct ft897_priv_data *p = (struct ft897_priv_data *) STATE(rig)->priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
@ -950,7 +950,7 @@ static int ft897_get_rawstr_level(RIG *rig, value_t *val)
static int ft897_get_alc_level(RIG *rig, value_t *val)
{
struct ft897_priv_data *p = (struct ft897_priv_data *) rig->state.priv;
struct ft897_priv_data *p = (struct ft897_priv_data *) STATE(rig)->priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
@ -1014,7 +1014,7 @@ int ft897_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
int ft897_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd)
{
struct ft897_priv_data *p = (struct ft897_priv_data *) rig->state.priv;
struct ft897_priv_data *p = (struct ft897_priv_data *) STATE(rig)->priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
@ -1097,7 +1097,7 @@ int ft897_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
/*invalidate frequency cache*/
rig_force_cache_timeout(&((struct ft897_priv_data *)
rig->state.priv)->fm_status_tv);
STATE(rig)->priv)->fm_status_tv);
return ft897_send_icmd(rig, FT897_NATIVE_CAT_SET_FREQ, data);
}
@ -1157,7 +1157,7 @@ int ft897_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
}
rig_force_cache_timeout(&((struct ft897_priv_data *)
rig->state.priv)->fm_status_tv);
STATE(rig)->priv)->fm_status_tv);
return ft897_send_cmd(rig, index);
}
@ -1185,7 +1185,7 @@ int ft897_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
n = ft897_send_cmd(rig, index);
rig_force_cache_timeout(&((struct ft897_priv_data *)
rig->state.priv)->tx_status_tv);
STATE(rig)->priv)->tx_status_tv);
if (n < 0 && n != -RIG_ERJCTED)
{
@ -1205,7 +1205,7 @@ int ft897_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op)
{
case RIG_OP_TOGGLE:
rig_force_cache_timeout(&((struct ft897_priv_data *)
rig->state.priv)->tx_status_tv);
STATE(rig)->priv)->tx_status_tv);
index = FT897_NATIVE_CAT_SET_VFOAB;
break;
@ -1246,7 +1246,7 @@ int ft897_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
n = ft897_send_cmd(rig, index);
rig_force_cache_timeout(&((struct ft897_priv_data *)
rig->state.priv)->tx_status_tv);
STATE(rig)->priv)->tx_status_tv);
if (n < 0 && n != -RIG_ERJCTED)
{
@ -1258,7 +1258,7 @@ int ft897_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
int ft897_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo)
{
struct ft897_priv_data *p = (struct ft897_priv_data *) rig->state.priv;
struct ft897_priv_data *p = (struct ft897_priv_data *) STATE(rig)->priv;
int n;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);

Wyświetl plik

@ -559,15 +559,15 @@ static int ft900_init(RIG *rig)
return -RIG_EINVAL;
}
rig->state.priv = (struct ft900_priv_data *) calloc(1,
STATE(rig)->priv = (struct ft900_priv_data *) calloc(1,
sizeof(struct ft900_priv_data));
if (!rig->state.priv) /* whoops! memory shortage! */
if (!STATE(rig)->priv) /* whoops! memory shortage! */
{
return -RIG_ENOMEM;
}
priv = rig->state.priv;
priv = STATE(rig)->priv;
/* TODO: read pacing from preferences */
priv->pacing = FT900_PACING_DEFAULT_VALUE; /* set pacing to minimum for now */
@ -594,12 +594,12 @@ static int ft900_cleanup(RIG *rig)
return -RIG_EINVAL;
}
if (rig->state.priv)
if (STATE(rig)->priv)
{
free(rig->state.priv);
free(STATE(rig)->priv);
}
rig->state.priv = NULL;
STATE(rig)->priv = NULL;
return RIG_OK;
}
@ -622,7 +622,7 @@ static int ft900_open(RIG *rig)
return -RIG_EINVAL;
}
priv = (struct ft900_priv_data *)rig->state.priv;
priv = (struct ft900_priv_data *)STATE(rig)->priv;
rig_debug(RIG_DEBUG_TRACE, "%s: write_delay = %i msec\n",
__func__, RIGPORT(rig)->write_delay);
@ -685,7 +685,7 @@ static int ft900_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
return -RIG_EINVAL;
}
priv = (struct ft900_priv_data *)rig->state.priv;
priv = (struct ft900_priv_data *)STATE(rig)->priv;
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo);
rig_debug(RIG_DEBUG_TRACE, "%s: passed freq = %"PRIfreq" Hz\n", __func__, freq);
@ -741,7 +741,7 @@ static int ft900_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
return -RIG_EINVAL;
}
priv = (struct ft900_priv_data *)rig->state.priv;
priv = (struct ft900_priv_data *)STATE(rig)->priv;
if (vfo == RIG_VFO_CURR)
{
@ -833,7 +833,7 @@ static int ft900_set_mode(RIG *rig, vfo_t vfo, rmode_t mode,
rig_debug(RIG_DEBUG_TRACE, "%s: passed width = %li Hz\n",
__func__, width);
priv = (struct ft900_priv_data *)rig->state.priv;
priv = (struct ft900_priv_data *)STATE(rig)->priv;
if (vfo == RIG_VFO_CURR)
{
@ -970,7 +970,7 @@ static int ft900_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo);
priv = (struct ft900_priv_data *)rig->state.priv;
priv = (struct ft900_priv_data *)STATE(rig)->priv;
if (vfo == RIG_VFO_CURR)
{
@ -1114,7 +1114,7 @@ static int ft900_set_vfo(RIG *rig, vfo_t vfo)
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo);
priv = (struct ft900_priv_data *)rig->state.priv;
priv = (struct ft900_priv_data *)STATE(rig)->priv;
if (vfo == RIG_VFO_CURR)
{
@ -1194,7 +1194,7 @@ static int ft900_get_vfo(RIG *rig, vfo_t *vfo)
return -RIG_EINVAL;
}
priv = (struct ft900_priv_data *)rig->state.priv;
priv = (struct ft900_priv_data *)STATE(rig)->priv;
/* Get flags for VFO status */
err = ft900_get_update_data(rig, FT900_NATIVE_READ_FLAGS,
@ -1300,7 +1300,7 @@ static int ft900_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
return -RIG_EINVAL;
}
priv = (struct ft900_priv_data *)rig->state.priv;
priv = (struct ft900_priv_data *)STATE(rig)->priv;
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo);
rig_debug(RIG_DEBUG_TRACE, "%s: passed ptt = 0x%02x\n", __func__, ptt);
@ -1364,7 +1364,7 @@ static int ft900_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt)
return -RIG_EINVAL;
}
priv = (struct ft900_priv_data *)rig->state.priv;
priv = (struct ft900_priv_data *)STATE(rig)->priv;
/* Get flags for VFO status */
err = ft900_get_update_data(rig, FT900_NATIVE_READ_FLAGS,
@ -1478,7 +1478,7 @@ static int ft900_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split,
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo);
priv = (struct ft900_priv_data *)rig->state.priv;
priv = (struct ft900_priv_data *)STATE(rig)->priv;
/* Get flags for VFO split status */
err = ft900_get_update_data(rig, FT900_NATIVE_READ_FLAGS,
@ -1543,7 +1543,7 @@ static int ft900_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit)
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo);
rig_debug(RIG_DEBUG_TRACE, "%s: passed rit = %li\n", __func__, rit);
priv = (struct ft900_priv_data *)rig->state.priv;
priv = (struct ft900_priv_data *)STATE(rig)->priv;
/*
* The assumption here is that the user hasn't changed
@ -1629,7 +1629,7 @@ static int ft900_get_rit(RIG *rig, vfo_t vfo, shortfreq_t *rit)
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo);
priv = (struct ft900_priv_data *)rig->state.priv;
priv = (struct ft900_priv_data *)STATE(rig)->priv;
if (vfo == RIG_VFO_CURR)
{
@ -1782,7 +1782,7 @@ static int ft900_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
rig_debug(RIG_DEBUG_TRACE, "%s: passed level = %s\n", __func__,
rig_strlevel(level));
priv = (struct ft900_priv_data *)rig->state.priv;
priv = (struct ft900_priv_data *)STATE(rig)->priv;
switch (level)
{
@ -1910,7 +1910,7 @@ static int ft900_get_update_data(RIG *rig, unsigned char ci, unsigned char rl)
return -RIG_EINVAL;
}
priv = (struct ft900_priv_data *)rig->state.priv;
priv = (struct ft900_priv_data *)STATE(rig)->priv;
err = ft900_send_static_cmd(rig, ci);
@ -2006,7 +2006,7 @@ static int ft900_send_dynamic_cmd(RIG *rig, unsigned char ci,
"%s: passed p1 = 0x%02x, p2 = 0x%02x, p3 = 0x%02x, p4 = 0x%02x,\n",
__func__, p1, p2, p3, p4);
priv = (struct ft900_priv_data *)rig->state.priv;
priv = (struct ft900_priv_data *)STATE(rig)->priv;
if (ncmd[ci].ncomp)
{
@ -2065,7 +2065,7 @@ static int ft900_send_dial_freq(RIG *rig, unsigned char ci, freq_t freq)
rig_debug(RIG_DEBUG_TRACE, "%s: passed ci = %i\n", __func__, ci);
rig_debug(RIG_DEBUG_TRACE, "%s: passed freq = %"PRIfreq" Hz\n", __func__, freq);
priv = (struct ft900_priv_data *)rig->state.priv;
priv = (struct ft900_priv_data *)STATE(rig)->priv;
if (ncmd[ci].ncomp)
{
@ -2130,7 +2130,7 @@ static int ft900_send_rit_freq(RIG *rig, unsigned char ci, shortfreq_t rit)
rig_debug(RIG_DEBUG_TRACE, "%s: passed ci = %i\n", __func__, ci);
rig_debug(RIG_DEBUG_TRACE, "%s: passed rit = %li Hz\n", __func__, rit);
priv = (struct ft900_priv_data *)rig->state.priv;
priv = (struct ft900_priv_data *)STATE(rig)->priv;
if (ncmd[ci].ncomp)
{

Wyświetl plik

@ -633,15 +633,15 @@ static int ft920_init(RIG *rig)
return -RIG_EINVAL;
}
rig->state.priv = (struct ft920_priv_data *) calloc(1,
STATE(rig)->priv = (struct ft920_priv_data *) calloc(1,
sizeof(struct ft920_priv_data));
if (!rig->state.priv)
if (!STATE(rig)->priv)
{
return -RIG_ENOMEM; /* whoops! memory shortage! */
}
priv = rig->state.priv;
priv = STATE(rig)->priv;
/* TODO: read pacing from preferences */
priv->pacing =
@ -668,12 +668,12 @@ static int ft920_cleanup(RIG *rig)
return -RIG_EINVAL;
}
if (rig->state.priv)
if (STATE(rig)->priv)
{
free(rig->state.priv);
free(STATE(rig)->priv);
}
rig->state.priv = NULL;
STATE(rig)->priv = NULL;
return RIG_OK;
}
@ -697,7 +697,7 @@ static int ft920_open(RIG *rig)
return -RIG_EINVAL;
}
priv = (struct ft920_priv_data *)rig->state.priv;
priv = (struct ft920_priv_data *)STATE(rig)->priv;
rig_debug(RIG_DEBUG_TRACE, "%s: write_delay = %i msec\n",
__func__, rp->write_delay);
@ -773,7 +773,7 @@ static int ft920_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
return -RIG_EINVAL;
}
priv = (struct ft920_priv_data *)rig->state.priv;
priv = (struct ft920_priv_data *)STATE(rig)->priv;
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo);
rig_debug(RIG_DEBUG_TRACE, "%s: passed freq = %"PRIfreq" Hz\n", __func__, freq);
@ -853,7 +853,7 @@ static int ft920_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
return -RIG_EINVAL;
}
priv = (struct ft920_priv_data *)rig->state.priv;
priv = (struct ft920_priv_data *)STATE(rig)->priv;
if (vfo == RIG_VFO_CURR)
{
@ -945,7 +945,7 @@ static int ft920_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
rig_strrmode(mode));
rig_debug(RIG_DEBUG_TRACE, "%s: passed width = %d Hz\n", __func__, (int)width);
priv = (struct ft920_priv_data *)rig->state.priv;
priv = (struct ft920_priv_data *)STATE(rig)->priv;
if (vfo == RIG_VFO_CURR)
{
@ -1183,7 +1183,7 @@ static int ft920_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo);
priv = (struct ft920_priv_data *)rig->state.priv;
priv = (struct ft920_priv_data *)STATE(rig)->priv;
if (vfo == RIG_VFO_CURR)
{
@ -1371,7 +1371,7 @@ static int ft920_set_vfo(RIG *rig, vfo_t vfo)
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo);
priv = (struct ft920_priv_data *)rig->state.priv;
priv = (struct ft920_priv_data *)STATE(rig)->priv;
if (vfo == RIG_VFO_CURR)
{
@ -1443,7 +1443,7 @@ static int ft920_get_vfo(RIG *rig, vfo_t *vfo)
return -RIG_EINVAL;
}
priv = (struct ft920_priv_data *)rig->state.priv;
priv = (struct ft920_priv_data *)STATE(rig)->priv;
/* Get flags for VFO status */
err = ft920_get_update_data(rig, FT920_NATIVE_STATUS_FLAGS,
@ -1632,7 +1632,7 @@ static int ft920_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split,
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo);
priv = (struct ft920_priv_data *)rig->state.priv;
priv = (struct ft920_priv_data *)STATE(rig)->priv;
/* Get flags for VFO split status */
err = ft920_get_update_data(rig, FT920_NATIVE_STATUS_FLAGS,
@ -1717,7 +1717,7 @@ static int ft920_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq)
if (err != RIG_OK) { RETURNFUNC(err); }
priv = (struct ft920_priv_data *)rig->state.priv;
priv = (struct ft920_priv_data *)STATE(rig)->priv;
err = ft920_get_split_vfo(rig, vfo, &priv->split, &priv->split_vfo);
@ -1778,7 +1778,7 @@ static int ft920_get_split_freq(RIG *rig, vfo_t vfo, freq_t *tx_freq)
return -RIG_EINVAL;
}
priv = (struct ft920_priv_data *)rig->state.priv;
priv = (struct ft920_priv_data *)STATE(rig)->priv;
err = ft920_get_split_vfo(rig, vfo, &priv->split, &priv->split_vfo);
@ -1847,7 +1847,7 @@ static int ft920_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode,
rig_debug(RIG_DEBUG_TRACE, "%s: passed width = %d Hz\n", __func__,
(int)tx_width);
priv = (struct ft920_priv_data *)rig->state.priv;
priv = (struct ft920_priv_data *)STATE(rig)->priv;
err = ft920_get_split_vfo(rig, vfo, &priv->split, &priv->split_vfo);
@ -1911,7 +1911,7 @@ static int ft920_get_split_mode(RIG *rig, vfo_t vfo, rmode_t *tx_mode,
return -RIG_EINVAL;
}
priv = (struct ft920_priv_data *)rig->state.priv;
priv = (struct ft920_priv_data *)STATE(rig)->priv;
err = ft920_get_split_vfo(rig, vfo, &priv->split, &priv->split_vfo);
@ -2056,7 +2056,7 @@ static int ft920_get_rit(RIG *rig, vfo_t vfo, shortfreq_t *rit)
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo);
priv = (struct ft920_priv_data *)rig->state.priv;
priv = (struct ft920_priv_data *)STATE(rig)->priv;
if (vfo == RIG_VFO_CURR)
{
@ -2259,7 +2259,7 @@ static int ft920_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
return -RIG_EINVAL;
}
priv = (struct ft920_priv_data *)rig->state.priv;
priv = (struct ft920_priv_data *)STATE(rig)->priv;
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo);
rig_debug(RIG_DEBUG_TRACE, "%s: passed ptt = 0x%02x\n", __func__, ptt);
@ -2331,7 +2331,7 @@ static int ft920_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt)
return -RIG_EINVAL;
}
priv = (struct ft920_priv_data *)rig->state.priv;
priv = (struct ft920_priv_data *)STATE(rig)->priv;
/* Get flags for VFO status */
err = ft920_get_update_data(rig, FT920_NATIVE_STATUS_FLAGS,
@ -2403,7 +2403,7 @@ static int ft920_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
return -RIG_EINVAL;
}
priv = (struct ft920_priv_data *)rig->state.priv;
priv = (struct ft920_priv_data *)STATE(rig)->priv;
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = %s, func = %s, status = %d\n",
__func__, rig_strvfo(vfo), rig_strfunc(func), status);
@ -2487,7 +2487,7 @@ static int ft920_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status)
return -RIG_EINVAL;
}
priv = (struct ft920_priv_data *)rig->state.priv;
priv = (struct ft920_priv_data *)STATE(rig)->priv;
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = %s, func = %s\n",
__func__, rig_strvfo(vfo), rig_strfunc(func));
@ -2622,7 +2622,7 @@ static int ft920_get_update_data(RIG *rig, unsigned char ci, unsigned char rl)
return -RIG_EINVAL;
}
priv = (struct ft920_priv_data *)rig->state.priv;
priv = (struct ft920_priv_data *)STATE(rig)->priv;
err = ft920_send_static_cmd(rig, ci);
@ -2722,7 +2722,7 @@ static int ft920_send_dynamic_cmd(RIG *rig, unsigned char ci,
"%s: passed p1 = 0x%02x, p2 = 0x%02x, p3 = 0x%02x, p4 = 0x%02x,\n",
__func__, p1, p2, p3, p4);
priv = (struct ft920_priv_data *)rig->state.priv;
priv = (struct ft920_priv_data *)STATE(rig)->priv;
/*
* If we've been passed a command index (ci) that is marked
@ -2786,7 +2786,7 @@ static int ft920_send_dial_freq(RIG *rig, unsigned char ci, freq_t freq)
rig_debug(RIG_DEBUG_TRACE, "%s: passed ci = %i\n", __func__, ci);
rig_debug(RIG_DEBUG_TRACE, "%s: passed freq = %"PRIfreq" Hz\n", __func__, freq);
priv = (struct ft920_priv_data *)rig->state.priv;
priv = (struct ft920_priv_data *)STATE(rig)->priv;
/*
* If we've been passed a command index (ci) that is marked
@ -2855,7 +2855,7 @@ static int ft920_send_rit_freq(RIG *rig, unsigned char ci, shortfreq_t rit)
rig_debug(RIG_DEBUG_TRACE, "%s: passed ci = %i\n", __func__, ci);
rig_debug(RIG_DEBUG_TRACE, "%s: passed rit = %li Hz\n", __func__, rit);
priv = (struct ft920_priv_data *)rig->state.priv;
priv = (struct ft920_priv_data *)STATE(rig)->priv;
/*
* If we've been passed a command index (ci) that is marked

Wyświetl plik

@ -612,7 +612,7 @@ int ft980_transaction(RIG *rig, const unsigned char *cmd, unsigned char *data,
int ft980_get_status_data(RIG *rig)
{
const unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0x01 };
struct ft980_priv_data *priv = (struct ft980_priv_data *)rig->state.priv;
struct ft980_priv_data *priv = (struct ft980_priv_data *)STATE(rig)->priv;
int retval;
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
@ -663,15 +663,15 @@ int ft980_init(RIG *rig)
return -RIG_EINVAL;
}
rig->state.priv = (struct ft980_priv_data *) calloc(1,
STATE(rig)->priv = (struct ft980_priv_data *) calloc(1,
sizeof(struct ft980_priv_data));
if (!rig->state.priv)
if (!STATE(rig)->priv)
{
return -RIG_ENOMEM;
}
priv = (struct ft980_priv_data *)rig->state.priv;
priv = (struct ft980_priv_data *)STATE(rig)->priv;
memset(priv, 0, sizeof(struct ft980_priv_data));
@ -705,12 +705,12 @@ int ft980_cleanup(RIG *rig)
return -RIG_EINVAL;
}
if (rig->state.priv)
if (STATE(rig)->priv)
{
free(rig->state.priv);
free(STATE(rig)->priv);
}
rig->state.priv = NULL;
STATE(rig)->priv = NULL;
return RIG_OK;
}
@ -739,7 +739,7 @@ int ft980_open(RIG *rig)
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
priv = (struct ft980_priv_data *)rig->state.priv;
priv = (struct ft980_priv_data *)STATE(rig)->priv;
/* send Ext Cntl ON: Activate CAT */
do
@ -782,7 +782,7 @@ int ft980_open(RIG *rig)
int ft980_close(RIG *rig)
{
unsigned char echo_back[YAESU_CMD_LENGTH];
struct ft980_priv_data *priv = (struct ft980_priv_data *)rig->state.priv;
struct ft980_priv_data *priv = (struct ft980_priv_data *)STATE(rig)->priv;
hamlib_port_t *rp = RIGPORT(rig);
int retry_count1 = 0;
@ -842,7 +842,7 @@ int ft980_close(RIG *rig)
int ft980_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
{
unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0x08};
struct ft980_priv_data *priv = (struct ft980_priv_data *)rig->state.priv;
struct ft980_priv_data *priv = (struct ft980_priv_data *)STATE(rig)->priv;
int err;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
@ -903,7 +903,7 @@ int ft980_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
*/
int ft980_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
{
struct ft980_priv_data *priv = (struct ft980_priv_data *)rig->state.priv;
struct ft980_priv_data *priv = (struct ft980_priv_data *)STATE(rig)->priv;
int retval;
freq_t f;
@ -977,7 +977,7 @@ int ft980_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
int ft980_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
{
unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0x0A};
struct ft980_priv_data *priv = (struct ft980_priv_data *)rig->state.priv;
struct ft980_priv_data *priv = (struct ft980_priv_data *)STATE(rig)->priv;
unsigned char md;
int err;
@ -1094,7 +1094,7 @@ int ft980_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
int ft980_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
{
unsigned char my_mode; /* ft890 mode, mode offset */
struct ft980_priv_data *priv = (struct ft980_priv_data *)rig->state.priv;
struct ft980_priv_data *priv = (struct ft980_priv_data *)STATE(rig)->priv;
int retval, norm;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
@ -1236,7 +1236,7 @@ int ft980_set_split_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
int ft980_set_mem(RIG *rig, vfo_t vfo, int ch)
{
unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0x0A };
struct ft980_priv_data *priv = (struct ft980_priv_data *)rig->state.priv;
struct ft980_priv_data *priv = (struct ft980_priv_data *)STATE(rig)->priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
@ -1269,7 +1269,7 @@ int ft980_set_mem(RIG *rig, vfo_t vfo, int ch)
*/
int ft980_get_mem(RIG *rig, vfo_t vfo, int *ch)
{
struct ft980_priv_data *priv = (struct ft980_priv_data *)rig->state.priv;
struct ft980_priv_data *priv = (struct ft980_priv_data *)STATE(rig)->priv;
int retval;
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
@ -1321,7 +1321,7 @@ int ft980_set_vfo(RIG *rig, vfo_t vfo)
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = %s\n", __func__, rig_strvfo(vfo));
priv = (struct ft980_priv_data *)rig->state.priv;
priv = (struct ft980_priv_data *)STATE(rig)->priv;
switch (vfo)
{
@ -1407,7 +1407,7 @@ int ft980_get_vfo(RIG *rig, vfo_t *vfo)
return -RIG_EARG;
}
priv = (struct ft980_priv_data *)rig->state.priv;
priv = (struct ft980_priv_data *)STATE(rig)->priv;
/* Get flags for VFO status */
err = ft980_get_status_data(rig);

Wyświetl plik

@ -397,15 +397,15 @@ int ft990_init(RIG *rig)
return -RIG_EINVAL;
}
rig->state.priv = (struct ft990_priv_data *) calloc(1,
STATE(rig)->priv = (struct ft990_priv_data *) calloc(1,
sizeof(struct ft990_priv_data));
if (!rig->state.priv)
if (!STATE(rig)->priv)
{
return -RIG_ENOMEM;
}
priv = rig->state.priv;
priv = STATE(rig)->priv;
// Set default pacing value
priv->pacing = FT990_PACING_DEFAULT_VALUE;
@ -430,12 +430,12 @@ int ft990_cleanup(RIG *rig)
return -RIG_EINVAL;
}
if (rig->state.priv)
if (STATE(rig)->priv)
{
free(rig->state.priv);
free(STATE(rig)->priv);
}
rig->state.priv = NULL;
STATE(rig)->priv = NULL;
return RIG_OK;
}
@ -456,7 +456,7 @@ int ft990_open(RIG *rig)
return -RIG_EINVAL;
}
priv = (struct ft990_priv_data *)rig->state.priv;
priv = (struct ft990_priv_data *)STATE(rig)->priv;
rig_debug(RIG_DEBUG_TRACE, "%s: write_delay = %i msec\n",
__func__, RIGPORT(rig)->write_delay);
@ -538,7 +538,7 @@ int ft990_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
return -RIG_EINVAL;
}
priv = (struct ft990_priv_data *)rig->state.priv;
priv = (struct ft990_priv_data *)STATE(rig)->priv;
vfo_save = priv->current_vfo;
// Set to selected VFO
@ -615,7 +615,7 @@ int ft990_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
return -RIG_EINVAL;
}
priv = (struct ft990_priv_data *)rig->state.priv;
priv = (struct ft990_priv_data *)STATE(rig)->priv;
if (vfo == RIG_VFO_CURR)
{
@ -708,7 +708,7 @@ int ft990_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo);
rig_debug(RIG_DEBUG_TRACE, "%s: passed ptt = 0x%02x\n", __func__, ptt);
priv = (struct ft990_priv_data *) rig->state.priv;
priv = (struct ft990_priv_data *) STATE(rig)->priv;
// Set to selected VFO
if (vfo == RIG_VFO_CURR)
@ -784,7 +784,7 @@ int ft990_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt)
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo);
priv = (struct ft990_priv_data *) rig->state.priv;
priv = (struct ft990_priv_data *) STATE(rig)->priv;
err = ft990_get_update_data(rig, FT990_NATIVE_READ_FLAGS, 0);
@ -839,7 +839,7 @@ int ft990_set_rptr_shift(RIG *rig, vfo_t vfo, rptr_shift_t rptr_shift)
rig_debug(RIG_DEBUG_TRACE, "%s: passed rptr_shift = 0x%02x\n", __func__,
rptr_shift);
priv = (struct ft990_priv_data *) rig->state.priv;
priv = (struct ft990_priv_data *) STATE(rig)->priv;
// Set to selected VFO
if (vfo == RIG_VFO_CURR)
@ -966,7 +966,7 @@ int ft990_get_rptr_shift(RIG *rig, vfo_t vfo, rptr_shift_t *rptr_shift)
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo);
priv = (struct ft990_priv_data *) rig->state.priv;
priv = (struct ft990_priv_data *) STATE(rig)->priv;
if (vfo == RIG_VFO_CURR)
{
@ -1117,7 +1117,7 @@ int ft990_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
rig_debug(RIG_DEBUG_TRACE, "%s: passed split = 0x%02x\n", __func__, split);
rig_debug(RIG_DEBUG_TRACE, "%s: passed tx_vfo = 0x%02x\n", __func__, tx_vfo);
priv = (struct ft990_priv_data *) rig->state.priv;
priv = (struct ft990_priv_data *) STATE(rig)->priv;
if (vfo == RIG_VFO_CURR)
{
@ -1213,7 +1213,7 @@ int ft990_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo)
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo);
priv = (struct ft990_priv_data *) rig->state.priv;
priv = (struct ft990_priv_data *) STATE(rig)->priv;
// Read status flags
err = ft990_get_update_data(rig, FT990_NATIVE_READ_FLAGS, 0);
@ -1306,7 +1306,7 @@ int ft990_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit)
return -RIG_EINVAL;
}
priv = (struct ft990_priv_data *) rig->state.priv;
priv = (struct ft990_priv_data *) STATE(rig)->priv;
// Set to selected VFO
if (vfo == RIG_VFO_CURR)
@ -1413,7 +1413,7 @@ int ft990_get_rit(RIG *rig, vfo_t vfo, shortfreq_t *rit)
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo);
priv = (struct ft990_priv_data *) rig->state.priv;
priv = (struct ft990_priv_data *) STATE(rig)->priv;
if (vfo == RIG_VFO_CURR)
{
@ -1512,7 +1512,7 @@ int ft990_set_xit(RIG *rig, vfo_t vfo, shortfreq_t xit)
return -RIG_EINVAL;
}
priv = (struct ft990_priv_data *) rig->state.priv;
priv = (struct ft990_priv_data *) STATE(rig)->priv;
// Set to selected VFO
if (vfo == RIG_VFO_CURR)
@ -1618,7 +1618,7 @@ int ft990_get_xit(RIG *rig, vfo_t vfo, shortfreq_t *xit)
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo);
priv = (struct ft990_priv_data *) rig->state.priv;
priv = (struct ft990_priv_data *) STATE(rig)->priv;
if (vfo == RIG_VFO_CURR)
{
@ -1778,7 +1778,7 @@ int ft990_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status)
rig_debug(RIG_DEBUG_TRACE, "%s: passed func = %s\n", __func__,
rig_strfunc(func));
priv = (struct ft990_priv_data *)rig->state.priv;
priv = (struct ft990_priv_data *)STATE(rig)->priv;
err = ft990_get_update_data(rig, FT990_NATIVE_READ_FLAGS, 0);
@ -1903,7 +1903,7 @@ int ft990_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
rig_strrmode(mode));
rig_debug(RIG_DEBUG_TRACE, "%s: passed width = %d Hz\n", __func__, (int)width);
priv = (struct ft990_priv_data *)rig->state.priv;
priv = (struct ft990_priv_data *)STATE(rig)->priv;
// Set to selected VFO
if (vfo == RIG_VFO_CURR)
@ -2055,7 +2055,7 @@ int ft990_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo);
priv = (struct ft990_priv_data *)rig->state.priv;
priv = (struct ft990_priv_data *)STATE(rig)->priv;
if (vfo == RIG_VFO_CURR)
{
@ -2231,7 +2231,7 @@ int ft990_set_vfo(RIG *rig, vfo_t vfo)
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo);
priv = (struct ft990_priv_data *)rig->state.priv;
priv = (struct ft990_priv_data *)STATE(rig)->priv;
if (vfo == RIG_VFO_CURR)
{
@ -2314,7 +2314,7 @@ int ft990_get_vfo(RIG *rig, vfo_t *vfo)
return -RIG_EINVAL;
}
priv = (struct ft990_priv_data *)rig->state.priv;
priv = (struct ft990_priv_data *)STATE(rig)->priv;
/* Get flags for VFO status */
err = ft990_get_update_data(rig, FT990_NATIVE_READ_FLAGS, 0);
@ -2400,7 +2400,7 @@ int ft990_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *value)
rig_debug(RIG_DEBUG_TRACE, "%s: passed level %s\n", __func__,
rig_strlevel(level));
priv = (struct ft990_priv_data *) rig->state.priv;
priv = (struct ft990_priv_data *) STATE(rig)->priv;
if (vfo == RIG_VFO_CURR)
{
@ -2499,7 +2499,7 @@ int ft990_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op)
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo %s\n", __func__, rig_strvfo(vfo));
rig_debug(RIG_DEBUG_TRACE, "%s: passed op %s\n", __func__, rig_strvfop(op));
priv = (struct ft990_priv_data *) rig->state.priv;
priv = (struct ft990_priv_data *) STATE(rig)->priv;
if (vfo == RIG_VFO_CURR)
{
@ -2620,7 +2620,7 @@ int ft990_set_mem(RIG *rig, vfo_t vfo, int ch)
rig_debug(RIG_DEBUG_TRACE, "%s: passed ch = %i\n", __func__, ch);
priv = (struct ft990_priv_data *) rig->state.priv;
priv = (struct ft990_priv_data *) STATE(rig)->priv;
// Check for valid channel number
if (ch < 1 || ch > 90)
@ -2672,7 +2672,7 @@ int ft990_get_mem(RIG *rig, vfo_t vfo, int *ch)
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo);
priv = (struct ft990_priv_data *) rig->state.priv;
priv = (struct ft990_priv_data *) STATE(rig)->priv;
if (vfo == RIG_VFO_CURR)
{
@ -2766,7 +2766,7 @@ int ft990_get_channel(RIG *rig, vfo_t vfo, channel_t *chan, int read_only)
rig_debug(RIG_DEBUG_TRACE, "%s: passed chan->channel_num = %i\n",
__func__, chan->channel_num);
priv = (struct ft990_priv_data *) rig->state.priv;
priv = (struct ft990_priv_data *) STATE(rig)->priv;
if (chan->channel_num < 0 || chan->channel_num > 90)
{
@ -3243,7 +3243,7 @@ int ft990_get_update_data(RIG *rig, unsigned char ci, unsigned short ch)
return -RIG_EINVAL;
}
priv = (struct ft990_priv_data *)rig->state.priv;
priv = (struct ft990_priv_data *)STATE(rig)->priv;
if (ci == FT990_NATIVE_UPDATE_MEM_CHNL_DATA)
// P4 = 0x01 to 0x5a for channel 1 - 90
@ -3383,7 +3383,7 @@ int ft990_send_dynamic_cmd(RIG *rig, unsigned char ci,
"%s: passed p1 = 0x%02x, p2 = 0x%02x, p3 = 0x%02x, p4 = 0x%02x,\n",
__func__, p1, p2, p3, p4);
priv = (struct ft990_priv_data *)rig->state.priv;
priv = (struct ft990_priv_data *)STATE(rig)->priv;
if (ncmd[ci].ncomp)
{
@ -3440,7 +3440,7 @@ int ft990_send_dial_freq(RIG *rig, unsigned char ci, freq_t freq)
rig_debug(RIG_DEBUG_TRACE, "%s: passed ci = 0x%02x\n", __func__, ci);
rig_debug(RIG_DEBUG_TRACE, "%s: passed freq = %"PRIfreq" Hz\n", __func__, freq);
priv = (struct ft990_priv_data *)rig->state.priv;
priv = (struct ft990_priv_data *)STATE(rig)->priv;
if (ncmd[ci].ncomp)
{
@ -3495,7 +3495,7 @@ int ft990_send_rit_freq(RIG *rig, unsigned char ci, shortfreq_t rit)
rig_debug(RIG_DEBUG_TRACE, "%s: passed ci = 0x%02x\n", __func__, ci);
rig_debug(RIG_DEBUG_TRACE, "%s: passed rit = %li Hz\n", __func__, rit);
priv = (struct ft990_priv_data *) rig->state.priv;
priv = (struct ft990_priv_data *) STATE(rig)->priv;
if (ncmd[ci].ncomp)
{

Wyświetl plik

@ -412,15 +412,15 @@ int ft990v12_init(RIG *rig)
return -RIG_EINVAL;
}
rig->state.priv = (struct ft990v12_priv_data *) calloc(1,
STATE(rig)->priv = (struct ft990v12_priv_data *) calloc(1,
sizeof(struct ft990v12_priv_data));
if (!rig->state.priv)
if (!STATE(rig)->priv)
{
return -RIG_ENOMEM;
}
priv = rig->state.priv;
priv = STATE(rig)->priv;
// Set default pacing value
priv->pacing = FT990_PACING_DEFAULT_VALUE;
@ -445,12 +445,12 @@ int ft990v12_cleanup(RIG *rig)
return -RIG_EINVAL;
}
if (rig->state.priv)
if (STATE(rig)->priv)
{
free(rig->state.priv);
free(STATE(rig)->priv);
}
rig->state.priv = NULL;
STATE(rig)->priv = NULL;
return RIG_OK;
}
@ -471,7 +471,7 @@ int ft990v12_open(RIG *rig)
return -RIG_EINVAL;
}
priv = (struct ft990v12_priv_data *)rig->state.priv;
priv = (struct ft990v12_priv_data *)STATE(rig)->priv;
rig_debug(RIG_DEBUG_TRACE, "%s: write_delay = %i msec\n",
__func__, RIGPORT(rig)->write_delay);
@ -556,7 +556,7 @@ int ft990v12_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
return -RIG_EINVAL;
}
priv = (struct ft990v12_priv_data *)rig->state.priv;
priv = (struct ft990v12_priv_data *)STATE(rig)->priv;
vfo_save = priv->current_vfo;
// Set to selected VFO
@ -640,7 +640,7 @@ int ft990v12_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
return -RIG_EINVAL;
}
priv = (struct ft990v12_priv_data *)rig->state.priv;
priv = (struct ft990v12_priv_data *)STATE(rig)->priv;
if (vfo == RIG_VFO_CURR)
{
@ -740,7 +740,7 @@ int ft990v12_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo);
rig_debug(RIG_DEBUG_TRACE, "%s: passed ptt = 0x%02x\n", __func__, ptt);
priv = (struct ft990v12_priv_data *) rig->state.priv;
priv = (struct ft990v12_priv_data *) STATE(rig)->priv;
// Set to selected VFO
if (vfo == RIG_VFO_CURR)
@ -816,7 +816,7 @@ int ft990v12_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt)
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo);
priv = (struct ft990v12_priv_data *) rig->state.priv;
priv = (struct ft990v12_priv_data *) STATE(rig)->priv;
err = ft990v12_get_update_data(rig, FT990_NATIVE_READ_FLAGS, 0);
@ -871,7 +871,7 @@ int ft990v12_set_rptr_shift(RIG *rig, vfo_t vfo, rptr_shift_t rptr_shift)
rig_debug(RIG_DEBUG_TRACE, "%s: passed rptr_shift = 0x%02x\n", __func__,
rptr_shift);
priv = (struct ft990v12_priv_data *) rig->state.priv;
priv = (struct ft990v12_priv_data *) STATE(rig)->priv;
// Set to selected VFO
if (vfo == RIG_VFO_CURR)
@ -998,7 +998,7 @@ int ft990v12_get_rptr_shift(RIG *rig, vfo_t vfo, rptr_shift_t *rptr_shift)
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo);
priv = (struct ft990v12_priv_data *) rig->state.priv;
priv = (struct ft990v12_priv_data *) STATE(rig)->priv;
if (vfo == RIG_VFO_CURR)
{
@ -1149,7 +1149,7 @@ int ft990v12_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
rig_debug(RIG_DEBUG_TRACE, "%s: passed split = 0x%02x\n", __func__, split);
rig_debug(RIG_DEBUG_TRACE, "%s: passed tx_vfo = 0x%02x\n", __func__, tx_vfo);
priv = (struct ft990v12_priv_data *) rig->state.priv;
priv = (struct ft990v12_priv_data *) STATE(rig)->priv;
if (vfo == RIG_VFO_CURR)
{
@ -1245,7 +1245,7 @@ int ft990v12_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo)
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo);
priv = (struct ft990v12_priv_data *) rig->state.priv;
priv = (struct ft990v12_priv_data *) STATE(rig)->priv;
// Read status flags
err = ft990v12_get_update_data(rig, FT990_NATIVE_READ_FLAGS, 0);
@ -1338,7 +1338,7 @@ int ft990v12_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit)
return -RIG_EINVAL;
}
priv = (struct ft990v12_priv_data *) rig->state.priv;
priv = (struct ft990v12_priv_data *) STATE(rig)->priv;
// Set to selected VFO
if (vfo == RIG_VFO_CURR)
@ -1445,7 +1445,7 @@ int ft990v12_get_rit(RIG *rig, vfo_t vfo, shortfreq_t *rit)
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo);
priv = (struct ft990v12_priv_data *) rig->state.priv;
priv = (struct ft990v12_priv_data *) STATE(rig)->priv;
if (vfo == RIG_VFO_CURR)
{
@ -1544,7 +1544,7 @@ int ft990v12_set_xit(RIG *rig, vfo_t vfo, shortfreq_t xit)
return -RIG_EINVAL;
}
priv = (struct ft990v12_priv_data *) rig->state.priv;
priv = (struct ft990v12_priv_data *) STATE(rig)->priv;
// Set to selected VFO
if (vfo == RIG_VFO_CURR)
@ -1650,7 +1650,7 @@ int ft990v12_get_xit(RIG *rig, vfo_t vfo, shortfreq_t *xit)
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo);
priv = (struct ft990v12_priv_data *) rig->state.priv;
priv = (struct ft990v12_priv_data *) STATE(rig)->priv;
if (vfo == RIG_VFO_CURR)
{
@ -1810,7 +1810,7 @@ int ft990v12_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status)
rig_debug(RIG_DEBUG_TRACE, "%s: passed func = %s\n", __func__,
rig_strfunc(func));
priv = (struct ft990v12_priv_data *)rig->state.priv;
priv = (struct ft990v12_priv_data *)STATE(rig)->priv;
err = ft990v12_get_update_data(rig, FT990_NATIVE_READ_FLAGS, 0);
@ -1935,7 +1935,7 @@ int ft990v12_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
rig_strrmode(mode));
rig_debug(RIG_DEBUG_TRACE, "%s: passed width = %d Hz\n", __func__, (int)width);
priv = (struct ft990v12_priv_data *)rig->state.priv;
priv = (struct ft990v12_priv_data *)STATE(rig)->priv;
// Set to selected VFO
if (vfo == RIG_VFO_CURR)
@ -2087,7 +2087,7 @@ int ft990v12_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo);
priv = (struct ft990v12_priv_data *)rig->state.priv;
priv = (struct ft990v12_priv_data *)STATE(rig)->priv;
if (vfo == RIG_VFO_CURR)
{
@ -2263,7 +2263,7 @@ int ft990v12_set_vfo(RIG *rig, vfo_t vfo)
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo);
priv = (struct ft990v12_priv_data *)rig->state.priv;
priv = (struct ft990v12_priv_data *)STATE(rig)->priv;
if (vfo == RIG_VFO_CURR)
{
@ -2345,7 +2345,7 @@ int ft990v12_get_vfo(RIG *rig, vfo_t *vfo)
return -RIG_EINVAL;
}
priv = (struct ft990v12_priv_data *)rig->state.priv;
priv = (struct ft990v12_priv_data *)STATE(rig)->priv;
/* Get flags for VFO status
err = ft990v12_get_update_data(rig, FT990_NATIVE_READ_FLAGS, 0);
@ -2432,7 +2432,7 @@ int ft990v12_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *value)
rig_debug(RIG_DEBUG_TRACE, "%s: passed level %s\n", __func__,
rig_strlevel(level));
priv = (struct ft990v12_priv_data *) rig->state.priv;
priv = (struct ft990v12_priv_data *) STATE(rig)->priv;
if (vfo == RIG_VFO_CURR)
{
@ -2531,7 +2531,7 @@ int ft990v12_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op)
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo %s\n", __func__, rig_strvfo(vfo));
rig_debug(RIG_DEBUG_TRACE, "%s: passed op %s\n", __func__, rig_strvfop(op));
priv = (struct ft990v12_priv_data *) rig->state.priv;
priv = (struct ft990v12_priv_data *) STATE(rig)->priv;
if (vfo == RIG_VFO_CURR)
{
@ -2652,7 +2652,7 @@ int ft990v12_set_mem(RIG *rig, vfo_t vfo, int ch)
rig_debug(RIG_DEBUG_TRACE, "%s: passed ch = %i\n", __func__, ch);
priv = (struct ft990v12_priv_data *) rig->state.priv;
priv = (struct ft990v12_priv_data *) STATE(rig)->priv;
// Check for valid channel number
if (ch < 1 || ch > 90)
@ -2704,7 +2704,7 @@ int ft990v12_get_mem(RIG *rig, vfo_t vfo, int *ch)
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo);
priv = (struct ft990v12_priv_data *) rig->state.priv;
priv = (struct ft990v12_priv_data *) STATE(rig)->priv;
if (vfo == RIG_VFO_CURR)
{
@ -2798,7 +2798,7 @@ int ft990v12_get_channel(RIG *rig, vfo_t vfo, channel_t *chan, int read_only)
rig_debug(RIG_DEBUG_TRACE, "%s: passed chan->channel_num = %i\n",
__func__, chan->channel_num);
priv = (struct ft990v12_priv_data *) rig->state.priv;
priv = (struct ft990v12_priv_data *) STATE(rig)->priv;
if (chan->channel_num < 0 || chan->channel_num > 90)
{
@ -3278,7 +3278,7 @@ int ft990v12_get_update_data(RIG *rig, unsigned char ci, unsigned short ch)
n = 0; // K1MMI: Initialise as the only time n will be updated is for the FT990_NATIVE_ALL_DATA AND FT990_READ_FLAGS
priv = (struct ft990v12_priv_data *)rig->state.priv;
priv = (struct ft990v12_priv_data *)STATE(rig)->priv;
switch (ci)
{
@ -3477,7 +3477,7 @@ int ft990v12_send_dynamic_cmd(RIG *rig, unsigned char ci,
"%s: passed p1 = 0x%02x, p2 = 0x%02x, p3 = 0x%02x, p4 = 0x%02x,\n",
__func__, p1, p2, p3, p4);
priv = (struct ft990v12_priv_data *)rig->state.priv;
priv = (struct ft990v12_priv_data *)STATE(rig)->priv;
if (ncmd[ci].ncomp)
{
@ -3534,7 +3534,7 @@ int ft990v12_send_dial_freq(RIG *rig, unsigned char ci, freq_t freq)
rig_debug(RIG_DEBUG_TRACE, "%s: passed ci = 0x%02x\n", __func__, ci);
rig_debug(RIG_DEBUG_TRACE, "%s: passed freq = %"PRIfreq" Hz\n", __func__, freq);
priv = (struct ft990v12_priv_data *)rig->state.priv;
priv = (struct ft990v12_priv_data *)STATE(rig)->priv;
if (ncmd[ci].ncomp)
{
@ -3589,7 +3589,7 @@ int ft990v12_send_rit_freq(RIG *rig, unsigned char ci, shortfreq_t rit)
rig_debug(RIG_DEBUG_TRACE, "%s: passed ci = 0x%02x\n", __func__, ci);
rig_debug(RIG_DEBUG_TRACE, "%s: passed rit = %li Hz\n", __func__, rit);
priv = (struct ft990v12_priv_data *) rig->state.priv;
priv = (struct ft990v12_priv_data *) STATE(rig)->priv;
if (ncmd[ci].ncomp)
{

Wyświetl plik

@ -547,7 +547,7 @@ static int ft991_get_split_mode(RIG *rig, vfo_t vfo, rmode_t *tx_mode,
return -RIG_EINVAL;
}
priv = (struct newcat_priv_data *)rig->state.priv;
priv = (struct newcat_priv_data *)STATE(rig)->priv;
rdata = (ft991info *)priv->ret_data;
SNPRINTF(priv->cmd_str, sizeof(priv->cmd_str), "OI;");
@ -660,7 +660,7 @@ static int ft991_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode,
}
state = &rig->state;
state = STATE(rig);
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = %s\n", __func__,
rig_strvfo(vfo));
@ -719,14 +719,14 @@ static int ft991_init(RIG *rig)
if (ret != RIG_OK) { return ret; }
rig->state.current_vfo = RIG_VFO_A;
STATE(rig)->current_vfo = RIG_VFO_A;
return RIG_OK;
}
static int ft991_find_current_vfo(RIG *rig, vfo_t *vfo, tone_t *enc_dec_mode,
rmode_t *mode)
{
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv;
ft991info *info = (ft991info *)priv->ret_data;
int err;
@ -776,7 +776,7 @@ static int ft991_find_current_vfo(RIG *rig, vfo_t *vfo, tone_t *enc_dec_mode,
static int ft991_get_enabled_ctcss_dcs_mode(RIG *rig)
{
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv;
int err;
rig_debug(RIG_DEBUG_TRACE, "%s called\n", __func__);
@ -794,7 +794,7 @@ static int ft991_get_enabled_ctcss_dcs_mode(RIG *rig)
static int ft991_set_ctcss_tone(RIG *rig, vfo_t vfo, tone_t tone)
{
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv;
int i;
ncboolean tone_match;
@ -831,7 +831,7 @@ static int ft991_set_ctcss_tone(RIG *rig, vfo_t vfo, tone_t tone)
static int ft991_get_ctcss_tone(RIG *rig, vfo_t vfo, tone_t *tone)
{
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv;
int ret;
int t;
int ret_data_len;
@ -897,7 +897,7 @@ static int ft991_get_ctcss_tone(RIG *rig, vfo_t vfo, tone_t *tone)
static int ft991_set_ctcss_sql(RIG *rig, vfo_t vfo, tone_t tone)
{
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv;
int err;
rmode_t rmode;
@ -946,7 +946,7 @@ static int ft991_set_ctcss_sql(RIG *rig, vfo_t vfo, tone_t tone)
static int ft991_get_ctcss_sql(RIG *rig, vfo_t vfo, tone_t *tone)
{
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv;
int ret;
int t;
int ret_data_len;
@ -999,7 +999,7 @@ static int ft991_get_ctcss_sql(RIG *rig, vfo_t vfo, tone_t *tone)
static int ft991_get_dcs_code(RIG *rig, vfo_t vfo, tone_t *code)
{
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv;
int err;
int t;
tone_t enc_dec_mode;
@ -1064,7 +1064,7 @@ static int ft991_get_dcs_code(RIG *rig, vfo_t vfo, tone_t *code)
static int ft991_set_dcs_code(RIG *rig, vfo_t vfo, tone_t code)
{
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv;
int i;
ncboolean code_match;
@ -1101,7 +1101,7 @@ static int ft991_set_dcs_code(RIG *rig, vfo_t vfo, tone_t code)
static int ft991_set_dcs_sql(RIG *rig, vfo_t vfo, tone_t code)
{
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv;
int i;
ncboolean code_match;
@ -1138,7 +1138,7 @@ static int ft991_set_dcs_sql(RIG *rig, vfo_t vfo, tone_t code)
static int ft991_get_dcs_sql(RIG *rig, vfo_t vfo, tone_t *code)
{
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv;
int codeindex;
int ret;
int ret_data_len;
@ -1192,12 +1192,12 @@ static int ft991_get_dcs_sql(RIG *rig, vfo_t vfo, tone_t *code)
// VFO functions so rigctld can be used without --vfo argument
static int ft991_set_vfo(RIG *rig, vfo_t vfo)
{
rig->state.current_vfo = vfo;
STATE(rig)->current_vfo = vfo;
RETURNFUNC2(RIG_OK);
}
static int ft991_get_vfo(RIG *rig, vfo_t *vfo)
{
*vfo = rig->state.current_vfo;
*vfo = STATE(rig)->current_vfo;
RETURNFUNC2(RIG_OK);
}

Wyświetl plik

@ -476,15 +476,15 @@ int newcat_init(RIG *rig)
ENTERFUNC;
rig->state.priv = (struct newcat_priv_data *) calloc(1,
STATE(rig)->priv = (struct newcat_priv_data *) calloc(1,
sizeof(struct newcat_priv_data));
if (!rig->state.priv) /* whoops! memory shortage! */
if (!STATE(rig)->priv) /* whoops! memory shortage! */
{
RETURNFUNC(-RIG_ENOMEM);
}
priv = rig->state.priv;
priv = STATE(rig)->priv;
// priv->current_vfo = RIG_VFO_MAIN; /* default to whatever */
// priv->current_vfo = RIG_VFO_A;
@ -534,12 +534,12 @@ int newcat_cleanup(RIG *rig)
ENTERFUNC;
if (rig->state.priv)
if (STATE(rig)->priv)
{
free(rig->state.priv);
free(STATE(rig)->priv);
}
rig->state.priv = NULL;
STATE(rig)->priv = NULL;
RETURNFUNC(RIG_OK);
}
@ -554,8 +554,8 @@ int newcat_cleanup(RIG *rig)
int newcat_open(RIG *rig)
{
struct newcat_priv_data *priv = rig->state.priv;
struct rig_state *rig_s = &rig->state;
struct rig_state *rig_s = STATE(rig);
struct newcat_priv_data *priv = rig_s->priv;
hamlib_port_t *rp = RIGPORT(rig);
const char *handshake[3] = {"None", "Xon/Xoff", "Hardware"};
int err;
@ -659,7 +659,7 @@ int newcat_open(RIG *rig)
if (priv->rig_id == NC_RIGID_FTDX3000 || priv->rig_id == NC_RIGID_FTDX3000DM)
{
rig->state.disable_yaesu_bandselect = 1;
rig_s->disable_yaesu_bandselect = 1;
rig_debug(RIG_DEBUG_VERBOSE, "%s: disabling FTDX3000 band select\n", __func__);
}
@ -703,8 +703,8 @@ int newcat_open(RIG *rig)
int newcat_close(RIG *rig)
{
struct newcat_priv_data *priv = rig->state.priv;
struct rig_state *rig_s = &rig->state;
struct rig_state *rig_s = STATE(rig);
struct newcat_priv_data *priv = rig_s->priv;
ENTERFUNC;
@ -753,7 +753,7 @@ int newcat_set_conf(RIG *rig, hamlib_token_t token, const char *val)
ENTERFUNC;
priv = (struct newcat_priv_data *)rig->state.priv;
priv = (struct newcat_priv_data *)STATE(rig)->priv;
if (priv == NULL)
{
@ -806,7 +806,7 @@ int newcat_get_conf2(RIG *rig, hamlib_token_t token, char *val, int val_len)
ENTERFUNC;
priv = (struct newcat_priv_data *)rig->state.priv;
priv = (struct newcat_priv_data *)STATE(rig)->priv;
if (priv == NULL)
{
@ -836,7 +836,7 @@ static int freq_60m[] = { 5332000, 5348000, 5358500, 5373000, 5405000 };
/* returns 0 if no exception or 1 if rig needs special handling */
int newcat_60m_exception(RIG *rig, freq_t freq, mode_t mode)
{
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv;
int err;
int channel = -1;
int i;
@ -937,6 +937,7 @@ int newcat_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
int err;
struct rig_caps *caps;
struct rig_cache *cachep = CACHE(rig);
struct rig_state *rig_s = STATE(rig);
struct newcat_priv_data *priv;
int special_60m = 0;
vfo_t vfo_mode;
@ -965,7 +966,7 @@ int newcat_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
RETURNFUNC(-RIG_ENAVAIL);
}
priv = (struct newcat_priv_data *)rig->state.priv;
priv = (struct newcat_priv_data *)rig_s->priv;
caps = rig->caps;
newcat_get_vfo_mode(rig, RIG_VFO_A, &vfo_mode);
@ -1033,7 +1034,7 @@ int newcat_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
if ((is_ftdx101d || is_ftdx101mp) && cachep->ptt == RIG_PTT_ON)
{
rig_debug(RIG_DEBUG_TRACE, "%s: ftdx101 check vfo OK, vfo=%s, tx_vfo=%s\n",
__func__, rig_strvfo(vfo), rig_strvfo(rig->state.tx_vfo));
__func__, rig_strvfo(vfo), rig_strvfo(rig_s->tx_vfo));
// when in split we can change VFOB but not VFOA
if (cachep->split == RIG_SPLIT_ON && target_vfo == '0') { return -RIG_ENTARGET; }
@ -1041,7 +1042,7 @@ int newcat_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
// when not in split we can't change VFOA at all
if (cachep->split == RIG_SPLIT_OFF && target_vfo == '0') { return -RIG_ENTARGET; }
if (vfo != rig->state.tx_vfo) { return -RIG_ENTARGET; }
if (vfo != rig_s->tx_vfo) { return -RIG_ENTARGET; }
}
if (is_ftdx3000 || is_ftdx3000dm || is_ftdx5000 || is_ftdx1200)
@ -1119,8 +1120,8 @@ int newcat_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
// And only when not in split mode (note this check has been removed for testing)
int changing;
rig_debug(RIG_DEBUG_TRACE, "%s(%d)%s: rig->state.current_vfo=%s\n", __FILE__,
__LINE__, __func__, rig_strvfo(rig->state.current_vfo));
rig_debug(RIG_DEBUG_TRACE, "%s(%d)%s: STATE(rig)->current_vfo=%s\n", __FILE__,
__LINE__, __func__, rig_strvfo(rig_s->current_vfo));
CACHE_RESET;
@ -1146,7 +1147,7 @@ int newcat_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
}
if (newcat_valid_command(rig, "BS") && changing
&& !rig->state.disable_yaesu_bandselect
&& !rig_s->disable_yaesu_bandselect
// remove the split check here -- hopefully works OK
//&& !cachep->split
// seems some rigs are problematic
@ -1161,7 +1162,7 @@ int newcat_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
&& rig->caps->set_vfo != NULL) // gotta' have get_vfo too
{
if (rig->state.current_vfo != vfo)
if (rig_s->current_vfo != vfo)
{
int vfo1 = 1, vfo2 = 0;
@ -1229,7 +1230,7 @@ int newcat_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
if (err != RIG_OK) { RETURNFUNC(err); }
if (rig->state.vfo_list & RIG_VFO_MAIN)
if (rig_s->vfo_list & RIG_VFO_MAIN)
{
err = rig_set_vfo(rig, vfotmp == RIG_VFO_MAIN ? RIG_VFO_SUB : RIG_VFO_MAIN);
}
@ -1263,7 +1264,7 @@ int newcat_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
}
// switch back to the starting vfo
if (rig->state.vfo_list & RIG_VFO_MAIN)
if (rig_s->vfo_list & RIG_VFO_MAIN)
{
err = rig_set_vfo(rig, vfotmp == RIG_VFO_MAIN ? RIG_VFO_MAIN : RIG_VFO_SUB);
}
@ -1387,7 +1388,7 @@ int newcat_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
}
rig_debug(RIG_DEBUG_TRACE, "%s: band changing? old=%d, new=%d\n", __func__,
newcat_band_index(freq), newcat_band_index(rig->state.current_freq));
newcat_band_index(freq), newcat_band_index(rig_s->current_freq));
if (RIG_MODEL_FT450 == caps->rig_model && priv->ret_data[2] != target_vfo)
{
@ -1418,7 +1419,7 @@ int newcat_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
int newcat_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
{
char command[3];
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv;
char c;
int err;
@ -1500,7 +1501,7 @@ int newcat_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
pbwidth_t twidth;
split_t split_save = cachep->split;
priv = (struct newcat_priv_data *)rig->state.priv;
priv = (struct newcat_priv_data *)STATE(rig)->priv;
ENTERFUNC;
@ -1611,7 +1612,7 @@ int newcat_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
int newcat_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
{
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv;
char c;
int err;
char main_sub_vfo = '0';
@ -1623,7 +1624,7 @@ int newcat_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
RETURNFUNC(-RIG_ENAVAIL);
}
if (rig->state.powerstat == 0)
if (STATE(rig)->powerstat == 0)
{
rig_debug(RIG_DEBUG_WARN, "%s: Cannot get from rig when power is off\n",
__func__);
@ -1697,8 +1698,8 @@ int newcat_set_vfo(RIG *rig, vfo_t vfo)
vfo_t vfo_mode;
char command[] = "VS";
priv = (struct newcat_priv_data *)rig->state.priv;
state = &rig->state;
state = STATE(rig);
priv = (struct newcat_priv_data *)state->priv;
priv->cache_start.tv_sec = 0; // invalidate the cache
@ -1805,7 +1806,7 @@ int newcat_set_vfo(RIG *rig, vfo_t vfo)
state->current_vfo = vfo; /* if set_vfo worked, set current_vfo */
rig_debug(RIG_DEBUG_TRACE, "%s: rig->state.current_vfo = %s\n", __func__,
rig_debug(RIG_DEBUG_TRACE, "%s: STATE(rig)->current_vfo = %s\n", __func__,
rig_strvfo(vfo));
RETURNFUNC(RIG_OK);
@ -1814,7 +1815,7 @@ int newcat_set_vfo(RIG *rig, vfo_t vfo)
// Either returns a valid RIG_VFO* or if < 0 an error code
static vfo_t newcat_set_vfo_if_needed(RIG *rig, vfo_t vfo)
{
vfo_t oldvfo = rig->state.current_vfo;
vfo_t oldvfo = STATE(rig)->current_vfo;
ENTERFUNC;
rig_debug(RIG_DEBUG_TRACE, "%s: vfo=%s, oldvfo=%s\n", __func__, rig_strvfo(vfo),
@ -1847,8 +1848,8 @@ static vfo_t newcat_set_vfo_if_needed(RIG *rig, vfo_t vfo)
int newcat_get_vfo(RIG *rig, vfo_t *vfo)
{
struct rig_state *state = &rig->state;
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
struct rig_state *state = STATE(rig);
struct newcat_priv_data *priv = (struct newcat_priv_data *)state->priv;
int err;
vfo_t vfo_mode;
char const *command = "VS";
@ -1882,13 +1883,13 @@ int newcat_get_vfo(RIG *rig, vfo_t *vfo)
switch (priv->ret_data[2])
{
case '0':
if (rig->state.vfo_list & RIG_VFO_MAIN) { *vfo = RIG_VFO_MAIN; }
if (state->vfo_list & RIG_VFO_MAIN) { *vfo = RIG_VFO_MAIN; }
else { *vfo = RIG_VFO_A; }
break;
case '1':
if (rig->state.vfo_list & RIG_VFO_SUB) { *vfo = RIG_VFO_SUB; }
if (state->vfo_list & RIG_VFO_SUB) { *vfo = RIG_VFO_SUB; }
else { *vfo = RIG_VFO_B; }
break;
@ -1912,7 +1913,7 @@ int newcat_get_vfo(RIG *rig, vfo_t *vfo)
state->current_vfo = *vfo; /* set now */
rig_debug(RIG_DEBUG_TRACE, "%s: rig->state.current_vfo = %s\n", __func__,
rig_debug(RIG_DEBUG_TRACE, "%s: STATE(rig)->current_vfo = %s\n", __func__,
rig_strvfo(state->current_vfo));
RETURNFUNC(RIG_OK);
@ -1921,7 +1922,7 @@ int newcat_get_vfo(RIG *rig, vfo_t *vfo)
int newcat_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
{
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv;
int err = -RIG_EPROTO;
char txon[] = "TX1;";
@ -1986,9 +1987,9 @@ int newcat_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
// some rigs like the FT991 need time before doing anything else like set_freq
// We won't mess with CW mode -- no freq change expected hopefully
if (rig->state.current_mode != RIG_MODE_CW
&& rig->state.current_mode != RIG_MODE_CWR
&& rig->state.current_mode != RIG_MODE_CWN
if (STATE(rig)->current_mode != RIG_MODE_CW
&& STATE(rig)->current_mode != RIG_MODE_CWR
&& STATE(rig)->current_mode != RIG_MODE_CWN
&& (is_ftdx3000 || is_ftdx3000dm)
)
{
@ -2010,7 +2011,7 @@ int newcat_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
int newcat_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt)
{
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv;
char c;
int err;
@ -2063,7 +2064,7 @@ int newcat_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd)
int newcat_set_rptr_shift(RIG *rig, vfo_t vfo, rptr_shift_t rptr_shift)
{
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv;
int err;
char c;
char command[] = "OS";
@ -2116,7 +2117,7 @@ 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)
{
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv;
int err;
char c;
char command[] = "OS";
@ -2177,7 +2178,7 @@ int newcat_get_rptr_shift(RIG *rig, vfo_t vfo, rptr_shift_t *rptr_shift)
int newcat_set_rptr_offs(RIG *rig, vfo_t vfo, shortfreq_t offs)
{
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv;
int err;
char command[32];
freq_t freq = 0;
@ -2422,7 +2423,7 @@ int newcat_set_rptr_offs(RIG *rig, vfo_t vfo, shortfreq_t offs)
int newcat_get_rptr_offs(RIG *rig, vfo_t vfo, shortfreq_t *offs)
{
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv;
int err;
int ret_data_len;
char *retoffs;
@ -2897,9 +2898,9 @@ int newcat_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo)
}
rig_debug(RIG_DEBUG_TRACE, "%s: tx_vfo=%s, curr_vfo=%s\n", __func__,
rig_strvfo(*tx_vfo), rig_strvfo(rig->state.current_vfo));
rig_strvfo(*tx_vfo), rig_strvfo(STATE(rig)->current_vfo));
if (*tx_vfo != rig->state.current_vfo)
if (*tx_vfo != STATE(rig)->current_vfo)
{
*split = RIG_SPLIT_ON;
}
@ -2918,7 +2919,7 @@ int newcat_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo)
int newcat_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit)
{
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv;
int oldvfo;
int ret;
@ -2970,7 +2971,7 @@ int newcat_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit)
int newcat_get_rit(RIG *rig, vfo_t vfo, shortfreq_t *rit)
{
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv;
char *retval;
int err;
int offset = 0;
@ -3034,7 +3035,7 @@ int newcat_get_rit(RIG *rig, vfo_t vfo, shortfreq_t *rit)
int newcat_set_xit(RIG *rig, vfo_t vfo, shortfreq_t xit)
{
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv;
int oldvfo;
int ret;
@ -3087,7 +3088,7 @@ int newcat_set_xit(RIG *rig, vfo_t vfo, shortfreq_t xit)
int newcat_get_xit(RIG *rig, vfo_t vfo, shortfreq_t *xit)
{
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv;
char *retval;
int err;
int offset = 0;
@ -3293,7 +3294,7 @@ 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 newcat_priv_data *)rig->state.priv;
struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv;
int err;
int i;
ncboolean tone_match;
@ -3363,7 +3364,7 @@ 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)
{
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv;
int err;
int t;
int ret_data_len;
@ -3675,7 +3676,7 @@ int newcat_mW2power(RIG *rig, float *power, unsigned int mwpower, freq_t freq,
int newcat_set_powerstat(RIG *rig, powerstat_t status)
{
hamlib_port_t *rp = RIGPORT(rig);
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv;
int retval;
int i = 0;
int retry_save;
@ -3768,7 +3769,7 @@ int newcat_set_powerstat(RIG *rig, powerstat_t status)
*/
int newcat_get_powerstat(RIG *rig, powerstat_t *status)
{
struct newcat_priv_data *priv = (struct newcat_priv_data *) rig->state.priv;
struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv;
hamlib_port_t *rp = RIGPORT(rig);
int result;
char ps;
@ -3881,7 +3882,7 @@ EX0301033 => RX-ANT => MONITOR [RANT]
*/
int newcat_set_ant(RIG *rig, vfo_t vfo, ant_t ant, value_t option)
{
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv;
int err;
char which_ant;
char command[] = "AN";
@ -3973,7 +3974,7 @@ int newcat_set_ant(RIG *rig, vfo_t vfo, ant_t ant, value_t option)
int newcat_get_ant(RIG *rig, vfo_t vfo, ant_t dummy, value_t *option,
ant_t *ant_curr, ant_t *ant_tx, ant_t *ant_rx)
{
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv;
int err;
char c;
char command[] = "AN";
@ -4092,7 +4093,7 @@ int newcat_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
{
struct rig_state *state = STATE(rig);
struct rig_cache *cachep = CACHE(rig);
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv;
int err;
int i;
int fpf;
@ -4303,9 +4304,9 @@ int newcat_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
rmode_t exclude = RIG_MODE_CW | RIG_MODE_CWR | RIG_MODE_RTTY | RIG_MODE_RTTYR;
if ((rig->state.tx_vfo == RIG_VFO_A && (cachep->modeMainA & exclude))
|| (rig->state.tx_vfo == RIG_VFO_B && (cachep->modeMainB & exclude))
|| (rig->state.tx_vfo == RIG_VFO_C && (cachep->modeMainC & exclude)))
if ((STATE(rig)->tx_vfo == RIG_VFO_A && (cachep->modeMainA & exclude))
|| (STATE(rig)->tx_vfo == RIG_VFO_B && (cachep->modeMainB & exclude))
|| (STATE(rig)->tx_vfo == RIG_VFO_C && (cachep->modeMainC & exclude)))
{
rig_debug(RIG_DEBUG_VERBOSE, "%s: rig cannot set MG in CW/RTTY modes\n",
__func__);
@ -4908,7 +4909,7 @@ int newcat_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
case RIG_LEVEL_USB_AF:
if (is_ftdx101d || is_ftdx101mp)
{
rmode_t curmode = rig->state.current_vfo == RIG_VFO_A ?
rmode_t curmode = STATE(rig)->current_vfo == RIG_VFO_A ?
cachep->modeMainA : cachep->modeMainB;
float valf = val.f / level_info->step.f;
@ -4965,7 +4966,7 @@ int newcat_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
{
struct rig_state *state = STATE(rig);
struct rig_cache *cachep = CACHE(rig);
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv;
int err;
int ret_data_len;
char *retlvl;
@ -5121,9 +5122,9 @@ int newcat_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
rmode_t exclude = RIG_MODE_CW | RIG_MODE_CWR | RIG_MODE_RTTY | RIG_MODE_RTTYR;
if ((rig->state.tx_vfo == RIG_VFO_A && (cachep->modeMainA & exclude))
|| (rig->state.tx_vfo == RIG_VFO_B && (cachep->modeMainB & exclude))
|| (rig->state.tx_vfo == RIG_VFO_C && (cachep->modeMainC & exclude)))
if ((STATE(rig)->tx_vfo == RIG_VFO_A && (cachep->modeMainA & exclude))
|| (STATE(rig)->tx_vfo == RIG_VFO_B && (cachep->modeMainB & exclude))
|| (STATE(rig)->tx_vfo == RIG_VFO_C && (cachep->modeMainC & exclude)))
{
rig_debug(RIG_DEBUG_VERBOSE, "%s: rig cannot read MG in CW/RTTY modes\n",
__func__);
@ -5505,7 +5506,7 @@ int newcat_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
case RIG_LEVEL_USB_AF_INPUT:
if (is_ftdx101d || is_ftdx101mp)
{
rmode_t curmode = rig->state.current_vfo == RIG_VFO_A ?
rmode_t curmode = STATE(rig)->current_vfo == RIG_VFO_A ?
cachep->modeMainA : cachep->modeMainB;
switch (curmode)
@ -5547,7 +5548,7 @@ int newcat_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
case RIG_LEVEL_USB_AF:
if (is_ftdx101d || is_ftdx101mp)
{
rmode_t curmode = rig->state.current_vfo == RIG_VFO_A ?
rmode_t curmode = STATE(rig)->current_vfo == RIG_VFO_A ?
cachep->modeMainA : cachep->modeMainB;
switch (curmode)
@ -6058,7 +6059,7 @@ int newcat_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
int newcat_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
{
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv;
int err;
char main_sub_vfo = '0';
@ -6497,7 +6498,7 @@ int newcat_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
int newcat_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status)
{
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv;
int err;
int ret_data_len;
int last_char_index;
@ -6912,7 +6913,7 @@ int newcat_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status)
int newcat_set_parm(RIG *rig, setting_t parm, value_t val)
{
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv;
int retval;
int rigband = 0;
int band = 0;
@ -6982,7 +6983,7 @@ int newcat_set_parm(RIG *rig, setting_t parm, value_t val)
int newcat_get_parm(RIG *rig, setting_t parm, value_t *val)
{
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv;
int retval;
ENTERFUNC;
@ -7024,7 +7025,7 @@ static int newcat_set_maxpower(RIG *rig, vfo_t vfo, hamlib_token_t token,
static int newcat_get_maxpower(RIG *rig, vfo_t vfo, hamlib_token_t token,
value_t *val)
{
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv;
int retval;
int code = 0;
int offset = 0;
@ -7086,7 +7087,7 @@ static int newcat_get_maxpower(RIG *rig, vfo_t vfo, hamlib_token_t token,
int newcat_set_ext_level(RIG *rig, vfo_t vfo, hamlib_token_t token, value_t val)
{
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv;
ENTERFUNC;
@ -7140,7 +7141,7 @@ int newcat_set_ext_level(RIG *rig, vfo_t vfo, hamlib_token_t token, value_t val)
int newcat_get_ext_level(RIG *rig, vfo_t vfo, hamlib_token_t token,
value_t *val)
{
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv;
char *result;
int retval;
int value;
@ -7301,7 +7302,7 @@ int newcat_recv_dtmf(RIG *rig, vfo_t vfo, char *digits, int *length)
int newcat_send_morse(RIG *rig, vfo_t vfo, const char *msg)
{
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv;
int rc;
ENTERFUNC;
@ -7398,7 +7399,7 @@ int newcat_set_bank(RIG *rig, vfo_t vfo, int bank)
int newcat_set_mem(RIG *rig, vfo_t vfo, int ch)
{
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv;
int err, i;
ncboolean restore_vfo;
chan_t *chan_list;
@ -7510,7 +7511,7 @@ int newcat_set_mem(RIG *rig, vfo_t vfo, int ch)
int newcat_get_mem(RIG *rig, vfo_t vfo, int *ch)
{
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv;
int err;
ENTERFUNC;
@ -7537,7 +7538,7 @@ int newcat_get_mem(RIG *rig, vfo_t vfo, int *ch)
int newcat_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op)
{
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv;
int err;
char main_sub_vfo = '0';
@ -7639,7 +7640,7 @@ int newcat_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op)
int newcat_scan(RIG *rig, vfo_t vfo, scan_t scan, int ch)
{
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv;
int retval;
ENTERFUNC;
@ -7662,7 +7663,7 @@ int newcat_scan(RIG *rig, vfo_t vfo, scan_t scan, int ch)
int newcat_set_trn(RIG *rig, int trn)
{
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv;
char c;
ENTERFUNC;
@ -7691,7 +7692,7 @@ int newcat_set_trn(RIG *rig, int trn)
int newcat_get_trn(RIG *rig, int *trn)
{
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv;
int err;
char c;
char command[] = "AI";
@ -7742,8 +7743,8 @@ int newcat_decode_event(RIG *rig)
int newcat_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan)
{
struct rig_state *state = &rig->state;
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
struct rig_state *state = STATE(rig);
struct newcat_priv_data *priv = (struct newcat_priv_data *)state->priv;
int err, i;
int rxit;
char c_rit, c_xit, c_mode, c_vfo, c_tone, c_rptr_shift;
@ -7910,7 +7911,7 @@ int newcat_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan)
int newcat_get_channel(RIG *rig, vfo_t vfo, channel_t *chan, int read_only)
{
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv;
char *retval;
char c, c2;
int err, i;
@ -8102,7 +8103,7 @@ int newcat_get_channel(RIG *rig, vfo_t vfo, channel_t *chan, int read_only)
const char *newcat_get_info(RIG *rig)
{
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv;
static char idbuf[129]; /* extra large static string array */
/* Build the command string */
@ -8270,7 +8271,7 @@ ncboolean newcat_is_rig(RIG *rig, rig_model_t model)
int newcat_set_tx_vfo(RIG *rig, vfo_t tx_vfo)
{
struct newcat_priv_data *priv = (struct newcat_priv_data *) rig->state.priv;
struct newcat_priv_data *priv = (struct newcat_priv_data *) STATE(rig)->priv;
char *command = "FT";
int result;
char p1;
@ -8340,7 +8341,7 @@ int newcat_set_tx_vfo(RIG *rig, vfo_t tx_vfo)
RETURNFUNC(result);
}
rig->state.tx_vfo = tx_vfo;
STATE(rig)->tx_vfo = tx_vfo;
RETURNFUNC(result);
}
@ -8348,7 +8349,7 @@ int newcat_set_tx_vfo(RIG *rig, vfo_t tx_vfo)
int newcat_get_tx_vfo(RIG *rig, vfo_t *tx_vfo)
{
struct newcat_priv_data *priv = (struct newcat_priv_data *) rig->state.priv;
struct newcat_priv_data *priv = (struct newcat_priv_data *) STATE(rig)->priv;
char const *command = "FT";
vfo_t vfo_mode;
int result;
@ -8373,7 +8374,7 @@ int newcat_get_tx_vfo(RIG *rig, vfo_t *tx_vfo)
switch (c)
{
case '0':
if (rig->state.vfo_list & RIG_VFO_MAIN)
if (STATE(rig)->vfo_list & RIG_VFO_MAIN)
{
*tx_vfo = RIG_VFO_MAIN;
}
@ -8385,7 +8386,7 @@ int newcat_get_tx_vfo(RIG *rig, vfo_t *tx_vfo)
break;
case '1' :
if (rig->state.vfo_list & RIG_VFO_SUB)
if (STATE(rig)->vfo_list & RIG_VFO_SUB)
{
*tx_vfo = RIG_VFO_SUB;
}
@ -8424,7 +8425,7 @@ int newcat_get_tx_vfo(RIG *rig, vfo_t *tx_vfo)
static int newcat_set_split(RIG *rig, split_t split, vfo_t *rx_vfo,
vfo_t *tx_vfo)
{
struct newcat_priv_data *priv = (struct newcat_priv_data *) rig->state.priv;
struct newcat_priv_data *priv = (struct newcat_priv_data *) STATE(rig)->priv;
char *command = "ST";
char p1;
int result;
@ -8474,8 +8475,8 @@ static int newcat_set_split(RIG *rig, split_t split, vfo_t *rx_vfo,
switch (split)
{
case RIG_SPLIT_OFF:
*rx_vfo = rig->state.current_vfo;
*tx_vfo = rig->state.current_vfo;
*rx_vfo = STATE(rig)->current_vfo;
*tx_vfo = STATE(rig)->current_vfo;
break;
case RIG_SPLIT_ON:
@ -8493,7 +8494,7 @@ static int newcat_set_split(RIG *rig, split_t split, vfo_t *rx_vfo,
}
else
{
*rx_vfo = rig->state.current_vfo;
*rx_vfo = STATE(rig)->current_vfo;
result = newcat_get_tx_vfo(rig, tx_vfo);
@ -8515,7 +8516,7 @@ static int newcat_set_split(RIG *rig, split_t split, vfo_t *rx_vfo,
static int newcat_get_split(RIG *rig, split_t *split, vfo_t *tx_vfo)
{
struct newcat_priv_data *priv = (struct newcat_priv_data *) rig->state.priv;
struct newcat_priv_data *priv = (struct newcat_priv_data *) STATE(rig)->priv;
char const *command = "ST";
int result;
char c;
@ -8621,19 +8622,19 @@ int newcat_set_vfo_from_alias(RIG *rig, vfo_t *vfo)
case RIG_VFO_CURR: /* RIG_VFO_RX == RIG_VFO_CURR */
case RIG_VFO_VFO:
*vfo = rig->state.current_vfo;
*vfo = STATE(rig)->current_vfo;
break;
case RIG_VFO_TX:
/* set to another vfo for split or uplink */
if (rig->state.vfo_list & RIG_VFO_MAIN)
if (STATE(rig)->vfo_list & RIG_VFO_MAIN)
{
*vfo = (rig->state.current_vfo == RIG_VFO_SUB) ? RIG_VFO_MAIN : RIG_VFO_SUB;
*vfo = (STATE(rig)->current_vfo == RIG_VFO_SUB) ? RIG_VFO_MAIN : RIG_VFO_SUB;
}
else
{
*vfo = (rig->state.current_vfo == RIG_VFO_B) ? RIG_VFO_A : RIG_VFO_B;
*vfo = (STATE(rig)->current_vfo == RIG_VFO_B) ? RIG_VFO_A : RIG_VFO_B;
}
break;
@ -8656,7 +8657,7 @@ int newcat_set_vfo_from_alias(RIG *rig, vfo_t *vfo)
int newcat_set_narrow(RIG *rig, vfo_t vfo, ncboolean narrow)
{
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv;
int err;
char c;
char main_sub_vfo = '0';
@ -8700,7 +8701,7 @@ int newcat_set_narrow(RIG *rig, vfo_t vfo, ncboolean narrow)
int newcat_get_narrow(RIG *rig, vfo_t vfo, ncboolean *narrow)
{
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv;
int err;
char c;
char command[] = "NA";
@ -8752,7 +8753,7 @@ int newcat_get_narrow(RIG *rig, vfo_t vfo, ncboolean *narrow)
// if vfo != RIG_VFO_NONE then will use NA0 or NA1 depending on vfo Main or Sub
static int get_narrow(RIG *rig, vfo_t vfo)
{
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv;
int narrow = 0;
int err;
@ -8779,7 +8780,7 @@ static int get_narrow(RIG *rig, vfo_t vfo)
int newcat_set_rx_bandwidth(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
{
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv;
int err;
int w = 0;
char main_sub_vfo = '0';
@ -9642,7 +9643,7 @@ int newcat_set_rx_bandwidth(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
static int set_roofing_filter(RIG *rig, vfo_t vfo, int index)
{
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv;
struct newcat_priv_caps *priv_caps = (struct newcat_priv_caps *)rig->caps->priv;
struct newcat_roofing_filter *roofing_filters;
char main_sub_vfo = '0';
@ -9747,7 +9748,7 @@ static int set_roofing_filter_for_width(RIG *rig, vfo_t vfo, int width)
static int get_roofing_filter(RIG *rig, vfo_t vfo,
struct newcat_roofing_filter **roofing_filter)
{
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv;
struct newcat_priv_caps *priv_caps = (struct newcat_priv_caps *)rig->caps->priv;
struct newcat_roofing_filter *roofing_filters;
char roofing_filter_choice;
@ -9809,7 +9810,7 @@ static int get_roofing_filter(RIG *rig, vfo_t vfo,
int newcat_get_rx_bandwidth(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t *width)
{
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv;
int err;
int w;
int sh_command_valid = 1;
@ -10946,7 +10947,7 @@ int newcat_get_rx_bandwidth(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t *width)
int newcat_set_faststep(RIG *rig, ncboolean fast_step)
{
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv;
char c;
ENTERFUNC;
@ -10975,7 +10976,7 @@ int newcat_set_faststep(RIG *rig, ncboolean fast_step)
int newcat_get_faststep(RIG *rig, ncboolean *fast_step)
{
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv;
int err;
char c;
char command[] = "FS";
@ -11012,7 +11013,7 @@ int newcat_get_faststep(RIG *rig, ncboolean *fast_step)
int newcat_get_rigid(RIG *rig)
{
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv;
const char *s = NULL;
ENTERFUNC;
@ -11050,7 +11051,7 @@ int newcat_get_rigid(RIG *rig)
*/
int newcat_get_vfo_mode(RIG *rig, vfo_t vfo, vfo_t *vfo_mode)
{
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv;
int err;
int offset = 0;
char *cmd = "IF";
@ -11076,7 +11077,7 @@ int newcat_get_vfo_mode(RIG *rig, vfo_t vfo, vfo_t *vfo_mode)
RETURNFUNC(err);
}
if (rig->state.powerstat == 0)
if (STATE(rig)->powerstat == 0)
{
rig_debug(RIG_DEBUG_WARN, "%s: Cannot get from rig when power is off\n",
__func__);
@ -11132,7 +11133,7 @@ int newcat_get_vfo_mode(RIG *rig, vfo_t vfo, vfo_t *vfo_mode)
int newcat_vfomem_toggle(RIG *rig)
{
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv;
char command[] = "VM";
ENTERFUNC;
@ -11163,9 +11164,9 @@ int newcat_vfomem_toggle(RIG *rig)
*/
int newcat_get_cmd(RIG *rig)
{
struct rig_state *state = &rig->state;
struct rig_state *state = STATE(rig);
hamlib_port_t *rp = RIGPORT(rig);
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv;
int retry_count = 0;
int rc = -RIG_EPROTO;
int is_read_cmd = 0;
@ -11413,7 +11414,7 @@ int newcat_get_cmd(RIG *rig)
*/
int newcat_set_cmd_validate(RIG *rig)
{
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv;
char valcmd[16];
int retries = 8;
int retry = 0;
@ -11659,7 +11660,7 @@ repeat:
int newcat_set_cmd(RIG *rig)
{
hamlib_port_t *rp = RIGPORT(rig);
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv;
int retry_count = 0;
int rc = -RIG_EPROTO;
@ -11956,7 +11957,7 @@ rmode_t newcat_rmode_width(RIG *rig, vfo_t vfo, char mode, pbwidth_t *width)
int newcat_send_voice_mem(RIG *rig, vfo_t vfo, int ch)
{
char *p1 = "0"; // newer rigs have 2 bytes where is fixed at zero e.g. FT991
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv;
if (!newcat_valid_command(rig, "PB"))
{
@ -11971,7 +11972,7 @@ int newcat_send_voice_mem(RIG *rig, vfo_t vfo, int ch)
static int newcat_set_clarifier(RIG *rig, vfo_t vfo, int rx, int tx)
{
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv;
char main_sub_vfo = '0';
if (!newcat_valid_command(rig, "CF"))
@ -12024,7 +12025,7 @@ static int newcat_set_clarifier(RIG *rig, vfo_t vfo, int rx, int tx)
static int newcat_get_clarifier(RIG *rig, vfo_t vfo, int *rx, int *tx)
{
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv;
char main_sub_vfo = '0';
int err;
int ret_data_len;
@ -12071,7 +12072,7 @@ static int newcat_get_clarifier(RIG *rig, vfo_t vfo, int *rx, int *tx)
int newcat_set_clarifier_frequency(RIG *rig, vfo_t vfo, shortfreq_t freq)
{
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv;
char main_sub_vfo = '0';
if (!newcat_valid_command(rig, "CF"))
@ -12092,7 +12093,7 @@ int newcat_set_clarifier_frequency(RIG *rig, vfo_t vfo, shortfreq_t freq)
int newcat_get_clarifier_frequency(RIG *rig, vfo_t vfo, shortfreq_t *freq)
{
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv;
char main_sub_vfo = '0';
int err;
int ret_data_len;
@ -12142,7 +12143,7 @@ int newcat_get_clarifier_frequency(RIG *rig, vfo_t vfo, shortfreq_t *freq)
static int newcat_set_apf_frequency(RIG *rig, vfo_t vfo, int freq)
{
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv;
char main_sub_vfo = (RIG_VFO_B == vfo || RIG_VFO_SUB == vfo) ? '1' : '0';
if (!newcat_valid_command(rig, "CO"))
@ -12176,7 +12177,7 @@ static int newcat_set_apf_frequency(RIG *rig, vfo_t vfo, int freq)
static int newcat_get_apf_frequency(RIG *rig, vfo_t vfo, int *freq)
{
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv;
char main_sub_vfo = (RIG_VFO_B == vfo || RIG_VFO_SUB == vfo) ? '1' : '0';
int err;
int ret_data_len;
@ -12228,7 +12229,7 @@ static int newcat_get_apf_frequency(RIG *rig, vfo_t vfo, int *freq)
static int newcat_set_apf_width(RIG *rig, vfo_t vfo, int choice)
{
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv;
if (!newcat_valid_command(rig, "EX"))
{
@ -12271,7 +12272,7 @@ static int newcat_set_apf_width(RIG *rig, vfo_t vfo, int choice)
static int newcat_get_apf_width(RIG *rig, vfo_t vfo, int *choice)
{
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv;
int err;
int ret_data_len;
char *ret_data;
@ -12330,7 +12331,7 @@ static int newcat_get_apf_width(RIG *rig, vfo_t vfo, int *choice)
static int newcat_set_contour(RIG *rig, vfo_t vfo, int status)
{
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv;
char main_sub_vfo = (RIG_VFO_B == vfo || RIG_VFO_SUB == vfo) ? '1' : '0';
if (!newcat_valid_command(rig, "CO"))
@ -12368,7 +12369,7 @@ static int newcat_set_contour(RIG *rig, vfo_t vfo, int status)
static int newcat_get_contour(RIG *rig, vfo_t vfo, int *status)
{
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv;
char main_sub_vfo = (RIG_VFO_B == vfo || RIG_VFO_SUB == vfo) ? '1' : '0';
int err;
int ret_data_len;
@ -12425,7 +12426,7 @@ static int newcat_get_contour(RIG *rig, vfo_t vfo, int *status)
static int newcat_set_contour_frequency(RIG *rig, vfo_t vfo, int freq)
{
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv;
char main_sub_vfo = (RIG_VFO_B == vfo || RIG_VFO_SUB == vfo) ? '1' : '0';
if (!newcat_valid_command(rig, "CO"))
@ -12466,7 +12467,7 @@ static int newcat_set_contour_frequency(RIG *rig, vfo_t vfo, int freq)
static int newcat_get_contour_frequency(RIG *rig, vfo_t vfo, int *freq)
{
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv;
char main_sub_vfo = (RIG_VFO_B == vfo || RIG_VFO_SUB == vfo) ? '1' : '0';
int err;
int ret_data_len;
@ -12533,7 +12534,7 @@ static int newcat_get_contour_frequency(RIG *rig, vfo_t vfo, int *freq)
static int newcat_set_contour_level(RIG *rig, vfo_t vfo, int level)
{
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv;
if (!newcat_valid_command(rig, "EX"))
{
@ -12577,7 +12578,7 @@ static int newcat_set_contour_level(RIG *rig, vfo_t vfo, int level)
static int newcat_get_contour_level(RIG *rig, vfo_t vfo, int *level)
{
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv;
int err;
int ret_data_len;
char *ret_data;
@ -12636,7 +12637,7 @@ static int newcat_get_contour_level(RIG *rig, vfo_t vfo, int *level)
static int newcat_set_contour_width(RIG *rig, vfo_t vfo, int width)
{
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv;
if (!newcat_valid_command(rig, "EX"))
{
@ -12679,7 +12680,7 @@ static int newcat_set_contour_width(RIG *rig, vfo_t vfo, int width)
static int newcat_get_contour_width(RIG *rig, vfo_t vfo, int *width)
{
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv;
int err;
int ret_data_len;
char *ret_data;
@ -12741,7 +12742,7 @@ int newcat_set_clock(RIG *rig, int year, int month, int day, int hour, int min,
{
int retval = RIG_OK;
int err;
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv;
if (!newcat_valid_command(rig, "DT"))
{
@ -12789,7 +12790,7 @@ int newcat_get_clock(RIG *rig, int *year, int *month, int *day, int *hour,
int retval = RIG_OK;
int err;
int n;
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv;
if (!newcat_valid_command(rig, "DT"))
{

Wyświetl plik

@ -246,10 +246,10 @@ struct vr5000_priv_data
int vr5000_init(RIG *rig)
{
rig->state.priv = (struct vr5000_priv_data *) calloc(1,
STATE(rig)->priv = (struct vr5000_priv_data *) calloc(1,
sizeof(struct vr5000_priv_data));
if (!rig->state.priv) { return -RIG_ENOMEM; }
if (!STATE(rig)->priv) { return -RIG_ENOMEM; }
return RIG_OK;
}
@ -262,12 +262,12 @@ int vr5000_cleanup(RIG *rig)
return -RIG_EINVAL;
}
if (rig->state.priv)
if (STATE(rig)->priv)
{
free(rig->state.priv);
free(STATE(rig)->priv);
}
rig->state.priv = NULL;
STATE(rig)->priv = NULL;
return RIG_OK;
}
@ -278,7 +278,7 @@ int vr5000_cleanup(RIG *rig)
*/
int vr5000_open(RIG *rig)
{
struct vr5000_priv_data *priv = rig->state.priv;
struct vr5000_priv_data *priv = STATE(rig)->priv;
hamlib_port_t *rp = RIGPORT(rig);
const unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0x00};
const unsigned char b_off[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0x31};
@ -331,7 +331,7 @@ int vr5000_close(RIG *rig)
int vr5000_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
{
struct vr5000_priv_data *priv = rig->state.priv;
struct vr5000_priv_data *priv = STATE(rig)->priv;
return set_vr5000(rig, vfo, freq, priv->curr_mode, priv->curr_width,
priv->curr_ts);
@ -341,7 +341,7 @@ int vr5000_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
int vr5000_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
{
const struct vr5000_priv_data *priv = rig->state.priv;
const struct vr5000_priv_data *priv = STATE(rig)->priv;
*freq = priv->curr_freq;
return RIG_OK;
@ -350,7 +350,7 @@ int vr5000_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
int vr5000_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
{
struct vr5000_priv_data *priv = rig->state.priv;
struct vr5000_priv_data *priv = STATE(rig)->priv;
if (check_tuning_step(rig, vfo, mode, priv->curr_ts) != RIG_OK)
{
@ -364,7 +364,7 @@ int vr5000_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
int vr5000_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
{
const struct vr5000_priv_data *priv = rig->state.priv;
const struct vr5000_priv_data *priv = STATE(rig)->priv;
*mode = priv->curr_mode;
*width = priv->curr_width;
@ -374,7 +374,7 @@ int vr5000_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
int vr5000_set_ts(RIG *rig, vfo_t vfo, shortfreq_t ts)
{
struct vr5000_priv_data *priv = rig->state.priv;
struct vr5000_priv_data *priv = STATE(rig)->priv;
int retval;
retval = check_tuning_step(rig, vfo, priv->curr_mode, ts);
@ -392,7 +392,7 @@ int vr5000_set_ts(RIG *rig, vfo_t vfo, shortfreq_t ts)
int vr5000_get_ts(RIG *rig, vfo_t vfo, shortfreq_t *ts)
{
const struct vr5000_priv_data *priv = rig->state.priv;
const struct vr5000_priv_data *priv = STATE(rig)->priv;
*ts = priv->curr_ts;
return RIG_OK;
@ -523,7 +523,7 @@ int mode2rig(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
void correct_frequency(RIG *rig, vfo_t vfo, freq_t curr_freq, freq_t *freq)
{
const struct vr5000_priv_data *priv = rig->state.priv;
const struct vr5000_priv_data *priv = STATE(rig)->priv;
shortfreq_t ts = priv->curr_ts;
unsigned long long correct_freq = (unsigned long long)curr_freq;
@ -572,7 +572,7 @@ void correct_frequency(RIG *rig, vfo_t vfo, freq_t curr_freq, freq_t *freq)
int set_vr5000(RIG *rig, vfo_t vfo, freq_t freq, rmode_t mode, pbwidth_t width,
shortfreq_t ts)
{
struct vr5000_priv_data *priv = rig->state.priv;
struct vr5000_priv_data *priv = STATE(rig)->priv;
hamlib_port_t *rp = RIGPORT(rig);
unsigned char cmd_mode_ts[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0x07};
unsigned char cmd_freq[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0x01};

Wyświetl plik

@ -708,11 +708,11 @@ static int vx1700_init(RIG *rig)
rig_debug(RIG_DEBUG_TRACE, "%s\n", __func__);
rig->state.priv = calloc(1, sizeof(struct vx1700_priv_data));
STATE(rig)->priv = calloc(1, sizeof(struct vx1700_priv_data));
if (rig->state.priv == NULL) { return -RIG_ENOMEM; }
if (STATE(rig)->priv == NULL) { return -RIG_ENOMEM; }
priv = rig->state.priv;
priv = STATE(rig)->priv;
priv->ch = 1;
return RIG_OK;
@ -720,8 +720,8 @@ static int vx1700_init(RIG *rig)
static int vx1700_open(RIG *rig)
{
struct vx1700_priv_data *priv = (struct vx1700_priv_data *)rig->state.priv;
struct rig_state *state = &rig->state;
struct vx1700_priv_data *priv = (struct vx1700_priv_data *)STATE(rig)->priv;
struct rig_state *state = STATE(rig);
int ret;
rig_debug(RIG_DEBUG_TRACE, "%s\n", __func__);
@ -743,9 +743,9 @@ static int vx1700_cleanup(RIG *rig)
{
rig_debug(RIG_DEBUG_TRACE, "%s\n", __func__);
if (rig->state.priv != NULL) { free(rig->state.priv); }
if (STATE(rig)->priv != NULL) { free(STATE(rig)->priv); }
rig->state.priv = NULL;
STATE(rig)->priv = NULL;
return RIG_OK;
}
@ -759,7 +759,7 @@ static const char *vx1700_get_info(RIG *rig)
static int vx1700_set_vfo(RIG *rig, vfo_t vfo)
{
const struct vx1700_priv_data *priv = (struct vx1700_priv_data *)
rig->state.priv;
STATE(rig)->priv;
rig_debug(RIG_DEBUG_TRACE, "%s, vfo=%s\n", __func__, rig_strvfo(vfo));
@ -1125,8 +1125,8 @@ static int vx1700_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
static int vx1700_set_mem(RIG *rig, vfo_t vfo, int ch)
{
struct vx1700_priv_data *priv = (struct vx1700_priv_data *)rig->state.priv;
const struct rig_state *state = &rig->state;
struct vx1700_priv_data *priv = (struct vx1700_priv_data *)STATE(rig)->priv;
const struct rig_state *state = STATE(rig);
if (! vx1700_channel_is_ok(ch)) { return -RIG_EINVAL; }
@ -1148,8 +1148,8 @@ static int vx1700_set_mem(RIG *rig, vfo_t vfo, int ch)
static int vx1700_get_mem(RIG *rig, vfo_t vfo, int *ch)
{
struct vx1700_priv_data *priv = (struct vx1700_priv_data *)rig->state.priv;
const struct rig_state *state = &rig->state;
struct vx1700_priv_data *priv = (struct vx1700_priv_data *)STATE(rig)->priv;
const struct rig_state *state = STATE(rig);
unsigned char channel = 0;
if (vfo == RIG_VFO_CURR) { vfo = state->current_vfo; }
@ -1179,7 +1179,7 @@ static int vx1700_get_mem(RIG *rig, vfo_t vfo, int *ch)
static int vx1700_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op)
{
const struct vx1700_priv_data *priv = (struct vx1700_priv_data *)
rig->state.priv;
STATE(rig)->priv;
(void) rig;
(void) vfo;