Moose/Instrument/HP3458A.pm

filter: Statementstmt 28.7% 29 / 101 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 21.0% 8 / 38 Podpod 50.0% 15 / 30 totaltotal 30.4% 52 / 171 CC 2 SCAR 6.9
CC
2
Cov
28%
set_high_speed_mode
6.0
BUILD
2.0
get_value
2.0
CRAP 2.0
« Moose/Connection/VISA_GPIB.pm ↑ Summary Moose/Instrument/KeysightN9310A.pm »
1 package Lab::Moose::Instrument::HP3458A;
2 1 $Lab::Moose::Instrument::HP3458A::VERSION = '3.931';
3 #ABSTRACT: HP 3458A digital multimeter
4  
5 1 ▶use v5.20;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use Moose::Util::TypeConstraints qw/enum/;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use MooseX::Params::Validate;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use Lab::Moose::Instrument qw/
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 validated_getter validated_setter setter_params /;
12 1 ▶use Lab::Moose::Instrument::Cache;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 1 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 1 extends 'Lab::Moose::Instrument';
17  
18 1 with qw(
19 Lab::Moose::Instrument::Common
20 );
21  
22 0 ▶sub BUILD {
Subroutine BUILD: not called CC=1 SCAR=6.9
Pod undocumented
23 0 my $self = shift;
24 0 $self->clear();
25  
26 # Set EOI after each answer.
27 0 $self->set_end( value => 'ALWAYS' );
28 }
29  
30  
31 0 ▶sub get_value {
Subroutine get_value: not called CC=1 SCAR=6.9
Pod documented
32 0 my ( $self, %args ) = validated_hash(
33 \@_,
34 setter_params(),
35 );
36 0 return $self->read(%args);
37 }
38  
39  
40 0 ▶sub get_nplc {
Subroutine get_nplc: not called CC=1 SCAR=6.9
Pod documented
41 0 my ( $self, %args ) = validated_getter( \@_ );
42 0 return $self->query( command => "NPLC?", %args );
43 }
44  
45 0 ▶sub set_nplc {
Subroutine set_nplc: not called CC=1 SCAR=6.9
Pod documented
46 0 my ( $self, $value, %args ) = validated_setter(
47 \@_,
48 value => { isa => 'Num' }
49 );
50 0 $self->write( command => "NPLC $value", %args );
51 }
52  
53  
54 0 ▶sub get_nrdgs {
Subroutine get_nrdgs: not called CC=1 SCAR=6.9
Pod documented
55 0 my ( $self, %args ) = validated_getter( \@_ );
56 0 my $result = $self->query( command => "NRDGS?", %args );
57 0 return split( /,/, $result );
58 }
59  
60 0 ▶sub set_nrdgs {
Subroutine set_nrdgs: not called CC=1 SCAR=6.9
Pod documented
61 0 my ( $self, %args ) = validated_getter(
62 \@_,
63 readings => { isa => 'Int' },
64 sample_event =>
65 { isa => enum( [qw/AUTO EXT HOLD LEVEL LINE SGL SYN TIMER/] ) },
66 );
67 0 my $readings = delete $args{readings};
68 0 my $sample_event = delete $args{sample_event};
69 0 $self->write( command => "NRDGS $readings, $sample_event", %args );
70 }
71  
72 0 ▶sub get_tarm_event {
Subroutine get_tarm_event: not called CC=1 SCAR=6.9
Pod undocumented
73 0 my ( $self, %args ) = validated_getter( \@_ );
74 0 return $self->query( command => "TARM?", %args );
75 }
76  
77 0 ▶sub set_tarm_event {
Subroutine set_tarm_event: not called CC=1 SCAR=6.9
Pod undocumented
78 0 my ( $self, $value, %args ) = validated_setter(
79 \@_,
80 value => { isa => enum( [qw/AUTO EXT SGL HOLD SYN/] ) },
81 );
82 0 $self->write( command => "TARM $value", %args );
83 }
84  
85  
86 0 ▶sub get_trig_event {
Subroutine get_trig_event: not called CC=1 SCAR=6.9
Pod documented
87 0 my ( $self, %args ) = validated_getter( \@_ );
88 0 return $self->query( command => "TRIG?", %args );
89 }
90  
91 0 ▶sub set_trig_event {
Subroutine set_trig_event: not called CC=1 SCAR=6.9
Pod documented
92 0 my ( $self, $value, %args ) = validated_setter(
93 \@_,
94 value => { isa => enum( [qw/AUTO EXT SGL HOLD SYN LEVEL LINE/] ) },
95 );
96 0 $self->write( command => "TRIG $value", %args );
97 }
98  
99  
100 0 ▶sub get_end {
Subroutine get_end: not called CC=1 SCAR=6.9
Pod documented
101 0 my ( $self, %args ) = validated_getter( \@_ );
102 0 return $self->query( command => "END?", %args );
103 }
104  
105 0 ▶sub set_end {
Subroutine set_end: not called CC=1 SCAR=6.9
Pod documented
106 0 my ( $self, $value, %args ) = validated_setter(
107 \@_,
108 value => { isa => enum( [qw/OFF ON ALWAYS/] ) }
109 );
110 0 $self->write( command => "END $value" );
111 }
112  
113  
114 0 ▶sub get_range {
Subroutine get_range: not called CC=1 SCAR=6.9
Pod documented
115 0 my ( $self, %args ) = validated_getter( \@_ );
116 0 return $self->query( command => "RANGE?", %args );
117 }
118  
119 0 ▶sub set_range {
Subroutine set_range: not called CC=1 SCAR=6.9
Pod documented
120 0 my ( $self, $value, %args ) = validated_setter(
121 \@_,
122 value => { isa => 'Lab::Moose::PosNum' }
123 );
124 0 $self->write( command => "RANGE $value" );
125 }
126  
127  
128 0 ▶sub get_auto_range {
Subroutine get_auto_range: not called CC=1 SCAR=6.9
Pod documented
129 0 my ( $self, %args ) = validated_getter( \@_ );
130 0 return $self->query( command => "ARANGE?", %args );
131 }
132  
133 0 ▶sub set_auto_range {
Subroutine set_auto_range: not called CC=1 SCAR=6.9
Pod documented
134 0 my ( $self, $value, %args ) = validated_setter(
135 \@_,
136 value => { isa => enum( [qw/ON OFF ONCE/] ) }
137 );
138 0 $self->write( command => "ARANGE $value", %args );
139 }
140  
141 0 ▶sub get_output_format {
Subroutine get_output_format: not called CC=1 SCAR=6.9
Pod undocumented
142 0 my ( $self, %args ) = validated_getter( \@_ );
143 0 return $self->query( command => 'OFORMAT?', %args );
144 }
145  
146 0 ▶sub set_output_format {
Subroutine set_output_format: not called CC=1 SCAR=6.9
Pod undocumented
147 0 my ( $self, $value, %args ) = validated_setter(
148 \@_,
149 value => { isa => enum( [qw/ASCII SINT DINT SREAL DREAL/] ) },
150 );
151 0 $self->write( command => "OFORMAT $value", %args );
152 }
153  
154 0 ▶sub get_memory_format {
Subroutine get_memory_format: not called CC=1 SCAR=6.9
Pod undocumented
155 0 my ( $self, %args ) = validated_getter( \@_ );
156 0 return $self->query( command => 'MFORMAT?', %args );
157 }
158  
159 0 ▶sub set_memory_format {
Subroutine set_memory_format: not called CC=1 SCAR=6.9
Pod undocumented
160 0 my ( $self, $value, %args ) = validated_setter(
161 \@_,
162 value => { isa => enum( [qw/ASCII SINT DINT SREAL DREAL/] ) },
163 );
164 0 $self->write( command => "MFORMAT $value", %args );
165 }
166  
167 0 ▶sub get_memory {
Subroutine get_memory: not called CC=1 SCAR=6.9
Pod undocumented
168 0 my ( $self, %args ) = validated_getter( \@_ );
169 0 return $self->query( command => 'MEM?', %args );
170 }
171  
172 0 ▶sub set_memory {
Subroutine set_memory: not called CC=1 SCAR=6.9
Pod undocumented
173 0 my ( $self, $value, %args ) = validated_setter(
174 \@_,
175 value => { isa => enum( [qw/OFF LIFO FIFO CONT/] ) },
176 );
177 0 $self->write( command => "MEM $value", %args );
178 }
179  
180 1 cache iscale => ( getter => 'get_iscale' );
181  
182 0 ▶sub get_iscale {
Subroutine get_iscale: not called CC=1 SCAR=6.9
Pod undocumented
183 0 my ( $self, %args ) = validated_getter( \@_ );
184 0 return $self->query( command => 'ISCALE?', %args );
185 }
186  
187 0 ▶sub get_auto_zero {
Subroutine get_auto_zero: not called CC=1 SCAR=6.9
Pod undocumented
188 0 my ( $self, %args ) = validated_getter( \@_ );
189 0 return $self->query( command => 'AZERO?', %args );
190 }
191  
192 0 ▶sub set_auto_zero {
Subroutine set_auto_zero: not called CC=1 SCAR=6.9
Pod undocumented
193 0 my ( $self, $value, %args ) = validated_setter(
194 \@_,
195 value => { isa => enum( [qw/ON OFF ONCE/] ) },
196 );
197 0 $self->write( command => "AZERO $value", %args );
198 }
199  
200 0 ▶sub get_disp {
Subroutine get_disp: not called CC=1 SCAR=6.9
Pod undocumented
201 0 my ( $self, %args ) = validated_getter( \@_ );
202 0 return $self->query( command => 'DISP?', %args );
203 }
204  
205 0 ▶sub set_disp {
Subroutine set_disp: not called CC=1 SCAR=6.9
Pod undocumented
206 0 my ( $self, $value, %args ) = validated_setter(
207 \@_,
208 value => { isa => enum( [qw/OFF ON MSG CLR/] ) },
209 );
210 0 $self->write( command => "DISP $value", %args );
211 }
212  
213 0 ▶sub set_math_off {
Subroutine set_math_off: not called CC=1 SCAR=6.9
Pod undocumented
214 0 my ( $self, %args ) = validated_getter( \@_ );
215 0 $self->write( command => 'MATH OFF', %args );
216 }
217  
218  
219 0 ▶sub get_mem_size {
Subroutine get_mem_size: not called CC=1 SCAR=6.9
Pod documented
220 0 my ( $self, %args ) = validated_getter( \@_ );
221 0 my $rv = $self->query( command => 'MSIZE?', %args );
222 0 return split( /,/, $rv );
223 }
224  
225  
226 0 ▶sub set_high_speed_mode {
Subroutine set_high_speed_mode: not called CC=2 SCAR=17.9
Pod documented
227 0 my ( $self, %args ) = validated_getter(
228 \@_,
229 format => { isa => enum( [qw/SINT DINT/] ) },
230 );
231 0 my $format = delete $args{format};
232  
233 0 $self->set_output_format( value => $format );
234 0 $self->set_memory_format( value => $format );
235  
236 0 $self->set_auto_zero( value => 'OFF' );
237 0 $self->set_disp( value => 'OFF' );
238 0 $self->set_math_off();
239  
240 0 ▶ if ( $self->get_auto_range() ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->get_auto_range) 0 0 0
241 0 croak("Autorange mode is on, cannot set high-speed mode");
242 }
243 }
244  
245  
246 1 __PACKAGE__->meta()->make_immutable();
247  
248 1 1;
249  
250 __END__
« Moose/Connection/VISA_GPIB.pm ↑ Summary Moose/Instrument/KeysightN9310A.pm »