added support for:

* aor_get_dcd
* set_level/get_level: RIG_LEVEL_AGC (only AR5000), RIG_LEVEL_RAWSTR
* set_powerstat: RIG_POWER_ON (only AR5000)


git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@1839 7ae35d74-ebe9-4afe-98af-79ac388436b8
Hamlib-1.2.3
Stéphane Fillod, F8CFE 2004-09-07 20:40:20 +00:00
rodzic 8cfe78560c
commit 6b7fa0b0ea
5 zmienionych plików z 147 dodań i 62 usunięć

Wyświetl plik

@ -2,7 +2,7 @@
* Hamlib AOR backend - main file
* Copyright (c) 2000-2004 by Stephane Fillod
*
* $Id: aor.c,v 1.28 2004-06-14 21:10:11 fillods Exp $
* $Id: aor.c,v 1.29 2004-09-07 20:40:20 fillods Exp $
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
@ -350,6 +350,7 @@ int aor_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
unsigned char lvlbuf[BUFSZ],ackbuf[BUFSZ];
int lvl_len, ack_len;
unsigned i;
int agc;
rs = &rig->state;
priv = (struct aor_priv_data*)rs->priv;
@ -372,8 +373,19 @@ int aor_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
lvl_len = sprintf(lvlbuf, "AT%u" EOM, att);
break;
}
case RIG_LEVEL_AGC: /* AR5000 */
switch(val.i) {
case RIG_AGC_FAST: agc = '0'; break;
case RIG_AGC_MEDIUM: agc = '1'; break;
case RIG_AGC_SLOW: agc = '2'; break;
case RIG_AGC_OFF:
default: agc = 'F';
}
lvl_len = sprintf(lvlbuf,"AC%c" EOM, agc);
break;
default:
rig_debug(RIG_DEBUG_ERR,"Unsupported aor_set_level %d", level);
rig_debug(RIG_DEBUG_ERR,"Unsupported aor_set_level %d\n", level);
return -RIG_EINVAL;
}
@ -395,11 +407,17 @@ int aor_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
priv = (struct aor_priv_data*)rs->priv;
switch (level) {
case RIG_LEVEL_RAWSTR:
lvl_len = sprintf(lvlbuf, "LM" EOM);
break;
case RIG_LEVEL_ATT:
lvl_len = sprintf(lvlbuf, "AT" EOM);
break;
case RIG_LEVEL_AGC: /* AR5000 */
lvl_len = sprintf(lvlbuf, "AC" EOM);
break;
default:
rig_debug(RIG_DEBUG_ERR,"Unsupported aor_set_level %d", level);
rig_debug(RIG_DEBUG_ERR,"Unsupported %s %d\n", __FUNCTION__, level);
return -RIG_EINVAL;
}
@ -409,6 +427,12 @@ int aor_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
return retval;
switch (level) {
case RIG_LEVEL_RAWSTR:
if (ack_len < 4 || ackbuf[0] != 'L' || ackbuf[1] != 'M')
return -RIG_EPROTO;
sscanf(ackbuf+(ackbuf[2]=='%'?3:2), "%x", &val->i);
break;
case RIG_LEVEL_ATT:
{
unsigned att;
@ -420,21 +444,54 @@ int aor_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
break;
}
if (att > MAXDBLSTSIZ || rs->attenuator[att-1]==0) {
rig_debug(RIG_DEBUG_ERR,"Unsupported att aor_get_level %d",
att);
rig_debug(RIG_DEBUG_ERR,"Unsupported att %s %d\n",
__FUNCTION__, att);
return -RIG_EPROTO;
}
val->i = rs->attenuator[att-1];
break;
}
case RIG_LEVEL_AGC:
if (ack_len < 3 || ackbuf[0] != 'A' || ackbuf[1] != 'C')
return -RIG_EPROTO;
switch(ackbuf[3]) {
case '0': val->i = RIG_AGC_FAST; break;
case '1': val->i = RIG_AGC_MEDIUM; break;
case '2': val->i = RIG_AGC_SLOW; break;
case 'F':
default: val->i = RIG_AGC_OFF;
}
break;
default:
rig_debug(RIG_DEBUG_ERR,"Unsupported aor_get_level %d", level);
rig_debug(RIG_DEBUG_ERR,"Unsupported %s %d\n", __FUNCTION__, level);
return -RIG_EINVAL;
}
return RIG_OK;
}
/*
* aor_get_dcd
* Assumes rig!=NULL, rig->state.priv!=NULL, val!=NULL
*/
int aor_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd)
{
unsigned char ackbuf[BUFSZ];
int ack_len, retval;
retval = aor_transaction (rig, "LM" EOM, 3, ackbuf, &ack_len);
if (retval != RIG_OK)
return retval;
if (ack_len < 2 || ackbuf[0] != 'L' || ackbuf[1] != 'M')
return -RIG_EPROTO;
*dcd = ackbuf[2]=='%' ? RIG_DCD_OFF:RIG_DCD_ON;
return RIG_OK;
}
/*
* aor_set_powerstat
@ -442,8 +499,8 @@ int aor_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
*/
int aor_set_powerstat(RIG *rig, powerstat_t status)
{
if (status != RIG_POWER_OFF)
return -RIG_EINVAL;
if (status == RIG_POWER_ON)
return aor_transaction (rig, "X" EOM, 2, NULL, NULL);
/* turn off power */
return aor_transaction (rig, "QP" EOM, 3, NULL, NULL);

Wyświetl plik

@ -2,7 +2,7 @@
* Hamlib AOR backend - main header
* Copyright (c) 2000-2004 by Stephane Fillod
*
* $Id: aor.h,v 1.16 2004-06-14 21:10:11 fillods Exp $
* $Id: aor.h,v 1.17 2004-09-07 20:40:20 fillods Exp $
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
@ -25,6 +25,8 @@
#include <hamlib/rig.h>
#define BACKEND_VER "0.2"
int aor_close(RIG *rig);
int aor_set_freq(RIG *rig, vfo_t vfo, freq_t freq);
@ -36,6 +38,7 @@ int aor_get_vfo(RIG *rig, vfo_t *vfo);
int aor_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val);
int aor_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val);
int aor_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd);
int aor_set_ts(RIG *rig, vfo_t vfo, shortfreq_t ts);
int aor_set_powerstat(RIG *rig, powerstat_t status);

