kopia lustrzana https://github.com/Hamlib/Hamlib
deprecated, use swig bindings/ instead
git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@1252 7ae35d74-ebe9-4afe-98af-79ac388436b8Hamlib-1.1.4
rodzic
d2bede454c
commit
59b81dfa18
|
@ -1,6 +0,0 @@
|
|||
Revision history for Perl extension Hamlib.
|
||||
|
||||
0.01 Sat Feb 9 22:12:07 2002
|
||||
- original version; created by h2xs 1.21 with options
|
||||
-Oax -n Hamlib -p rig_ -o '^[R]IG \*$' -F -I../../include rig.h
|
||||
|
715
perl/Hamlib.pm
715
perl/Hamlib.pm
|
@ -1,715 +0,0 @@
|
|||
package Hamlib;
|
||||
|
||||
# Copyright 2002 Stephane Fillod. See accompanying README file for
|
||||
# usage information
|
||||
|
||||
use 5.006;
|
||||
use strict;
|
||||
use warnings;
|
||||
use Errno;
|
||||
use Carp;
|
||||
|
||||
require Exporter;
|
||||
require DynaLoader;
|
||||
use AutoLoader;
|
||||
#use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $AUTOLOAD);
|
||||
our $VERSION = '0.02';
|
||||
|
||||
our @ISA = qw(Exporter DynaLoader);
|
||||
|
||||
# Items to export into callers namespace by default. Note: do not export
|
||||
# names by default without a very good reason. Use EXPORT_OK instead.
|
||||
# Do not simply export all your public functions/methods/constants.
|
||||
|
||||
# This allows declaration use Hamlib ':all';
|
||||
# If you do not need this, moving things directly into @EXPORT or @EXPORT_OK
|
||||
# will save memory.
|
||||
our %EXPORT_TAGS = ( 'ann' => [ qw(
|
||||
RIG_ANN_ALL
|
||||
RIG_ANN_FREQ
|
||||
RIG_ANN_NONE
|
||||
RIG_ANN_OFF
|
||||
RIG_ANN_RXMODE
|
||||
) ] ,
|
||||
'conf' => [ qw(
|
||||
RIG_CONF_CHECKBUTTON
|
||||
RIG_CONF_COMBO
|
||||
RIG_CONF_NUMERIC
|
||||
RIG_CONF_STRING
|
||||
) ] ,
|
||||
'err_code' => [ qw(
|
||||
RIG_OK
|
||||
RIG_ECONF
|
||||
RIG_EINTERNAL
|
||||
RIG_EINVAL
|
||||
RIG_EIO
|
||||
RIG_ENAVAIL
|
||||
RIG_ENIMPL
|
||||
RIG_ENOMEM
|
||||
RIG_ENTARGET
|
||||
RIG_EPROTO
|
||||
RIG_ERJCTED
|
||||
RIG_ETIMEOUT
|
||||
RIG_ETRUNC
|
||||
) ] ,
|
||||
'flag' => [ qw(
|
||||
RIG_FLAG_APRS
|
||||
RIG_FLAG_COMPUTER
|
||||
RIG_FLAG_DXCLUSTER
|
||||
RIG_FLAG_HANDHELD
|
||||
RIG_FLAG_MOBILE
|
||||
RIG_FLAG_RECEIVER
|
||||
RIG_FLAG_SCANNER
|
||||
RIG_FLAG_TNC
|
||||
RIG_FLAG_TRANSCEIVER
|
||||
RIG_FLAG_TRANSMITTER
|
||||
RIG_FLAG_TRUNKING
|
||||
) ] ,
|
||||
'func' => [ qw(
|
||||
RIG_FUNC_ABM
|
||||
RIG_FUNC_AIP
|
||||
RIG_FUNC_ANF
|
||||
RIG_FUNC_APF
|
||||
RIG_FUNC_ARO
|
||||
RIG_FUNC_BC
|
||||
RIG_FUNC_COMP
|
||||
RIG_FUNC_FAGC
|
||||
RIG_FUNC_FBKIN
|
||||
RIG_FUNC_LMP
|
||||
RIG_FUNC_LOCK
|
||||
RIG_FUNC_MBC
|
||||
RIG_FUNC_MN
|
||||
RIG_FUNC_MON
|
||||
RIG_FUNC_MUTE
|
||||
RIG_FUNC_NB
|
||||
RIG_FUNC_NONE
|
||||
RIG_FUNC_NR
|
||||
RIG_FUNC_REV
|
||||
RIG_FUNC_RNF
|
||||
RIG_FUNC_SBKIN
|
||||
RIG_FUNC_SQL
|
||||
RIG_FUNC_TONE
|
||||
RIG_FUNC_TSQL
|
||||
RIG_FUNC_VOX
|
||||
RIG_FUNC_VSC
|
||||
) ] ,
|
||||
'itu_region' => [ qw(
|
||||
RIG_ITU_REGION1
|
||||
RIG_ITU_REGION2
|
||||
RIG_ITU_REGION3
|
||||
) ] ,
|
||||
'level' => [ qw(
|
||||
RIG_LEVEL_AF
|
||||
RIG_LEVEL_AGC
|
||||
RIG_LEVEL_ALC
|
||||
RIG_LEVEL_APF
|
||||
RIG_LEVEL_ATT
|
||||
RIG_LEVEL_BALANCE
|
||||
RIG_LEVEL_BKINDL
|
||||
RIG_LEVEL_COMP
|
||||
RIG_LEVEL_CWPITCH
|
||||
RIG_LEVEL_FLOAT_LIST
|
||||
RIG_LEVEL_IF
|
||||
RIG_LEVEL_KEYSPD
|
||||
RIG_LEVEL_METER
|
||||
RIG_LEVEL_MICGAIN
|
||||
RIG_LEVEL_NONE
|
||||
RIG_LEVEL_NOTCHF
|
||||
RIG_LEVEL_NR
|
||||
RIG_LEVEL_PBT_IN
|
||||
RIG_LEVEL_PBT_OUT
|
||||
RIG_LEVEL_PREAMP
|
||||
RIG_LEVEL_READONLY_LIST
|
||||
RIG_LEVEL_RF
|
||||
RIG_LEVEL_RFPOWER
|
||||
RIG_LEVEL_SQL
|
||||
RIG_LEVEL_SQLSTAT
|
||||
RIG_LEVEL_STRENGTH
|
||||
RIG_LEVEL_SWR
|
||||
RIG_LEVEL_VOX
|
||||
) ] ,
|
||||
'mode' => [ qw(
|
||||
RIG_MODE_AM
|
||||
RIG_MODE_CW
|
||||
RIG_MODE_FM
|
||||
RIG_MODE_LSB
|
||||
RIG_MODE_NONE
|
||||
RIG_MODE_RTTY
|
||||
RIG_MODE_SSB
|
||||
RIG_MODE_USB
|
||||
RIG_MODE_WFM
|
||||
) ] ,
|
||||
'vfo_op' => [ qw(
|
||||
RIG_OP_BAND_DOWN
|
||||
RIG_OP_BAND_UP
|
||||
RIG_OP_CPY
|
||||
RIG_OP_DOWN
|
||||
RIG_OP_FROM_VFO
|
||||
RIG_OP_LEFT
|
||||
RIG_OP_MCL
|
||||
RIG_OP_NONE
|
||||
RIG_OP_RIGHT
|
||||
RIG_OP_TO_VFO
|
||||
RIG_OP_UP
|
||||
RIG_OP_XCHG
|
||||
) ] ,
|
||||
'parm' => [ qw(
|
||||
RIG_PARM_ANN
|
||||
RIG_PARM_APO
|
||||
RIG_PARM_BACKLIGHT
|
||||
RIG_PARM_BAT
|
||||
RIG_PARM_BEEP
|
||||
RIG_PARM_FLOAT_LIST
|
||||
RIG_PARM_NONE
|
||||
RIG_PARM_READONLY_LIST
|
||||
RIG_PARM_TIME
|
||||
) ] ,
|
||||
'scan' => [ qw(
|
||||
RIG_SCAN_DELTA
|
||||
RIG_SCAN_MEM
|
||||
RIG_SCAN_NONE
|
||||
RIG_SCAN_PRIO
|
||||
RIG_SCAN_PROG
|
||||
RIG_SCAN_SLCT
|
||||
RIG_SCAN_STOP
|
||||
) ] ,
|
||||
'trn' => [ qw(
|
||||
RIG_TRN_OFF
|
||||
RIG_TRN_POLL
|
||||
RIG_TRN_RIG
|
||||
) ] ,
|
||||
'type' => [ qw(
|
||||
RIG_TYPE_COMPUTER
|
||||
RIG_TYPE_HANDHELD
|
||||
RIG_TYPE_MASK
|
||||
RIG_TYPE_MOBILE
|
||||
RIG_TYPE_OTHER
|
||||
RIG_TYPE_PCRECEIVER
|
||||
RIG_TYPE_RECEIVER
|
||||
RIG_TYPE_SCANNER
|
||||
RIG_TYPE_TRANSCEIVER
|
||||
RIG_TYPE_TRUNKSCANNER
|
||||
) ] ,
|
||||
'vfo' => [ qw(
|
||||
RIG_VFO1
|
||||
RIG_VFO2
|
||||
RIG_VFO_A
|
||||
RIG_VFO_ALL
|
||||
RIG_VFO_B
|
||||
RIG_VFO_C
|
||||
RIG_VFO_CURR
|
||||
RIG_VFO_MAIN
|
||||
RIG_VFO_MEM
|
||||
RIG_VFO_NONE
|
||||
RIG_VFO_SUB
|
||||
RIG_VFO_VFO
|
||||
) ] );
|
||||
|
||||
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'vfo'} } );
|
||||
|
||||
our @EXPORT = qw(
|
||||
RIG_ANN_ALL
|
||||
RIG_ANN_FREQ
|
||||
RIG_ANN_NONE
|
||||
RIG_ANN_OFF
|
||||
RIG_ANN_RXMODE
|
||||
RIG_CONF_CHECKBUTTON
|
||||
RIG_CONF_COMBO
|
||||
RIG_CONF_NUMERIC
|
||||
RIG_CONF_STRING
|
||||
RIG_OK
|
||||
RIG_ECONF
|
||||
RIG_EINTERNAL
|
||||
RIG_EINVAL
|
||||
RIG_EIO
|
||||
RIG_ENAVAIL
|
||||
RIG_ENIMPL
|
||||
RIG_ENOMEM
|
||||
RIG_ENTARGET
|
||||
RIG_EPROTO
|
||||
RIG_ERJCTED
|
||||
RIG_ETIMEOUT
|
||||
RIG_ETRUNC
|
||||
RIG_FLAG_APRS
|
||||
RIG_FLAG_COMPUTER
|
||||
RIG_FLAG_DXCLUSTER
|
||||
RIG_FLAG_HANDHELD
|
||||
RIG_FLAG_MOBILE
|
||||
RIG_FLAG_RECEIVER
|
||||
RIG_FLAG_SCANNER
|
||||
RIG_FLAG_TNC
|
||||
RIG_FLAG_TRANSCEIVER
|
||||
RIG_FLAG_TRANSMITTER
|
||||
RIG_FLAG_TRUNKING
|
||||
RIG_FREQ_NONE
|
||||
RIG_FUNC_ABM
|
||||
RIG_FUNC_AIP
|
||||
RIG_FUNC_ANF
|
||||
RIG_FUNC_APF
|
||||
RIG_FUNC_ARO
|
||||
RIG_FUNC_BC
|
||||
RIG_FUNC_COMP
|
||||
RIG_FUNC_FAGC
|
||||
RIG_FUNC_FBKIN
|
||||
RIG_FUNC_LMP
|
||||
RIG_FUNC_LOCK
|
||||
RIG_FUNC_MBC
|
||||
RIG_FUNC_MN
|
||||
RIG_FUNC_MON
|
||||
RIG_FUNC_MUTE
|
||||
RIG_FUNC_NB
|
||||
RIG_FUNC_NONE
|
||||
RIG_FUNC_NR
|
||||
RIG_FUNC_REV
|
||||
RIG_FUNC_RNF
|
||||
RIG_FUNC_SBKIN
|
||||
RIG_FUNC_SQL
|
||||
RIG_FUNC_TONE
|
||||
RIG_FUNC_TSQL
|
||||
RIG_FUNC_VOX
|
||||
RIG_FUNC_VSC
|
||||
RIG_ITU_REGION1
|
||||
RIG_ITU_REGION2
|
||||
RIG_ITU_REGION3
|
||||
RIG_LEVEL_AF
|
||||
RIG_LEVEL_AGC
|
||||
RIG_LEVEL_ALC
|
||||
RIG_LEVEL_APF
|
||||
RIG_LEVEL_ATT
|
||||
RIG_LEVEL_BALANCE
|
||||
RIG_LEVEL_BKINDL
|
||||
RIG_LEVEL_COMP
|
||||
RIG_LEVEL_CWPITCH
|
||||
RIG_LEVEL_FLOAT_LIST
|
||||
RIG_LEVEL_IF
|
||||
RIG_LEVEL_KEYSPD
|
||||
RIG_LEVEL_METER
|
||||
RIG_LEVEL_MICGAIN
|
||||
RIG_LEVEL_NONE
|
||||
RIG_LEVEL_NOTCHF
|
||||
RIG_LEVEL_NR
|
||||
RIG_LEVEL_PBT_IN
|
||||
RIG_LEVEL_PBT_OUT
|
||||
RIG_LEVEL_PREAMP
|
||||
RIG_LEVEL_READONLY_LIST
|
||||
RIG_LEVEL_RF
|
||||
RIG_LEVEL_RFPOWER
|
||||
RIG_LEVEL_SQL
|
||||
RIG_LEVEL_SQLSTAT
|
||||
RIG_LEVEL_STRENGTH
|
||||
RIG_LEVEL_SWR
|
||||
RIG_LEVEL_VOX
|
||||
RIG_MODE_AM
|
||||
RIG_MODE_CW
|
||||
RIG_MODE_FM
|
||||
RIG_MODE_LSB
|
||||
RIG_MODE_NONE
|
||||
RIG_MODE_RTTY
|
||||
RIG_MODE_SSB
|
||||
RIG_MODE_USB
|
||||
RIG_MODE_WFM
|
||||
RIG_OP_BAND_DOWN
|
||||
RIG_OP_BAND_UP
|
||||
RIG_OP_CPY
|
||||
RIG_OP_DOWN
|
||||
RIG_OP_FROM_VFO
|
||||
RIG_OP_LEFT
|
||||
RIG_OP_MCL
|
||||
RIG_OP_NONE
|
||||
RIG_OP_RIGHT
|
||||
RIG_OP_TO_VFO
|
||||
RIG_OP_UP
|
||||
RIG_OP_XCHG
|
||||
RIG_PARM_ANN
|
||||
RIG_PARM_APO
|
||||
RIG_PARM_BACKLIGHT
|
||||
RIG_PARM_BAT
|
||||
RIG_PARM_BEEP
|
||||
RIG_PARM_FLOAT_LIST
|
||||
RIG_PARM_NONE
|
||||
RIG_PARM_READONLY_LIST
|
||||
RIG_PARM_TIME
|
||||
RIG_PASSBAND_NORMAL
|
||||
RIG_SCAN_DELTA
|
||||
RIG_SCAN_MEM
|
||||
RIG_SCAN_NONE
|
||||
RIG_SCAN_PRIO
|
||||
RIG_SCAN_PROG
|
||||
RIG_SCAN_SLCT
|
||||
RIG_SCAN_STOP
|
||||
RIG_SETTING_MAX
|
||||
RIG_TARGETABLE_ALL
|
||||
RIG_TARGETABLE_FREQ
|
||||
RIG_TARGETABLE_MODE
|
||||
RIG_TARGETABLE_NONE
|
||||
RIG_TRN_OFF
|
||||
RIG_TRN_POLL
|
||||
RIG_TRN_RIG
|
||||
RIG_TYPE_COMPUTER
|
||||
RIG_TYPE_HANDHELD
|
||||
RIG_TYPE_MASK
|
||||
RIG_TYPE_MOBILE
|
||||
RIG_TYPE_OTHER
|
||||
RIG_TYPE_PCRECEIVER
|
||||
RIG_TYPE_RECEIVER
|
||||
RIG_TYPE_SCANNER
|
||||
RIG_TYPE_TRANSCEIVER
|
||||
RIG_TYPE_TRUNKSCANNER
|
||||
RIG_VFO_A
|
||||
RIG_VFO_B
|
||||
RIG_VFO_C
|
||||
RIG_VFO_ALL
|
||||
RIG_VFO_CURR
|
||||
RIG_VFO_MAIN
|
||||
RIG_VFO_MEM
|
||||
RIG_VFO_NONE
|
||||
RIG_VFO_SUB
|
||||
RIG_VFO_VFO
|
||||
);
|
||||
|
||||
sub AUTOLOAD {
|
||||
# This AUTOLOAD is used to 'autoload' constants from the constant()
|
||||
# XS function. If a constant is not found then control is passed
|
||||
# to the AUTOLOAD in AutoLoader.
|
||||
|
||||
my $constname;
|
||||
our $AUTOLOAD;
|
||||
($constname = $AUTOLOAD) =~ s/.*:://;
|
||||
croak "& not defined" if $constname eq 'constant';
|
||||
my $val = constant($constname, @_ ? $_[0] : 0);
|
||||
if ($! != 0) {
|
||||
if ($!{EINVAL}) {
|
||||
$AutoLoader::AUTOLOAD = $AUTOLOAD;
|
||||
goto &AutoLoader::AUTOLOAD;
|
||||
}
|
||||
else {
|
||||
croak "Your vendor has not defined Hamlib macro $constname";
|
||||
}
|
||||
}
|
||||
{
|
||||
no strict 'refs';
|
||||
# Fixed between 5.005_53 and 5.005_61
|
||||
if ($] >= 5.00561) {
|
||||
*$AUTOLOAD = sub () { $val };
|
||||
}
|
||||
else {
|
||||
*$AUTOLOAD = sub { $val };
|
||||
}
|
||||
}
|
||||
goto &$AUTOLOAD;
|
||||
}
|
||||
|
||||
bootstrap Hamlib $VERSION;
|
||||
|
||||
# Preloaded methods go here.
|
||||
|
||||
|
||||
# Autoload methods go after =cut, and are processed by the autosplit program.
|
||||
|
||||
1;
|
||||
__END__
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Hamlib - Perl extension for Hamlib
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
use Hamlib;
|
||||
blah blah blah
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Stub documentation for Hamlib, created by h2xs. It looks like the
|
||||
author of the extension was negligent enough to leave the stub
|
||||
unedited.
|
||||
|
||||
Blah blah blah.
|
||||
|
||||
=head2 EXPORT
|
||||
|
||||
None by default.
|
||||
|
||||
=head2 Exportable constants
|
||||
|
||||
CHANLSTSIZ
|
||||
FILPATHLEN
|
||||
FLTLSTSIZ
|
||||
FRQRANGESIZ
|
||||
MAXCHANDESC
|
||||
MAXDBLSTSIZ
|
||||
RIGNAMSIZ
|
||||
RIGVERSIZ
|
||||
RIG_ANN_ALL
|
||||
RIG_ANN_FREQ
|
||||
RIG_ANN_NONE
|
||||
RIG_ANN_OFF
|
||||
RIG_ANN_RXMODE
|
||||
RIG_COMBO_MAX
|
||||
RIG_CONF_CHECKBUTTON
|
||||
RIG_CONF_COMBO
|
||||
RIG_CONF_NUMERIC
|
||||
RIG_CONF_STRING
|
||||
RIG_CTRL_MAIN
|
||||
RIG_CTRL_SUB
|
||||
RIG_ECONF
|
||||
RIG_EINTERNAL
|
||||
RIG_EINVAL
|
||||
RIG_EIO
|
||||
RIG_ENAVAIL
|
||||
RIG_ENIMPL
|
||||
RIG_ENOMEM
|
||||
RIG_ENTARGET
|
||||
RIG_EPROTO
|
||||
RIG_ERJCTED
|
||||
RIG_ETIMEOUT
|
||||
RIG_ETRUNC
|
||||
RIG_FLAG_APRS
|
||||
RIG_FLAG_COMPUTER
|
||||
RIG_FLAG_DXCLUSTER
|
||||
RIG_FLAG_HANDHELD
|
||||
RIG_FLAG_MOBILE
|
||||
RIG_FLAG_RECEIVER
|
||||
RIG_FLAG_SCANNER
|
||||
RIG_FLAG_TNC
|
||||
RIG_FLAG_TRANSCEIVER
|
||||
RIG_FLAG_TRANSMITTER
|
||||
RIG_FLAG_TRUNKING
|
||||
RIG_FREQ_NONE
|
||||
RIG_FUNC_ABM
|
||||
RIG_FUNC_AIP
|
||||
RIG_FUNC_ANF
|
||||
RIG_FUNC_APF
|
||||
RIG_FUNC_ARO
|
||||
RIG_FUNC_BC
|
||||
RIG_FUNC_COMP
|
||||
RIG_FUNC_FAGC
|
||||
RIG_FUNC_FBKIN
|
||||
RIG_FUNC_LMP
|
||||
RIG_FUNC_LOCK
|
||||
RIG_FUNC_MBC
|
||||
RIG_FUNC_MN
|
||||
RIG_FUNC_MON
|
||||
RIG_FUNC_MUTE
|
||||
RIG_FUNC_NB
|
||||
RIG_FUNC_NONE
|
||||
RIG_FUNC_NR
|
||||
RIG_FUNC_REV
|
||||
RIG_FUNC_RNF
|
||||
RIG_FUNC_SBKIN
|
||||
RIG_FUNC_SQL
|
||||
RIG_FUNC_TONE
|
||||
RIG_FUNC_TSQL
|
||||
RIG_FUNC_VOX
|
||||
RIG_FUNC_VSC
|
||||
RIG_ITU_REGION1
|
||||
RIG_ITU_REGION2
|
||||
RIG_ITU_REGION3
|
||||
RIG_LEVEL_AF
|
||||
RIG_LEVEL_AGC
|
||||
RIG_LEVEL_ALC
|
||||
RIG_LEVEL_APF
|
||||
RIG_LEVEL_ATT
|
||||
RIG_LEVEL_BALANCE
|
||||
RIG_LEVEL_BKINDL
|
||||
RIG_LEVEL_COMP
|
||||
RIG_LEVEL_CWPITCH
|
||||
RIG_LEVEL_FLOAT_LIST
|
||||
RIG_LEVEL_IF
|
||||
RIG_LEVEL_KEYSPD
|
||||
RIG_LEVEL_METER
|
||||
RIG_LEVEL_MICGAIN
|
||||
RIG_LEVEL_NONE
|
||||
RIG_LEVEL_NOTCHF
|
||||
RIG_LEVEL_NR
|
||||
RIG_LEVEL_PBT_IN
|
||||
RIG_LEVEL_PBT_OUT
|
||||
RIG_LEVEL_PREAMP
|
||||
RIG_LEVEL_READONLY_LIST
|
||||
RIG_LEVEL_RF
|
||||
RIG_LEVEL_RFPOWER
|
||||
RIG_LEVEL_SQL
|
||||
RIG_LEVEL_SQLSTAT
|
||||
RIG_LEVEL_STRENGTH
|
||||
RIG_LEVEL_SWR
|
||||
RIG_LEVEL_VOX
|
||||
RIG_MODE_AM
|
||||
RIG_MODE_CW
|
||||
RIG_MODE_FM
|
||||
RIG_MODE_LSB
|
||||
RIG_MODE_NONE
|
||||
RIG_MODE_RTTY
|
||||
RIG_MODE_SSB
|
||||
RIG_MODE_USB
|
||||
RIG_MODE_WFM
|
||||
RIG_OK
|
||||
RIG_OP_BAND_DOWN
|
||||
RIG_OP_BAND_UP
|
||||
RIG_OP_CPY
|
||||
RIG_OP_DOWN
|
||||
RIG_OP_FROM_VFO
|
||||
RIG_OP_LEFT
|
||||
RIG_OP_MCL
|
||||
RIG_OP_NONE
|
||||
RIG_OP_RIGHT
|
||||
RIG_OP_TO_VFO
|
||||
RIG_OP_UP
|
||||
RIG_OP_XCHG
|
||||
RIG_PARM_ANN
|
||||
RIG_PARM_APO
|
||||
RIG_PARM_BACKLIGHT
|
||||
RIG_PARM_BAT
|
||||
RIG_PARM_BEEP
|
||||
RIG_PARM_FLOAT_LIST
|
||||
RIG_PARM_NONE
|
||||
RIG_PARM_READONLY_LIST
|
||||
RIG_PARM_TIME
|
||||
RIG_PASSBAND_NORMAL
|
||||
RIG_SCAN_DELTA
|
||||
RIG_SCAN_MEM
|
||||
RIG_SCAN_NONE
|
||||
RIG_SCAN_PRIO
|
||||
RIG_SCAN_PROG
|
||||
RIG_SCAN_SLCT
|
||||
RIG_SCAN_STOP
|
||||
RIG_SETTING_MAX
|
||||
RIG_TARGETABLE_ALL
|
||||
RIG_TARGETABLE_FREQ
|
||||
RIG_TARGETABLE_MODE
|
||||
RIG_TARGETABLE_NONE
|
||||
RIG_TRN_OFF
|
||||
RIG_TRN_POLL
|
||||
RIG_TRN_RIG
|
||||
RIG_TYPE_COMPUTER
|
||||
RIG_TYPE_HANDHELD
|
||||
RIG_TYPE_MASK
|
||||
RIG_TYPE_MOBILE
|
||||
RIG_TYPE_OTHER
|
||||
RIG_TYPE_PCRECEIVER
|
||||
RIG_TYPE_RECEIVER
|
||||
RIG_TYPE_SCANNER
|
||||
RIG_TYPE_TRANSCEIVER
|
||||
RIG_TYPE_TRUNKSCANNER
|
||||
RIG_VFO1
|
||||
RIG_VFO2
|
||||
RIG_VFO_A
|
||||
RIG_VFO_ALL
|
||||
RIG_VFO_B
|
||||
RIG_VFO_C
|
||||
RIG_VFO_CURR
|
||||
RIG_VFO_MAIN
|
||||
RIG_VFO_MEM
|
||||
RIG_VFO_NONE
|
||||
RIG_VFO_SUB
|
||||
RIG_VFO_VFO
|
||||
|
||||
=head2 Exportable functions
|
||||
|
||||
int rig_check_backend (rig_model_t rig_model)
|
||||
int rig_cleanup (RIG *rig)
|
||||
int rig_close (RIG *rig)
|
||||
const struct confparams* rig_confparam_lookup (RIG *rig, const char *name)
|
||||
void rig_debug (enum rig_debug_level_e debug_level, const char *fmt, ...)
|
||||
int rig_get_ant (RIG *rig, vfo_t vfo, ant_t *ant)
|
||||
const struct rig_caps * rig_get_caps (rig_model_t rig_model)
|
||||
int rig_get_channel (RIG *rig, channel_t *chan)
|
||||
int rig_get_conf (RIG *rig, token_t token, char *val)
|
||||
int rig_get_ctcss_sql (RIG *rig, vfo_t vfo, tone_t *tone)
|
||||
int rig_get_ctcss_tone (RIG *rig, vfo_t vfo, tone_t *tone)
|
||||
int rig_get_dcd (RIG *rig, vfo_t vfo, dcd_t *dcd)
|
||||
int rig_get_dcs_code (RIG *rig, vfo_t vfo, tone_t *code)
|
||||
int rig_get_dcs_sql (RIG *rig, vfo_t vfo, tone_t *code)
|
||||
int rig_get_freq (RIG *rig, vfo_t vfo, freq_t *freq)
|
||||
int rig_get_func (RIG *rig, vfo_t vfo, setting_t func, int *status)
|
||||
const char * rig_get_info (RIG *rig)
|
||||
int rig_get_level (RIG *rig, vfo_t vfo, setting_t level, value_t *val)
|
||||
int rig_get_mem (RIG *rig, vfo_t vfo, int *ch)
|
||||
int rig_get_mode (RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
|
||||
int rig_get_parm (RIG *rig, setting_t parm, value_t *val)
|
||||
int rig_get_powerstat (RIG *rig, powerstat_t *status)
|
||||
int rig_get_ptt (RIG *rig, vfo_t vfo, ptt_t *ptt)
|
||||
const freq_range_t * rig_get_range (const freq_range_t *range_list, freq_t freq, rmode_t mode)
|
||||
shortfreq_t rig_get_resolution (RIG *rig, rmode_t mode)
|
||||
int rig_get_rit (RIG *rig, vfo_t vfo, shortfreq_t *rit)
|
||||
int rig_get_rptr_offs (RIG *rig, vfo_t vfo, shortfreq_t *rptr_offs)
|
||||
int rig_get_rptr_shift (RIG *rig, vfo_t vfo, rptr_shift_t *rptr_shift)
|
||||
int rig_get_split (RIG *rig, vfo_t vfo, split_t *split)
|
||||
int rig_get_split_freq (RIG *rig, vfo_t vfo, freq_t *tx_freq)
|
||||
int rig_get_split_mode (RIG *rig, vfo_t vfo, rmode_t *tx_mode, pbwidth_t *tx_width)
|
||||
int rig_get_trn (RIG *rig, int *trn)
|
||||
int rig_get_ts (RIG *rig, vfo_t vfo, shortfreq_t *ts)
|
||||
int rig_get_vfo (RIG *rig, vfo_t *vfo)
|
||||
int rig_get_xit (RIG *rig, vfo_t vfo, shortfreq_t *xit)
|
||||
setting_t rig_has_get_func (RIG *rig, setting_t func)
|
||||
setting_t rig_has_get_level (RIG *rig, setting_t level)
|
||||
setting_t rig_has_get_parm (RIG *rig, setting_t parm)
|
||||
scan_t rig_has_scan (RIG *rig, scan_t scan)
|
||||
setting_t rig_has_set_func (RIG *rig, setting_t func)
|
||||
setting_t rig_has_set_level (RIG *rig, setting_t level)
|
||||
setting_t rig_has_set_parm (RIG *rig, setting_t parm)
|
||||
vfo_op_t rig_has_vfo_op (RIG *rig, vfo_op_t op)
|
||||
RIG * rig_init (rig_model_t rig_model)
|
||||
int rig_list_foreach (int (*cfunc)(const struct rig_caps*, void* ), void* data)
|
||||
int rig_load_all_backends ()
|
||||
int rig_load_backend (const char *be_name)
|
||||
int rig_mW2power (RIG *rig, float *power, unsigned int mwpower, freq_t freq, rmode_t mode)
|
||||
int rig_need_debug (enum rig_debug_level_e debug_level)
|
||||
int rig_open (RIG *rig)
|
||||
pbwidth_t rig_passband_narrow (RIG *rig, rmode_t mode)
|
||||
pbwidth_t rig_passband_normal (RIG *rig, rmode_t mode)
|
||||
pbwidth_t rig_passband_wide (RIG *rig, rmode_t mode)
|
||||
int rig_power2mW (RIG *rig, unsigned int *mwpower, float power, freq_t freq, rmode_t mode)
|
||||
rig_model_t rig_probe (port_t *p)
|
||||
rig_model_t rig_probe_all (port_t *p)
|
||||
int rig_recv_dtmf (RIG *rig, vfo_t vfo, char *digits, int *length)
|
||||
int rig_register (const struct rig_caps *caps)
|
||||
int rig_reset (RIG *rig, reset_t reset)
|
||||
int rig_restore_channel (RIG *rig, const channel_t *chan)
|
||||
int rig_save_channel (RIG *rig, channel_t *chan)
|
||||
int rig_scan (RIG *rig, vfo_t vfo, scan_t scan, int ch)
|
||||
int rig_send_dtmf (RIG *rig, vfo_t vfo, const char *digits)
|
||||
int rig_send_morse (RIG *rig, vfo_t vfo, const char *msg)
|
||||
int rig_set_ant (RIG *rig, vfo_t vfo, ant_t ant)
|
||||
int rig_set_bank (RIG *rig, vfo_t vfo, int bank)
|
||||
int rig_set_channel (RIG *rig, const channel_t *chan)
|
||||
int rig_set_conf (RIG *rig, token_t token, const char *val)
|
||||
int rig_set_ctcss_sql (RIG *rig, vfo_t vfo, tone_t tone)
|
||||
int rig_set_ctcss_tone (RIG *rig, vfo_t vfo, tone_t tone)
|
||||
int rig_set_dcs_code (RIG *rig, vfo_t vfo, tone_t code)
|
||||
int rig_set_dcs_sql (RIG *rig, vfo_t vfo, tone_t code)
|
||||
void rig_set_debug (enum rig_debug_level_e debug_level)
|
||||
int rig_set_freq (RIG *rig, vfo_t vfo, freq_t freq)
|
||||
int rig_set_func (RIG *rig, vfo_t vfo, setting_t func, int status)
|
||||
int rig_set_level (RIG *rig, vfo_t vfo, setting_t level, value_t val)
|
||||
int rig_set_mem (RIG *rig, vfo_t vfo, int ch)
|
||||
int rig_set_mode (RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
|
||||
int rig_set_parm (RIG *rig, setting_t parm, value_t val)
|
||||
int rig_set_powerstat (RIG *rig, powerstat_t status)
|
||||
int rig_set_ptt (RIG *rig, vfo_t vfo, ptt_t ptt)
|
||||
int rig_set_rit (RIG *rig, vfo_t vfo, shortfreq_t rit)
|
||||
int rig_set_rptr_offs (RIG *rig, vfo_t vfo, shortfreq_t rptr_offs)
|
||||
int rig_set_rptr_shift (RIG *rig, vfo_t vfo, rptr_shift_t rptr_shift)
|
||||
int rig_set_split (RIG *rig, vfo_t vfo, split_t split)
|
||||
int rig_set_split_freq (RIG *rig, vfo_t vfo, freq_t tx_freq)
|
||||
int rig_set_split_mode (RIG *rig, vfo_t vfo, rmode_t tx_mode, pbwidth_t tx_width)
|
||||
int rig_set_trn (RIG *rig, int trn)
|
||||
int rig_set_ts (RIG *rig, vfo_t vfo, shortfreq_t ts)
|
||||
int rig_set_vfo (RIG *rig, vfo_t vfo)
|
||||
int rig_set_xit (RIG *rig, vfo_t vfo, shortfreq_t xit)
|
||||
int rig_setting2idx (setting_t s)
|
||||
int rig_token_foreach (RIG *rig, int (*cfunc)(const struct confparams *, void* ), void* data)
|
||||
token_t rig_token_lookup (RIG *rig, const char *name)
|
||||
int rig_unregister (rig_model_t rig_model)
|
||||
int rig_vfo_op (RIG *rig, vfo_t vfo, vfo_op_t op)
|
||||
const char * rigerror (int errnum)
|
||||
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
A. U. Thor, E<lt>a.u.thor@a.galaxy.far.far.awayE<gt>
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
L<perl>.
|
||||
|
||||
=cut
|
3510
perl/Hamlib.xs
3510
perl/Hamlib.xs
Plik diff jest za duży
Load Diff
|
@ -1,8 +0,0 @@
|
|||
Changes
|
||||
Hamlib.pm
|
||||
Hamlib.xs
|
||||
Makefile.PL
|
||||
MANIFEST
|
||||
README
|
||||
test.pl
|
||||
typemap
|
35
perl/README
35
perl/README
|
@ -1,35 +0,0 @@
|
|||
Hamlib version 0.01
|
||||
===================
|
||||
|
||||
The README is used to introduce the module and provide instructions on
|
||||
how to install the module, any machine dependencies it may have (for
|
||||
example C compilers and installed libraries) and any other information
|
||||
that should be provided before the module is installed.
|
||||
|
||||
A README file is required for CPAN modules since CPAN extracts the
|
||||
README file from a module distribution so that people browsing the
|
||||
archive can use it get an idea of the modules uses. It is usually a
|
||||
good idea to provide version information here so that people can
|
||||
decide whether fixes for the module are worth downloading.
|
||||
|
||||
INSTALLATION
|
||||
|
||||
To install this module type the following:
|
||||
|
||||
perl Makefile.PL
|
||||
make
|
||||
make test
|
||||
make install
|
||||
|
||||
DEPENDENCIES
|
||||
|
||||
This module requires these other modules and libraries:
|
||||
|
||||
blah blah blah
|
||||
|
||||
COPYRIGHT AND LICENCE
|
||||
|
||||
Put the correct copyright and licence information here.
|
||||
|
||||
Copyright (C) 2002 A. U. Thor blah blah blah
|
||||
|
62
perl/test.pl
62
perl/test.pl
|
@ -1,62 +0,0 @@
|
|||
# Before `make install' is performed this script should be runnable with
|
||||
# `make test'. After `make install' it should work as `perl test.pl'
|
||||
|
||||
#########################
|
||||
|
||||
# change 'tests => 1' to 'tests => last_test_to_print';
|
||||
|
||||
use Test;
|
||||
BEGIN { plan tests => 12 };
|
||||
use Hamlib;
|
||||
ok(1); # If we made it this far, we're ok.
|
||||
|
||||
#########################
|
||||
|
||||
# Insert your test code below, the Test module is use()ed here so read
|
||||
# its man page ( perldoc Test ) for help writing this test script.
|
||||
|
||||
# 1 => RIG_MODEL_DUMMY
|
||||
|
||||
$rig = Hamlib::Rig::init(1);
|
||||
ok(defined $rig);
|
||||
|
||||
# set configuration parameter and readback
|
||||
$rig->set_conf("itu_region", "1");
|
||||
ok($rig->get_conf("itu_region") eq "1");
|
||||
|
||||
# open rig communication
|
||||
$rig->open();
|
||||
ok(1);
|
||||
|
||||
# Get some info from the rig, is available
|
||||
print "Info: " . $rig->get_info() . "\n";
|
||||
ok(1);
|
||||
|
||||
# Here's the plan. Select VFO A, check we got it.
|
||||
# Then tune to 50.110 MHz, and set USB mode.
|
||||
|
||||
$rig->set_vfo(RIG_VFO_A);
|
||||
ok(1);
|
||||
|
||||
ok($rig->get_vfo() == RIG_VFO_A);
|
||||
|
||||
$rig->set_freq(50110000);
|
||||
ok(1);
|
||||
|
||||
ok($rig->get_freq() == 50110000);
|
||||
|
||||
$rig->set_mode(RIG_MODE_USB);
|
||||
ok(1);
|
||||
|
||||
my ($mode, $width) = $rig->get_mode();
|
||||
ok($mode == RIG_MODE_USB);
|
||||
|
||||
# CQ CQ ...
|
||||
|
||||
|
||||
# No propagation today on 6. Maybe tomorrow.
|
||||
$rig->close();
|
||||
ok(1);
|
||||
|
||||
# NB: destroy done automatically
|
||||
|
72
perl/typemap
72
perl/typemap
|
@ -1,72 +0,0 @@
|
|||
TYPEMAP
|
||||
Hamlib::Rig T_PTROBJ
|
||||
freq_t T_HAMLIB_QUAD
|
||||
const char * T_PV
|
||||
pbwidth_t T_IV
|
||||
rig_model_t T_IV
|
||||
rmode_t T_UV
|
||||
vfo_t T_IV
|
||||
|
||||
# will vanish one day..
|
||||
RIG * T_PTROBJ
|
||||
|
||||
# Following to be fixed:
|
||||
ant_t T_IV
|
||||
ant_t * T_PTROBJ
|
||||
channel_t * T_PTROBJ
|
||||
const channel_t * T_PTROBJ
|
||||
const freq_range_t * T_PTROBJ
|
||||
const struct confparams * T_PTROBJ
|
||||
const struct rig_caps * T_PTROBJ
|
||||
dcd_t * T_PTROBJ
|
||||
enum rig_debug_level_e T_PTROBJ
|
||||
float T_DOUBLE
|
||||
float * T_PTROBJ
|
||||
int ( * cfunc ) ( const struct confparams *, void * ) T_PTROBJ
|
||||
int ( * cfunc ) ( const struct rig_caps *, void * ) T_PTROBJ
|
||||
int * T_PTROBJ
|
||||
port_t * T_PTROBJ
|
||||
powerstat_t T_PTROBJ
|
||||
powerstat_t * T_PTROBJ
|
||||
ptt_t T_PTROBJ
|
||||
ptt_t * T_PTROBJ
|
||||
reset_t T_PTROBJ
|
||||
rptr_shift_t T_PTROBJ
|
||||
rptr_shift_t * T_PTROBJ
|
||||
scan_t T_IV
|
||||
setting_t T_HAMLIB_QUAD
|
||||
shortfreq_t T_IV
|
||||
shortfreq_t * T_PTROBJ
|
||||
split_t T_IV
|
||||
split_t * T_PTROBJ
|
||||
token_t T_IV
|
||||
tone_t T_UV
|
||||
tone_t * T_PTROBJ
|
||||
unsigned int * T_PTROBJ
|
||||
value_t T_OPAQUE_STRUCT
|
||||
value_t * T_PTROBJ
|
||||
vfo_op_t T_IV
|
||||
#############################################################################
|
||||
INPUT
|
||||
T_OPAQUE_STRUCT
|
||||
if (sv_derived_from($arg, \"${ntype}\")) {
|
||||
STRLEN len;
|
||||
char *s = SvPV((SV*)SvRV($arg), len);
|
||||
|
||||
if (len != sizeof($var))
|
||||
croak(\"Size %d of packed data != expected %d\",
|
||||
len, sizeof($var));
|
||||
$var = *($type *)s;
|
||||
}
|
||||
else
|
||||
croak(\"$var is not of type ${ntype}\")
|
||||
|
||||
T_HAMLIB_QUAD
|
||||
$var = ($type)SvNV($arg)
|
||||
#############################################################################
|
||||
OUTPUT
|
||||
T_OPAQUE_STRUCT
|
||||
sv_setref_pvn($arg, \"${ntype}\", (char *)&$var, sizeof($var));
|
||||
|
||||
T_HAMLIB_QUAD
|
||||
sv_setnv($arg, (NV)$var);
|
|
@ -1,12 +0,0 @@
|
|||
INCLUDES = @INCLUDES@ -I@TCL_SRC_DIR@/generic
|
||||
|
||||
lib_LTLIBRARIES = libhamlibtcl.la
|
||||
libhamlibtcl_la_SOURCES = hamlibtcl.c tclrig.c tclrot.c
|
||||
libhamlibtcl_la_LDFLAGS = -no-undefined -module -version-info 0:0:0 \
|
||||
@TCL_LIB_SPEC@
|
||||
libhamlibtcl_la_LIBADD = ../src/libhamlib.la
|
||||
|
||||
noinst_HEADERS = tclrig.h tclrot.h
|
||||
|
||||
noinst_SCRIPTS = tcltest.tcl
|
||||
EXTRA_DIST = tcltest.tcl
|
|
@ -1,54 +0,0 @@
|
|||
/*
|
||||
* Hamlib tcl/tk bindings - main file
|
||||
* Copyright (c) 2001,2002 by Stephane Fillod
|
||||
*
|
||||
* $Id: hamlibtcl.c,v 1.3 2002-01-22 00:53:01 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
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include <tcl.h>
|
||||
#include <hamlib/rig.h>
|
||||
#include <hamlib/rotator.h>
|
||||
#include <misc.h>
|
||||
|
||||
#include "tclrig.h"
|
||||
#include "tclrot.h"
|
||||
|
||||
|
||||
int Hamlib_Init(Tcl_Interp *interp)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if ((ret=Tcl_PkgProvide(interp, "Hamlib", "1.0")) != TCL_OK)
|
||||
return ret;
|
||||
|
||||
/* Register the commands in the package */
|
||||
|
||||
Tcl_CreateObjCommand(interp, "rig", DoRigLib,
|
||||
(ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
|
||||
|
||||
Tcl_CreateObjCommand(interp, "rot", DoRotLib,
|
||||
(ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
|
||||
|
||||
return TCL_OK;
|
||||
}
|
||||
|
1416
tcl/tclrig.c
1416
tcl/tclrig.c
Plik diff jest za duży
Load Diff
33
tcl/tclrig.h
33
tcl/tclrig.h
|
@ -1,33 +0,0 @@
|
|||
/*
|
||||
* Hamlib tcl/tk bindings - rig header
|
||||
* Copyright (c) 2001,2002 by Stephane Fillod
|
||||
*
|
||||
* $Id: tclrig.h,v 1.1 2002-01-22 00:34:48 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
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _TCLRIG_H
|
||||
#define _TCLRIG_H
|
||||
|
||||
#include <tcl.h>
|
||||
|
||||
extern int DoRig(ClientData clientData, Tcl_Interp *interp,
|
||||
int objc, Tcl_Obj *CONST objv[]);
|
||||
extern int DoRigLib(ClientData clientData, Tcl_Interp *interp,
|
||||
int objc, Tcl_Obj *CONST objv[]);
|
||||
|
||||
#endif /* _TCLRIG_H */
|
292
tcl/tclrot.c
292
tcl/tclrot.c
|
@ -1,292 +0,0 @@
|
|||
/*
|
||||
* Hamlib tcl/tk bindings - rotator
|
||||
* Copyright (c) 2001,2002 by Stephane Fillod
|
||||
*
|
||||
* $Id: tclrot.c,v 1.1 2002-01-22 00:34:48 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
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include <tcl.h>
|
||||
#include <hamlib/rotator.h>
|
||||
#include <misc.h>
|
||||
|
||||
#include "tclrot.h"
|
||||
|
||||
|
||||
#define ARG_IN1 0x01
|
||||
#define ARG_OUT1 0x02
|
||||
#define ARG_IN2 0x04
|
||||
#define ARG_OUT2 0x08
|
||||
#define ARG_IN3 0x10
|
||||
#define ARG_OUT3 0x20
|
||||
#define ARG_IN4 0x40
|
||||
#define ARG_OUT4 0x80
|
||||
|
||||
#define ARG_IN (ARG_IN1|ARG_IN2|ARG_IN3|ARG_IN4)
|
||||
#define ARG_OUT (ARG_OUT1|ARG_OUT2|ARG_OUT3|ARG_OUT4)
|
||||
|
||||
struct cmd_table {
|
||||
const char *name;
|
||||
int (*rot_routine)(ROT*, const struct cmd_table*,
|
||||
Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]);
|
||||
int flags;
|
||||
const char *arg1;
|
||||
const char *arg2;
|
||||
const char *arg3;
|
||||
};
|
||||
|
||||
#define declare_proto_rot(f) static int (f)(ROT *rot, \
|
||||
const struct cmd_table *cmd, \
|
||||
Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
|
||||
|
||||
declare_proto_rot(open);
|
||||
declare_proto_rot(close);
|
||||
declare_proto_rot(set_conf);
|
||||
declare_proto_rot(get_conf);
|
||||
declare_proto_rot(set_pos);
|
||||
declare_proto_rot(get_pos);
|
||||
declare_proto_rot(get_info);
|
||||
|
||||
/*
|
||||
*/
|
||||
static struct cmd_table cmd_list[] = {
|
||||
{ "open", open },
|
||||
{ "close", close },
|
||||
{ "set_conf", set_conf, ARG_IN, "Token", "Value" },
|
||||
{ "get_conf", get_conf, ARG_IN1|ARG_OUT2, "Token", "Value" },
|
||||
{ "set_pos", set_pos, ARG_IN, "Azimuth", "Elevation" },
|
||||
{ "get_pos", get_pos, ARG_OUT, "Azimuth", "Elevation" },
|
||||
{ "get_info", get_info, ARG_OUT, "Info" },
|
||||
{ NULL, NULL },
|
||||
|
||||
};
|
||||
|
||||
#define MAXNAMSIZ 32
|
||||
#define MAXNBOPT 100 /* max number of different options */
|
||||
|
||||
|
||||
/*
|
||||
* TODO: use Lex and some kind of hash table
|
||||
*/
|
||||
static struct cmd_table *parse_cmd(const char *name)
|
||||
{
|
||||
int i;
|
||||
for (i=0; i<MAXNBOPT && cmd_list[i].name != NULL; i++)
|
||||
if (!strncmp(name, cmd_list[i].name, MAXNAMSIZ))
|
||||
return &cmd_list[i];
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* since there's no long long support in tcl API,
|
||||
* freq_t is mapped to double object, which has enough
|
||||
* significant digits for frequencies up to tens of GHz.
|
||||
*/
|
||||
|
||||
int
|
||||
DoRotLib(ClientData clientData, Tcl_Interp *interp,
|
||||
int objc, Tcl_Obj *CONST objv[])
|
||||
{
|
||||
Tcl_Obj *resultPtr;
|
||||
int retcode;
|
||||
char *subcmd;
|
||||
|
||||
/* objc gives the number of "objects" = arguments to
|
||||
the command */
|
||||
if (objc != 2 && objc != 3) {
|
||||
Tcl_WrongNumArgs(interp, 1, objv, "cmd ?model?");
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
/* Process the arguments
|
||||
objv is an array holding the arguments */
|
||||
|
||||
/* Use Tcl_GetIntFromObj to put an integer value
|
||||
into a variable from the argument list */
|
||||
|
||||
subcmd = Tcl_GetString(objv[1]);
|
||||
resultPtr = Tcl_GetObjResult(interp);
|
||||
|
||||
/* TODO: make use of flex here! */
|
||||
|
||||
if (!strcasecmp(subcmd, "version")) {
|
||||
Tcl_SetStringObj(resultPtr, hamlib_version, -1);
|
||||
} else if (!strcasecmp(subcmd, "help")) {
|
||||
Tcl_SetStringObj(resultPtr, "no help yet!", -1);
|
||||
} else if (!strcasecmp(subcmd, "init")) {
|
||||
rot_model_t model;
|
||||
ROT *tcl_rot;
|
||||
char rotcmd_name[16];
|
||||
static int rotcmd_cpt=0;
|
||||
|
||||
retcode = Tcl_GetIntFromObj(interp, objv[2], (int*)&model);
|
||||
if (retcode != TCL_OK)
|
||||
return retcode;
|
||||
tcl_rot = rot_init(model);
|
||||
if (!tcl_rot)
|
||||
return TCL_ERROR;
|
||||
sprintf(rotcmd_name, "rot%d", rotcmd_cpt++);
|
||||
Tcl_CreateObjCommand(interp, rotcmd_name, DoRot,
|
||||
(ClientData)tcl_rot, (Tcl_CmdDeleteProc *)NULL);
|
||||
Tcl_SetStringObj(resultPtr, rotcmd_name, -1);
|
||||
} else {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
int
|
||||
DoRot(ClientData clientData, Tcl_Interp *interp,
|
||||
int objc, Tcl_Obj *CONST objv[])
|
||||
{
|
||||
int retcode;
|
||||
char *subcmd;
|
||||
ROT *tcl_rot = (ROT*)clientData;
|
||||
struct cmd_table *cmd_entry;
|
||||
|
||||
if (!tcl_rot)
|
||||
return TCL_ERROR;
|
||||
|
||||
/* objc gives the number of "objects" = arguments to
|
||||
the command */
|
||||
if (objc < 2) {
|
||||
Tcl_WrongNumArgs(interp, 1, objv, "var1 var2 ?var3?");
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
/* Process the arguments
|
||||
objv is an array holding the arguments */
|
||||
|
||||
/* Use Tcl_GetIntFromObj to put an integer value
|
||||
into a variable from the argument list */
|
||||
|
||||
subcmd = Tcl_GetString(objv[1]);
|
||||
cmd_entry = parse_cmd(subcmd);
|
||||
if (!cmd_entry) {
|
||||
/* unknow subcmd */
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
retcode = (*cmd_entry->rot_routine)(tcl_rot,
|
||||
cmd_entry, interp, objc, objv);
|
||||
|
||||
if (retcode != RIG_OK ) {
|
||||
/* FIXME: set Tcl error, and retcode can be TCL_ERROR! */
|
||||
fprintf(stderr, "%s: %s\n", cmd_entry->name, rigerror(retcode));
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* static int (f)(ROT *rot, const struct cmd_table *cmd,
|
||||
* Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
|
||||
*/
|
||||
|
||||
declare_proto_rot(open)
|
||||
{
|
||||
return rot_open(rot);
|
||||
}
|
||||
|
||||
declare_proto_rot(close)
|
||||
{
|
||||
return rot_close(rot);
|
||||
}
|
||||
|
||||
declare_proto_rot(set_conf)
|
||||
{
|
||||
token_t tok;
|
||||
|
||||
tok = rot_token_lookup(rot, Tcl_GetString(objv[2]));
|
||||
|
||||
return rot_set_conf(rot, tok, Tcl_GetString(objv[3]));
|
||||
}
|
||||
|
||||
declare_proto_rot(get_conf)
|
||||
{
|
||||
int status;
|
||||
token_t tok;
|
||||
Tcl_Obj *resultPtr;
|
||||
char buf[255];
|
||||
|
||||
resultPtr = Tcl_GetObjResult(interp);
|
||||
|
||||
tok = rot_token_lookup(rot, Tcl_GetString(objv[2]));
|
||||
|
||||
status = rot_get_conf(rot, tok, buf);
|
||||
if (status != RIG_OK)
|
||||
return status;
|
||||
|
||||
Tcl_SetStringObj(resultPtr, buf, -1);
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
|
||||
declare_proto_rot(set_pos)
|
||||
{
|
||||
int status;
|
||||
double da, de;
|
||||
|
||||
status = Tcl_GetDoubleFromObj(interp, objv[2], &da);
|
||||
if (status != TCL_OK)
|
||||
return status;
|
||||
status = Tcl_GetDoubleFromObj(interp, objv[3], &de);
|
||||
if (status != TCL_OK)
|
||||
return status;
|
||||
|
||||
return rot_set_position(rot, (azimuth_t)da, (elevation_t)de);
|
||||
}
|
||||
|
||||
declare_proto_rot(get_pos)
|
||||
{
|
||||
int status;
|
||||
azimuth_t az;
|
||||
elevation_t el;
|
||||
Tcl_Obj *resultPtr;
|
||||
|
||||
resultPtr = Tcl_GetObjResult(interp);
|
||||
|
||||
status = rot_get_position(rot, &az, &el);
|
||||
if (status != RIG_OK)
|
||||
return status;
|
||||
/* FIXME: return also elevation */
|
||||
Tcl_SetDoubleObj(resultPtr, (double)az);
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
declare_proto_rot(get_info)
|
||||
{
|
||||
const char *s;
|
||||
Tcl_Obj *resultPtr;
|
||||
|
||||
resultPtr = Tcl_GetObjResult(interp);
|
||||
|
||||
s = rot_get_info(rot);
|
||||
Tcl_SetStringObj(resultPtr, s ? s : "None", -1);
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
33
tcl/tclrot.h
33
tcl/tclrot.h
|
@ -1,33 +0,0 @@
|
|||
/*
|
||||
* Hamlib tcl/tk bindings - rotator header
|
||||
* Copyright (c) 2001,2002 by Stephane Fillod
|
||||
*
|
||||
* $Id: tclrot.h,v 1.1 2002-01-22 00:34:48 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
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _TCLROT_H
|
||||
#define _TCLROT_H
|
||||
|
||||
#include <tcl.h>
|
||||
|
||||
extern int DoRot(ClientData clientData, Tcl_Interp *interp,
|
||||
int objc, Tcl_Obj *CONST objv[]);
|
||||
extern int DoRotLib(ClientData clientData, Tcl_Interp *interp,
|
||||
int objc, Tcl_Obj *CONST objv[]);
|
||||
|
||||
#endif /* _TCLROT_H */
|
|
@ -1,20 +0,0 @@
|
|||
#!/bin/sh
|
||||
# the next line restarts using tclsh \
|
||||
exec tclsh "$0" "$@"
|
||||
|
||||
load "../tcl/.libs/libhamlibtcl.so" Hamlib
|
||||
#load "./hamlibtcl.so" Hamlib
|
||||
|
||||
puts [rig version]\n
|
||||
|
||||
# Init RIG_MODEL_DUMMY
|
||||
set my_rig [rig init 1]
|
||||
$my_rig open
|
||||
$my_rig set_freq 145550000
|
||||
puts [$my_rig get_strength]
|
||||
puts [$my_rig get_level STRENGTH]
|
||||
$my_rig close
|
||||
$my_rig cleanup
|
||||
|
||||
|
||||
exit 0
|
Ładowanie…
Reference in New Issue