summaryrefslogtreecommitdiff
path: root/libvxi11client
diff options
context:
space:
mode:
Diffstat (limited to 'libvxi11client')
-rw-r--r--libvxi11client/perlbits/Client.pm123
1 files changed, 123 insertions, 0 deletions
diff --git a/libvxi11client/perlbits/Client.pm b/libvxi11client/perlbits/Client.pm
new file mode 100644
index 0000000..c92d613
--- /dev/null
+++ b/libvxi11client/perlbits/Client.pm
@@ -0,0 +1,123 @@
+package VXI11::Client;
+
+use 5.014002;
+use strict;
+use warnings;
+
+require Exporter;
+
+our @ISA = qw(Exporter);
+
+# 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 VXI11::Client ':all';
+# If you do not need this, moving things directly into @EXPORT or @EXPORT_OK
+# will save memory.
+our %EXPORT_TAGS = ( 'all' => [ qw(
+
+) ] );
+
+our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
+
+our @EXPORT = qw(
+ vxi_startinterruptserver
+ vxi_stopinterruptserver
+ vxi_open
+ vxi_wait_for_interrupt
+);
+
+our $VERSION = '0.01';
+
+require XSLoader;
+XSLoader::load('VXI11::Client', $VERSION);
+
+# Preloaded methods go here.
+
+1;
+__END__
+# Below is stub documentation for your module. You'd better edit it!
+
+=head1 NAME
+
+VXI11::Client - Perl extension for interfacing with VXI-11 networked instruments
+
+=head1 SYNOPSIS
+
+ use VXI11::Client;
+
+ vxi_startinterruptserver();
+
+ my $instr = vxi_open("myintrumentshostname", 0);
+
+ $instr->vxi_lock(0);
+ $instr->vxi_write("*IDN?", -1, 0, 0);
+ my ($bytes, $buff, $reason) = $instr->vxi_read(256, 0, 0, 0);
+ print "got " . $bytes . ";" . $buff . "\n";
+
+ $instr->vxi_readstatusbyte(0);
+ $instr->vxi_create_intr_chan();
+ $instr->vxi_enable_srq(1, "myhandle");
+ vxi_wait_for_interrupt();
+ $instr->vxi_enable_srq(0, "");
+ $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_unlock();
+
+ $instr->vxi_close();
+
+ vxi_stopinterruptserver();
+
+
+=head1 DESCRIPTION
+
+A client for VXI-11 networked instruments. To start talking to an instrument
+call open with the host you want to connect to (ip or hostname) and whether
+you want to lock it right away. You can then call the object methods to
+do stuff. For interrupts to work you must call vxi_startinterruptserver before
+enabling interrupts. You only need to do this once even if you have multiple
+instruments. VXI-11 has mixed client and server roles (with interrupts the client
+becomes the server). Starting the interrupt server creates an RPC server on the
+client that the instruments can connect to.
+
+Return codes work like this;
+1 - is a success
+0 - means the request failed locally, the state inside the client is
+incorrect, i.e. calling to enable interrupts before creating the channel
+or that the server couldn't be contacted
+< 0 - Any negative value is the negated VXI-11 error code from the server
+
+The only exceptions to this are the read and write methods
+0 - Error as above or zero bytes read/written
+> 0 - Number of bytes read/written
+
+=head2 EXPORT
+
+vxi_startinterruptserver
+vxi_stopinterruptserver
+vxi_open
+vxi_wait_for_interrupt
+
+=head1 SEE ALSO
+
+The vxi-11 spec.
+
+=head1 AUTHOR
+
+daniel, E<lt>daniel@E<gt>
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright (C) 2013 by daniel
+
+This library is free software; you can redistribute it and/or modify
+it under the same terms as Perl itself, either Perl version 5.14.2 or,
+at your option, any later version of Perl 5 you may have available.
+
+
+=cut