Moose/Instrument/Synctek_MCL1_540.pm

filter: Statementstmt 32.2% 31 / 96 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 23.6% 9 / 38 Podpod 0.0% 0 / 28 totaltotal 24.6% 40 / 162 CC 1 SCAR 5.7
CC
1
Cov
32%
__ANON__
2.0
request
2.0
get_A_V1_DC
2.0
CRAP 1.8
« Moose/Instrument/ZI_MFLI.pm ↑ Summary Moose/Instrument.pm »
1 package Lab::Moose::Instrument::Synctek_MCL1_540;
2 1 $Lab::Moose::Instrument::Synctek_MCL1_540::VERSION = '3.931';
3 #ABSTRACT: Synctek MCL1-540 Lock-in Amplifier
4  
5 1 ▶use v5.20;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use Moose::Util::TypeConstraints qw/enum/;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use MooseX::Params::Validate;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 ▶use Lab::Moose::Instrument qw/
Subroutine BEGIN: called CC=1 SCAR=0.0
12 validated_getter
13 validated_setter
14 validated_no_param_setter
15 setter_params
16 1 /;
17 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 1 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 1 ▶use Time::HiRes qw/time usleep/;
Subroutine BEGIN: called CC=1 SCAR=0.0
20  
21 1 extends 'Lab::Moose::Instrument';
22  
23  
24 # TODO
25 # ====
26 # - how is ip address and port configured?
27 # --> port 8002 is fixed
28 # --> ip is required for init
29 # - type checks for write arguments - done
30 # - URL structure - done
31 # - names of outputs
32 # - which functions to implement?
33  
34  
35 # default connection options:
36 0 ▶around default_connection_options => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
37 0 my $orig = shift;
38 0 my $self = shift;
39 0 my $options = $self->$orig();
40  
41 0 $options->{WWW}{port} = 8002;
42 0 return $options;
43 1 };
44  
45  
46 # html escape sequences
47 0 ▶sub request {
Subroutine request: not called CC=1 SCAR=6.9
Pod undocumented
48 0 my ( $self, %args ) = validated_getter(
49 \@_,
50 type => { isa => enum( [qw/config data/] ) },
51 id => { isa => 'Str' },
52 action => { isa => enum( [qw/get set/] ) },
53 path => { isa => 'Str' },
54 );
55 0 my $type = delete $args{'type'};
56 0 my $id = delete $args{'id'};
57 0 my $action = delete $args{'action'};
58 0 my $path = delete $args{'path'};
59 0 return query( command =>
60 "/MCL/api?type=$type&id=$id&action=$action&path=$path"
61 );
62 }
63  
64 # Configuration dump and write todo
65  
66 # WTF is das System mit dem Array?
67 # TODO: - use a single function to return all DC voltages
68 # => use hash to match A_V1->id=L1,DC[0] etc
69 0 ▶sub get_A_V1_DC {
Subroutine get_A_V1_DC: not called CC=1 SCAR=6.9
Pod undocumented
70 0 my $self = shift;
71 0 return $self->request(
72 type => "data",
73 id => "L1",
74 action => "get",
75 path => "/output_cluster/DataReadings/DC[0]/"
76 );
77 }
78  
79 0 ▶sub get_A_V2_DC {
Subroutine get_A_V2_DC: not called CC=1 SCAR=6.9
Pod undocumented
80 0 my $self = shift;
81 0 return $self->request(
82 type => "data",
83 id => "L1",
84 action => "get",
85 path => "/output_cluster/DataReadings/DC[1]/"
86 );
87 }
88  
89 0 ▶sub get_B_V1_DC {
Subroutine get_B_V1_DC: not called CC=1 SCAR=6.9
Pod undocumented
90 0 my $self = shift;
91 0 return $self->request(
92 type => "data",
93 id => "L1",
94 action => "get",
95 path => "/output_cluster/DataReadings/DC[2]/"
96 );
97 }
98  
99 0 ▶sub get_B_V2_DC {
Subroutine get_B_V2_DC: not called CC=1 SCAR=6.9
Pod undocumented
100 0 my $self = shift;
101 0 return $self->request(
102 type => "data",
103 id => "L1",
104 action => "get",
105 path => "/output_cluster/DataReadings/DC[3]/"
106 );
107 }
108  
109 0 ▶sub get_C_V1_DC {
Subroutine get_C_V1_DC: not called CC=1 SCAR=6.9
Pod undocumented
110 0 my $self = shift;
111 0 return $self->request(
112 type => "data",
113 id => "L1",
114 action => "get",
115 path => "/output_cluster/DataReadings/DC[4]/"
116 );
117 }
118  
119 0 ▶sub get_C_V2_DC {
Subroutine get_C_V2_DC: not called CC=1 SCAR=6.9
Pod undocumented
120 0 my $self = shift;
121 0 return $self->request(
122 type => "data",
123 id => "L1",
124 action => "get",
125 path => "/output_cluster/DataReadings/DC[5]/"
126 );
127 }
128  
129 0 ▶sub get_D_V1_DC {
Subroutine get_D_V1_DC: not called CC=1 SCAR=6.9
Pod undocumented
130 0 my $self = shift;
131 0 return $self->request(
132 type => "data",
133 id => "L1",
134 action => "get",
135 path => "/output_cluster/DataReadings/DC[6]/"
136 );
137 }
138  
139 0 ▶sub get_D_V2_DC {
Subroutine get_D_V2_DC: not called CC=1 SCAR=6.9
Pod undocumented
140 0 my $self = shift;
141 0 return $self->request(
142 type => "data",
143 id => "L1",
144 action => "get",
145 path => "/output_cluster/DataReadings/DC[7]/"
146 );
147 }
148  
149 0 ▶sub get_E_V1_DC {
Subroutine get_E_V1_DC: not called CC=1 SCAR=6.9
Pod undocumented
150 0 my $self = shift;
151 0 return $self->request(
152 type => "data",
153 id => "L1",
154 action => "get",
155 path => "/output_cluster/DataReadings/DC[8]/"
156 );
157 }
158  
159 0 ▶sub get_E_V2_DC {
Subroutine get_E_V2_DC: not called CC=1 SCAR=6.9
Pod undocumented
160 0 my $self = shift;
161 0 return $self->request(
162 type => "data",
163 id => "L1",
164 action => "get",
165 path => "/output_cluster/DataReadings/DC[9]/"
166 );
167 }
168  
169 0 ▶sub get_AI {
Subroutine get_AI: not called CC=1 SCAR=6.9
Pod undocumented
170 0 my $self = shift;
171 0 return $self->request(
172 type => "data",
173 id => "L1",
174 action => "get",
175 path => "/output_cluster/DataReadings/DC[10]/"
176 );
177 }
178  
179 0 ▶sub get_BI {
Subroutine get_BI: not called CC=1 SCAR=6.9
Pod undocumented
180 0 my $self = shift;
181 0 return $self->request(
182 type => "data",
183 id => "L1",
184 action => "get",
185 path => "/output_cluster/DataReadings/DC[11]/"
186 );
187 }
188  
189 0 ▶sub get_CI {
Subroutine get_CI: not called CC=1 SCAR=6.9
Pod undocumented
190 0 my $self = shift;
191 0 return $self->request(
192 type => "data",
193 id => "L1",
194 action => "get",
195 path => "/output_cluster/DataReadings/DC[12]/"
196 );
197 }
198  
199 0 ▶sub get_DI {
Subroutine get_DI: not called CC=1 SCAR=6.9
Pod undocumented
200 0 my $self = shift;
201 0 return $self->request(
202 type => "data",
203 id => "L1",
204 action => "get",
205 path => "/output_cluster/DataReadings/DC[13]/"
206 );
207 }
208  
209 0 ▶sub get_EI {
Subroutine get_EI: not called CC=1 SCAR=6.9
Pod undocumented
210 0 my $self = shift;
211 0 return $self->request(
212 type => "data",
213 id => "L1",
214 action => "get",
215 path => "/output_cluster/DataReadings/DC[14]/"
216 );
217 }
218  
219 0 ▶sub get_L1_X_0 {
Subroutine get_L1_X_0: not called CC=1 SCAR=6.9
Pod undocumented
220 0 my $self = shift;
221 0 return $self->request(
222 type => "data",
223 id => "L1",
224 action => "get",
225 path => "/output_cluster/DataReadings/X[0]/"
226 );
227 }
228  
229 0 ▶sub get_L1_Y_0 {
Subroutine get_L1_Y_0: not called CC=1 SCAR=6.9
Pod undocumented
230 0 my $self = shift;
231 0 return $self->request(
232 type => "data",
233 id => "L1",
234 action => "get",
235 path => "/output_cluster/DataReadings/Y[0]/"
236 );
237 }
238  
239 0 ▶sub get_L1_X_10 {
Subroutine get_L1_X_10: not called CC=1 SCAR=6.9
Pod undocumented
240 0 my $self = shift;
241 0 return $self->request(
242 type => "data",
243 id => "L1",
244 action => "get",
245 path => "/output_cluster/DataReadings/X[10]/"
246 );
247 }
248  
249 0 ▶sub get_L1_Y_10 {
Subroutine get_L1_Y_10: not called CC=1 SCAR=6.9
Pod undocumented
250 0 my $self = shift;
251 0 return $self->request(
252 type => "data",
253 id => "L1",
254 action => "get",
255 path => "/output_cluster/DataReadings/Y[10]/"
256 );
257 }
258  
259 0 ▶sub get_L1_frq {
Subroutine get_L1_frq: not called CC=1 SCAR=6.9
Pod undocumented
260 0 my $self = shift;
261 0 return $self->request(
262 type => "data",
263 id => "L1",
264 action => "get",
265 path =>
266 "/output_cluster/GeneralReadings/Lock-in_f_(Hz)"
267 );
268 }
269  
270 0 ▶sub set_L1_frq {
Subroutine set_L1_frq: not called CC=1 SCAR=6.9
Pod undocumented
271 0 my $self = shift;
272 0 return $self->request(
273 type => "config",
274 id => "Freq_1",
275 action => "set",
276 path =>
277 "/FrequencyCtrl/Frequency_(Hz)&value=..."
278 );
279 }
280  
281 0 ▶sub get_Offset_1 {
Subroutine get_Offset_1: not called CC=1 SCAR=6.9
Pod undocumented
282 0 my $self = shift;
283 0 return $self->request(
284 type => "config",
285 id => "Offset_1",
286 action => "get",
287 path =>
288 "/OffsetCtrl/Offset_(V)"
289 );
290 }
291  
292 0 ▶sub set_Offset_1 {
Subroutine set_Offset_1: not called CC=1 SCAR=6.9
Pod undocumented
293 0 my $self = shift;
294 0 return $self->request(
295 type => "config",
296 id => "Offset_1",
297 action => "set",
298 path =>
299 "/OffsetCtrl/Offset_(V)&value=..."
300 );
301 }
302  
303 0 ▶sub get_Amplitude_1 {
Subroutine get_Amplitude_1: not called CC=1 SCAR=6.9
Pod undocumented
304 0 my $self = shift;
305 0 return $self->request(
306 type => "config",
307 id => "Amplitude_1",
308 action => "get",
309 path =>
310 "/AmplitudeCtrl/Amplitude:Amplitude"
311 );
312 }
313  
314 0 ▶sub set_Amplitude_1 {
Subroutine set_Amplitude_1: not called CC=1 SCAR=6.9
Pod undocumented
315 0 my $self = shift;
316 0 return $self->request(
317 type => "config",
318 id => "Amplitude_1",
319 action => "set",
320 path =>
321 "/AmplitudeCtrl/Amplitude:Amplitude&value=..."
322 );
323 }
324  
325 0 ▶sub get_time_constant_1 {
Subroutine get_time_constant_1: not called CC=1 SCAR=6.9
Pod undocumented
326 0 my $self = shift;
327 0 return $self->request(
328 type => "config",
329 id => "Lockin_L1",
330 action => "get",
331 path =>
332 "/LockinCtrl/Time_constant_(s)"
333 );
334 }
335  
336 0 ▶sub set_time_constant_1 {
Subroutine set_time_constant_1: not called CC=1 SCAR=6.9
Pod undocumented
337 0 my $self = shift;
338 0 return $self->request(
339 type => "config",
340 id => "Lockin_L1",
341 action => "set",
342 path =>
343 "/LockinCtrl/Time_constant_(s)&value=..."
344 );
345 }
346  
347  
348  
349 1 __PACKAGE__->meta()->make_immutable();
350  
351 1 1;
352  
353 __END__
« Moose/Instrument/ZI_MFLI.pm ↑ Summary Moose/Instrument.pm »