Wyświetl plik

@ -1,8 +1,8 @@
/*
* Hamlib AOR backend - AR5000 description
* Copyright (c) 2000-2003 by Stephane Fillod
* Copyright (c) 2000-2004 by Stephane Fillod
*
* $Id: ar5000.c,v 1.4 2003-10-01 19:31:54 fillods Exp $
* $Id: ar5000.c,v 1.5 2004-09-07 20:40:20 fillods Exp $
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
@ -32,9 +32,9 @@
#define AR5000_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_FM|RIG_MODE_WFM)
#define AR5000_FUNC_ALL (RIG_FUNC_TSQL|RIG_FUNC_ABM)
#define AR5000_FUNC_ALL (RIG_FUNC_TSQL|RIG_FUNC_ABM|RIG_FUNC_AFC)
#define AR5000_LEVEL (RIG_LEVEL_ATT|RIG_LEVEL_AGC|RIG_LEVEL_SQL|RIG_LEVEL_SQLSTAT|RIG_LEVEL_STRENGTH)
#define AR5000_LEVEL (RIG_LEVEL_ATT|RIG_LEVEL_AGC|RIG_LEVEL_SQL|RIG_LEVEL_RAWSTR)
#define AR5000_PARM (RIG_PARM_APO|RIG_PARM_BACKLIGHT|RIG_PARM_BEEP)
@ -45,43 +45,41 @@
/*
* Data was obtained from AR5000 pdf on http://www.aoruk.com
*/
#define dBm2S(x) (x) /* FIXME */
#define dBm2S9(x) ((x)+73)
#define AR5000_REAL_STR_CAL { 33, \
{ \
{ 0x02, dBm2S(-120) }, \
{ 0x06, dBm2S(-111) }, \
{ 0x0b, dBm2S(-110) }, \
{ 0x14, dBm2S(-109) }, \
{ 0x1d, dBm2S(-108) }, \
{ 0x25, dBm2S(-107) }, \
{ 0x2b, dBm2S(-106) }, \
{ 0x32, dBm2S(-105) }, \
{ 0x38, dBm2S(-104) }, \
{ 0x3d, dBm2S(-103) }, \
{ 0x43, dBm2S(-102) }, \
{ 0x49, dBm2S(-101) }, \
{ 0x4e, dBm2S(-100) }, \
{ 0x63, dBm2S(-95) }, \
{ 0x71, dBm2S(-90) }, \
{ 0x7f, dBm2S(-85) }, \
{ 0x8b, dBm2S(-80) }, \
{ 0x96, dBm2S(-75) }, \
{ 0xa0, dBm2S(-70) }, \
{ 0xaa, dBm2S(-65) }, \
{ 0xb3, dBm2S(-60) }, \
{ 0xbd, dBm2S(-55) }, \
{ 0xc6, dBm2S(-50) }, \
{ 0xce, dBm2S(-45) }, \
{ 0xd7, dBm2S(-40) }, \
{ 0xe0, dBm2S(-35) }, \
{ 0xe8, dBm2S(-30) }, \
{ 0xf1, dBm2S(-25) }, \
{ 0xf8, dBm2S(-20) }, \
{ 0xfa, dBm2S(-15) }, \
{ 0xfb, dBm2S(-10) }, \
{ 0xfc, dBm2S(-5) }, \
{ 0xfd, dBm2S(0) }, \
{ 0x02, dBm2S9(-120) }, \
{ 0x06, dBm2S9(-111) }, \
{ 0x0b, dBm2S9(-110) }, \
{ 0x14, dBm2S9(-109) }, \
{ 0x1d, dBm2S9(-108) }, \
{ 0x25, dBm2S9(-107) }, \
{ 0x2b, dBm2S9(-106) }, \
{ 0x32, dBm2S9(-105) }, \
{ 0x38, dBm2S9(-104) }, \
{ 0x3d, dBm2S9(-103) }, \
{ 0x43, dBm2S9(-102) }, \
{ 0x49, dBm2S9(-101) }, \
{ 0x4e, dBm2S9(-100) }, \
{ 0x63, dBm2S9(-95) }, \
{ 0x71, dBm2S9(-90) }, \
{ 0x7f, dBm2S9(-85) }, \
{ 0x8b, dBm2S9(-80) }, \
{ 0x96, dBm2S9(-75) }, \
{ 0xa0, dBm2S9(-70) }, \
{ 0xaa, dBm2S9(-65) }, \
{ 0xb3, dBm2S9(-60) }, \
{ 0xbd, dBm2S9(-55) }, \
{ 0xc6, dBm2S9(-50) }, \
{ 0xce, dBm2S9(-45) }, \
{ 0xd7, dBm2S9(-40) }, \
{ 0xe0, dBm2S9(-35) }, \
{ 0xe8, dBm2S9(-30) }, \
{ 0xf1, dBm2S9(-25) }, \
{ 0xf8, dBm2S9(-20) }, \
{ 0xfa, dBm2S9(-15) }, \
{ 0xfd, dBm2S9(0) } \
} }
static int ar5k_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width);
@ -98,12 +96,12 @@ const struct rig_caps ar5000_caps = {
.rig_model = RIG_MODEL_AR5000,
.model_name = "AR5000",
.mfg_name = "AOR",
.version = "0.1.1",
.version = BACKEND_VER ".1",
.copyright = "LGPL",
.status = RIG_STATUS_ALPHA,
.status = RIG_STATUS_BETA,
.rig_type = RIG_TYPE_SCANNER,
.ptt_type = RIG_PTT_NONE,
.dcd_type = RIG_DCD_NONE,
.dcd_type = RIG_DCD_RIG,
.port_type = RIG_PORT_SERIAL,
.serial_rate_min = 4800,
.serial_rate_max = 19200,
@ -135,6 +133,7 @@ const struct rig_caps ar5000_caps = {
.bank_qty = 20,
.chan_desc_sz = 12,
.vfo_ops = AR5000_VFO_OPS,
.str_cal = AR5000_REAL_STR_CAL,
.chan_list = { RIG_CHAN_END, }, /* FIXME: memory channel list: 1000 memories */
@ -202,6 +201,7 @@ const struct rig_caps ar5000_caps = {
.set_level = aor_set_level,
.get_level = aor_get_level,
.get_dcd = aor_get_dcd,
.set_ts = aor_set_ts,
.set_powerstat = aor_set_powerstat,

Wyświetl plik

@ -1,8 +1,8 @@
/*
* Hamlib AOR backend - AR8000 description
* Copyright (c) 2000-2003 by Stephane Fillod
* Copyright (c) 2000-2004 by Stephane Fillod
*
* $Id: ar8000.c,v 1.4 2003-10-01 19:31:54 fillods Exp $
* $Id: ar8000.c,v 1.5 2004-09-07 20:40:20 fillods Exp $
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
@ -32,9 +32,9 @@
#define AR8000_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_FM|RIG_MODE_WFM)
#define AR8000_FUNC_ALL (RIG_FUNC_TSQL|RIG_FUNC_ABM)
#define AR8000_FUNC_ALL (RIG_FUNC_TSQL|RIG_FUNC_ABM|RIG_FUNC_AFC)
#define AR8000_LEVEL (RIG_LEVEL_ATT|RIG_LEVEL_AGC|RIG_LEVEL_SQL|RIG_LEVEL_SQLSTAT|RIG_LEVEL_STRENGTH)
#define AR8000_LEVEL (RIG_LEVEL_ATT|RIG_LEVEL_AGC|RIG_LEVEL_SQL|RIG_LEVEL_RAWSTR)
#define AR8000_PARM (RIG_PARM_APO|RIG_PARM_BACKLIGHT|RIG_PARM_BEEP)
@ -42,6 +42,14 @@
#define AR8000_VFO (RIG_VFO_A|RIG_VFO_B)
/* TODO: measure and report real values */
#define AR8000_STR_CAL { 2, \
{ \
{ 0x00, -60 }, \
{ 0xff, 60 } \
} }
/*
* ar8000 rig capabilities.
* Notice that some rigs share the same functions.
@ -53,12 +61,12 @@ const struct rig_caps ar8000_caps = {
.rig_model = RIG_MODEL_AR8000,
.model_name = "AR8000",
.mfg_name = "AOR",
.version = "0.1",
.version = BACKEND_VER,
.copyright = "LGPL",
.status = RIG_STATUS_UNTESTED,
.rig_type = RIG_TYPE_SCANNER,
.ptt_type = RIG_PTT_NONE,
.dcd_type = RIG_DCD_NONE,
.dcd_type = RIG_DCD_RIG,
.port_type = RIG_PORT_SERIAL,
.serial_rate_min = 4800,
.serial_rate_max = 19200,
@ -90,6 +98,7 @@ const struct rig_caps ar8000_caps = {
.bank_qty = 20,
.chan_desc_sz = 12,
.vfo_ops = AR8000_VFO_OPS,
.str_cal = AR8000_STR_CAL,
.chan_list = { RIG_CHAN_END, }, /* FIXME: memory channel list: 1000 memories */
@ -148,6 +157,10 @@ const struct rig_caps ar8000_caps = {
.set_vfo = aor_set_vfo,
.get_vfo = aor_get_vfo,
.set_level = aor_set_level,
.get_level = aor_get_level,
.get_dcd = aor_get_dcd,
.set_ts = aor_set_ts,
.set_powerstat = aor_set_powerstat,
.vfo_op = aor_vfo_op,

Wyświetl plik

@ -1,8 +1,8 @@
/*
* Hamlib AOR backend - AR8200 description
* Copyright (c) 2000-2003 by Stephane Fillod
* Copyright (c) 2000-2004 by Stephane Fillod
*
* $Id: ar8200.c,v 1.16 2003-10-01 19:31:54 fillods Exp $
* $Id: ar8200.c,v 1.17 2004-09-07 20:40:20 fillods Exp $
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
@ -32,9 +32,9 @@
#define AR8200_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_FM|RIG_MODE_WFM)
#define AR8200_FUNC (RIG_FUNC_TSQL|RIG_FUNC_ABM)
#define AR8200_FUNC (RIG_FUNC_TSQL|RIG_FUNC_ABM|RIG_FUNC_AFC)
#define AR8200_LEVEL (RIG_LEVEL_ATT|RIG_LEVEL_AGC|RIG_LEVEL_SQL|RIG_LEVEL_SQLSTAT|RIG_LEVEL_STRENGTH)
#define AR8200_LEVEL (RIG_LEVEL_ATT|RIG_LEVEL_AGC|RIG_LEVEL_SQL|RIG_LEVEL_RAWSTR)
#define AR8200_PARM (RIG_PARM_APO|RIG_PARM_BACKLIGHT|RIG_PARM_BEEP)
@ -42,6 +42,13 @@
#define AR8200_VFO_ALL (RIG_VFO_A|RIG_VFO_B)
/* TODO: measure and report real values */
#define AR8200_STR_CAL { 2, \
{ \
{ 0x00, -60 }, \
{ 0xff, 60 } \
} }
/*
* ar8200 rig capabilities.
* Notice that some rigs share the same functions.
@ -53,12 +60,12 @@ const struct rig_caps ar8200_caps = {
.rig_model = RIG_MODEL_AR8200,
.model_name = "AR8200",
.mfg_name = "AOR",
.version = "0.1",
.version = BACKEND_VER,
.copyright = "LGPL",
.status = RIG_STATUS_UNTESTED,
.rig_type = RIG_TYPE_SCANNER,
.ptt_type = RIG_PTT_NONE,
.dcd_type = RIG_DCD_NONE,
.dcd_type = RIG_DCD_RIG,
.port_type = RIG_PORT_SERIAL,
.serial_rate_min = 4800,
.serial_rate_max = 19200,
@ -90,6 +97,7 @@ const struct rig_caps ar8200_caps = {
.bank_qty = 20,
.chan_desc_sz = 12,
.vfo_ops = AR8200_VFO_OPS,
.str_cal = AR8200_STR_CAL,
.chan_list = { RIG_CHAN_END, }, /* FIXME: memory channel list: 1000 memories */
@ -143,6 +151,10 @@ const struct rig_caps ar8200_caps = {
.set_mode = aor_set_mode,
.get_mode = aor_get_mode,
.set_level = aor_set_level,
.get_level = aor_get_level,
.get_dcd = aor_get_dcd,
.set_ts = aor_set_ts,
.set_powerstat = aor_set_powerstat,
.vfo_op = aor_vfo_op,