kopia lustrzana https://github.com/Hamlib/Hamlib
mv_ctl replaced by vfo_op, added RIG_VFO_MEM support
git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@522 7ae35d74-ebe9-4afe-98af-79ac388436b8Hamlib-1.1.2
rodzic
9437e3c29f
commit
7ffe3fbe22
|
@ -7,7 +7,7 @@
|
|||
* purpose mainly.
|
||||
*
|
||||
*
|
||||
* $Id: dummy.c,v 1.8 2001-06-02 18:10:20 f4cfe Exp $
|
||||
* $Id: dummy.c,v 1.9 2001-06-03 19:54:05 f4cfe Exp $
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
|
@ -55,6 +55,14 @@ static unsigned char *decode_vfo(vfo_t vfo)
|
|||
return "currVFO";
|
||||
case RIG_VFO_ALL:
|
||||
return "VFOall";
|
||||
#ifdef RIG_VFO_MEM
|
||||
case RIG_VFO_MEM:
|
||||
return "MEM";
|
||||
#endif
|
||||
#ifdef RIG_VFO_VFO
|
||||
case RIG_VFO_VFO:
|
||||
return "VFO";
|
||||
#endif
|
||||
default:
|
||||
return "VFO?";
|
||||
}
|
||||
|
@ -518,13 +526,21 @@ static int dummy_get_mem(RIG *rig, vfo_t vfo, int *ch)
|
|||
}
|
||||
|
||||
|
||||
#ifdef WANT_OLD_VFO_TO_BE_REMOVED
|
||||
static int dummy_mv_ctl(RIG *rig, vfo_t vfo, mv_op_t op)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_VERBOSE,__FUNCTION__ " called\n");
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
#else
|
||||
static int dummy_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_VERBOSE,__FUNCTION__ " called\n");
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int dummy_set_channel(RIG *rig, const channel_t *chan)
|
||||
{
|
||||
|
@ -687,7 +703,11 @@ const struct rig_caps dummy_caps = {
|
|||
set_bank: dummy_set_bank,
|
||||
set_mem: dummy_set_mem,
|
||||
get_mem: dummy_get_mem,
|
||||
#ifdef WANT_OLD_VFO_TO_BE_REMOVED
|
||||
mv_ctl: dummy_mv_ctl,
|
||||
#else
|
||||
vfo_op: dummy_vfo_op,
|
||||
#endif
|
||||
send_dtmf: dummy_send_dtmf,
|
||||
recv_dtmf: dummy_recv_dtmf,
|
||||
send_morse: dummy_send_morse,
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
* using the "CI-V" interface.
|
||||
*
|
||||
*
|
||||
* $Id: ic706.c,v 1.21 2001-05-04 22:37:35 f4cfe Exp $
|
||||
* $Id: ic706.c,v 1.22 2001-06-03 19:54:05 f4cfe Exp $
|
||||
*
|
||||
*
|
||||
*
|
||||
|
@ -57,6 +57,8 @@
|
|||
|
||||
#define IC706_VFO_ALL (RIG_VFO_A|RIG_VFO_B)
|
||||
|
||||
#define IC706_OPS (RIG_OP_CPY|RIG_OP_XCHG|RIG_OP_FROM_VFO|RIG_OP_TO_VFO|RIG_OP_MCL)
|
||||
|
||||
#define IC706IIG_STR_CAL { 16, \
|
||||
{ \
|
||||
{ 100, -18 }, \
|
||||
|
@ -366,6 +368,7 @@ max_rit: Hz(0),
|
|||
max_xit: Hz(0),
|
||||
max_ifshift: Hz(0),
|
||||
targetable_vfo: 0,
|
||||
vfo_ops: IC706_OPS,
|
||||
transceive: RIG_TRN_RIG,
|
||||
bank_qty: 0,
|
||||
chan_desc_sz: 0,
|
||||
|
@ -453,7 +456,11 @@ get_level: icom_get_level,
|
|||
set_func: icom_set_func,
|
||||
get_func: icom_get_func,
|
||||
set_mem: icom_set_mem,
|
||||
#ifdef WANT_OLD_VFO_TO_BE_REMOVED
|
||||
mv_ctl: icom_mv_ctl,
|
||||
#else
|
||||
vfo_op: icom_vfo_op,
|
||||
#endif
|
||||
set_ptt: icom_set_ptt,
|
||||
get_ptt: icom_get_ptt,
|
||||
get_dcd: icom_get_dcd,
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
* using the "CI-V" interface.
|
||||
*
|
||||
*
|
||||
* $Id: icall.c,v 1.4 2001-05-04 22:37:35 f4cfe Exp $
|
||||
* $Id: icall.c,v 1.5 2001-06-03 19:54:05 f4cfe Exp $
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
|
@ -54,6 +54,8 @@
|
|||
|
||||
#define ICALL_LEVEL_ALL (RIG_LEVEL_PREAMP|RIG_LEVEL_ATT|RIG_LEVEL_AGC|RIG_LEVEL_SQLSTAT|RIG_LEVEL_STRENGTH)
|
||||
|
||||
#define ICALL_OPS (RIG_OP_CPY|RIG_OP_XCHG|RIG_OP_FROM_VFO|RIG_OP_TO_VFO|RIG_OP_MCL)
|
||||
|
||||
static const struct icom_priv_caps icall_priv_caps = {
|
||||
0x58, /* whatever! */
|
||||
0, /* 731 mode */
|
||||
|
@ -101,6 +103,7 @@ max_rit: Hz(9999),
|
|||
max_xit: Hz(0),
|
||||
max_ifshift: Hz(2.1),
|
||||
targetable_vfo: 0,
|
||||
vfo_ops: ICALL_OPS,
|
||||
transceive: RIG_TRN_RIG,
|
||||
bank_qty: 0,
|
||||
chan_desc_sz: 0,
|
||||
|
@ -187,7 +190,11 @@ get_func: icom_get_func,
|
|||
set_channel: icom_set_channel,
|
||||
get_channel: icom_get_channel,
|
||||
set_mem: icom_set_mem,
|
||||
#ifdef WANT_OLD_VFO_TO_BE_REMOVED
|
||||
mv_ctl: icom_mv_ctl,
|
||||
#else
|
||||
vfo_op: icom_vfo_op,
|
||||
#endif
|
||||
set_ptt: icom_set_ptt,
|
||||
get_ptt: icom_get_ptt,
|
||||
get_dcd: icom_get_dcd,
|
||||
|
|
99
icom/icom.c
99
icom/icom.c
|
@ -6,7 +6,7 @@
|
|||
* via serial interface to an ICOM using the "CI-V" interface.
|
||||
*
|
||||
*
|
||||
* $Id: icom.c,v 1.26 2001-05-15 22:06:37 f4cfe Exp $
|
||||
* $Id: icom.c,v 1.27 2001-06-03 19:54:05 f4cfe Exp $
|
||||
*
|
||||
*
|
||||
*
|
||||
|
@ -414,6 +414,26 @@ int icom_set_vfo(RIG *rig, vfo_t vfo)
|
|||
switch(vfo) {
|
||||
case RIG_VFO_A: icvfo = S_VFOA; break;
|
||||
case RIG_VFO_B: icvfo = S_VFOB; break;
|
||||
#ifdef RIG_VFO_VFO
|
||||
case RIG_VFO_VFO:
|
||||
icom_transaction (rig, C_SET_VFO, -1, NULL, 0, ackbuf, &ack_len);
|
||||
if (ack_len != 1 || ackbuf[0] != ACK) {
|
||||
rig_debug(RIG_DEBUG_ERR,"icom_set_vfo: ack NG (%#.2x), "
|
||||
"len=%d\n", ackbuf[0],ack_len);
|
||||
return -RIG_ERJCTED;
|
||||
}
|
||||
return RIG_OK;
|
||||
#endif
|
||||
#ifdef RIG_VFO_MEM
|
||||
case RIG_VFO_MEM:
|
||||
icom_transaction (rig, C_SET_MEM, -1, NULL, 0, ackbuf, &ack_len);
|
||||
if (ack_len != 1 || ackbuf[0] != ACK) {
|
||||
rig_debug(RIG_DEBUG_ERR,"icom_set_vfo: ack NG (%#.2x), "
|
||||
"len=%d\n", ackbuf[0],ack_len);
|
||||
return -RIG_ERJCTED;
|
||||
}
|
||||
return RIG_OK;
|
||||
#endif
|
||||
default:
|
||||
rig_debug(RIG_DEBUG_ERR,"icom: Unsupported VFO %d\n",
|
||||
vfo);
|
||||
|
@ -1789,6 +1809,7 @@ int icom_set_bank(RIG *rig, vfo_t vfo, int bank)
|
|||
return RIG_OK;
|
||||
}
|
||||
|
||||
#ifdef WANT_OLD_VFO_TO_BE_REMOVED
|
||||
/*
|
||||
* icom_mv_ctl, Mem/VFO operation
|
||||
* Assumes rig!=NULL, rig->state.priv!=NULL
|
||||
|
@ -1860,6 +1881,82 @@ int icom_mv_ctl(RIG *rig, vfo_t vfo, mv_op_t op)
|
|||
return RIG_OK;
|
||||
}
|
||||
|
||||
#else
|
||||
/*
|
||||
* icom_vfo_op, Mem/VFO operation
|
||||
* Assumes rig!=NULL, rig->state.priv!=NULL
|
||||
*/
|
||||
int icom_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op)
|
||||
{
|
||||
struct icom_priv_data *priv;
|
||||
struct rig_state *rs;
|
||||
unsigned char mvbuf[16];
|
||||
unsigned char ackbuf[16];
|
||||
int mv_len, ack_len;
|
||||
int mv_cn, mv_sc;
|
||||
|
||||
rs = &rig->state;
|
||||
priv = (struct icom_priv_data*)rs->priv;
|
||||
|
||||
mv_len = 0;
|
||||
|
||||
switch(op) {
|
||||
#if 0
|
||||
case RIG_MVOP_VFO_MODE:
|
||||
mv_cn = C_SET_VFO;
|
||||
mv_sc = -1;
|
||||
break;
|
||||
case RIG_MVOP_MEM_MODE:
|
||||
mv_cn = C_SET_MEM;
|
||||
mv_sc = -1;
|
||||
break;
|
||||
#endif
|
||||
case RIG_OP_CPY:
|
||||
mv_cn = C_SET_VFO;
|
||||
mv_sc = S_BTOA;
|
||||
break;
|
||||
case RIG_OP_XCHG:
|
||||
mv_cn = C_SET_VFO;
|
||||
mv_sc = S_XCHNG;
|
||||
break;
|
||||
#if 0
|
||||
case RIG_OP_DUAL_OFF:
|
||||
mv_cn = C_SET_VFO;
|
||||
mv_sc = S_DUAL_OFF;
|
||||
break;
|
||||
case RIG_OP_DUAL_ON:
|
||||
mv_cn = C_SET_VFO;
|
||||
mv_sc = S_DUAL_ON;
|
||||
break;
|
||||
#endif
|
||||
case RIG_OP_FROM_VFO:
|
||||
mv_cn = C_WR_MEM;
|
||||
mv_sc = -1;
|
||||
break;
|
||||
case RIG_OP_TO_VFO:
|
||||
mv_cn = C_MEM2VFO;
|
||||
mv_sc = -1;
|
||||
break;
|
||||
case RIG_OP_MCL:
|
||||
mv_cn = C_CLR_MEM;
|
||||
mv_sc = -1;
|
||||
break;
|
||||
default:
|
||||
rig_debug(RIG_DEBUG_ERR,"Unsupported mem/vfo op %#x", op);
|
||||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
icom_transaction (rig, mv_cn, mv_sc, mvbuf, mv_len, ackbuf, &ack_len);
|
||||
|
||||
if (ack_len != 1 || ackbuf[0] != ACK) {
|
||||
rig_debug(RIG_DEBUG_ERR,"icom_vfo_op: ack NG (%#.2x), "
|
||||
"len=%d\n", ackbuf[0], ack_len);
|
||||
return -RIG_ERJCTED;
|
||||
}
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* icom_decode is called by sa_sigio, when some asynchronous
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* via serial interface to an ICOM using the "CI-V" interface.
|
||||
*
|
||||
*
|
||||
* $Id: icom.h,v 1.18 2001-05-04 22:40:37 f4cfe Exp $
|
||||
* $Id: icom.h,v 1.19 2001-06-03 19:54:05 f4cfe Exp $
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
|
@ -94,7 +94,11 @@ int icom_set_ctcss_sql(RIG *rig, vfo_t vfo, unsigned int tone);
|
|||
int icom_get_ctcss_sql(RIG *rig, vfo_t vfo, unsigned int *tone);
|
||||
int icom_set_bank(RIG *rig, vfo_t vfo, int bank);
|
||||
int icom_set_mem(RIG *rig, vfo_t vfo, int ch);
|
||||
#ifdef WANT_OLD_VFO_TO_BE_REMOVED
|
||||
int icom_mv_ctl(RIG *rig, vfo_t vfo, mv_op_t op);
|
||||
#else
|
||||
int icom_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op);
|
||||
#endif
|
||||
int icom_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val);
|
||||
int icom_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val);
|
||||
int icom_set_func(RIG *rig, vfo_t vfo, setting_t func, int status);
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
* using the "CI-V" interface.
|
||||
*
|
||||
*
|
||||
* $Id: icr8500.c,v 1.9 2001-05-04 22:37:35 f4cfe Exp $
|
||||
* $Id: icr8500.c,v 1.10 2001-06-03 19:54:05 f4cfe Exp $
|
||||
*
|
||||
*
|
||||
*
|
||||
|
@ -48,6 +48,8 @@
|
|||
|
||||
#define ICR8500_LEVEL_ALL (RIG_LEVEL_PREAMP|RIG_LEVEL_ATT|RIG_LEVEL_AGC|RIG_LEVEL_APF|RIG_LEVEL_SQL|RIG_LEVEL_SQLSTAT|RIG_LEVEL_STRENGTH)
|
||||
|
||||
#define ICR8500_OPS (RIG_OP_CPY|RIG_OP_XCHG|RIG_OP_FROM_VFO|RIG_OP_TO_VFO|RIG_OP_MCL)
|
||||
|
||||
static const struct icom_priv_caps icr8500_priv_caps = {
|
||||
0x4a, /* default address */
|
||||
0, /* 731 mode */
|
||||
|
@ -95,6 +97,7 @@ max_rit: Hz(9999),
|
|||
max_xit: Hz(0),
|
||||
max_ifshift: Hz(0),
|
||||
targetable_vfo: 0,
|
||||
vfo_ops: ICR8500_OPS,
|
||||
transceive: RIG_TRN_RIG,
|
||||
bank_qty: 12,
|
||||
chan_desc_sz: 0,
|
||||
|
@ -159,7 +162,11 @@ set_func: icom_set_func,
|
|||
set_channel: icom_set_channel,
|
||||
get_channel: icom_get_channel,
|
||||
set_mem: icom_set_mem,
|
||||
#ifdef WANT_OLD_VFO_TO_BE_REMOVED
|
||||
mv_ctl: icom_mv_ctl,
|
||||
#else
|
||||
vfo_op: icom_vfo_op,
|
||||
#endif
|
||||
set_ts: icom_set_ts,
|
||||
get_ts: icom_get_ts,
|
||||
};
|
||||
|
|
136
src/rig.c
136
src/rig.c
|
@ -2,7 +2,7 @@
|
|||
Copyright (C) 2000,2001 Stephane Fillod and Frank Singleton
|
||||
This file is part of the hamlib package.
|
||||
|
||||
$Id: rig.c,v 1.29 2001-06-02 18:05:14 f4cfe Exp $
|
||||
$Id: rig.c,v 1.30 2001-06-03 19:54:05 f4cfe Exp $
|
||||
|
||||
Hamlib is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
|
@ -850,7 +850,10 @@ pbwidth_t rig_passband_wide(RIG *rig, rmode_t mode)
|
|||
* @rig: The rig handle
|
||||
* @vfo: The VFO to set to
|
||||
*
|
||||
* The rig_set_vfo() function sets the current VFO.
|
||||
* The rig_set_vfo() function sets the current VFO. The VFO can
|
||||
* be %RIG_VFO_A, %RIG_VFO_B, %RIG_VFO_C for VFOA, VFOB, VFOC
|
||||
* respectively or %RIG_VFO_MEM for Memory mode.
|
||||
* Supported VFOs depends on rig capabilities.
|
||||
*
|
||||
* RETURN VALUE: The rig_set_vfo() function returns %RIG_OK
|
||||
* if the operation has been sucessful, or a negative value
|
||||
|
@ -883,7 +886,10 @@ int rig_set_vfo(RIG *rig, vfo_t vfo)
|
|||
* @rig: The rig handle
|
||||
* @vfo: The location where to store the current VFO
|
||||
*
|
||||
* The rig_get_vfo() function retrieves the current VFO.
|
||||
* The rig_get_vfo() function retrieves the current VFO. The VFO can
|
||||
* be %RIG_VFO_A, %RIG_VFO_B, %RIG_VFO_C for VFOA, VFOB, VFOC
|
||||
* respectively or %RIG_VFO_MEM for Memory mode.
|
||||
* Supported VFOs depends on rig capabilities.
|
||||
*
|
||||
* RETURN VALUE: The rig_get_vfo() function returns %RIG_OK
|
||||
* if the operation has been sucessful, or a negative value
|
||||
|
@ -2670,7 +2676,7 @@ int rig_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
|
|||
* if the operation has been sucessful, or a negative value
|
||||
* if an error occured (in which case, cause is set appropriately).
|
||||
*
|
||||
* SEE ALSO: rig_has_level(), rig_set_level()
|
||||
* SEE ALSO: rig_has_get_level(), rig_set_level()
|
||||
*/
|
||||
int rig_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
|
||||
{
|
||||
|
@ -2743,7 +2749,7 @@ int rig_set_parm(RIG *rig, setting_t parm, value_t val)
|
|||
* if the operation has been sucessful, or a negative value
|
||||
* if an error occured (in which case, cause is set appropriately).
|
||||
*
|
||||
* SEE ALSO: rig_has_parm(), rig_set_parm()
|
||||
* SEE ALSO: rig_has_get_parm(), rig_set_parm()
|
||||
*/
|
||||
int rig_get_parm(RIG *rig, setting_t parm, value_t *val)
|
||||
{
|
||||
|
@ -2761,7 +2767,8 @@ int rig_get_parm(RIG *rig, setting_t parm, value_t *val)
|
|||
* @rig: The rig handle
|
||||
* @level: The level settings
|
||||
*
|
||||
* The rig_has_level() "macro" checks if a rig can *get* a level setting.
|
||||
* The rig_has_get_level() "macro" checks if a rig is capable of
|
||||
* *getting* a level setting.
|
||||
* Since the @level is a OR'ed bitwise argument, more than
|
||||
* one level can be checked at the same time.
|
||||
*
|
||||
|
@ -2797,7 +2804,7 @@ setting_t rig_has_get_level(RIG *rig, setting_t level)
|
|||
*
|
||||
* EXAMPLE: if (rig_has_set_level(my_rig, RIG_LVL_RFPOWER)) crank_tx();
|
||||
*
|
||||
* SEE ALSO: rig_has_level(), rig_set_level()
|
||||
* SEE ALSO: rig_has_get_level(), rig_set_level()
|
||||
*/
|
||||
setting_t rig_has_set_level(RIG *rig, setting_t level)
|
||||
{
|
||||
|
@ -2812,7 +2819,8 @@ setting_t rig_has_set_level(RIG *rig, setting_t level)
|
|||
* @rig: The rig handle
|
||||
* @parm: The parameter settings
|
||||
*
|
||||
* The rig_has_parm() "macro" checks if a rig can *get* a parm setting.
|
||||
* The rig_has_get_parm() "macro" checks if a rig is capable of
|
||||
* *getting* a parm setting.
|
||||
* Since the @parm is a OR'ed bitwise argument, more than
|
||||
* one parameter can be checked at the same time.
|
||||
*
|
||||
|
@ -2848,7 +2856,7 @@ setting_t rig_has_get_parm(RIG *rig, setting_t parm)
|
|||
*
|
||||
* EXAMPLE: if (rig_has_set_parm(my_rig, RIG_PARM_ANN)) announce_all();
|
||||
*
|
||||
* SEE ALSO: rig_has_parm(), rig_set_parm()
|
||||
* SEE ALSO: rig_has_get_parm(), rig_set_parm()
|
||||
*/
|
||||
setting_t rig_has_set_parm(RIG *rig, setting_t parm)
|
||||
{
|
||||
|
@ -2863,7 +2871,8 @@ setting_t rig_has_set_parm(RIG *rig, setting_t parm)
|
|||
* @rig: The rig handle
|
||||
* @func: The functions
|
||||
*
|
||||
* The rig_has_func() "macro" checks if a rig supports a set of functions.
|
||||
* The rig_has_get_func() "macro" checks if a rig supports
|
||||
* a set of functions.
|
||||
* Since the @func is a OR'ed bitwise argument, more than
|
||||
* one function can be checked at the same time.
|
||||
*
|
||||
|
@ -2872,7 +2881,7 @@ setting_t rig_has_set_parm(RIG *rig, setting_t parm)
|
|||
*
|
||||
* EXAMPLE: if (rig_has_get_func(my_rig,RIG_FUNC_FAGC)) disp_fagc_button();
|
||||
*
|
||||
* SEE ALSO: rig_set_func(), rig_get_func()
|
||||
* SEE ALSO: rig_has_set_func(), rig_get_func()
|
||||
*/
|
||||
setting_t rig_has_get_func(RIG *rig, setting_t func)
|
||||
{
|
||||
|
@ -2887,7 +2896,8 @@ setting_t rig_has_get_func(RIG *rig, setting_t func)
|
|||
* @rig: The rig handle
|
||||
* @func: The functions
|
||||
*
|
||||
* The rig_has_func() "macro" checks if a rig supports a set of functions.
|
||||
* The rig_has_set_func() "macro" checks if a rig supports
|
||||
* a set of functions.
|
||||
* Since the @func is a OR'ed bitwise argument, more than
|
||||
* one function can be checked at the same time.
|
||||
*
|
||||
|
@ -2896,7 +2906,7 @@ setting_t rig_has_get_func(RIG *rig, setting_t func)
|
|||
*
|
||||
* EXAMPLE: if (rig_has_set_func(my_rig,RIG_FUNC_FAGC)) disp_fagc_button();
|
||||
*
|
||||
* SEE ALSO: rig_set_func(), rig_get_func()
|
||||
* SEE ALSO: rig_set_func(), rig_has_get_func()
|
||||
*/
|
||||
setting_t rig_has_set_func(RIG *rig, setting_t func)
|
||||
{
|
||||
|
@ -3093,6 +3103,7 @@ int rig_get_mem(RIG *rig, vfo_t vfo, int *ch)
|
|||
return retcode;
|
||||
}
|
||||
|
||||
#ifdef WANT_OLD_VFO_TO_BE_REMOVED
|
||||
/**
|
||||
* rig_mv_ctl - perform Memory/VFO operations
|
||||
* @rig: The rig handle
|
||||
|
@ -3137,6 +3148,79 @@ int rig_mv_ctl(RIG *rig, vfo_t vfo, mv_op_t op)
|
|||
caps->set_vfo(rig, curr_vfo);
|
||||
return retcode;
|
||||
}
|
||||
#else
|
||||
|
||||
/**
|
||||
* rig_has_vfo_op - check retrieval ability of VFO operations
|
||||
* @rig: The rig handle
|
||||
* @op: The VFO op
|
||||
*
|
||||
* The rig_has_vfo_op() "macro" checks if a rig is capable of executing
|
||||
* a VFO operation. Since the @op is a OR'ed bitmap argument, more than
|
||||
* one op can be checked at the same time.
|
||||
*
|
||||
* RETURN VALUE: The rig_has_vfo_op() "macro" returns a bitmap
|
||||
* mask of supported op settings that can be retrieve,
|
||||
* 0 if none supported.
|
||||
*
|
||||
* EXAMPLE: if (rig_has_vfo_op(my_rig, RIG_OP_CPY)) disp_VFOcpy_btn();
|
||||
*
|
||||
* SEE ALSO: rig_vfo_op()
|
||||
*/
|
||||
vfo_op_t rig_has_vfo_op(RIG *rig, vfo_op_t op)
|
||||
{
|
||||
if (!rig || !rig->caps)
|
||||
return 0;
|
||||
|
||||
return (rig->caps->vfo_ops & op);
|
||||
}
|
||||
|
||||
/**
|
||||
* rig_vfo_op - perform Memory/VFO operations
|
||||
* @rig: The rig handle
|
||||
* @vfo: The target VFO
|
||||
* @op: The Memory/VFO operation to perform
|
||||
*
|
||||
* The rig_vfo_op() function performs Memory/VFO operation.
|
||||
* See &vfo_op_t for more information.
|
||||
*
|
||||
* RETURN VALUE: The rig_vfo_op() function returns %RIG_OK
|
||||
* if the operation has been sucessful, or a negative value
|
||||
* if an error occured (in which case, cause is set appropriately).
|
||||
*
|
||||
* SEE ALSO: rig_has_vfo_op()
|
||||
*/
|
||||
|
||||
int rig_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op)
|
||||
{
|
||||
const struct rig_caps *caps;
|
||||
int retcode;
|
||||
vfo_t curr_vfo;
|
||||
|
||||
if (!rig || !rig->caps)
|
||||
return -RIG_EINVAL;
|
||||
|
||||
caps = rig->caps;
|
||||
|
||||
if (caps->vfo_op == NULL || !rig_has_vfo_op(rig,op))
|
||||
return -RIG_ENAVAIL;
|
||||
|
||||
if (caps->targetable_vfo || vfo == RIG_VFO_CURR ||
|
||||
vfo == rig->state.current_vfo)
|
||||
return caps->vfo_op(rig, vfo, op);
|
||||
|
||||
if (!caps->set_vfo)
|
||||
return -RIG_ENTARGET;
|
||||
curr_vfo = rig->state.current_vfo;
|
||||
retcode = caps->set_vfo(rig, vfo);
|
||||
if (retcode != RIG_OK)
|
||||
return retcode;
|
||||
|
||||
retcode = caps->vfo_op(rig, vfo, op);
|
||||
caps->set_vfo(rig, curr_vfo);
|
||||
return retcode;
|
||||
}
|
||||
#endif /* WANT_OLD_VFO_TO_BE_REMOVED */
|
||||
|
||||
/**
|
||||
* rig_send_dtmf - send DTMF digits
|
||||
|
@ -3409,16 +3493,8 @@ int rig_restore_channel(RIG *rig, const channel_t *chan)
|
|||
}
|
||||
rig_set_rptr_shift(rig, RIG_VFO_CURR, chan->rptr_shift);
|
||||
rig_set_rptr_offs(rig, RIG_VFO_CURR, chan->rptr_offs);
|
||||
#if 0
|
||||
/* power in mW */
|
||||
rig_mW2power(rig, &hfpwr, chan->power, chan->freq, chan->mode);
|
||||
rig_set_level(rig, RIG_VFO_CURR, RIG_LEVEL_RFPOWER, hfpwr);
|
||||
rig_set_level(rig, RIG_VFO_CURR, RIG_LEVEL_ATT, chan->att);
|
||||
rig_set_level(rig, RIG_VFO_CURR, RIG_LEVEL_PREAMP, chan->preamp);
|
||||
#else
|
||||
for (i=0; i<RIG_SETTING_MAX; i++)
|
||||
rig_set_level(rig, RIG_VFO_CURR, rig_idx2setting(i), chan->levels[i]);
|
||||
#endif
|
||||
|
||||
rig_set_ant(rig, RIG_VFO_CURR, chan->ant);
|
||||
rig_set_ts(rig, RIG_VFO_CURR, chan->tuning_step);
|
||||
|
@ -3458,6 +3534,7 @@ int rig_set_channel(RIG *rig, const channel_t *chan)
|
|||
{
|
||||
channel_t curr_chan;
|
||||
int curr_chan_num;
|
||||
vfo_t curr_vfo;
|
||||
|
||||
if (!rig || !rig->caps || !chan)
|
||||
return -RIG_EINVAL;
|
||||
|
@ -3467,12 +3544,21 @@ int rig_set_channel(RIG *rig, const channel_t *chan)
|
|||
*/
|
||||
if (rig->caps->set_channel == NULL) {
|
||||
rig_save_channel(rig, &curr_chan);
|
||||
#ifdef WANT_OLD_VFO_TO_BE_REMOVED
|
||||
rig_mv_ctl(rig, RIG_VFO_CURR, RIG_MVOP_MEM_MODE);
|
||||
#else
|
||||
curr_vfo = rig->state.current_vfo;
|
||||
rig_set_vfo(rig, RIG_VFO_MEM);
|
||||
#endif
|
||||
rig_get_mem(rig, RIG_VFO_CURR, &curr_chan_num);
|
||||
rig_set_mem(rig, RIG_VFO_CURR, chan->channel_num);
|
||||
rig_set_mem(rig, RIG_VFO_CURR, curr_chan_num);
|
||||
rig_restore_channel(rig, chan);
|
||||
#ifdef WANT_OLD_VFO_TO_BE_REMOVED
|
||||
rig_mv_ctl(rig, RIG_VFO_CURR, RIG_MVOP_VFO_MODE);
|
||||
#else
|
||||
rig_set_vfo(rig, curr_vfo);
|
||||
#endif
|
||||
rig_restore_channel(rig, &curr_chan);
|
||||
return RIG_OK;
|
||||
}
|
||||
|
@ -3497,8 +3583,10 @@ int rig_set_channel(RIG *rig, const channel_t *chan)
|
|||
*/
|
||||
int rig_get_channel(RIG *rig, channel_t *chan)
|
||||
{
|
||||
#if 0
|
||||
channel_t curr_chan;
|
||||
int curr_chan_num;
|
||||
#endif
|
||||
|
||||
if (!rig || !rig->caps || !chan)
|
||||
return -RIG_EINVAL;
|
||||
|
@ -3510,7 +3598,13 @@ int rig_get_channel(RIG *rig, channel_t *chan)
|
|||
#if 0
|
||||
rig_save_channel(rig, &curr_chan);
|
||||
#endif
|
||||
|
||||
#ifdef WANT_OLD_VFO_TO_BE_REMOVED
|
||||
rig_mv_ctl(rig, RIG_VFO_CURR, RIG_MVOP_MEM_MODE);
|
||||
#else
|
||||
rig_set_vfo(rig, RIG_VFO_MEM);
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
rig_get_mem(rig, RIG_VFO_CURR, &curr_chan_num);
|
||||
#endif
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* This programs dumps the capabilities of a backend rig.
|
||||
*
|
||||
*
|
||||
* $Id: dumpcaps.c,v 1.24 2001-06-02 18:11:21 f4cfe Exp $
|
||||
* $Id: dumpcaps.c,v 1.25 2001-06-03 19:54:05 f4cfe Exp $
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
|
@ -496,7 +496,11 @@ int main (int argc, char *argv[])
|
|||
printf("Can get mem:\t%c\n",caps->get_mem!=NULL?'Y':'N');
|
||||
printf("Can set channel:\t%c\n",caps->set_channel!=NULL?'Y':'N');
|
||||
printf("Can get channel:\t%c\n",caps->get_channel!=NULL?'Y':'N');
|
||||
#ifdef WANT_OLD_VFO_TO_BE_REMOVED
|
||||
printf("Can ctl mem/vfo:\t%c\n",caps->mv_ctl!=NULL?'Y':'N');
|
||||
#else
|
||||
printf("Can ctl mem/vfo:\t%c\n",caps->vfo_op!=NULL?'Y':'N');
|
||||
#endif
|
||||
printf("Can get info:\t%c\n",caps->get_info!=NULL?'Y':'N');
|
||||
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
* TODO: be more generic and add command line option to run
|
||||
* in non-interactive mode
|
||||
*
|
||||
* $Id: rigctl.c,v 1.12 2001-04-28 12:43:43 f4cfe Exp $
|
||||
* $Id: rigctl.c,v 1.13 2001-06-03 19:54:05 f4cfe Exp $
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
|
@ -84,7 +84,11 @@ declare_proto_rig(get_func);
|
|||
declare_proto_rig(set_bank);
|
||||
declare_proto_rig(set_mem);
|
||||
declare_proto_rig(get_mem);
|
||||
#ifdef WANT_OLD_VFO_TO_BE_REMOVED
|
||||
declare_proto_rig(mv_ctl);
|
||||
#else
|
||||
declare_proto_rig(vfo_op);
|
||||
#endif
|
||||
declare_proto_rig(set_channel);
|
||||
declare_proto_rig(get_channel);
|
||||
declare_proto_rig(set_trn);
|
||||
|
@ -128,7 +132,11 @@ struct test_table test_list[] = {
|
|||
{ 'B', "set_bank", set_bank, "Bank" },
|
||||
{ 'E', "set_mem", set_mem, "Memory#" },
|
||||
{ 'e', "get_mem", get_mem, "Memory#" },
|
||||
#ifdef WANT_OLD_VFO_TO_BE_REMOVED
|
||||
{ 'G', "mv_ctl", mv_ctl, "Mem/VFO op" },
|
||||
#else
|
||||
{ 'G', "vfo_op", vfo_op, "Mem/VFO op" },
|
||||
#endif
|
||||
{ 'H', "set_channel", set_channel /* huh! */ },
|
||||
{ 'h', "get_channel", get_channel, "Channel" },
|
||||
{ 'A', "set_trn", set_trn, "Transceive" },
|
||||
|
@ -683,6 +691,7 @@ declare_proto_rig(get_mem)
|
|||
}
|
||||
|
||||
|
||||
#ifdef WANT_OLD_VFO_TO_BE_REMOVED
|
||||
declare_proto_rig(mv_ctl)
|
||||
{
|
||||
mv_op_t op;
|
||||
|
@ -690,6 +699,15 @@ declare_proto_rig(mv_ctl)
|
|||
sscanf(arg1, "%d", (int*)&op);
|
||||
return rig_mv_ctl(rig, RIG_VFO_CURR, op);
|
||||
}
|
||||
#else
|
||||
declare_proto_rig(vfo_op)
|
||||
{
|
||||
vfo_op_t op;
|
||||
|
||||
sscanf(arg1, "%d", (int*)&op);
|
||||
return rig_vfo_op(rig, RIG_VFO_CURR, op);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
declare_proto_rig(set_channel)
|
||||
|
|
Ładowanie…
Reference in New Issue