Moose/Instrument/HPE4400B.pm untested

filter: Statementstmt 0.0% 0 / 47 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 12 MC/DCmcdc n/a Subroutinesub 0.0% 0 / 11 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 78 SCAR 30.0
CC
4
Cov
0%
BUILD
12.0
validate_trace_param
6.0
BEGIN
2.0
CRAP 20.0
1 package Lab::Moose::Instrument::HPE4400B;
2 $Lab::Moose::Instrument::HPE4400B::VERSION = '3.881';
3 #ABSTRACT: HP E4400B Series Spectrum Analyzer
4  
5 use v5.20;
6  
7  
8 use PDL::Core qw/pdl cat nelem/;
9  
10 use Moose;
11 use Moose::Util::TypeConstraints;
12 use MooseX::Params::Validate;
13 use Lab::Moose::Instrument qw/
14 timeout_param
15 precision_param
16 validated_getter
17 validated_setter
18 validated_channel_getter
19 validated_channel_setter
20 /;
21 use Lab::Moose::Instrument::Cache;
22 use Carp;
23 use namespace::autoclean;
24  
25 extends 'Lab::Moose::Instrument';
26  
27 with 'Lab::Moose::Instrument::SpectrumAnalyzer', qw(
28 Lab::Moose::Instrument::Common
29  
30 Lab::Moose::Instrument::SCPI::Format
31  
32 Lab::Moose::Instrument::SCPI::Sense::Bandwidth
33 Lab::Moose::Instrument::SCPI::Sense::Frequency
34 Lab::Moose::Instrument::SCPI::Sense::Sweep
35 Lab::Moose::Instrument::SCPI::Sense::Power
36 Lab::Moose::Instrument::SCPI::Display::Window
37 Lab::Moose::Instrument::SCPI::Unit
38  
39 Lab::Moose::Instrument::SCPI::Initiate
40  
41 Lab::Moose::Instrument::SCPIBlock
42  
43 );
44  
45 sub BUILD {
46 my $self = shift;
47  
48 # limitation of hardware
49 my $firmware = $self->idn_firmware;
50 my $model = $self->idn_model;
51 if (!$firmware ||
52 $firmware !~ /^A\.(\d+)\.\d+$/ ||
53 $1 < 4)
54 {
55 $self->capable_to_query_number_of_X_points_in_hardware(0);
56 }
57  
58 if (!$model || $model !~ /^E440[12457]B$/) {
59 print STDERR "Model $model does not support setting X points\n";
60 $self->capable_to_set_number_of_X_points_in_hardware(0);
61 $self->hardwired_number_of_X_points(401);
62 }
63  
64 $self->clear();
65 $self->cls();
66 }
67  
68  
69 sub validate_trace_param {
70 my ( $self, $trace ) = @_;
71 if ( $trace < 1 || $trace > 3 ) {
72 confess "trace has to be in (1..3)";
73 }
74 return $trace;
75 }
76  
77  
78 __PACKAGE__->meta()->make_immutable();
79  
80 1;
81  
82 __END__
83  
84 =pod
85  
86 =encoding UTF-8
87  
88 =head1 NAME
89  
90 Lab::Moose::Instrument::HPE4400B - HP E4400B Series Spectrum Analyzer
91  
92 =head1 VERSION
93  
94 version 3.881
95  
96 =head1 Driver for HP E4400B series spectrum analyzers
97  
98 =head1 METHODS
99  
100 =head2 validate_trace_param
101  
102 Validates or applies hardware friendly aliases to trace parameter.
103 Trace has to be in (1..3).
104  
105 =head1 Consumed Roles
106  
107 This driver consumes the following roles:
108  
109 =over
110  
111 =item L<Lab::Moose::Instrument::Common>
112  
113 =item L<Lab::Moose::Instrument::SCPI::Format>
114  
115 =item L<Lab::Moose::Instrument::SCPI::Sense::Bandwidth>
116  
117 =item L<Lab::Moose::Instrument::SCPI::Sense::Frequency>
118  
119 =item L<Lab::Moose::Instrument::SCPI::Sense::Sweep>
120  
121 =item L<Lab::Moose::Instrument::SCPI::Initiate>
122  
123 =item L<Lab::Moose::Instrument::SCPIBlock>
124  
125 =back
126  
127 =head1 COPYRIGHT AND LICENSE
128  
129 This software is copyright (c) 2023 by the Lab::Measurement team; in detail:
130  
131 Copyright 2020 Andreas K. Huettel, Sam Bingner
132  
133  
134 This is free software; you can redistribute it and/or modify it under
135 the same terms as the Perl 5 programming language system itself.
136  
137 =cut