| 1 | package Lab::Connection::VISA; | ||
| 2 | #ABSTRACT: VISA-type connection | ||
| 3 | $Lab::Connection::VISA::VERSION = '3.881'; | ||
| 4 | use v5.20; | ||
| 5 | |||
| 6 | use strict; | ||
| 7 | use Lab::Bus::VISA; | ||
| 8 | use Lab::Connection; | ||
| 9 | use Lab::Exception; | ||
| 10 | |||
| 11 | our @ISA = ("Lab::Connection"); | ||
| 12 | |||
| 13 | our %fields = ( | ||
| 14 | bus_class => 'Lab::Bus::VISA', | ||
| 15 | resource_name => undef, | ||
| 16 | wait_status => 0, # sec; | ||
| 17 | wait_query => 10e-6, # sec; | ||
| 18 | read_length => 1000, # bytes | ||
| 19 | ); | ||
| 20 | |||
| 21 | sub new { | ||
| 22 | my $proto = shift; | ||
| 23 | my $class = ref($proto) || $proto; | ||
| 24 | my $twin = undef; | ||
| 25 | my $self = $class->SUPER::new(@_) | ||
| 26 | ; # getting fields and _permitted from parent class, parameter checks | ||
| 27 | $self->${ \( __PACKAGE__ . '::_construct' ) }(__PACKAGE__); | ||
| 28 | |||
| 29 | return $self; | ||
| 30 | } | ||
| 31 | |||
| 32 | 1; | ||
| 33 | |||
| 34 | # | ||
| 35 | # That's all, all that was needed was the additional field "resource_name". | ||
| 36 | # | ||
| 37 | |||
| 38 | |||
| 39 | 1; | ||
| 40 | |||
| 41 | __END__ | ||
| 42 | |||
| 43 | =pod | ||
| 44 | |||
| 45 | =encoding utf-8 | ||
| 46 | |||
| 47 | =head1 NAME | ||
| 48 | |||
| 49 | Lab::Connection::VISA - VISA-type connection | ||
| 50 | |||
| 51 | =head1 VERSION | ||
| 52 | |||
| 53 | version 3.881 | ||
| 54 | |||
| 55 | =head1 SYNOPSIS | ||
| 56 | |||
| 57 | Ths general VISA Connection class for Lab::Bus::VISA digests VISA resource names. | ||
| 58 | |||
| 59 | This is not called directly. To make a VISA suppporting instrument use Lab::Connection::VISA, set | ||
| 60 | the connection_type parameter accordingly: | ||
| 61 | |||
| 62 | $instrument = new HP34401A( | ||
| 63 | connection_type => 'VISA', | ||
| 64 | resource_name => 'GPIB0::14::INSTR', | ||
| 65 | ) | ||
| 66 | |||
| 67 | =head1 DESCRIPTION | ||
| 68 | |||
| 69 | C<Lab::Connection::VISA> provides a VISA-type connection with L<Lab::Bus::VISA> using | ||
| 70 | NI VISA (L<Lab::VISA>) as backend. | ||
| 71 | |||
| 72 | It inherits from L<Lab::Connection>. | ||
| 73 | |||
| 74 | =head1 CONSTRUCTOR | ||
| 75 | |||
| 76 | =head2 new | ||
| 77 | |||
| 78 | my $connection = new Lab::Connection::VISA( | ||
| 79 | connection_type => 'VISA', | ||
| 80 | resource_name => 'GPIB0::14::INSTR', | ||
| 81 | } | ||
| 82 | |||
| 83 | =head1 METHODS | ||
| 84 | |||
| 85 | This just falls back on the methods inherited from L<Lab::Connection>. | ||
| 86 | |||
| 87 | =head2 config | ||
| 88 | |||
| 89 | Provides unified access to the fields in initial @_ to all the child classes. | ||
| 90 | E.g. | ||
| 91 | |||
| 92 | $GPIB_Address=$instrument->Config(gpib_address); | ||
| 93 | |||
| 94 | Without arguments, returns a reference to the complete $self->Config aka @_ of the constructor. | ||
| 95 | |||
| 96 | $Config = $connection->Config(); | ||
| 97 | $GPIB_Address = $connection->Config()->{'gpib_address'}; | ||
| 98 | |||
| 99 | =head1 CAVEATS/BUGS | ||
| 100 | |||
| 101 | Probably few. Mostly because there's not a lot to be done here. Please report. | ||
| 102 | |||
| 103 | =head1 SEE ALSO | ||
| 104 | |||
| 105 | =over 4 | ||
| 106 | |||
| 107 | =item * L<Lab::Connection> | ||
| 108 | |||
| 109 | =item * L<Lab::Connection::GPIB> | ||
| 110 | |||
| 111 | =back | ||
| 112 | |||
| 113 | =head1 COPYRIGHT AND LICENSE | ||
| 114 | |||
| 115 | This software is copyright (c) 2023 by the Lab::Measurement team; in detail: | ||
| 116 | |||
| 117 | Copyright 2010 Andreas K. Huettel | ||
| 118 | 2011 Andreas K. Huettel, Florian Olbrich | ||
| 119 | 2012 Florian Olbrich | ||
| 120 | 2016 Simon Reinhardt | ||
| 121 | 2017 Andreas K. Huettel | ||
| 122 | 2020 Andreas K. Huettel | ||
| 123 | |||
| 124 | |||
| 125 | This is free software; you can redistribute it and/or modify it under | ||
| 126 | the same terms as the Perl 5 programming language system itself. | ||
| 127 | |||
| 128 | =cut |