diff options
author | Michael J. Chudobiak <mjc@avtechpulse.com> | 2013-01-29 14:37:29 -0500 |
---|---|---|
committer | Michael J. Chudobiak <mjc@avtechpulse.com> | 2013-01-29 14:37:29 -0500 |
commit | 81053ca6108f03213abeffb60cbb64377ce7509f (patch) | |
tree | ecd767ff0128c2a5214d32f689105412432b3245 /libvxi11client/perlbits/Client.pm | |
parent | 45bb6cfe0537dc21a98908241223a2b82bc993df (diff) |
more named parameters
Diffstat (limited to 'libvxi11client/perlbits/Client.pm')
-rw-r--r-- | libvxi11client/perlbits/Client.pm | 99 |
1 files changed, 87 insertions, 12 deletions
diff --git a/libvxi11client/perlbits/Client.pm b/libvxi11client/perlbits/Client.pm index f4c76a4..a5c5164 100644 --- a/libvxi11client/perlbits/Client.pm +++ b/libvxi11client/perlbits/Client.pm @@ -35,38 +35,102 @@ XSLoader::load('VXI11::Client', $VERSION); # Preloaded methods go here. + sub vxi_enable_srq { return vxi_enable_srq_long($_[0], 1, $_[1]); } + sub vxi_disable_srq { return vxi_enable_srq_long($_[0], 0 , ""); } + +sub vxi_clear { + my $self = shift; + my %args = ( + waitforlock => 0, + @_ + ); + return vxi_clear_long ($self, $args{waitforlock}); +} + + +sub vxi_local { + my $self = shift; + my %args = ( + waitforlock => 0, + @_ + ); + return vxi_local_long ($self, $args{waitforlock}); +} + + +sub vxi_remote { + my $self = shift; + my %args = ( + waitforlock => 0, + @_ + ); + return vxi_remote_long ($self, $args{waitforlock}); +} + + +sub vxi_trigger { + my $self = shift; + my %args = ( + waitforlock => 0, + @_ + ); + return vxi_trigger_long ($self, $args{waitforlock}); +} + + +sub vxi_lock { + my $self = shift; + my %args = ( + waitforlock => 0, + @_ + ); + return vxi_lock_long ($self, $args{waitforlock}); +} + + +sub vxi_open { + my %args = ( + address => '127.0.0.1', + device => 0, + @_ + ); + return vxi_open_long ($args{address}, $args{device}); +} + + sub vxi_write { my $self = shift; my $data = shift; my %args = ( len => -1, - waitlock => 0, + waitforlock => 0, end => 1, @_ ); - return vxi_write_long($self, $data, $args{len}, $args{waitlock}, $args{end}); + return vxi_write_long($self, $data, $args{len}, $args{waitforlock}, $args{end}); } + sub vxi_read { my $self = shift; my %args = ( bufferlen => 1024, - waitlock => 0, + waitforlock => 0, termchrset => 0, termchr => 0, autochomp => 1, @_ ); - my ($bytes, $string, $reason) = vxi_read_long($self, $args{bufferlen}, $args{waitlock}, $args{termchrset},$args{termchr}); + my ($bytes, $string, $reason) = vxi_read_long($self, $args{bufferlen}, $args{waitforlock}, $args{termchrset},$args{termchr}); if (defined($string) && $args{autochomp}) { chomp ($string); @@ -75,6 +139,17 @@ sub vxi_read { return ($bytes, $string, $reason); } + +sub vxi_readstatusbyte { + my $self = shift; + my %args = ( + waitforlock => 0, + @_ + ); + return vxi_readstatusbyte_long ($self, $args{waitforlock}); +} + + sub vxi_docmd { my $self = shift; my $cmd = shift; @@ -82,12 +157,12 @@ sub vxi_docmd { datain => "", datainlen => -1, dataoutbufferlen => 256, - waitlock => 0, + waitforlock => 0, autochomp => 1, @_ ); - my ($ret, $dataout, $dataoutlen) = vxi_docmd_long($self, $args{datain}, $args{datainlen}, $args{dataoutbufferlen}, $args{waitlock}); + my ($ret, $dataout, $dataoutlen) = vxi_docmd_long($self, $args{datain}, $args{datainlen}, $args{dataoutbufferlen}, $args{waitforlock}); if (defined($dataout) && $args{autochomp}) { chomp ($dataout); @@ -110,9 +185,9 @@ VXI11::Client - Perl extension for interfacing with VXI-11 networked instruments vxi_startinterruptserver(); - my $instr = vxi_open("192.168.0.62", 0); + my $instr = vxi_open(address => "192.168.0.62"); - $instr->vxi_lock(0); + $instr->vxi_lock(); $instr->vxi_write("*idn?"); my ($bytes, $buff, $reason) = $instr->vxi_read(); print "got " . $bytes . ";" . $buff . " reason " . $reason ."\n"; @@ -126,10 +201,10 @@ VXI11::Client - Perl extension for interfacing with VXI-11 networked instruments $instr->vxi_disable_srq(); $instr->vxi_destroy_intr_chan(); $instr->vxi_abort(); - $instr->vxi_clear(0); - $instr->vxi_trigger(0); - $instr->vxi_local(0); - $instr->vxi_remote(0); + $instr->vxi_clear(); + $instr->vxi_trigger(); + $instr->vxi_local(); + $instr->vxi_remote(); $instr->vxi_unlock(); $instr->vxi_close(); |