File Coverage

blib/lib/Lab/Moose/Instrument/SCPI/Sense/Impedance.pm
Criterion Covered Total %
statement 29 31 93.5
branch 2 4 50.0
condition n/a
subroutine 9 9 100.0
pod 2 2 100.0
total 42 46 91.3


line stmt bran cond sub pod time code
1             package Lab::Moose::Instrument::SCPI::Sense::Impedance;
2             $Lab::Moose::Instrument::SCPI::Sense::Impedance::VERSION = '3.880';
3             #ABSTRACT: Role for the HP/Agilent/Keysight SCPI SENSe:$function:IMPedance subsystem
4              
5 2     2   1520 use v5.20;
  2         11  
6              
7 2     2   15 use Moose::Role;
  2         4  
  2         21  
8 2     2   11404 use Lab::Moose::Instrument::Cache;
  2         7  
  2         18  
9 2     2   1482 use Lab::Moose::Instrument qw/validated_getter validated_setter/;
  2         5  
  2         147  
10 2     2   17 use Moose::Util::TypeConstraints 'enum';
  2         8  
  2         17  
11 2     2   964 use Carp;
  2         6  
  2         107  
12 2     2   12 use namespace::autoclean;
  2         7  
  2         17  
13              
14              
15             requires 'cached_sense_function';
16              
17             cache sense_impedance_auto => ( getter => 'sense_impedance_auto_query' );
18              
19             sub sense_impedance_auto_query {
20 3     3 1 1366 my ( $self, %args ) = validated_getter( \@_ );
21              
22 3         1547 my $func = $self->cached_sense_function();
23 3 50       14 if ( $func ne 'VOLT' ) {
24 0         0 croak "query impedance with function $func";
25             }
26 3         16 return $self->cached_sense_impedance_auto(
27             $self->query( command => "SENS:$func:IMP:AUTO?", %args ) );
28             }
29              
30             sub sense_impedance_auto {
31 3     3 1 3035 my ( $self, $value, %args ) = validated_setter(
32             \@_,
33             value => { isa => enum( [ 0, 1 ] ) },
34             );
35              
36 3         15 my $func = $self->cached_sense_function();
37 3 50       12 if ( $func ne 'VOLT' ) {
38 0         0 croak "query impedance with function $func";
39             }
40 3         19 $self->write( command => "SENS:$func:IMP:AUTO $value", %args );
41              
42 3         14 $self->cached_sense_impedance_auto($value);
43             }
44              
45             1;
46              
47             __END__
48              
49             =pod
50              
51             =encoding UTF-8
52              
53             =head1 NAME
54              
55             Lab::Moose::Instrument::SCPI::Sense::Impedance - Role for the HP/Agilent/Keysight SCPI SENSe:$function:IMPedance subsystem
56              
57             =head1 VERSION
58              
59             version 3.880
60              
61             =head1 METHODS
62              
63             =head2 sense_impedance_auto_query
64              
65             =head2 sense_impedance_auto
66              
67             $self->sense_impedance_auto(value => 1);
68              
69             Query/Set input impedance mode. Allowed values: '0' or '1'.
70              
71             =head1 COPYRIGHT AND LICENSE
72              
73             This software is copyright (c) 2023 by the Lab::Measurement team; in detail:
74              
75             Copyright 2018 Simon Reinhardt
76             2020 Andreas K. Huettel
77              
78              
79             This is free software; you can redistribute it and/or modify it under
80             the same terms as the Perl 5 programming language system itself.
81              
82             =cut