From d5d90ce89becbabdc4cd87eb106fe76311dd764c Mon Sep 17 00:00:00 2001 From: Ervin Hegedus Date: Mon, 28 Mar 2016 22:51:21 +0200 Subject: [PATCH 1/4] Fixed Kenwood filter cmd when passband is set to 500Hz --- kenwood/kenwood.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kenwood/kenwood.c b/kenwood/kenwood.c index b45a1fab9..74045a4ef 100644 --- a/kenwood/kenwood.c +++ b/kenwood/kenwood.c @@ -1077,7 +1077,7 @@ static int kenwood_set_filter(RIG *rig, pbwidth_t width) if (width <= Hz(250)) cmd = "FL010009"; else if(width <= Hz(500)) - cmd = "FL009009"; + cmd = "FL007009"; else if(width <= kHz(2.7)) cmd = "FL007007"; else if(width <= kHz(6)) From c7476de364314639a68fe5ee071ffc5f006b7675 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Heged=C3=BCs=20Ervin?= Date: Fri, 20 May 2016 22:08:10 +0200 Subject: [PATCH 2/4] Check SWIG string functions for some languages --- bindings/hamlib.swg | 2 ++ bindings/rig.swg | 2 ++ 2 files changed, 4 insertions(+) diff --git a/bindings/hamlib.swg b/bindings/hamlib.swg index 5b1cce8ad..35a4f9f20 100644 --- a/bindings/hamlib.swg +++ b/bindings/hamlib.swg @@ -52,8 +52,10 @@ %apply double *OUTPUT { double *longitude, double *latitude }; %apply char *OUTPUT { char *locator_res }; +#ifndef SWIG_CSTRING_UNIMPL /* longlat2locator */ %cstring_bounded_output(char *locator_res, 13) +#endif %immutable confparams::name; %immutable confparams::label; diff --git a/bindings/rig.swg b/bindings/rig.swg index 69d7094d6..8d43110ee 100644 --- a/bindings/rig.swg +++ b/bindings/rig.swg @@ -225,7 +225,9 @@ typedef channel_t * const_channel_t_p; */ %extend Rig { +#ifndef SWIG_CSTRING_UNIMPL %cstring_bounded_output(char *returnstr, MAX_RETURNSTR); +#endif Rig(int rig_model) { Rig *r; From cef8c2d1576e5da2cbd2234b6b060a7323d3e86a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Heged=C3=BCs=20Ervin?= Date: Fri, 20 May 2016 22:46:23 +0200 Subject: [PATCH 3/4] Leave off multiply 'typedef const char * const_char_string' definition (in rig.swg and rotator.swg) --- bindings/hamlib.swg | 4 ++++ bindings/rig.swg | 1 - bindings/rotator.swg | 2 -- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/bindings/hamlib.swg b/bindings/hamlib.swg index 35a4f9f20..ffc4f6986 100644 --- a/bindings/hamlib.swg +++ b/bindings/hamlib.swg @@ -83,6 +83,10 @@ %include %include +%inline { +typedef const char * const_char_string; +} + /* * The Rig "class" */ diff --git a/bindings/rig.swg b/bindings/rig.swg index 8d43110ee..f54b98446 100644 --- a/bindings/rig.swg +++ b/bindings/rig.swg @@ -30,7 +30,6 @@ typedef struct Rig { } Rig; typedef char * char_string; -typedef const char * const_char_string; typedef channel_t * channel_t_p; typedef channel_t * const_channel_t_p; diff --git a/bindings/rotator.swg b/bindings/rotator.swg index 9e14e0797..544d98d8f 100644 --- a/bindings/rotator.swg +++ b/bindings/rotator.swg @@ -29,8 +29,6 @@ typedef struct Rot { int do_exception; } Rot; -typedef const char * const_char_string; - %} /* From 37cac121f4725521419af70c3f9628d49c796597 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Heged=C3=BCs=20Ervin?= Date: Sat, 27 Aug 2016 21:24:17 +0200 Subject: [PATCH 4/4] Fixed int[10] type variable error in bindings --- bindings/hamlib.swg | 81 ++++++++++++++++++++++++++++++++++++++++++++ bindings/perltest.pl | 6 ++++ bindings/pytest.py | 1 + bindings/tcltest.tcl | 8 +++++ 4 files changed, 96 insertions(+) diff --git a/bindings/hamlib.swg b/bindings/hamlib.swg index ffc4f6986..9441b92c8 100644 --- a/bindings/hamlib.swg +++ b/bindings/hamlib.swg @@ -44,6 +44,87 @@ %include cstring.i #ifdef SWIGPYTHON %include python/file.i + +%typemap(out) int [ANY] { + int len,i; + len = $1_dim0; + $result = PyList_New(len); + for (i = 0; i < len; i++) { + PyList_SetItem($result,i,PyInt_FromLong((long)$1[i])); + } +} + +%typemap(varout) int [ANY] { + int len,i; + len = $1_dim0; + $result = PyList_New(len); + for (i = 0; i < len; i++) { + PyList_SetItem($result,i,PyInt_FromLong((long)$1[i])); + } +} + +#endif + +#ifdef SWIGPERL + +%typemap(out) int [ANY] { + AV * av = newAV(); + int i = 0,len = 0; + len = $1_dim0; + + for (i = 0; i < len ; i++) { + SV* perlval = newSV(0); + sv_setiv(perlval, (IV)$1[i]); + av_push(av, perlval); + } + $result = newRV_noinc((SV *)av); + sv_2mortal( $result ); + argvi++; +} + +%typemap(argout) int [ANY] { + AV * av = newAV(); + int i = 0,len = 0; + len = $1_dim0; + + for (i = 0; i < len ; i++) { + SV* perlval = newSV(0); + sv_setiv(perlval, (IV)$1[i]); + av_push(av, perlval); + } + $result = newRV_noinc((SV *)av); + sv_2mortal( $result ); + argvi++; +} + +#endif + +#ifdef SWIGTCL + +%typemap(out) int [ANY] { + int i, len, l; + len = $1_dim0; + + Tcl_Obj * list = Tcl_NewListObj(len, NULL); + for(i=0; i < len; i++) { + Tcl_ListObjAppendElement(interp, list, Tcl_NewIntObj($1[i])); + } + Tcl_SetObjResult(interp, list); +} + +%typemap(varout) int [ANY] { + int i, len, l; + len = $1_dim0; + + Tcl_Obj * list = Tcl_NewListObj(len, NULL); + for(i=0; i < len; i++) { + Tcl_ListObjAppendElement(interp, list, Tcl_NewIntObj($1[i])); + } + + $result = list; +} + + #endif %apply double *OUTPUT { double *distance, double *azimuth }; diff --git a/bindings/perltest.pl b/bindings/perltest.pl index edd4ad654..310d657c2 100755 --- a/bindings/perltest.pl +++ b/bindings/perltest.pl @@ -40,6 +40,9 @@ $rig->set_mode($Hamlib::RIG_MODE_CW, $Hamlib::RIG_PASSBAND_NORMAL); print "ITU region:\t\t$rig->{state}->{itu_region}\n"; print "Backend copyright:\t$rig->{caps}->{copyright}\n"; +print "Model:\t\t\t$rig->{caps}->{model_name}\n"; +print "Manufacturer:\t\t$rig->{caps}->{mfg_name}\n"; +print "Backend version:\t$rig->{caps}->{version}\n"; $inf = $rig->get_info(); print "get_info:\t\t$inf\n"; @@ -62,6 +65,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"; +$att = $rig->{caps}->{attenuator}; +print "Attenuators:\t\t@$att\n"; + print "\nSending Morse, '73'\n"; $rig->send_morse($Hamlib::RIG_VFO_A, "73"); diff --git a/bindings/pytest.py b/bindings/pytest.py index 552a926d1..05a9f81b4 100755 --- a/bindings/pytest.py +++ b/bindings/pytest.py @@ -66,6 +66,7 @@ def StartUp (): print "get_channel status:\t",my_rig.error_status print "VFO:\t\t\t",Hamlib.rig_strvfo(chan.vfo),", ",chan.freq + print "Attenuators:\t\t", my_rig.caps.attenuator print "\nSending Morse, '73'" my_rig.send_morse(Hamlib.RIG_VFO_A, "73") diff --git a/bindings/tcltest.tcl b/bindings/tcltest.tcl index c5dd223f7..722fe279d 100755 --- a/bindings/tcltest.tcl +++ b/bindings/tcltest.tcl @@ -36,6 +36,14 @@ puts "ITU_region:\t[$state cget -itu_region]" # The following works well also # puts ITU_region:[[my_rig cget -state] cget -itu_region] +set rigcaps [my_rig cget -caps] +#set model [$rigcaps cget -model_name] +puts "Model:\t\t[$rigcaps cget -model_name]" +puts "Manufacturer:\t\t[$rigcaps cget -mfg_name]" +puts "Backend version:\t[$rigcaps cget -version]" +puts "Backend license:\t[$rigcaps cget -copyright]" +puts "Attenuators:\t[$rigcaps cget -attenuator]" + puts "getinfo:\t[my_rig get_info]" my_rig set_level "VOX" 1