Fix Rig.get_ant()

The only supported value for get_ant() in the union of "option"
is signed integer.
Do the test when the rig is open.
pull/1784/head
Daniele Forsi IU5HKX 2025-06-25 23:02:31 +02:00
rodzic 6c399b55ff
commit bf518c0609
2 zmienionych plików z 14 dodań i 11 usunięć

Wyświetl plik

@ -59,6 +59,11 @@ class TestClass:
assert rig.get_split_vfo() == [5000000, 1]
assert rig.get_split_vfo(Hamlib.RIG_VFO_CURR) == [5000000, 1]
# FIXME should use a RIG_ANT_* constant but it isn't available in the bindings
RIG_ANT_UNKNOWN = 1<<30
assert rig.get_ant(Hamlib.RIG_VFO_A) == [RIG_ANT_UNKNOWN, RIG_ANT_UNKNOWN, Hamlib.RIG_VFO_A, 0]
assert rig.get_ant(Hamlib.RIG_VFO_A, Hamlib.RIG_VFO_A) == [RIG_ANT_UNKNOWN, RIG_ANT_UNKNOWN, Hamlib.RIG_VFO_A, 0]
assert rig.close() is None
assert rig.state.comm_state == 0
info = rig.get_info()
@ -72,12 +77,6 @@ class TestClass:
assert rig.close() is None
assert rig.ext_token_lookup("") is None
option = Hamlib.value_t()
ant = 0 # FIXME should use a RIG_ANT_* constant but it isn't available in the bindings
with raises(AssertionError): # FIXME
assert len(rig.get_ant(option, ant)) == 4
assert len(rig.get_ant(option, ant, Hamlib.RIG_VFO_CURR)) == 4
assert option.i == 0
assert rig.get_chan_all() is None
channel = 0
readonly = 0
@ -158,10 +157,12 @@ class TestClass:
assert rig.scan(0, 0, 0) is None
assert rig.send_dtmf(0, "") is None
assert rig.send_morse(0, "") is None
# FIXME should use a RIG_ANT_* constant but it isn't available in the bindings
RIG_ANT_1 = 1<<0
option = Hamlib.value_t()
option.i = 0 # FIXME should use a RIG_ANT_* constant but it isn't available in the bindings
option.i = 0
assert rig.set_ant(Hamlib.RIG_VFO_CURR, option) is None
assert rig.set_ant(Hamlib.RIG_VFO_CURR, option, 0) is None
assert rig.set_ant(Hamlib.RIG_VFO_CURR, option, RIG_ANT_1) is None
assert rig.set_bank(0, 0) is None
channel = Hamlib.channel()
channel = Hamlib.channel(0)

Wyświetl plik

@ -473,7 +473,7 @@ typedef channel_t * const_channel_t_p;
METHOD1VGET(get_rit, shortfreq_t)
METHOD1VGET(get_xit, shortfreq_t)
METHOD1VGET(get_ts, shortfreq_t)
extern void get_ant(ant_t *OUTPUT, ant_t *OUTPUT, ant_t *OUTPUT, value_t *OUTPUT, ant_t ant, vfo_t vfo = RIG_VFO_CURR);
extern void get_ant(ant_t *OUTPUT, ant_t *OUTPUT, ant_t *OUTPUT, signed int *OUTPUT, ant_t ant, vfo_t vfo = RIG_VFO_CURR);
void get_vfo_info (int *satmode, split_t *split, pbwidth_t *width, rmode_t *mode, freq_t *freq, vfo_t vfo = RIG_VFO_CURR)
{ self->error_status = rig_get_vfo_info(self->rig, vfo, freq, mode, width, split, satmode); }
METHOD1VGET(get_mem, int)
@ -623,9 +623,11 @@ void Rig_get_split_freq_mode(Rig *self, vfo_t vfo, freq_t *tx_freq, rmode_t *tx_
/*
* these ones return 4 values
*/
void Rig_get_ant(Rig *self, ant_t *ant_rx, ant_t *ant_tx, ant_t *ant_curr, value_t *option, ant_t ant, vfo_t vfo)
void Rig_get_ant(Rig *self, ant_t *ant_rx, ant_t *ant_tx, ant_t *ant_curr, signed int *option, ant_t ant, vfo_t vfo)
{
self->error_status = rig_get_ant(self->rig, vfo, ant, option, ant_curr, ant_tx, ant_rx);
value_t value;
self->error_status = rig_get_ant(self->rig, vfo, ant, &value, ant_curr, ant_tx, ant_rx);
*option = value.i;
}
struct channel *Rig_get_chan_all(Rig *self)