From: Nate B. <n0...@us...> - 2013-02-13 00:57:36
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Hamlib -- Ham radio control libraries". The branch, master has been updated via 49d2124a03a27d7f219cc3b274bb288f88c5166a (commit) via d9fc9c04d767554ab1be60f7c040628004fb4423 (commit) from 7e9f628648c70a0365dcc23414ff470d2ff65269 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 49d2124a03a27d7f219cc3b274bb288f88c5166a Author: Nate Bargmann <n0...@n0...> Date: Tue Feb 12 18:39:47 2013 -0600 Binding test scripts--fix set_freq ordering Due to the changes of the patch contributed by Ervin Hegedüs, correct the bindings test scripts to work with the corrected ordering of VFO and frequency arguments. Also add a call to send_morse() in each script. diff --git a/bindings/perltest.pl b/bindings/perltest.pl index dd7693d..edd4ad6 100755 --- a/bindings/perltest.pl +++ b/bindings/perltest.pl @@ -23,7 +23,7 @@ $retry = $rig->get_conf("retry"); print "get_conf:\t\tpath = \"$rpath\", retry = $retry, ITU region = $region\n"; -$rig->set_freq(14266000, $Hamlib::RIG_VFO_A); +$rig->set_freq($Hamlib::RIG_VFO_A, 14266000); $f = $rig->get_freq(); print "freq:\t\t\t$f\n"; @@ -62,6 +62,9 @@ print "get_channel status:\t$rig->{error_status} = ".Hamlib::rigerror($rig->{err print "VFO:\t\t\t".Hamlib::rig_strvfo($chan->{vfo}).", $chan->{freq}\n"; +print "\nSending Morse, '73'\n"; +$rig->send_morse($Hamlib::RIG_VFO_A, "73"); + $rig->close(); diff --git a/bindings/pytest.py b/bindings/pytest.py index 21711d6..552a926 100755 --- a/bindings/pytest.py +++ b/bindings/pytest.py @@ -30,10 +30,10 @@ def StartUp (): print "get_conf:\t\tpath = %s, retry = %s, ITU region = %s" \ % (rpath, retry, region) - my_rig.set_freq (5700000000,Hamlib.RIG_VFO_B) - print "freq:\t\t\t",my_rig.get_freq() - my_rig.set_freq (145550000) + my_rig.set_freq (Hamlib.RIG_VFO_B, 5700000000) my_rig.set_vfo (Hamlib.RIG_VFO_B) + print "freq:\t\t\t",my_rig.get_freq() + my_rig.set_freq (Hamlib.RIG_VFO_A, 145550000) #my_rig.set_vfo ("VFOA") (mode, width) = my_rig.get_mode() @@ -66,6 +66,10 @@ def StartUp (): print "get_channel status:\t",my_rig.error_status print "VFO:\t\t\t",Hamlib.rig_strvfo(chan.vfo),", ",chan.freq + + print "\nSending Morse, '73'" + my_rig.send_morse(Hamlib.RIG_VFO_A, "73") + my_rig.close () print "\nSome static functions:" diff --git a/bindings/tcltest.tcl b/bindings/tcltest.tcl index bfba7c6..c5dd223 100755 --- a/bindings/tcltest.tcl +++ b/bindings/tcltest.tcl @@ -21,7 +21,7 @@ rig_set_debug $RIG_DEBUG_NONE Rig my_rig $RIG_MODEL_DUMMY my_rig open -my_rig set_freq 145550000 +my_rig set_freq $RIG_VFO_A 145550000 puts "status:\t\t[my_rig cget -error_status]" @@ -51,6 +51,9 @@ puts "strength:\t[my_rig get_level_i $RIG_LEVEL_STRENGTH]" puts "status:\t\t[my_rig cget -error_status]" puts "status(str):\t[rigerror [my_rig cget -error_status]]" +puts "\nSending Morse, '73'" +my_rig send_morse $RIG_VFO_A "73" + my_rig close #my_rig cleanup commit d9fc9c04d767554ab1be60f7c040628004fb4423 Author: Ervin Hegedüs <ai...@gm...> Date: Tue Feb 12 21:43:19 2013 +0100 rig.swg: New properly formatted macro I made a patch, you can see in that there is the solution, which describe the error: if a function in hamlib looks 3 argument (rig, vfo, any 3rd arg), the order of the 2nd and 3rd argument were reversed, because the macro METHOD1 reversed them. I've collected these functions, compared its arguments with hamlib docs (http://hamlib.sourceforge.net/manuals/1.2.15/), and where 1st arg is rig, 2nd arg is vfo, and 3rd is any kind of type, changed to METHOD3, which is a new macro, and keeps the correct order of original function - see the patch. (I didn't find any info about the expected diff format, so I just created the `diff -uprN ORIG NEW'.) To check my theory, I've tested with another function, which uses vfo type at 2nd argument, eg. rig_set_freq; here is the Python code: my_rig.set_freq(Hamlib.RIG_VFO_A, 7013200.0) and the original code drop the exception: my_rig.set_freq(Hamlib.RIG_VFO_A, 7012500.0) File "/usr/local/lib/python2.7/dist-packages/Hamlib.py", line 2513, in set_freq def set_freq(self, *args): return _Hamlib.Rig_set_freq(self, *args) TypeError: in method 'Rig_set_freq', argument 3 of type 'vfo_t' As you can see, it's same as my original error above. So, after I patched the source and recompiled it again, these two function works correctly - I will test it at soon, but I think _this_ is good and stable. Signed-off-by: Nate Bargmann <n0...@n0...> diff --git a/bindings/hamlib.swg b/bindings/hamlib.swg index b277b13..d846630 100644 --- a/bindings/hamlib.swg +++ b/bindings/hamlib.swg @@ -64,14 +64,6 @@ %include <hamlib/rotlist.h> %include <hamlib/rotator.h> -/* needed because rig.swg and rotator.swg macros require identifiers like arg (no spaces) */ -%header %{ - typedef char * char_string; - typedef const char * const_char_string; - typedef channel_t * channel_t_p; - typedef channel_t * const_channel_t_p; -%} - /* * The Rig "class" */ @@ -90,5 +82,3 @@ %include "python.i" %include "whatever.i" */ - - diff --git a/bindings/rig.swg b/bindings/rig.swg index 71bcbaa..69d7094 100644 --- a/bindings/rig.swg +++ b/bindings/rig.swg @@ -29,6 +29,11 @@ typedef struct Rig { int do_exception; } Rig; +typedef char * char_string; +typedef const char * const_char_string; +typedef channel_t * channel_t_p; +typedef channel_t * const_channel_t_p; + %} %extend channel { @@ -54,7 +59,7 @@ typedef struct Rig { %array_class(tone_t, toneArray); /* - * decalre wrapper method with one argument besides RIG* and optional no target vfo + * declare wrapper method with one argument besides RIG* and optional no target vfo */ #define METHOD1(f, t1) void f (t1 _##t1 _VFO_DECL) \ { self->error_status = rig_##f(self->rig _VFO_ARG, _##t1); } @@ -62,15 +67,16 @@ typedef struct Rig { { self->error_status = rig_##f(self->rig _VFO_ARG, _##t1##_1, _##t2##_2); } #define METHOD2_INIT(f, t1, t2, i2) void f (t1 _##t1##_1, t2 _##t2##_2 = i2 _VFO_DECL) \ { self->error_status = rig_##f(self->rig _VFO_ARG, _##t1##_1, _##t2##_2); } - +#define METHOD3(f, t1) void f ( vfo_t vfo, t1 _##t1) \ + { self->error_status = rig_##f(self->rig _VFO_ARG, _##t1); } /* - * decalre wrapper method with one output argument besides RIG* (no target vfo) + * declare wrapper method with one output argument besides RIG* (no target vfo) */ #define METHOD1GET(f, t1) t1 f (void) \ { t1 _##t1; self->error_status = rig_##f(self->rig, &_##t1); return _##t1; } /* - * decalre wrapper method with one output argument besides RIG* and vfo + * declare wrapper method with one output argument besides RIG* and vfo */ #define METHOD1VGET(f, t1) t1 f (vfo_t vfo = RIG_VFO_CURR) \ { t1 _##t1; self->error_status = rig_##f(self->rig, vfo, &_##t1); return _##t1; } @@ -267,28 +273,28 @@ typedef struct Rig { #define _VFO_ARG ,vfo #define _VFO_DECL ,vfo_t vfo = RIG_VFO_CURR - METHOD1(set_freq, freq_t) + METHOD3(set_freq, freq_t) METHOD2_INIT(set_mode, rmode_t, pbwidth_t, RIG_PASSBAND_NORMAL) - METHOD1(set_ptt, ptt_t) - METHOD1(set_rptr_shift, rptr_shift_t) - METHOD1(set_rptr_offs, shortfreq_t) - METHOD1(set_ctcss_tone, tone_t) - METHOD1(set_dcs_code, tone_t) - METHOD1(set_ctcss_sql, tone_t) + METHOD3(set_ptt, ptt_t) + METHOD3(set_rptr_shift, rptr_shift_t) + METHOD3(set_rptr_offs, shortfreq_t) + METHOD3(set_ctcss_tone, tone_t) + METHOD3(set_dcs_code, tone_t) + METHOD3(set_ctcss_sql, tone_t) METHOD1(set_dcs_sql, tone_t) - METHOD1(set_split_freq, freq_t) + METHOD3(set_split_freq, freq_t) METHOD2_INIT(set_split_mode, rmode_t, pbwidth_t, RIG_PASSBAND_NORMAL) METHOD2(set_split_vfo, split_t, vfo_t) - METHOD1(set_rit, shortfreq_t) - METHOD1(set_xit, shortfreq_t) - METHOD1(set_ts, shortfreq_t) - METHOD1(set_ant, ant_t) + METHOD3(set_rit, shortfreq_t) + METHOD3(set_xit, shortfreq_t) + METHOD3(set_ts, shortfreq_t) + METHOD3(set_ant, ant_t) METHOD2(set_func, setting_t, int) - METHOD1(set_bank, int) - METHOD1(set_mem, int) - METHOD1(send_dtmf, const_char_string) - METHOD1(send_morse, const_char_string) - METHOD1(vfo_op, vfo_op_t) + METHOD3(set_bank, int) + METHOD3(set_mem, int) + METHOD3(send_dtmf, const_char_string) + METHOD3(send_morse, const_char_string) + METHOD3(vfo_op, vfo_op_t) METHOD2(scan, scan_t, int) METHODSIMPLESET(level, int, i, RIG_LEVEL_IS_FLOAT(stg)) METHODSIMPLESET(level, float, f, !RIG_LEVEL_IS_FLOAT(stg)) @@ -521,4 +527,3 @@ struct channel *Rig_get_chan_all(Rig *self) } %} - diff --git a/bindings/rotator.swg b/bindings/rotator.swg index c757559..9e14e07 100644 --- a/bindings/rotator.swg +++ b/bindings/rotator.swg @@ -29,10 +29,12 @@ typedef struct Rot { int do_exception; } Rot; +typedef const char * const_char_string; + %} /* - * decalre wrapper method with 0,1,2 arguments besides ROT* + * declare wrapper method with 0,1,2 arguments besides ROT* */ #define ROTMETHOD0(f) void f () \ { self->error_status = rot_##f(self->rot); } ----------------------------------------------------------------------- Summary of changes: bindings/hamlib.swg | 10 ---------- bindings/perltest.pl | 5 ++++- bindings/pytest.py | 10 +++++++--- bindings/rig.swg | 49 +++++++++++++++++++++++++++---------------------- bindings/rotator.swg | 4 +++- bindings/tcltest.tcl | 5 ++++- 6 files changed, 45 insertions(+), 38 deletions(-) hooks/post-receive -- Hamlib -- Ham radio control libraries |