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 SCAR 2.7
CC
1
Cov
32%
__ANON__
2.0
request
2.0
get_A_V1_DC
2.0
CRAP 1.3
« Moose/Instrument/ZI_HDAWG.pm ↑ Summary Moose/Connection/IsoBus.pm »
1 package Lab::Moose::Instrument::Synctek_MCL1_540;
2 1 $Lab::Moose::Instrument::Synctek_MCL1_540::VERSION = '3.881';
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/
12 validated_getter
13 validated_setter
14 validated_no_param_setter
15 setter_params
16 1 ▶ /;
Subroutine BEGIN: called CC=1 SCAR=0.0
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 around default_connection_options => sub {
37 0 ▶ my $orig = shift;
Subroutine __ANON__: not called CC=1 SCAR=6.9
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 sub request {
48 0 ▶ my ( $self, %args ) = validated_getter(
Subroutine request: not called CC=1 SCAR=6.9
Pod undocumented
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 sub get_A_V1_DC {
70 0 ▶ my $self = shift;
Subroutine get_A_V1_DC: not called CC=1 SCAR=6.9
Pod undocumented
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 sub get_A_V2_DC {
80 0 ▶ my $self = shift;
Subroutine get_A_V2_DC: not called CC=1 SCAR=6.9
Pod undocumented
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 sub get_B_V1_DC {
90 0 ▶ my $self = shift;
Subroutine get_B_V1_DC: not called CC=1 SCAR=6.9
Pod undocumented
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 sub get_B_V2_DC {
100 0 ▶ my $self = shift;
Subroutine get_B_V2_DC: not called CC=1 SCAR=6.9
Pod undocumented
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 sub get_C_V1_DC {
110 0 ▶ my $self = shift;
Subroutine get_C_V1_DC: not called CC=1 SCAR=6.9
Pod undocumented
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 sub get_C_V2_DC {
120 0 ▶ my $self = shift;
Subroutine get_C_V2_DC: not called CC=1 SCAR=6.9
Pod undocumented
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 sub get_D_V1_DC {
130 0 ▶ my $self = shift;
Subroutine get_D_V1_DC: not called CC=1 SCAR=6.9
Pod undocumented
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 sub get_D_V2_DC {
140 0 ▶ my $self = shift;
Subroutine get_D_V2_DC: not called CC=1 SCAR=6.9
Pod undocumented
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 sub get_E_V1_DC {
150 0 ▶ my $self = shift;
Subroutine get_E_V1_DC: not called CC=1 SCAR=6.9
Pod undocumented
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 sub get_E_V2_DC {
160 0 ▶ my $self = shift;
Subroutine get_E_V2_DC: not called CC=1 SCAR=6.9
Pod undocumented
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 sub get_AI {
170 0 ▶ my $self = shift;
Subroutine get_AI: not called CC=1 SCAR=6.9
Pod undocumented
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 sub get_BI {
180 0 ▶ my $self = shift;
Subroutine get_BI: not called CC=1 SCAR=6.9
Pod undocumented
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 sub get_CI {
190 0 ▶ my $self = shift;
Subroutine get_CI: not called CC=1 SCAR=6.9
Pod undocumented
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 sub get_DI {
200 0 ▶ my $self = shift;
Subroutine get_DI: not called CC=1 SCAR=6.9
Pod undocumented
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 sub get_EI {
210 0 ▶ my $self = shift;
Subroutine get_EI: not called CC=1 SCAR=6.9
Pod undocumented
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 sub get_L1_X_0 {
220 0 ▶ my $self = shift;
Subroutine get_L1_X_0: not called CC=1 SCAR=6.9
Pod undocumented
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 sub get_L1_Y_0 {
230 0 ▶ my $self = shift;
Subroutine get_L1_Y_0: not called CC=1 SCAR=6.9
Pod undocumented
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 sub get_L1_X_10 {
240 0 ▶ my $self = shift;
Subroutine get_L1_X_10: not called CC=1 SCAR=6.9
Pod undocumented
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 sub get_L1_Y_10 {
250 0 ▶ my $self = shift;
Subroutine get_L1_Y_10: not called CC=1 SCAR=6.9
Pod undocumented
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 sub get_L1_frq {
260 0 ▶ my $self = shift;
Subroutine get_L1_frq: not called CC=1 SCAR=6.9
Pod undocumented
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 sub set_L1_frq {
271 0 ▶ my $self = shift;
Subroutine set_L1_frq: not called CC=1 SCAR=6.9
Pod undocumented
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 sub get_Offset_1 {
282 0 ▶ my $self = shift;
Subroutine get_Offset_1: not called CC=1 SCAR=6.9
Pod undocumented
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 sub set_Offset_1 {
293 0 ▶ my $self = shift;
Subroutine set_Offset_1: not called CC=1 SCAR=6.9
Pod undocumented
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 sub get_Amplitude_1 {
304 0 ▶ my $self = shift;
Subroutine get_Amplitude_1: not called CC=1 SCAR=6.9
Pod undocumented
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 sub set_Amplitude_1 {
315 0 ▶ my $self = shift;
Subroutine set_Amplitude_1: not called CC=1 SCAR=6.9
Pod undocumented
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 sub get_time_constant_1 {
326 0 ▶ my $self = shift;
Subroutine get_time_constant_1: not called CC=1 SCAR=6.9
Pod undocumented
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 sub set_time_constant_1 {
337 0 ▶ my $self = shift;
Subroutine set_time_constant_1: not called CC=1 SCAR=6.9
Pod undocumented
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__
354  
355 =pod
356  
357 =encoding UTF-8
358  
359 =head1 NAME
360  
361 Lab::Moose::Instrument::Synctek_MCL1_540 - Synctek MCL1-540 Lock-in Amplifier
362  
363 =head1 VERSION
364  
365 version 3.881
366  
367 =head1 SYNOPSIS
368  
369 use Lab::Moose;
370  
371 my $lockin = instrument(...);
372  
373 TODO
374  
375 =head2 Consumed Roles
376  
377 This driver consumes the following roles:
378  
379 =over
380  
381 =item TODO
382  
383 =back
384  
385 =head1 COPYRIGHT AND LICENSE
386  
387 This software is copyright (c) 2023 by the Lab::Measurement team; in detail:
388  
389 Copyright 2022 Jonas Schambeck, Mia Schambeck, Simon Reinhardt
390 2023 Mia Schambeck
391  
392  
393 This is free software; you can redistribute it and/or modify it under
394 the same terms as the Perl 5 programming language system itself.
395  
396 =cut
« Moose/Instrument/ZI_HDAWG.pm ↑ Summary Moose/Connection/IsoBus.pm »