File Coverage

blib/lib/Lab/Moose/Instrument/SCPI/Sense/Null.pm
Criterion Covered Total %
statement 34 34 100.0
branch n/a
condition n/a
subroutine 11 11 100.0
pod 4 4 100.0
total 49 49 100.0


line stmt bran cond sub pod time code
1             package Lab::Moose::Instrument::SCPI::Sense::Null;
2             $Lab::Moose::Instrument::SCPI::Sense::Null::VERSION = '3.881';
3             #ABSTRACT: Role for the HP/Agilent/Keysight SCPI SENSe:$function:NULL subsystem
4              
5 2     2   1221 use v5.20;
  2         11  
6              
7 2     2   14 use Moose::Role;
  2         5  
  2         15  
8 2     2   10658 use Lab::Moose::Instrument::Cache;
  2         5  
  2         16  
9 2     2   1276 use Lab::Moose::Instrument qw/validated_getter validated_setter/;
  2         5  
  2         121  
10 2     2   17 use Moose::Util::TypeConstraints 'enum';
  2         4  
  2         16  
11 2     2   961 use Carp;
  2         10  
  2         115  
12 2     2   16 use namespace::autoclean;
  2         5  
  2         22  
13              
14              
15             requires 'cached_sense_function';
16              
17             cache sense_null_state => ( getter => 'sense_null_state_query' );
18              
19             sub sense_null_state_query {
20 3     3 1 1385 my ( $self, %args ) = validated_getter( \@_ );
21              
22 3         1556 my $func = $self->cached_sense_function();
23 3         17 return $self->cached_sense_null_state(
24             $self->query( command => "SENS:$func:NULL:STAT?", %args ) );
25             }
26              
27             sub sense_null_state {
28 3     3 1 5734 my ( $self, $value, %args ) = validated_setter(
29             \@_,
30             value => { isa => enum( [ 0, 1 ] ) },
31             );
32              
33 3         14 my $func = $self->cached_sense_function();
34 3         21 $self->write( command => "SENS:$func:NULL:STATE $value", %args );
35              
36 3         17 $self->cached_sense_null_state($value);
37             }
38              
39              
40             cache sense_null_value => ( getter => 'sense_null_value_query' );
41              
42             sub sense_null_value_query {
43 3     3 1 1366 my ( $self, %args ) = validated_getter( \@_ );
44              
45 3         1514 my $func = $self->cached_sense_function();
46              
47 3         23 return $self->cached_sense_null_value(
48             $self->query( command => "SENS:$func:NULL:VAL?", %args ) );
49             }
50              
51             sub sense_null_value {
52 3     3 1 5567 my ( $self, $value, %args ) = validated_setter(
53             \@_,
54             value => { isa => 'Num' },
55             );
56              
57 3         13 my $func = $self->cached_sense_function();
58              
59 3         22 $self->write( command => "SENS:$func:NULL:VAL $value", %args );
60              
61 3         28 $self->cached_sense_null_value($value);
62             }
63              
64             1;
65              
66             __END__
67              
68             =pod
69              
70             =encoding UTF-8
71              
72             =head1 NAME
73              
74             Lab::Moose::Instrument::SCPI::Sense::Null - Role for the HP/Agilent/Keysight SCPI SENSe:$function:NULL subsystem
75              
76             =head1 VERSION
77              
78             version 3.881
79              
80             =head1 METHODS
81              
82             =head2 sense_null_state_query
83              
84             =head2 sense_null_state
85              
86             $self->sense_null_state(value => 1);
87              
88             Query/Set state of null function.
89              
90             =head1 METHODS
91              
92             =head2 sense_null_value_query
93              
94             =head2 sense_null_value
95              
96             $self->sense_null_value(value => 0.12345);
97              
98             Query/Set state of null function.
99              
100             =head1 COPYRIGHT AND LICENSE
101              
102             This software is copyright (c) 2023 by the Lab::Measurement team; in detail:
103              
104             Copyright 2018 Simon Reinhardt
105             2020 Andreas K. Huettel
106              
107              
108             This is free software; you can redistribute it and/or modify it under
109             the same terms as the Perl 5 programming language system itself.
110              
111             =cut