kopia lustrzana https://github.com/Hamlib/Hamlib
* misc rewrite
git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@406 7ae35d74-ebe9-4afe-98af-79ac388436b8Hamlib-1.1.1
rodzic
8efc759e81
commit
08a7c48d05
12
aor/aor.c
12
aor/aor.c
|
@ -6,7 +6,7 @@
|
|||
* via serial interface to an AOR scanner.
|
||||
*
|
||||
*
|
||||
* $Id: aor.c,v 1.3 2000-12-05 22:01:00 f4cfe Exp $
|
||||
* $Id: aor.c,v 1.4 2001-02-27 23:06:53 f4cfe Exp $
|
||||
*
|
||||
*
|
||||
*
|
||||
|
@ -73,12 +73,12 @@
|
|||
int aor_transaction(RIG *rig, const char *cmd, int cmd_len, char *data, int *data_len)
|
||||
{
|
||||
int i;
|
||||
struct rig_state *rig_s;
|
||||
struct rig_state *rs;
|
||||
|
||||
rig_s = &rig->state;
|
||||
rs = &rig->state;
|
||||
|
||||
write_block(rig_s->fd, cmd, cmd_len, rig_s->write_delay, rig_s->post_write_delay);
|
||||
write_block(rig_s->fd, "\n", 1, rig_s->write_delay, rig_s->post_write_delay);
|
||||
write_block(rs->fd, cmd, cmd_len, rs->write_delay, rs->post_write_delay);
|
||||
write_block(rs->fd, "\n", 1, rs->write_delay, rs->post_write_delay);
|
||||
|
||||
/*
|
||||
* buffered read are quite helpful here!
|
||||
|
@ -86,7 +86,7 @@ int aor_transaction(RIG *rig, const char *cmd, int cmd_len, char *data, int *dat
|
|||
*/
|
||||
i = 0;
|
||||
do {
|
||||
fread_block(rig_s->stream, data+i, 1, rig_s->timeout);
|
||||
fread_block(rs->stream, data+i, 1, rs->timeout);
|
||||
} while (data[i++] != CR);
|
||||
|
||||
*data_len = i;
|
||||
|
|
16
icom/frame.c
16
icom/frame.c
|
@ -6,7 +6,7 @@
|
|||
* CI-V interface, used in serial communication to ICOM radios.
|
||||
*
|
||||
*
|
||||
* $Id: frame.c,v 1.7 2001-01-05 18:20:27 f4cfe Exp $
|
||||
* $Id: frame.c,v 1.8 2001-02-27 23:05:51 f4cfe Exp $
|
||||
*
|
||||
*
|
||||
*
|
||||
|
@ -96,12 +96,12 @@ int make_cmd_frame(char frame[], char re_id, char cmd, int subcmd, const char *d
|
|||
int icom_transaction (RIG *rig, int cmd, int subcmd, const char *payload, int payload_len, char *data, int *data_len)
|
||||
{
|
||||
struct icom_priv_data *priv;
|
||||
struct rig_state *rig_s;
|
||||
struct rig_state *rs;
|
||||
unsigned char buf[16];
|
||||
int frm_len;
|
||||
|
||||
rig_s = &rig->state;
|
||||
priv = (struct icom_priv_data*)rig_s->priv;
|
||||
rs = &rig->state;
|
||||
priv = (struct icom_priv_data*)rs->priv;
|
||||
|
||||
frm_len = make_cmd_frame(buf, priv->re_civ_addr, cmd, subcmd,
|
||||
payload, payload_len);
|
||||
|
@ -109,7 +109,7 @@ int icom_transaction (RIG *rig, int cmd, int subcmd, const char *payload, int pa
|
|||
/*
|
||||
* should check return code and that write wrote cmd_len chars!
|
||||
*/
|
||||
write_block(rig_s->fd, buf, frm_len, rig_s->write_delay, rig_s->post_write_delay);
|
||||
write_block(rs->fd, buf, frm_len, rs->write_delay, rs->post_write_delay);
|
||||
|
||||
/*
|
||||
* read what we just sent, because TX and RX are looped,
|
||||
|
@ -117,18 +117,18 @@ int icom_transaction (RIG *rig, int cmd, int subcmd, const char *payload, int pa
|
|||
* TODO: - if what we read is not what we sent, then it means
|
||||
* a collision on the CI-V bus occured!
|
||||
* - if we get a timeout, then retry to send the frame,
|
||||
* up to rig_s->retry times.
|
||||
* up to rs->retry times.
|
||||
*/
|
||||
|
||||
Hold_Decode(rig);
|
||||
read_icom_block(rig_s->stream, buf, frm_len, rig_s->timeout);
|
||||
read_icom_block(rs->stream, buf, frm_len, rs->timeout);
|
||||
|
||||
/*
|
||||
* wait for ACK ...
|
||||
* FIXME: handle pading/collisions
|
||||
* ACKFRMLEN is the smallest frame we can expect from the rig
|
||||
*/
|
||||
frm_len = read_icom_frame(rig_s->stream, buf, rig_s->timeout);
|
||||
frm_len = read_icom_frame(rs->stream, buf, rs->timeout);
|
||||
Unhold_Decode(rig);
|
||||
|
||||
*data_len = frm_len-(ACKFRMLEN-1);
|
||||
|
|
13
icom/icom.c
13
icom/icom.c
|
@ -6,7 +6,7 @@
|
|||
* via serial interface to an ICOM using the "CI-V" interface.
|
||||
*
|
||||
*
|
||||
* $Id: icom.c,v 1.16 2001-02-26 23:16:11 f4cfe Exp $
|
||||
* $Id: icom.c,v 1.17 2001-02-27 23:05:51 f4cfe Exp $
|
||||
*
|
||||
*
|
||||
*
|
||||
|
@ -197,11 +197,14 @@ static const struct icom_addr icom_addr_list[] = {
|
|||
int icom_init(RIG *rig)
|
||||
{
|
||||
struct icom_priv_data *priv;
|
||||
const struct rig_caps *caps;
|
||||
int i;
|
||||
|
||||
if (!rig)
|
||||
return -RIG_EINVAL;
|
||||
|
||||
caps = rig->caps;
|
||||
|
||||
priv = (struct icom_priv_data*)malloc(sizeof(struct icom_priv_data));
|
||||
if (!priv) {
|
||||
/* whoops! memory shortage! */
|
||||
|
@ -219,19 +222,19 @@ int icom_init(RIG *rig)
|
|||
|
||||
priv->re_civ_addr = 0x00;
|
||||
for (i=0; icom_addr_list[i].model >= 0; i++) {
|
||||
if (icom_addr_list[i].model == rig->caps->rig_model) {
|
||||
if (icom_addr_list[i].model == caps->rig_model) {
|
||||
priv->re_civ_addr = icom_addr_list[i].re_civ_addr;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (rig->caps->rig_model == RIG_MODEL_IC731 ||
|
||||
rig->caps->rig_model == RIG_MODEL_IC735)
|
||||
if (caps->rig_model == RIG_MODEL_IC731 ||
|
||||
caps->rig_model == RIG_MODEL_IC735)
|
||||
priv->civ_731_mode = 1;
|
||||
else
|
||||
priv->civ_731_mode = 0;
|
||||
|
||||
switch (rig->caps->rig_model) {
|
||||
switch (caps->rig_model) {
|
||||
case RIG_MODEL_IC737:
|
||||
priv->ts_sc_list = ic737_ts_sc_list;
|
||||
break;
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* via serial interface to a Kenwood radio.
|
||||
*
|
||||
*
|
||||
* $Id: kenwood.c,v 1.1 2000-12-23 08:40:14 f4cfe Exp $
|
||||
* $Id: kenwood.c,v 1.2 2001-02-27 23:06:53 f4cfe Exp $
|
||||
*
|
||||
*
|
||||
*
|
||||
|
@ -60,11 +60,11 @@
|
|||
int kenwood_transaction(RIG *rig, const char *cmd, int cmd_len, char *data, int *data_len)
|
||||
{
|
||||
int i;
|
||||
struct rig_state *rig_s;
|
||||
struct rig_state *rs;
|
||||
|
||||
rig_s = &rig->state;
|
||||
rs = &rig->state;
|
||||
|
||||
write_block(rig_s->fd, cmd, cmd_len, rig_s->write_delay, rig_s->post_write_delay);
|
||||
write_block(rs->fd, cmd, cmd_len, rs->write_delay, rs->post_write_delay);
|
||||
|
||||
/*
|
||||
* buffered read are quite helpful here!
|
||||
|
@ -72,7 +72,7 @@ int kenwood_transaction(RIG *rig, const char *cmd, int cmd_len, char *data, int
|
|||
*/
|
||||
i = 0;
|
||||
do {
|
||||
fread_block(rig_s->stream, data+i, 1, rig_s->timeout);
|
||||
fread_block(rs->stream, data+i, 1, rs->timeout);
|
||||
} while (data[i++] != ';');
|
||||
|
||||
*data_len = i;
|
||||
|
|
Ładowanie…
Reference in New Issue