newportxps 0.3.0__py3-none-any.whl → 2025.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -14,6 +14,8 @@
14
14
 
15
15
  import sys
16
16
  import socket
17
+ from collections import defaultdict
18
+ from typing import Callable, Dict, Union, List
17
19
 
18
20
  from .utils import bytes2str, str2bytes
19
21
 
@@ -24,20 +26,47 @@ class XPSException(Exception):
24
26
  def __str__(self):
25
27
  return str(self.msg)
26
28
 
29
+
30
+ class XPSOutputs:
31
+ _PARSERS: Dict[str, Callable[[str], Union[bool, str, float, int]]] = {
32
+ 'bool': bool,
33
+ 'char': lambda x: x,
34
+ 'double': float,
35
+ 'int': int,
36
+ 'short': int,
37
+ 'unsigned short': int,
38
+ }
39
+
40
+ def __init__(self, *output_parameter_types: str):
41
+ self.output_parameter_types = output_parameter_types
42
+ for p in output_parameter_types:
43
+ assert p in self._PARSERS, f'Unknown output parameter type {p}'
44
+
45
+ def __str__(self):
46
+ return ','.join(f'{c_type} *' for c_type in self.output_parameter_types)
47
+
48
+ def parse(self, error: int, response: str):
49
+ if error != 0:
50
+ return [error, response]
51
+
52
+ response_parts = response.split(',', len(self.output_parameter_types))
53
+ parsed_response: List[Union[bool, str, float, int]] = [error]
54
+ for i, c_type in enumerate(self.output_parameter_types):
55
+ parsed_response.append(self._PARSERS[c_type](response_parts[i]))
56
+ return parsed_response
57
+
58
+
27
59
  class XPS:
28
60
  # Defines
29
61
  MAX_NB_SOCKETS = 100
30
62
 
31
63
  # Global variables
32
64
  __sockets = {}
33
- __usedSockets = {}
65
+ __usedSockets = defaultdict(int)
34
66
  __nbSockets = 0
35
67
 
36
68
  # Initialization Function
37
69
  def __init__ (self):
38
- XPS.__nbSockets = 0
39
- for socketId in range(self.MAX_NB_SOCKETS):
40
- XPS.__usedSockets[socketId] = 0
41
70
  self.errorcodes = {}
42
71
 
43
72
  def withValidSocket(fcn):
@@ -60,20 +89,21 @@ class XPS:
60
89
  @withValidSocket
61
90
  def __sendAndReceive (self, socketId, command):
62
91
  # print("SEND REC ", command, type(command))
92
+ suffix = ',EndOfAPI'
63
93
  try:
94
+ XPS.__sockets[socketId].settimeout(3600.0)
64
95
  XPS.__sockets[socketId].send(str2bytes(command))
65
96
  ret = bytes2str(XPS.__sockets[socketId].recv(1024))
66
- while (ret.find(',EndOfAPI') == -1):
97
+ while (ret.find(suffix) == -1):
67
98
  ret += bytes2str(XPS.__sockets[socketId].recv(1024))
68
99
  except socket.timeout:
69
- return [-2, '']
100
+ return -2, ''
70
101
  except socket.error as err: # (errNb, errString):
71
102
  print( 'Socket error : ', err.errno, err)
72
- return [-2, '']
103
+ return -2, ''
73
104
 
74
- for i in range(len(ret)):
75
- if (ret[i] == ','):
76
- return [int(ret[0:i]), ret[i+1:-9]]
105
+ error, rest = ret[:-len(suffix)].split(',', 1)
106
+ return int(error), rest
77
107
 
78
108
  def Send(self, socketId=None, cmd=None, check=False):
79
109
  """send and receive command cmd from socketId
@@ -142,49 +172,29 @@ class XPS:
142
172
 
143
173
  # ControllerMotionKernelTimeLoadGet : Get controller motion kernel time load
144
174
  def ControllerMotionKernelTimeLoadGet(self, socketId=None):
145
- command = 'ControllerMotionKernelTimeLoadGet(double *,double *,double *,double *)'
175
+ outputs = XPSOutputs("double", 'double', 'double', 'double')
176
+ command = f'ControllerMotionKernelTimeLoadGet({outputs})'
146
177
  error, returnedString = self.Send(socketId=socketId, cmd=command)
147
- if (error != 0):
148
- return [error, returnedString]
149
-
150
- i, j, retList = 0, 0, [error]
151
- for paramNb in range(4):
152
- while ((i+j) < len(returnedString) and returnedString[i+j] != ','):
153
- j += 1
154
- retList.append(eval(returnedString[i:i+j]))
155
- i, j = i+j+1, 0
156
- return retList
178
+ return outputs.parse(error, returnedString)
157
179
 
158
180
  # ControllerStatusGet : Read controller current status
159
181
  def ControllerStatusGet(self, socketId=None):
182
+ outputs = XPSOutputs('int')
160
183
  error, returnedString = self.Send(socketId=socketId,
161
- cmd='ControllerStatusGet(int *)', check=True)
162
- i, j, retList = 0, 0, [error]
163
- while ((i+j) < len(returnedString) and returnedString[i+j] != ','):
164
- j += 1
165
- retList.append(eval(returnedString[i:i+j]))
166
- return retList
184
+ cmd=f'ControllerStatusGet({outputs})', check=True)
185
+ return outputs.parse(error, returnedString)
167
186
 
168
187
  # ControllerStatusStringGet : Return the controller status string corresponding to the controller status code
169
188
  def ControllerStatusStringGet(self, socketId, ControllerStatusCode):
170
189
  command = 'ControllerStatusStringGet(%s, char *)' % str(ControllerStatusCode)
171
190
  return self.Send(socketId, command)
172
191
 
173
-
174
192
  # ElapsedTimeGet : Return elapsed time from controller power on
175
193
  def ElapsedTimeGet(self, socketId=None):
176
- command = 'ElapsedTimeGet(double *)'
177
- [error, returnedString] = self.Send(socketId, command)
178
- if (error != 0):
179
- return [error, returnedString]
180
-
181
- i, j, retList = 0, 0, [error]
182
- while ((i+j) < len(returnedString) and returnedString[i+j] != ','):
183
- j += 1
184
- retList.append(eval(returnedString[i:i+j]))
185
-
186
- return retList
187
-
194
+ outputs = XPSOutputs('double')
195
+ command = f'ElapsedTimeGet({outputs})'
196
+ error, returnedString = self.Send(socketId, command)
197
+ return outputs.parse(error, returnedString)
188
198
 
189
199
  # ErrorStringGet : Return the error string corresponding to the error code
190
200
  def ErrorStringGet(self, socketId, ErrorCode):
@@ -216,17 +226,10 @@ class XPS:
216
226
 
217
227
  # TimerGet : Get a timer
218
228
  def TimerGet (self, socketId, TimerName):
219
- command = 'TimerGet(' + TimerName + ',int *)'
229
+ outputs = XPSOutputs('int')
230
+ command = f'TimerGet({TimerName},{outputs})'
220
231
  error, returnedString = self.Send(socketId, command)
221
- if (error != 0):
222
- return [error, returnedString]
223
-
224
- i, j, retList = 0, 0, [error]
225
- while ((i+j) < len(returnedString) and returnedString[i+j] != ','):
226
- j += 1
227
- retList.append(eval(returnedString[i:i+j]))
228
-
229
- return retList
232
+ return outputs.parse(error, returnedString)
230
233
 
231
234
  # TimerSet : Set a timer
232
235
  def TimerSet (self, socketId, TimerName, FrequencyTicks):
@@ -306,16 +309,10 @@ class XPS:
306
309
 
307
310
  # EventExtendedStart : Launch the last event and action configuration and return an ID
308
311
  def EventExtendedStart (self, socketId):
309
- command = 'EventExtendedStart(int *)'
312
+ outputs = XPSOutputs('int')
313
+ command = f'EventExtendedStart({outputs})'
310
314
  error, returnedString = self.Send(socketId, command)
311
- if (error != 0):
312
- return [error, returnedString]
313
-
314
- i, j, retList = 0, 0, [error]
315
- while ((i+j) < len(returnedString) and returnedString[i+j] != ','):
316
- j += 1
317
- retList.append(eval(returnedString[i:i+j]))
318
- return retList
315
+ return outputs.parse(error, returnedString)
319
316
 
320
317
  # EventExtendedAllGet : Read all event and action configurations
321
318
  def EventExtendedAllGet (self, socketId):
@@ -349,18 +346,10 @@ class XPS:
349
346
 
350
347
  # GatheringCurrentNumberGet : Maximum number of samples and current number during acquisition
351
348
  def GatheringCurrentNumberGet (self, socketId):
352
- command = 'GatheringCurrentNumberGet(int *,int *)'
349
+ outputs = XPSOutputs('int', 'int')
350
+ command = f'GatheringCurrentNumberGet({outputs})'
353
351
  error, returnedString = self.Send(socketId, command)
354
- if (error != 0):
355
- return [error, returnedString]
356
-
357
- i, j, retList = 0, 0, [error]
358
- for paramNb in range(2):
359
- while ((i+j) < len(returnedString) and returnedString[i+j] != ','):
360
- j += 1
361
- retList.append(eval(returnedString[i:i+j]))
362
- i, j = i+j+1, 0
363
- return retList
352
+ return outputs.parse(error, returnedString)
364
353
 
365
354
  # GatheringStopAndSave : Stop acquisition and save data
366
355
  def GatheringStopAndSave (self, socketId):
@@ -415,19 +404,10 @@ class XPS:
415
404
 
416
405
  # GatheringExternalCurrentNumberGet : Maximum number of samples and current number during acquisition
417
406
  def GatheringExternalCurrentNumberGet (self, socketId):
418
- command = 'GatheringExternalCurrentNumberGet(int *,int *)'
407
+ outputs = XPSOutputs('int', 'int')
408
+ command = f'GatheringExternalCurrentNumberGet({outputs})'
419
409
  error, returnedString = self.Send(socketId, command)
420
- if (error != 0):
421
- return [error, returnedString]
422
-
423
- i, j, retList = 0, 0, [error]
424
- for paramNb in range(2):
425
- while ((i+j) < len(returnedString) and returnedString[i+j] != ','):
426
- j += 1
427
- retList.append(eval(returnedString[i:i+j]))
428
- i, j = i+j+1, 0
429
- return retList
430
-
410
+ return outputs.parse(error, returnedString)
431
411
 
432
412
  # GatheringExternalDataGet : Get a data line from external gathering buffer
433
413
  def GatheringExternalDataGet (self, socketId, IndexPoint):
@@ -448,16 +428,10 @@ class XPS:
448
428
 
449
429
  # DoubleGlobalArrayGet : Get double global array value
450
430
  def DoubleGlobalArrayGet (self, socketId, Number):
451
- command = 'DoubleGlobalArrayGet(' + str(Number) + ',double *)'
431
+ outputs = XPSOutputs('double')
432
+ command = f'DoubleGlobalArrayGet({Number},{outputs})'
452
433
  error, returnedString = self.Send(socketId, command)
453
- if (error != 0):
454
- return [error, returnedString]
455
-
456
- i, j, retList = 0, 0, [error]
457
- while ((i+j) < len(returnedString) and returnedString[i+j] != ','):
458
- j += 1
459
- retList.append(eval(returnedString[i:i+j]))
460
- return retList
434
+ return outputs.parse(error, returnedString)
461
435
 
462
436
  # DoubleGlobalArraySet : Set double global array value
463
437
  def DoubleGlobalArraySet (self, socketId, Number, DoubleValue):
@@ -466,6 +440,7 @@ class XPS:
466
440
 
467
441
  # GPIOAnalogGet : Read analog input or analog output for one or few input
468
442
  def GPIOAnalogGet (self, socketId, GPIOName):
443
+ outputs = XPSOutputs(*(['double'] * len(GPIOName)))
469
444
  command = 'GPIOAnalogGet('
470
445
  for i in range(len(GPIOName)):
471
446
  if (i > 0):
@@ -474,17 +449,7 @@ class XPS:
474
449
  command += ')'
475
450
 
476
451
  error, returnedString = self.Send(socketId, command)
477
- if (error != 0):
478
- return [error, returnedString]
479
-
480
- i, j, retList = 0, 0, [error]
481
- for paramNb in range(len(GPIOName)):
482
- while ((i+j) < len(returnedString) and returnedString[i+j] != ','):
483
- j += 1
484
- retList.append(eval(returnedString[i:i+j]))
485
- i, j = i+j+1, 0
486
- return retList
487
-
452
+ return outputs.parse(error, returnedString)
488
453
 
489
454
  # GPIOAnalogSet : Set analog output for one or few output
490
455
  def GPIOAnalogSet (self, socketId, GPIOName, AnalogOutputValue):
@@ -496,9 +461,9 @@ class XPS:
496
461
  command += ')'
497
462
  return self.Send(socketId, command)
498
463
 
499
-
500
464
  # GPIOAnalogGainGet : Read analog input gain (1, 2, 4 or 8) for one or few input
501
465
  def GPIOAnalogGainGet (self, socketId, GPIOName):
466
+ outputs = XPSOutputs(*(['int'] * len(GPIOName)))
502
467
  command = 'GPIOAnalogGainGet('
503
468
  for i in range(len(GPIOName)):
504
469
  if (i > 0):
@@ -507,17 +472,7 @@ class XPS:
507
472
  command += ')'
508
473
 
509
474
  error, returnedString = self.Send(socketId, command)
510
- if (error != 0):
511
- return [error, returnedString]
512
-
513
- i, j, retList = 0, 0, [error]
514
- for paramNb in range(len(GPIOName)):
515
- while ((i+j) < len(returnedString) and returnedString[i+j] != ','):
516
- j += 1
517
- retList.append(eval(returnedString[i:i+j]))
518
- i, j = i+j+1, 0
519
- return retList
520
-
475
+ return outputs.parse(error, returnedString)
521
476
 
522
477
  # GPIOAnalogGainSet : Set analog input gain (1, 2, 4 or 8) for one or few input
523
478
  def GPIOAnalogGainSet (self, socketId, GPIOName, AnalogInputGainValue):
@@ -532,17 +487,10 @@ class XPS:
532
487
 
533
488
  # GPIODigitalGet : Read digital output or digital input
534
489
  def GPIODigitalGet (self, socketId, GPIOName):
535
-
536
- command = 'GPIODigitalGet(' + GPIOName + ',unsigned short *)'
490
+ outputs = XPSOutputs('unsigned short')
491
+ command = f'GPIODigitalGet({GPIOName},{outputs})'
537
492
  error, returnedString = self.Send(socketId, command)
538
- if (error != 0):
539
- return [error, returnedString]
540
-
541
- i, j, retList = 0, 0, [error]
542
- while ((i+j) < len(returnedString) and returnedString[i+j] != ','):
543
- j += 1
544
- retList.append(eval(returnedString[i:i+j]))
545
- return retList
493
+ return outputs.parse(error, returnedString)
546
494
 
547
495
 
548
496
  # GPIODigitalSet : Set Digital Output for one or few output TTL
@@ -552,24 +500,11 @@ class XPS:
552
500
 
553
501
  # GroupAccelerationSetpointGet : Return setpoint accelerations
554
502
  def GroupAccelerationSetpointGet (self, socketId, GroupName, nbElement):
555
- command = 'GroupAccelerationSetpointGet(' + GroupName + ','
556
- for i in range(nbElement):
557
- if (i > 0):
558
- command += ','
559
- command += 'double *'
560
- command += ')'
503
+ outputs = XPSOutputs(*(['double'] * nbElement))
504
+ command = f'GroupAccelerationSetpointGet({GroupName},{outputs})'
561
505
 
562
506
  error, returnedString = self.Send(socketId, command)
563
- if (error != 0):
564
- return [error, returnedString]
565
-
566
- i, j, retList = 0, 0, [error]
567
- for paramNb in range(nbElement):
568
- while ((i+j) < len(returnedString) and returnedString[i+j] != ','):
569
- j += 1
570
- retList.append(eval(returnedString[i:i+j]))
571
- i, j = i+j+1, 0
572
- return retList
507
+ return outputs.parse(error, returnedString)
573
508
 
574
509
  # GroupAnalogTrackingModeEnable : Enable Analog Tracking mode on selected group
575
510
  def GroupAnalogTrackingModeEnable (self, socketId, GroupName, Type):
@@ -583,46 +518,18 @@ class XPS:
583
518
 
584
519
  # GroupCorrectorOutputGet : Return corrector outputs
585
520
  def GroupCorrectorOutputGet (self, socketId, GroupName, nbElement):
586
- command = 'GroupCorrectorOutputGet(' + GroupName + ','
587
- for i in range(nbElement):
588
- if (i > 0):
589
- command += ','
590
- command += 'double *'
591
- command += ')'
521
+ outputs = XPSOutputs(*(['double'] * nbElement))
522
+ command = f'GroupCorrectorOutputGet({GroupName},{outputs})'
592
523
  error, returnedString = self.Send(socketId, command)
593
- if (error != 0):
594
- return [error, returnedString]
595
-
596
- i, j, retList = 0, 0, [error]
597
- for paramNb in range(nbElement):
598
- while ((i+j) < len(returnedString) and returnedString[i+j] != ','):
599
- j += 1
600
- retList.append(eval(returnedString[i:i+j]))
601
- i, j = i+j+1, 0
602
- return retList
603
-
524
+ return outputs.parse(error, returnedString)
604
525
 
605
526
  # GroupCurrentFollowingErrorGet : Return current following errors
606
527
  def GroupCurrentFollowingErrorGet (self, socketId, GroupName, nbElement):
607
- command = 'GroupCurrentFollowingErrorGet(' + GroupName + ','
608
- for i in range(nbElement):
609
- if (i > 0):
610
- command += ','
611
- command += 'double *'
612
- command += ')'
528
+ outputs = XPSOutputs(*(['double'] * nbElement))
529
+ command = f'GroupCurrentFollowingErrorGet({GroupName},{outputs})'
613
530
 
614
531
  error, returnedString = self.Send(socketId, command)
615
- if (error != 0):
616
- return [error, returnedString]
617
-
618
- i, j, retList = 0, 0, [error]
619
- for paramNb in range(nbElement):
620
- while ((i+j) < len(returnedString) and returnedString[i+j] != ','):
621
- j += 1
622
- retList.append(eval(returnedString[i:i+j]))
623
- i, j = i+j+1, 0
624
- return retList
625
-
532
+ return outputs.parse(error, returnedString)
626
533
 
627
534
  # GroupHomeSearch : Start home search sequence
628
535
  def GroupHomeSearch (self, socketId, GroupName):
@@ -658,47 +565,19 @@ class XPS:
658
565
 
659
566
  # GroupJogParametersGet : Get Jog parameters on selected group
660
567
  def GroupJogParametersGet (self, socketId, GroupName, nbElement):
661
- command = 'GroupJogParametersGet(' + GroupName + ','
662
- for i in range(nbElement):
663
- if (i > 0):
664
- command += ','
665
- command += 'double *' + ',' + 'double *'
666
- command += ')'
568
+ outputs = XPSOutputs(*(['double'] * 2 * nbElement))
569
+ command = f'GroupJogParametersGet({GroupName},{outputs})'
667
570
 
668
571
  error, returnedString = self.Send(socketId, command)
669
- if (error != 0):
670
- return [error, returnedString]
671
-
672
- i, j, retList = 0, 0, [error]
673
- for paramNb in range(nbElement*2):
674
- while ((i+j) < len(returnedString) and returnedString[i+j] != ','):
675
- j += 1
676
- retList.append(eval(returnedString[i:i+j]))
677
- i, j = i+j+1, 0
678
- return retList
572
+ return outputs.parse(error, returnedString)
679
573
 
680
574
  # GroupJogCurrentGet : Get Jog current on selected group
681
575
  def GroupJogCurrentGet (self, socketId, GroupName, nbElement):
682
- command = 'GroupJogCurrentGet(' + GroupName + ','
683
- for i in range(nbElement):
684
- if (i > 0):
685
- command += ','
686
- command += 'double *' + ',' + 'double *'
687
- command += ')'
576
+ outputs = XPSOutputs(*(['double'] * 2 * nbElement))
577
+ command = f'GroupJogCurrentGet({GroupName},{outputs})'
688
578
 
689
579
  error, returnedString = self.Send(socketId, command)
690
- if (error != 0):
691
- return [error, returnedString]
692
-
693
- i, j, retList = 0, 0, [error]
694
- for paramNb in range(nbElement*2):
695
- while ((i+j) < len(returnedString) and returnedString[i+j] != ','):
696
- j += 1
697
- retList.append(eval(returnedString[i:i+j]))
698
- i, j = i+j+1, 0
699
-
700
- return retList
701
-
580
+ return outputs.parse(error, returnedString)
702
581
 
703
582
  # GroupJogModeEnable : Enable Jog mode on selected group
704
583
  def GroupJogModeEnable (self, socketId, GroupName):
@@ -748,99 +627,42 @@ class XPS:
748
627
 
749
628
  # GroupPositionCorrectedProfilerGet : Return corrected profiler positions
750
629
  def GroupPositionCorrectedProfilerGet (self, socketId, GroupName, PositionX, PositionY):
751
- command = 'GroupPositionCorrectedProfilerGet(' + GroupName + ',' + str(PositionX) + ',' + str(PositionY) + ',double *,double *)'
630
+ outputs = XPSOutputs('double', 'double')
631
+ command = f'GroupPositionCorrectedProfilerGet({GroupName},{PositionX},{PositionY},{outputs})'
752
632
  error, returnedString = self.Send(socketId, command)
753
- if (error != 0):
754
- return [error, returnedString]
755
-
756
- i, j, retList = 0, 0, [error]
757
- for paramNb in range(2):
758
- while ((i+j) < len(returnedString) and returnedString[i+j] != ','):
759
- j += 1
760
- retList.append(eval(returnedString[i:i+j]))
761
- i, j = i+j+1, 0
762
- return retList
763
-
633
+ return outputs.parse(error, returnedString)
764
634
 
765
635
  # GroupPositionCurrentGet : Return current positions
766
636
  def GroupPositionCurrentGet (self, socketId, GroupName, nbElement):
767
- command = 'GroupPositionCurrentGet(' + GroupName + ','
768
- for i in range(nbElement):
769
- if (i > 0):
770
- command += ','
771
- command += 'double *'
772
- command += ')'
637
+ outputs = XPSOutputs(*(['double'] * nbElement))
638
+ command = f'GroupPositionCurrentGet({GroupName},{outputs})'
773
639
 
774
640
  error, returnedString = self.Send(socketId, command)
775
- if (error != 0):
776
- return [error, returnedString]
777
-
778
- i, j, retList = 0, 0, [error]
779
- for paramNb in range(nbElement):
780
- while ((i+j) < len(returnedString) and returnedString[i+j] != ','):
781
- j += 1
782
- retList.append(eval(returnedString[i:i+j]))
783
- i, j = i+j+1, 0
784
- return retList
641
+ return outputs.parse(error, returnedString)
785
642
 
786
643
  # GroupPositionPCORawEncoderGet : Return PCO raw encoder positions
787
644
  def GroupPositionPCORawEncoderGet (self, socketId, GroupName, PositionX, PositionY):
788
- command = 'GroupPositionPCORawEncoderGet(' + GroupName + ',' + str(PositionX) + ',' + str(PositionY) + ',double *,double *)'
789
- error, returnedString = self.Send(socketId, command)
790
- if (error != 0):
791
- return [error, returnedString]
645
+ outputs = XPSOutputs('double', 'double')
646
+ command = f'GroupPositionPCORawEncoderGet({GroupName},{PositionX},{PositionY},{outputs})'
792
647
 
793
- i, j, retList = 0, 0, [error]
794
- for paramNb in range(2):
795
- while ((i+j) < len(returnedString) and returnedString[i+j] != ','):
796
- j += 1
797
- retList.append(eval(returnedString[i:i+j]))
798
- i, j = i+j+1, 0
799
- return retList
648
+ error, returnedString = self.Send(socketId, command)
649
+ return outputs.parse(error, returnedString)
800
650
 
801
651
  # GroupPositionSetpointGet : Return setpoint positions
802
652
  def GroupPositionSetpointGet (self, socketId, GroupName, nbElement):
803
- command = 'GroupPositionSetpointGet(' + GroupName + ','
804
- for i in range(nbElement):
805
- if (i > 0):
806
- command += ','
807
- command += 'double *'
808
- command += ')'
653
+ outputs = XPSOutputs(*(['double'] * nbElement))
654
+ command = f'GroupPositionSetpointGet({GroupName},{outputs})'
809
655
 
810
656
  error, returnedString = self.Send(socketId, command)
811
- if (error != 0):
812
- return [error, returnedString]
813
-
814
- i, j, retList = 0, 0, [error]
815
- for paramNb in range(nbElement):
816
- while ((i+j) < len(returnedString) and returnedString[i+j] != ','):
817
- j += 1
818
- retList.append(eval(returnedString[i:i+j]))
819
- i, j = i+j+1, 0
820
- return retList
821
-
657
+ return outputs.parse(error, returnedString)
822
658
 
823
659
  # GroupPositionTargetGet : Return target positions
824
660
  def GroupPositionTargetGet (self, socketId, GroupName, nbElement):
825
- command = 'GroupPositionTargetGet(' + GroupName + ','
826
- for i in range(nbElement):
827
- if (i > 0):
828
- command += ','
829
- command += 'double *'
830
- command += ')'
661
+ outputs = XPSOutputs(*(['double'] * nbElement))
662
+ command = f'GroupPositionTargetGet({GroupName},{outputs})'
831
663
 
832
664
  error, returnedString = self.Send(socketId, command)
833
- if (error != 0):
834
- return [error, returnedString]
835
-
836
- i, j, retList = 0, 0, [error]
837
- for paramNb in range(nbElement):
838
- while ((i+j) < len(returnedString) and returnedString[i+j] != ','):
839
- j += 1
840
- retList.append(eval(returnedString[i:i+j]))
841
- i, j = i+j+1, 0
842
- return retList
843
-
665
+ return outputs.parse(error, returnedString)
844
666
 
845
667
  # GroupReferencingActionExecute : Execute an action in referencing mode
846
668
  def GroupReferencingActionExecute (self, socketId, PositionerName, ReferencingAction, ReferencingSensor, ReferencingParameter):
@@ -857,17 +679,10 @@ class XPS:
857
679
 
858
680
  # GroupStatusGet : Return group status
859
681
  def GroupStatusGet (self, socketId, GroupName):
860
- command = 'GroupStatusGet(' + GroupName + ',int *)'
682
+ outputs = XPSOutputs('int')
683
+ command = f'GroupStatusGet({GroupName},{outputs})'
861
684
  error, returnedString = self.Send(socketId, command)
862
- if (error != 0):
863
- return [error, returnedString]
864
-
865
- i, j, retList = 0, 0, [error]
866
- while ((i+j) < len(returnedString) and returnedString[i+j] != ','):
867
- j += 1
868
- retList.append(eval(returnedString[i:i+j]))
869
- return retList
870
-
685
+ return outputs.parse(error, returnedString)
871
686
 
872
687
  # GroupStatusStringGet : Return the group status string corresponding to the group status code
873
688
  def GroupStatusStringGet (self, socketId, GroupStatusCode):
@@ -875,25 +690,11 @@ class XPS:
875
690
 
876
691
  # GroupVelocityCurrentGet : Return current velocities
877
692
  def GroupVelocityCurrentGet (self, socketId, GroupName, nbElement):
878
- command = 'GroupVelocityCurrentGet(' + GroupName + ','
879
- for i in range(nbElement):
880
- if (i > 0):
881
- command += ','
882
- command += 'double *'
883
- command += ')'
693
+ outputs = XPSOutputs(*(['double'] * nbElement))
694
+ command = f'GroupVelocityCurrentGet({GroupName},{outputs})'
884
695
 
885
696
  error, returnedString = self.Send(socketId, command)
886
- if (error != 0):
887
- return [error, returnedString]
888
-
889
- i, j, retList = 0, 0, [error]
890
- for paramNb in range(nbElement):
891
- while ((i+j) < len(returnedString) and returnedString[i+j] != ','):
892
- j += 1
893
- retList.append(eval(returnedString[i:i+j]))
894
- i, j = i+j+1, 0
895
- return retList
896
-
697
+ return outputs.parse(error, returnedString)
897
698
 
898
699
  # KillAll : Put all groups in 'Not initialized' state
899
700
  def KillAll (self, socketId):
@@ -901,18 +702,10 @@ class XPS:
901
702
 
902
703
  # PositionerAnalogTrackingPositionParametersGet : Read dynamic parameters for one axe of a group for a future analog tracking position
903
704
  def PositionerAnalogTrackingPositionParametersGet (self, socketId, PositionerName):
904
- command = 'PositionerAnalogTrackingPositionParametersGet(' + PositionerName + ',char *,double *,double *,double *,double *)'
705
+ outputs = XPSOutputs('char', 'double', 'double', 'double', 'double')
706
+ command = f'PositionerAnalogTrackingPositionParametersGet({PositionerName},{outputs})'
905
707
  error, returnedString = self.Send(socketId, command)
906
- if (error != 0):
907
- return [error, returnedString]
908
-
909
- i, j, retList = 0, 0, [error]
910
- for paramNb in range(4):
911
- while ((i+j) < len(returnedString) and returnedString[i+j] != ','):
912
- j += 1
913
- retList.append(eval(returnedString[i:i+j]))
914
- i, j = i+j+1, 0
915
- return retList
708
+ return outputs.parse(error, returnedString)
916
709
 
917
710
  # PositionerAnalogTrackingPositionParametersSet : Update dynamic parameters for one axe of a group for a future analog tracking position
918
711
  def PositionerAnalogTrackingPositionParametersSet (self, socketId, PositionerName, GPIOName, Offset, Scale, Velocity, Acceleration):
@@ -921,18 +714,10 @@ class XPS:
921
714
 
922
715
  # PositionerAnalogTrackingVelocityParametersGet : Read dynamic parameters for one axe of a group for a future analog tracking velocity
923
716
  def PositionerAnalogTrackingVelocityParametersGet (self, socketId, PositionerName):
924
- command = 'PositionerAnalogTrackingVelocityParametersGet(' + PositionerName + ',char *,double *,double *,double *,int *,double *,double *)'
717
+ outputs = XPSOutputs('char', 'double', 'double', 'double', 'int', 'double', 'double')
718
+ command = f'PositionerAnalogTrackingVelocityParametersGet({PositionerName},{outputs})'
925
719
  error, returnedString = self.Send(socketId, command)
926
- if (error != 0):
927
- return [error, returnedString]
928
-
929
- i, j, retList = 0, 0, [error]
930
- for paramNb in range(6):
931
- while ((i+j) < len(returnedString) and returnedString[i+j] != ','):
932
- j += 1
933
- retList.append(eval(returnedString[i:i+j]))
934
- i, j = i+j+1, 0
935
- return retList
720
+ return outputs.parse(error, returnedString)
936
721
 
937
722
  # PositionerAnalogTrackingVelocityParametersSet : Update dynamic parameters for one axe of a group for a future analog tracking velocity
938
723
  def PositionerAnalogTrackingVelocityParametersSet (self, socketId, PositionerName, GPIOName, Offset, Scale, DeadBandThreshold, Order, Velocity, Acceleration):
@@ -941,18 +726,10 @@ class XPS:
941
726
 
942
727
  # PositionerBacklashGet : Read backlash value and status
943
728
  def PositionerBacklashGet (self, socketId, PositionerName):
944
- command = 'PositionerBacklashGet(' + PositionerName + ',double *,char *)'
729
+ outputs = XPSOutputs('double', 'char')
730
+ command = f'PositionerBacklashGet({PositionerName},{outputs})'
945
731
  error, returnedString = self.Send(socketId, command)
946
- if (error != 0):
947
- return [error, returnedString]
948
-
949
- i, j, retList = 0, 0, [error]
950
- for paramNb in range(2):
951
- while ((i+j) < len(returnedString) and returnedString[i+j] != ','):
952
- j += 1
953
- retList.append(eval(returnedString[i:i+j]))
954
- i, j = i+j+1, 0
955
- return retList
732
+ return outputs.parse(error, returnedString)
956
733
 
957
734
  # PositionerBacklashSet : Set backlash value
958
735
  def PositionerBacklashSet (self, socketId, PositionerName, BacklashValue):
@@ -974,18 +751,10 @@ class XPS:
974
751
 
975
752
  # PositionerCorrectorNotchFiltersGet : Read filters parameters
976
753
  def PositionerCorrectorNotchFiltersGet (self, socketId, PositionerName):
977
- command = 'PositionerCorrectorNotchFiltersGet(' + PositionerName + ',double *,double *,double *,double *,double *,double *)'
754
+ outputs = XPSOutputs('double', 'double', 'double', 'double', 'double', 'double')
755
+ command = f'PositionerCorrectorNotchFiltersGet({PositionerName},{outputs})'
978
756
  error, returnedString = self.Send(socketId, command)
979
- if (error != 0):
980
- return [error, returnedString]
981
-
982
- i, j, retList = 0, 0, [error]
983
- for paramNb in range(6):
984
- while ((i+j) < len(returnedString) and returnedString[i+j] != ','):
985
- j += 1
986
- retList.append(eval(returnedString[i:i+j]))
987
- i, j = i+j+1, 0
988
- return retList
757
+ return outputs.parse(error, returnedString)
989
758
 
990
759
  # PositionerCorrectorPIDFFAccelerationSet : Update corrector parameters
991
760
  def PositionerCorrectorPIDFFAccelerationSet (self, socketId, PositionerName, ClosedLoopStatus, KP, KI, KD, KS, IntegrationTime,
@@ -998,19 +767,10 @@ class XPS:
998
767
 
999
768
  # PositionerCorrectorPIDFFAccelerationGet : Read corrector parameters
1000
769
  def PositionerCorrectorPIDFFAccelerationGet (self, socketId, PositionerName):
1001
- command = 'PositionerCorrectorPIDFFAccelerationGet(' + PositionerName + ',bool *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *)'
770
+ outputs = XPSOutputs('bool', 'double', 'double', 'double', 'double', 'double', 'double', 'double', 'double', 'double', 'double', 'double')
771
+ command = f'PositionerCorrectorPIDFFAccelerationGet({PositionerName},{outputs})'
1002
772
  error, returnedString = self.Send(socketId, command)
1003
- if (error != 0):
1004
- return [error, returnedString]
1005
-
1006
- i, j, retList = 0, 0, [error]
1007
- for paramNb in range(12):
1008
- while ((i+j) < len(returnedString) and returnedString[i+j] != ','):
1009
- j += 1
1010
- retList.append(eval(returnedString[i:i+j]))
1011
- i, j = i+j+1, 0
1012
- return retList
1013
-
773
+ return outputs.parse(error, returnedString)
1014
774
 
1015
775
  # PositionerCorrectorPIDFFVelocitySet : Update corrector parameters
1016
776
  def PositionerCorrectorPIDFFVelocitySet (self, socketId, PositionerName, ClosedLoopStatus, KP, KI, KD, KS, IntegrationTime, DerivativeFilterCutOffFrequency, GKP, GKI, GKD, KForm, FeedForwardGainVelocity):
@@ -1021,18 +781,10 @@ class XPS:
1021
781
 
1022
782
  # PositionerCorrectorPIDFFVelocityGet : Read corrector parameters
1023
783
  def PositionerCorrectorPIDFFVelocityGet (self, socketId, PositionerName):
1024
- command = 'PositionerCorrectorPIDFFVelocityGet(' + PositionerName + ',bool *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *)'
784
+ outputs = XPSOutputs('bool', 'double', 'double', 'double', 'double', 'double', 'double', 'double', 'double', 'double', 'double', 'double')
785
+ command = f'PositionerCorrectorPIDFFVelocityGet({PositionerName},{outputs})'
1025
786
  error, returnedString = self.Send(socketId, command)
1026
- if (error != 0):
1027
- return [error, returnedString]
1028
-
1029
- i, j, retList = 0, 0, [error]
1030
- for paramNb in range(12):
1031
- while ((i+j) < len(returnedString) and returnedString[i+j] != ','):
1032
- j += 1
1033
- retList.append(eval(returnedString[i:i+j]))
1034
- i, j = i+j+1, 0
1035
- return retList
787
+ return outputs.parse(error, returnedString)
1036
788
 
1037
789
  # PositionerCorrectorPIDDualFFVoltageSet : Update corrector parameters
1038
790
  def PositionerCorrectorPIDDualFFVoltageSet (self, socketId, PositionerName, ClosedLoopStatus, KP, KI, KD, KS, IntegrationTime, DerivativeFilterCutOffFrequency, GKP, GKI, GKD, KForm, FeedForwardGainVelocity, FeedForwardGainAcceleration, Friction):
@@ -1043,18 +795,10 @@ class XPS:
1043
795
 
1044
796
  # PositionerCorrectorPIDDualFFVoltageGet : Read corrector parameters
1045
797
  def PositionerCorrectorPIDDualFFVoltageGet (self, socketId, PositionerName):
1046
- command = 'PositionerCorrectorPIDDualFFVoltageGet(' + PositionerName + ',bool *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *)'
798
+ outputs = XPSOutputs('bool', 'double', 'double', 'double', 'double', 'double', 'double', 'double', 'double', 'double', 'double', 'double', 'double', 'double')
799
+ command = f'PositionerCorrectorPIDDualFFVoltageGet({PositionerName},{outputs})'
1047
800
  error, returnedString = self.Send(socketId, command)
1048
- if (error != 0):
1049
- return [error, returnedString]
1050
-
1051
- i, j, retList = 0, 0, [error]
1052
- for paramNb in range(14):
1053
- while ((i+j) < len(returnedString) and returnedString[i+j] != ','):
1054
- j += 1
1055
- retList.append(eval(returnedString[i:i+j]))
1056
- i, j = i+j+1, 0
1057
- return retList
801
+ return outputs.parse(error, returnedString)
1058
802
 
1059
803
  # PositionerCorrectorPIPositionSet : Update corrector parameters
1060
804
  def PositionerCorrectorPIPositionSet (self, socketId, PositionerName, ClosedLoopStatus, KP, KI, IntegrationTime):
@@ -1063,18 +807,10 @@ class XPS:
1063
807
 
1064
808
  # PositionerCorrectorPIPositionGet : Read corrector parameters
1065
809
  def PositionerCorrectorPIPositionGet (self, socketId, PositionerName):
1066
- command = 'PositionerCorrectorPIPositionGet(' + PositionerName + ',bool *,double *,double *,double *)'
810
+ outputs = XPSOutputs('bool', 'double', 'double', 'double')
811
+ command = f'PositionerCorrectorPIPositionGet({PositionerName},{outputs})'
1067
812
  error, returnedString = self.Send(socketId, command)
1068
- if (error != 0):
1069
- return [error, returnedString]
1070
-
1071
- i, j, retList = 0, 0, [error]
1072
- for paramNb in range(4):
1073
- while ((i+j) < len(returnedString) and returnedString[i+j] != ','):
1074
- j += 1
1075
- retList.append(eval(returnedString[i:i+j]))
1076
- i, j = i+j+1, 0
1077
- return retList
813
+ return outputs.parse(error, returnedString)
1078
814
 
1079
815
  # PositionerCorrectorTypeGet : Read corrector type
1080
816
  def PositionerCorrectorTypeGet (self, socketId, PositionerName):
@@ -1082,18 +818,10 @@ class XPS:
1082
818
 
1083
819
  # PositionerCurrentVelocityAccelerationFiltersGet : Get current velocity and acceleration cutoff frequencies
1084
820
  def PositionerCurrentVelocityAccelerationFiltersGet (self, socketId, PositionerName):
1085
- command = 'PositionerCurrentVelocityAccelerationFiltersGet(' + PositionerName + ',double *,double *)'
821
+ outputs = XPSOutputs('double', 'double')
822
+ command = f'PositionerCurrentVelocityAccelerationFiltersGet({PositionerName},{outputs})'
1086
823
  error, returnedString = self.Send(socketId, command)
1087
- if (error != 0):
1088
- return [error, returnedString]
1089
-
1090
- i, j, retList = 0, 0, [error]
1091
- for paramNb in range(2):
1092
- while ((i+j) < len(returnedString) and returnedString[i+j] != ','):
1093
- j += 1
1094
- retList.append(eval(returnedString[i:i+j]))
1095
- i, j = i+j+1, 0
1096
- return retList
824
+ return outputs.parse(error, returnedString)
1097
825
 
1098
826
  # PositionerCurrentVelocityAccelerationFiltersSet : Set current velocity and acceleration cutoff frequencies
1099
827
  def PositionerCurrentVelocityAccelerationFiltersSet (self, socketId, PositionerName, CurrentVelocityCutOffFrequency, CurrentAccelerationCutOffFrequency):
@@ -1102,18 +830,10 @@ class XPS:
1102
830
 
1103
831
  # PositionerDriverFiltersGet : Get driver filters parameters
1104
832
  def PositionerDriverFiltersGet (self, socketId, PositionerName):
1105
- command = 'PositionerDriverFiltersGet(' + PositionerName + ',double *,double *,double *,double *,double *)'
833
+ outputs = XPSOutputs('double', 'double', 'double', 'double', 'double')
834
+ command = f'PositionerDriverFiltersGet({PositionerName},{outputs})'
1106
835
  error, returnedString = self.Send(socketId, command)
1107
- if (error != 0):
1108
- return [error, returnedString]
1109
-
1110
- i, j, retList = 0, 0, [error]
1111
- for paramNb in range(5):
1112
- while ((i+j) < len(returnedString) and returnedString[i+j] != ','):
1113
- j += 1
1114
- retList.append(eval(returnedString[i:i+j]))
1115
- i, j = i+j+1, 0
1116
- return retList
836
+ return outputs.parse(error, returnedString)
1117
837
 
1118
838
  # PositionerDriverFiltersSet : Set driver filters parameters
1119
839
  def PositionerDriverFiltersSet (self, socketId, PositionerName, KI, NotchFrequency, NotchBandwidth, NotchGain, LowpassFrequency):
@@ -1122,32 +842,17 @@ class XPS:
1122
842
 
1123
843
  # PositionerDriverPositionOffsetsGet : Get driver stage and gage position offset
1124
844
  def PositionerDriverPositionOffsetsGet (self, socketId, PositionerName):
1125
- command = 'PositionerDriverPositionOffsetsGet(' + PositionerName + ',double *,double *)'
845
+ outputs = XPSOutputs('double', 'double')
846
+ command = f'PositionerDriverPositionOffsetsGet({PositionerName},{outputs})'
1126
847
  error, returnedString = self.Send(socketId, command)
1127
- if (error != 0):
1128
- return [error, returnedString]
1129
-
1130
- i, j, retList = 0, 0, [error]
1131
- for paramNb in range(2):
1132
- while ((i+j) < len(returnedString) and returnedString[i+j] != ','):
1133
- j += 1
1134
- retList.append(eval(returnedString[i:i+j]))
1135
- i, j = i+j+1, 0
1136
- return retList
848
+ return outputs.parse(error, returnedString)
1137
849
 
1138
850
  # PositionerDriverStatusGet : Read positioner driver status
1139
851
  def PositionerDriverStatusGet (self, socketId, PositionerName):
1140
- command = 'PositionerDriverStatusGet(' + PositionerName + ',int *)'
852
+ outputs = XPSOutputs('int')
853
+ command = f'PositionerDriverStatusGet({PositionerName},{outputs})'
1141
854
  error, returnedString = self.Send(socketId, command)
1142
- if (error != 0):
1143
- return [error, returnedString]
1144
-
1145
- i, j, retList = 0, 0, [error]
1146
- while ((i+j) < len(returnedString) and returnedString[i+j] != ','):
1147
- j += 1
1148
- retList.append(eval(returnedString[i:i+j]))
1149
- return retList
1150
-
855
+ return outputs.parse(error, returnedString)
1151
856
 
1152
857
  # PositionerDriverStatusStringGet : Return the positioner driver status string corresponding to the positioner error code
1153
858
  def PositionerDriverStatusStringGet (self, socketId, PositionerDriverStatus):
@@ -1156,59 +861,31 @@ class XPS:
1156
861
 
1157
862
  # PositionerEncoderAmplitudeValuesGet : Read analog interpolated encoder amplitude values
1158
863
  def PositionerEncoderAmplitudeValuesGet (self, socketId, PositionerName):
1159
- command = 'PositionerEncoderAmplitudeValuesGet(' + PositionerName + ',double *,double *,double *,double *)'
864
+ outputs = XPSOutputs('double', 'double', 'double', 'double')
865
+ command = f'PositionerEncoderAmplitudeValuesGet({PositionerName},{outputs})'
1160
866
  error, returnedString = self.Send(socketId, command)
1161
- if (error != 0):
1162
- return [error, returnedString]
1163
-
1164
- i, j, retList = 0, 0, [error]
1165
- for paramNb in range(4):
1166
- while ((i+j) < len(returnedString) and returnedString[i+j] != ','):
1167
- j += 1
1168
- retList.append(eval(returnedString[i:i+j]))
1169
- i, j = i+j+1, 0
1170
- return retList
867
+ return outputs.parse(error, returnedString)
1171
868
 
1172
869
  # PositionerEncoderCalibrationParametersGet : Read analog interpolated encoder calibration parameters
1173
870
  def PositionerEncoderCalibrationParametersGet (self, socketId, PositionerName):
1174
- command = 'PositionerEncoderCalibrationParametersGet(' + PositionerName + ',double *,double *,double *,double *)'
871
+ outputs = XPSOutputs('double', 'double', 'double', 'double')
872
+ command = f'PositionerEncoderCalibrationParametersGet({PositionerName},{outputs})'
1175
873
  error, returnedString = self.Send(socketId, command)
1176
- if (error != 0):
1177
- return [error, returnedString]
1178
-
1179
- i, j, retList = 0, 0, [error]
1180
- for paramNb in range(4):
1181
- while ((i+j) < len(returnedString) and returnedString[i+j] != ','):
1182
- j += 1
1183
- retList.append(eval(returnedString[i:i+j]))
1184
- i, j = i+j+1, 0
1185
- return retList
874
+ return outputs.parse(error, returnedString)
1186
875
 
1187
876
  # PositionerErrorGet : Read and clear positioner error code
1188
877
  def PositionerErrorGet (self, socketId, PositionerName):
1189
- command = 'PositionerErrorGet(' + PositionerName + ',int *)'
878
+ outputs = XPSOutputs('int')
879
+ command = f'PositionerErrorGet({PositionerName},{outputs})'
1190
880
  error, returnedString = self.Send(socketId, command)
1191
- if (error != 0):
1192
- return [error, returnedString]
1193
-
1194
- i, j, retList = 0, 0, [error]
1195
- while ((i+j) < len(returnedString) and returnedString[i+j] != ','):
1196
- j += 1
1197
- retList.append(eval(returnedString[i:i+j]))
1198
- return retList
881
+ return outputs.parse(error, returnedString)
1199
882
 
1200
883
  # PositionerErrorRead : Read only positioner error code without clear it
1201
884
  def PositionerErrorRead (self, socketId, PositionerName):
1202
- command = 'PositionerErrorRead(' + PositionerName + ',int *)'
885
+ outputs = XPSOutputs('int')
886
+ command = f'PositionerErrorRead({PositionerName},{outputs})'
1203
887
  error, returnedString = self.Send(socketId, command)
1204
- if (error != 0):
1205
- return [error, returnedString]
1206
-
1207
- i, j, retList = 0, 0, [error]
1208
- while ((i+j) < len(returnedString) and returnedString[i+j] != ','):
1209
- j += 1
1210
- retList.append(eval(returnedString[i:i+j]))
1211
- return retList
888
+ return outputs.parse(error, returnedString)
1212
889
 
1213
890
  # PositionerErrorStringGet : Return the positioner status string corresponding to the positioner error code
1214
891
  def PositionerErrorStringGet (self, socketId, PositionerErrorCode):
@@ -1216,18 +893,10 @@ class XPS:
1216
893
 
1217
894
  # PositionerExcitationSignalGet : Read disturbing signal parameters
1218
895
  def PositionerExcitationSignalGet (self, socketId, PositionerName):
1219
- command = 'PositionerExcitationSignalGet(' + PositionerName + ',int *,double *,double *,double *)'
896
+ outputs = XPSOutputs('int', 'double', 'double', 'double')
897
+ command = f'PositionerExcitationSignalGet({PositionerName},{outputs})'
1220
898
  error, returnedString = self.Send(socketId, command)
1221
- if (error != 0):
1222
- return [error, returnedString]
1223
-
1224
- i, j, retList = 0, 0, [error]
1225
- for paramNb in range(4):
1226
- while ((i+j) < len(returnedString) and returnedString[i+j] != ','):
1227
- j += 1
1228
- retList.append(eval(returnedString[i:i+j]))
1229
- i, j = i+j+1, 0
1230
- return retList
899
+ return outputs.parse(error, returnedString)
1231
900
 
1232
901
  # PositionerExcitationSignalSet : Update disturbing signal parameters
1233
902
  def PositionerExcitationSignalSet (self, socketId, PositionerName, Mode, Frequency, Amplitude, Time):
@@ -1236,29 +905,17 @@ class XPS:
1236
905
 
1237
906
  # PositionerExternalLatchPositionGet : Read external latch position
1238
907
  def PositionerExternalLatchPositionGet (self, socketId, PositionerName):
1239
- command = 'PositionerExternalLatchPositionGet(' + PositionerName + ',double *)'
908
+ outputs = XPSOutputs('double')
909
+ command = f'PositionerExternalLatchPositionGet({PositionerName},{outputs})'
1240
910
  error, returnedString = self.Send(socketId, command)
1241
- if (error != 0):
1242
- return [error, returnedString]
1243
-
1244
- i, j, retList = 0, 0, [error]
1245
- while ((i+j) < len(returnedString) and returnedString[i+j] != ','):
1246
- j += 1
1247
- retList.append(eval(returnedString[i:i+j]))
1248
- return retList
911
+ return outputs.parse(error, returnedString)
1249
912
 
1250
913
  # PositionerHardwareStatusGet : Read positioner hardware status
1251
914
  def PositionerHardwareStatusGet (self, socketId, PositionerName):
1252
- command = 'PositionerHardwareStatusGet(' + PositionerName + ',int *)'
915
+ outputs = XPSOutputs('int')
916
+ command = f'PositionerHardwareStatusGet({PositionerName},{outputs})'
1253
917
  error, returnedString = self.Send(socketId, command)
1254
- if (error != 0):
1255
- return [error, returnedString]
1256
-
1257
- i, j, retList = 0, 0, [error]
1258
- while ((i+j) < len(returnedString) and returnedString[i+j] != ','):
1259
- j += 1
1260
- retList.append(eval(returnedString[i:i+j]))
1261
- return retList
918
+ return outputs.parse(error, returnedString)
1262
919
 
1263
920
  # PositionerHardwareStatusStringGet : Return the positioner hardware status string corresponding to the positioner error code
1264
921
  def PositionerHardwareStatusStringGet (self, socketId, PositionerHardwareStatus):
@@ -1266,16 +923,10 @@ class XPS:
1266
923
 
1267
924
  # PositionerHardInterpolatorFactorGet : Get hard interpolator parameters
1268
925
  def PositionerHardInterpolatorFactorGet (self, socketId, PositionerName):
1269
- command = 'PositionerHardInterpolatorFactorGet(' + PositionerName + ',int *)'
926
+ outputs = XPSOutputs('int')
927
+ command = f'PositionerHardInterpolatorFactorGet({PositionerName},{outputs})'
1270
928
  error, returnedString = self.Send(socketId, command)
1271
- if (error != 0):
1272
- return [error, returnedString]
1273
-
1274
- i, j, retList = 0, 0, [error]
1275
- while ((i+j) < len(returnedString) and returnedString[i+j] != ','):
1276
- j += 1
1277
- retList.append(eval(returnedString[i:i+j]))
1278
- return retList
929
+ return outputs.parse(error, returnedString)
1279
930
 
1280
931
  # PositionerHardInterpolatorFactorSet : Set hard interpolator parameters
1281
932
  def PositionerHardInterpolatorFactorSet (self, socketId, PositionerName, InterpolationFactor):
@@ -1284,33 +935,17 @@ class XPS:
1284
935
 
1285
936
  # PositionerMaximumVelocityAndAccelerationGet : Return maximum velocity and acceleration of the positioner
1286
937
  def PositionerMaximumVelocityAndAccelerationGet (self, socketId, PositionerName):
1287
- command = 'PositionerMaximumVelocityAndAccelerationGet(' + PositionerName + ',double *,double *)'
938
+ outputs = XPSOutputs('double', 'double')
939
+ command = f'PositionerMaximumVelocityAndAccelerationGet({PositionerName},{outputs})'
1288
940
  error, returnedString = self.Send(socketId, command)
1289
- if (error != 0):
1290
- return [error, returnedString]
1291
-
1292
- i, j, retList = 0, 0, [error]
1293
- for paramNb in range(2):
1294
- while ((i+j) < len(returnedString) and returnedString[i+j] != ','):
1295
- j += 1
1296
- retList.append(eval(returnedString[i:i+j]))
1297
- i, j = i+j+1, 0
1298
- return retList
941
+ return outputs.parse(error, returnedString)
1299
942
 
1300
943
  # PositionerMotionDoneGet : Read motion done parameters
1301
944
  def PositionerMotionDoneGet (self, socketId, PositionerName):
1302
- command = 'PositionerMotionDoneGet(' + PositionerName + ',double *,double *,double *,double *,double *)'
945
+ outputs = XPSOutputs('double', 'double', 'double', 'double', 'double')
946
+ command = f'PositionerMotionDoneGet({PositionerName},{outputs})'
1303
947
  error, returnedString = self.Send(socketId, command)
1304
- if (error != 0):
1305
- return [error, returnedString]
1306
-
1307
- i, j, retList = 0, 0, [error]
1308
- for paramNb in range(5):
1309
- while ((i+j) < len(returnedString) and returnedString[i+j] != ','):
1310
- j += 1
1311
- retList.append(eval(returnedString[i:i+j]))
1312
- i, j = i+j+1, 0
1313
- return retList
948
+ return outputs.parse(error, returnedString)
1314
949
 
1315
950
  # PositionerMotionDoneSet : Update motion done parameters
1316
951
  def PositionerMotionDoneSet (self, socketId, PositionerName, PositionWindow, VelocityWindow, CheckingTime, MeanPeriod, TimeOut):
@@ -1324,18 +959,10 @@ class XPS:
1324
959
 
1325
960
  # PositionerPositionCompareAquadBWindowedGet : Read position compare AquadB windowed parameters
1326
961
  def PositionerPositionCompareAquadBWindowedGet (self, socketId, PositionerName):
1327
- command = 'PositionerPositionCompareAquadBWindowedGet(' + PositionerName + ',double *,double *,bool *)'
962
+ outputs = XPSOutputs('double', 'double', 'bool')
963
+ command = f'PositionerPositionCompareAquadBWindowedGet({PositionerName},{outputs})'
1328
964
  error, returnedString = self.Send(socketId, command)
1329
- if (error != 0):
1330
- return [error, returnedString]
1331
-
1332
- i, j, retList = 0, 0, [error]
1333
- for paramNb in range(3):
1334
- while ((i+j) < len(returnedString) and returnedString[i+j] != ','):
1335
- j += 1
1336
- retList.append(eval(returnedString[i:i+j]))
1337
- i, j = i+j+1, 0
1338
- return retList
965
+ return outputs.parse(error, returnedString)
1339
966
 
1340
967
  # PositionerPositionCompareAquadBWindowedSet : Set position compare AquadB windowed parameters
1341
968
  def PositionerPositionCompareAquadBWindowedSet (self, socketId, PositionerName, MinimumPosition, MaximumPosition):
@@ -1350,25 +977,17 @@ class XPS:
1350
977
 
1351
978
  # PositionerPositionCompareAquadBPrescalerGet : Gets PCO AquadB interpolation factor.
1352
979
  def PositionerPositionCompareAquadBPrescalerGet(self, socketId, PositionerName):
1353
- command = 'PositionerPositionCompareAquadBPrescalerGet(' + PositionerName + ',double *)'
980
+ outputs = XPSOutputs('double')
981
+ command = f'PositionerPositionCompareAquadBPrescalerGet({PositionerName},{outputs})'
1354
982
  error, returnedString = self.Send(socketId, command)
1355
- if (error != 0):
1356
- return [error, returnedString]
983
+ return outputs.parse(error, returnedString)
1357
984
 
1358
985
  # PositionerPositionCompareGet : Read position compare parameters
1359
986
  def PositionerPositionCompareGet (self, socketId, PositionerName):
1360
- command = 'PositionerPositionCompareGet(' + PositionerName + ',double *,double *,double *,bool *)'
987
+ outputs = XPSOutputs('double', 'double', 'double', 'bool')
988
+ command = f'PositionerPositionCompareGet({PositionerName},{outputs})'
1361
989
  error, returnedString = self.Send(socketId, command)
1362
- if (error != 0):
1363
- return [error, returnedString]
1364
-
1365
- i, j, retList = 0, 0, [error]
1366
- for paramNb in range(4):
1367
- while ((i+j) < len(returnedString) and returnedString[i+j] != ','):
1368
- j += 1
1369
- retList.append(eval(returnedString[i:i+j]))
1370
- i, j = i+j+1, 0
1371
- return retList
990
+ return outputs.parse(error, returnedString)
1372
991
 
1373
992
  # PositionerPositionCompareSet : Set position compare parameters
1374
993
  def PositionerPositionCompareSet (self, socketId, PositionerName, MinimumPosition, MaximumPosition, PositionStep):
@@ -1387,18 +1006,10 @@ class XPS:
1387
1006
 
1388
1007
  # PositionerPositionComparePulseParametersGet : Get position compare PCO pulse parameters
1389
1008
  def PositionerPositionComparePulseParametersGet (self, socketId, PositionerName):
1390
- command = 'PositionerPositionComparePulseParametersGet(' + PositionerName + ',double *,double *)'
1009
+ outputs = XPSOutputs('double', 'double')
1010
+ command = f'PositionerPositionComparePulseParametersGet({PositionerName},{outputs})'
1391
1011
  error, returnedString = self.Send(socketId, command)
1392
- if (error != 0):
1393
- return [error, returnedString]
1394
-
1395
- i, j, retList = 0, 0, [error]
1396
- for paramNb in range(2):
1397
- while ((i+j) < len(returnedString) and returnedString[i+j] != ','):
1398
- j += 1
1399
- retList.append(eval(returnedString[i:i+j]))
1400
- i, j = i+j+1, 0
1401
- return retList
1012
+ return outputs.parse(error, returnedString)
1402
1013
 
1403
1014
  # PositionerPositionComparePulseParametersSet : Set position compare PCO pulse parameters
1404
1015
  def PositionerPositionComparePulseParametersSet (self, socketId, PositionerName, PCOPulseWidth, EncoderSettlingTime):
@@ -1407,57 +1018,31 @@ class XPS:
1407
1018
 
1408
1019
  # PositionerRawEncoderPositionGet : Get the raw encoder position
1409
1020
  def PositionerRawEncoderPositionGet (self, socketId, PositionerName, UserEncoderPosition):
1410
- command = 'PositionerRawEncoderPositionGet(' + PositionerName + ',' + str(UserEncoderPosition) + ',double *)'
1021
+ outputs = XPSOutputs('double')
1022
+ command = f'PositionerRawEncoderPositionGet({PositionerName},{UserEncoderPosition},{outputs})'
1411
1023
  error, returnedString = self.Send(socketId, command)
1412
- if (error != 0):
1413
- return [error, returnedString]
1414
-
1415
- i, j, retList = 0, 0, [error]
1416
- while ((i+j) < len(returnedString) and returnedString[i+j] != ','):
1417
- j += 1
1418
- retList.append(eval(returnedString[i:i+j]))
1419
- return retList
1024
+ return outputs.parse(error, returnedString)
1420
1025
 
1421
1026
  # PositionersEncoderIndexDifferenceGet : Return the difference between index of primary axis and secondary axis (only after homesearch)
1422
1027
  def PositionersEncoderIndexDifferenceGet (self, socketId, PositionerName):
1423
- command = 'PositionersEncoderIndexDifferenceGet(' + PositionerName + ',double *)'
1028
+ outputs = XPSOutputs('double')
1029
+ command = f'PositionersEncoderIndexDifferenceGet({PositionerName},{outputs})'
1424
1030
  error, returnedString = self.Send(socketId, command)
1425
- if (error != 0):
1426
- return [error, returnedString]
1427
-
1428
- i, j, retList = 0, 0, [error]
1429
- while ((i+j) < len(returnedString) and returnedString[i+j] != ','):
1430
- j += 1
1431
- retList.append(eval(returnedString[i:i+j]))
1432
- return retList
1031
+ return outputs.parse(error, returnedString)
1433
1032
 
1434
1033
  # PositionerSGammaExactVelocityAjustedDisplacementGet : Return adjusted displacement to get exact velocity
1435
1034
  def PositionerSGammaExactVelocityAjustedDisplacementGet (self, socketId, PositionerName, DesiredDisplacement):
1436
- command = 'PositionerSGammaExactVelocityAjustedDisplacementGet(' + PositionerName + ',' + str(DesiredDisplacement) + ',double *)'
1035
+ outputs = XPSOutputs('double')
1036
+ command = f'PositionerSGammaExactVelocityAjustedDisplacementGet({PositionerName},{DesiredDisplacement},{outputs})'
1437
1037
  error, returnedString = self.Send(socketId, command)
1438
- if (error != 0):
1439
- return [error, returnedString]
1440
-
1441
- i, j, retList = 0, 0, [error]
1442
- while ((i+j) < len(returnedString) and returnedString[i+j] != ','):
1443
- j += 1
1444
- retList.append(eval(returnedString[i:i+j]))
1445
- return retList
1038
+ return outputs.parse(error, returnedString)
1446
1039
 
1447
1040
  # PositionerSGammaParametersGet : Read dynamic parameters for one axe of a group for a future displacement
1448
1041
  def PositionerSGammaParametersGet (self, socketId, PositionerName):
1449
- command = 'PositionerSGammaParametersGet(' + PositionerName + ',double *,double *,double *,double *)'
1042
+ outputs = XPSOutputs('double', 'double', 'double', 'double')
1043
+ command = f'PositionerSGammaParametersGet({PositionerName},{outputs})'
1450
1044
  error, returnedString = self.Send(socketId, command)
1451
- if (error != 0):
1452
- return [error, returnedString]
1453
-
1454
- i, j, retList = 0, 0, [error]
1455
- for paramNb in range(4):
1456
- while ((i+j) < len(returnedString) and returnedString[i+j] != ','):
1457
- j += 1
1458
- retList.append(eval(returnedString[i:i+j]))
1459
- i, j = i+j+1, 0
1460
- return retList
1045
+ return outputs.parse(error, returnedString)
1461
1046
 
1462
1047
  # PositionerSGammaParametersSet : Update dynamic parameters for one axe of a group for a future displacement
1463
1048
  def PositionerSGammaParametersSet (self, socketId, PositionerName, Velocity, Acceleration, MinimumTjerkTime, MaximumTjerkTime):
@@ -1466,18 +1051,10 @@ class XPS:
1466
1051
 
1467
1052
  # PositionerSGammaPreviousMotionTimesGet : Read SettingTime and SettlingTime
1468
1053
  def PositionerSGammaPreviousMotionTimesGet (self, socketId, PositionerName):
1469
- command = 'PositionerSGammaPreviousMotionTimesGet(' + PositionerName + ',double *,double *)'
1054
+ outputs = XPSOutputs('double', 'double')
1055
+ command = f'PositionerSGammaPreviousMotionTimesGet({PositionerName},{outputs})'
1470
1056
  error, returnedString = self.Send(socketId, command)
1471
- if (error != 0):
1472
- return [error, returnedString]
1473
-
1474
- i, j, retList = 0, 0, [error]
1475
- for paramNb in range(2):
1476
- while ((i+j) < len(returnedString) and returnedString[i+j] != ','):
1477
- j += 1
1478
- retList.append(eval(returnedString[i:i+j]))
1479
- i, j = i+j+1, 0
1480
- return retList
1057
+ return outputs.parse(error, returnedString)
1481
1058
 
1482
1059
  # PositionerStageParameterGet : Return the stage parameter
1483
1060
  def PositionerStageParameterGet (self, socketId, PositionerName, ParameterName):
@@ -1491,18 +1068,10 @@ class XPS:
1491
1068
 
1492
1069
  # PositionerTimeFlasherGet : Read time flasher parameters
1493
1070
  def PositionerTimeFlasherGet (self, socketId, PositionerName):
1494
- command = 'PositionerTimeFlasherGet(' + PositionerName + ',double *,double *,double *,bool *)'
1071
+ outputs = XPSOutputs('double', 'double', 'double', 'bool')
1072
+ command = f'PositionerTimeFlasherGet({PositionerName},{outputs})'
1495
1073
  error, returnedString = self.Send(socketId, command)
1496
- if (error != 0):
1497
- return [error, returnedString]
1498
-
1499
- i, j, retList = 0, 0, [error]
1500
- for paramNb in range(4):
1501
- while ((i+j) < len(returnedString) and returnedString[i+j] != ','):
1502
- j += 1
1503
- retList.append(eval(returnedString[i:i+j]))
1504
- i, j = i+j+1, 0
1505
- return retList
1074
+ return outputs.parse(error, returnedString)
1506
1075
 
1507
1076
  # PositionerTimeFlasherSet : Set time flasher parameters
1508
1077
  def PositionerTimeFlasherSet (self, socketId, PositionerName, MinimumPosition, MaximumPosition, TimeInterval):
@@ -1519,19 +1088,10 @@ class XPS:
1519
1088
 
1520
1089
  # PositionerUserTravelLimitsGet : Read UserMinimumTarget and UserMaximumTarget
1521
1090
  def PositionerUserTravelLimitsGet (self, socketId, PositionerName):
1522
- command = 'PositionerUserTravelLimitsGet(' + PositionerName + ',double *,double *)'
1091
+ outputs = XPSOutputs('double', 'double')
1092
+ command = f'PositionerUserTravelLimitsGet({PositionerName},{outputs})'
1523
1093
  error, returnedString = self.Send(socketId, command)
1524
- if (error != 0):
1525
- return [error, returnedString]
1526
-
1527
- i, j, retList = 0, 0, [error]
1528
- for paramNb in range(2):
1529
- while ((i+j) < len(returnedString) and returnedString[i+j] != ','):
1530
- j += 1
1531
- retList.append(eval(returnedString[i:i+j]))
1532
- i, j = i+j+1, 0
1533
- return retList
1534
-
1094
+ return outputs.parse(error, returnedString)
1535
1095
 
1536
1096
  # PositionerUserTravelLimitsSet : Update UserMinimumTarget and UserMaximumTarget
1537
1097
  def PositionerUserTravelLimitsSet (self, socketId, PositionerName, UserMinimumTarget, UserMaximumTarget):
@@ -1540,18 +1100,10 @@ class XPS:
1540
1100
 
1541
1101
  # PositionerDACOffsetGet : Get DAC offsets
1542
1102
  def PositionerDACOffsetGet (self, socketId, PositionerName):
1543
- command = 'PositionerDACOffsetGet(' + PositionerName + ',short *,short *)'
1103
+ outputs = XPSOutputs('short', 'short')
1104
+ command = f'PositionerDACOffsetGet({PositionerName},{outputs})'
1544
1105
  error, returnedString = self.Send(socketId, command)
1545
- if (error != 0):
1546
- return [error, returnedString]
1547
-
1548
- i, j, retList = 0, 0, [error]
1549
- for paramNb in range(2):
1550
- while ((i+j) < len(returnedString) and returnedString[i+j] != ','):
1551
- j += 1
1552
- retList.append(eval(returnedString[i:i+j]))
1553
- i, j = i+j+1, 0
1554
- return retList
1106
+ return outputs.parse(error, returnedString)
1555
1107
 
1556
1108
  # PositionerDACOffsetSet : Set DAC offsets
1557
1109
  def PositionerDACOffsetSet (self, socketId, PositionerName, DACOffset1, DACOffset2):
@@ -1560,19 +1112,10 @@ class XPS:
1560
1112
 
1561
1113
  # PositionerDACOffsetDualGet : Get dual DAC offsets
1562
1114
  def PositionerDACOffsetDualGet (self, socketId, PositionerName):
1563
- command = 'PositionerDACOffsetDualGet(' + PositionerName + ',short *,short *,short *,short *)'
1115
+ outputs = XPSOutputs('short', 'short', 'short', 'short')
1116
+ command = f'PositionerDACOffsetDualGet({PositionerName},{outputs})'
1564
1117
  error, returnedString = self.Send(socketId, command)
1565
- if (error != 0):
1566
- return [error, returnedString]
1567
-
1568
- i, j, retList = 0, 0, [error]
1569
- for paramNb in range(4):
1570
- while ((i+j) < len(returnedString) and returnedString[i+j] != ','):
1571
- j += 1
1572
- retList.append(eval(returnedString[i:i+j]))
1573
- i, j = i+j+1, 0
1574
- return retList
1575
-
1118
+ return outputs.parse(error, returnedString)
1576
1119
 
1577
1120
  # PositionerDACOffsetDualSet : Set dual DAC offsets
1578
1121
  def PositionerDACOffsetDualSet (self, socketId, PositionerName, PrimaryDACOffset1, PrimaryDACOffset2, SecondaryDACOffset1, SecondaryDACOffset2):
@@ -1581,37 +1124,23 @@ class XPS:
1581
1124
 
1582
1125
  # PositionerCorrectorAutoTuning : Astrom&Hagglund based auto-tuning
1583
1126
  def PositionerCorrectorAutoTuning (self, socketId, PositionerName, TuningMode):
1584
- command = 'PositionerCorrectorAutoTuning(' + PositionerName + ',' + str(TuningMode) + ',double *,double *,double *)'
1585
- return self.Send(socketId, command)
1586
- if (error != 0):
1587
- return [error, returnedString]
1588
-
1589
- i, j, retList = 0, 0, [error]
1590
- for paramNb in range(3):
1591
- while ((i+j) < len(returnedString) and returnedString[i+j] != ','):
1592
- j += 1
1593
- retList.append(eval(returnedString[i:i+j]))
1594
- i, j = i+j+1, 0
1595
- return retList
1127
+ outputs = XPSOutputs('double', 'double', 'double')
1128
+ command = f'PositionerCorrectorAutoTuning({PositionerName},{TuningMode},{outputs})'
1129
+ error, returnedString = self.Send(socketId, command)
1130
+ return outputs.parse(error, returnedString)
1596
1131
 
1597
1132
  # PositionerAccelerationAutoScaling : Astrom&Hagglund based auto-scaling
1598
1133
  def PositionerAccelerationAutoScaling (self, socketId, PositionerName):
1599
- command = 'PositionerAccelerationAutoScaling(' + PositionerName + ',double *)'
1134
+ outputs = XPSOutputs('double')
1135
+ command = f'PositionerAccelerationAutoScaling({PositionerName},{outputs})'
1600
1136
  error, returnedString = self.Send(socketId, command)
1601
- if (error != 0):
1602
- return [error, returnedString]
1603
-
1604
- i, j, retList = 0, 0, [error]
1605
- while ((i+j) < len(returnedString) and returnedString[i+j] != ','):
1606
- j += 1
1607
- retList.append(eval(returnedString[i:i+j]))
1608
- return retList
1137
+ return outputs.parse(error, returnedString)
1609
1138
 
1610
1139
  # MultipleAxesPVTVerification : Multiple axes PVT trajectory verification
1611
1140
  def MultipleAxesPVTVerification (self, socketId, GroupName, TrajectoryFileName):
1612
1141
  command = 'MultipleAxesPVTVerification(' + GroupName + ',' + TrajectoryFileName + ')'
1613
1142
  return self.Send(socketId, command)
1614
-
1143
+
1615
1144
  # MultipleAxesPTVerification : Multiple axes PT trajectory verification
1616
1145
  def MultipleAxesPTVerification (self, socketId, GroupName, TrajectoryFileName):
1617
1146
  command = 'MultipleAxesPTVerification(' + GroupName + ',' + TrajectoryFileName + ')'
@@ -1619,24 +1148,16 @@ class XPS:
1619
1148
 
1620
1149
  # MultipleAxesPVTVerificationResultGet : Multiple axes PVT trajectory verification result get
1621
1150
  def MultipleAxesPVTVerificationResultGet (self, socketId, PositionerName):
1622
- command = 'MultipleAxesPVTVerificationResultGet(' + PositionerName + ',char *,double *,double *,double *,double *)'
1151
+ outputs = XPSOutputs('char', 'double', 'double', 'double', 'double')
1152
+ command = f'MultipleAxesPVTVerificationResultGet({PositionerName},{outputs})'
1623
1153
  error, returnedString = self.Send(socketId, command)
1624
- if (error != 0):
1625
- return [error, returnedString]
1626
-
1627
- i, j, retList = 0, 0, [error]
1628
- for paramNb in range(4):
1629
- while ((i+j) < len(returnedString) and returnedString[i+j] != ','):
1630
- j += 1
1631
- retList.append(eval(returnedString[i:i+j]))
1632
- i, j = i+j+1, 0
1633
- return retList
1154
+ return outputs.parse(error, returnedString)
1634
1155
 
1635
1156
  # MultipleAxesPVTExecution : Multiple axes PVT trajectory execution
1636
1157
  def MultipleAxesPVTExecution (self, socketId, GroupName, TrajectoryFileName, ExecutionNumber):
1637
1158
  command = 'MultipleAxesPVTExecution(' + GroupName + ',' + TrajectoryFileName + ',' + str(ExecutionNumber) + ')'
1638
1159
  return self.Send(socketId, command)
1639
-
1160
+
1640
1161
  # MultipleAxesPTExecution : Multiple axes PT trajectory execution
1641
1162
  def MultipleAxesPTExecution (self, socketId, GroupName, TrajectoryFileName, ExecutionNumber):
1642
1163
  command = 'MultipleAxesPTExecution(' + GroupName + ',' + TrajectoryFileName + ',' + str(ExecutionNumber) + ')'
@@ -1644,16 +1165,10 @@ class XPS:
1644
1165
 
1645
1166
  # MultipleAxesPVTParametersGet : Multiple axes PVT trajectory get parameters
1646
1167
  def MultipleAxesPVTParametersGet (self, socketId, GroupName):
1647
- command = 'MultipleAxesPVTParametersGet(' + GroupName + ',char *,int *)'
1168
+ outputs = XPSOutputs('char', 'int')
1169
+ command = f'MultipleAxesPVTParametersGet({GroupName},{outputs})'
1648
1170
  error, returnedString = self.Send(socketId, command)
1649
- if (error != 0):
1650
- return [error, returnedString]
1651
-
1652
- i, j, retList = 0, 0, [error]
1653
- while ((i+j) < len(returnedString) and returnedString[i+j] != ','):
1654
- j += 1
1655
- retList.append(eval(returnedString[i:i+j]))
1656
- return retList
1171
+ return outputs.parse(error, returnedString)
1657
1172
 
1658
1173
  # MultipleAxesPVTPulseOutputSet : Configure pulse output on trajectory
1659
1174
  def MultipleAxesPVTPulseOutputSet (self, socketId, GroupName, StartElement, EndElement, TimeInterval):
@@ -1662,18 +1177,10 @@ class XPS:
1662
1177
 
1663
1178
  # MultipleAxesPVTPulseOutputGet : Get pulse output on trajectory configuration
1664
1179
  def MultipleAxesPVTPulseOutputGet (self, socketId, GroupName):
1665
- command = 'MultipleAxesPVTPulseOutputGet(' + GroupName + ',int *,int *,double *)'
1180
+ outputs = XPSOutputs('int', 'int', 'double')
1181
+ command = f'MultipleAxesPVTPulseOutputGet({GroupName},{outputs})'
1666
1182
  error, returnedString = self.Send(socketId, command)
1667
- if (error != 0):
1668
- return [error, returnedString]
1669
-
1670
- i, j, retList = 0, 0, [error]
1671
- for paramNb in range(3):
1672
- while ((i+j) < len(returnedString) and returnedString[i+j] != ','):
1673
- j += 1
1674
- retList.append(eval(returnedString[i:i+j]))
1675
- i, j = i+j+1, 0
1676
- return retList
1183
+ return outputs.parse(error, returnedString)
1677
1184
 
1678
1185
  # SingleAxisSlaveModeEnable : Enable the slave mode
1679
1186
  def SingleAxisSlaveModeEnable (self, socketId, GroupName):
@@ -1690,16 +1197,10 @@ class XPS:
1690
1197
 
1691
1198
  # SingleAxisSlaveParametersGet : Get slave parameters
1692
1199
  def SingleAxisSlaveParametersGet (self, socketId, GroupName):
1693
- command = 'SingleAxisSlaveParametersGet(' + GroupName + ',char *,double *)'
1200
+ outputs = XPSOutputs('char', 'double')
1201
+ command = f'SingleAxisSlaveParametersGet({GroupName},{outputs})'
1694
1202
  error, returnedString = self.Send(socketId, command)
1695
- if (error != 0):
1696
- return [error, returnedString]
1697
-
1698
- i, j, retList = 0, 0, [error]
1699
- while ((i+j) < len(returnedString) and returnedString[i+j] != ','):
1700
- j += 1
1701
- retList.append(eval(returnedString[i:i+j]))
1702
- return retList
1203
+ return outputs.parse(error, returnedString)
1703
1204
 
1704
1205
  # SpindleSlaveModeEnable : Enable the slave mode
1705
1206
  def SpindleSlaveModeEnable (self, socketId, GroupName):
@@ -1716,16 +1217,10 @@ class XPS:
1716
1217
 
1717
1218
  # SpindleSlaveParametersGet : Get slave parameters
1718
1219
  def SpindleSlaveParametersGet (self, socketId, GroupName):
1719
- command = 'SpindleSlaveParametersGet(' + GroupName + ',char *,double *)'
1220
+ outputs = XPSOutputs('char', 'double')
1221
+ command = f'SpindleSlaveParametersGet({GroupName},{outputs})'
1720
1222
  error, returnedString = self.Send(socketId, command)
1721
- if (error != 0):
1722
- return [error, returnedString]
1723
-
1724
- i, j, retList = 0, 0, [error]
1725
- while ((i+j) < len(returnedString) and returnedString[i+j] != ','):
1726
- j += 1
1727
- retList.append(eval(returnedString[i:i+j]))
1728
- return retList
1223
+ return outputs.parse(error, returnedString)
1729
1224
 
1730
1225
  # GroupSpinParametersSet : Modify Spin parameters on selected group and activate the continuous move
1731
1226
  def GroupSpinParametersSet (self, socketId, GroupName, Velocity, Acceleration):
@@ -1734,34 +1229,17 @@ class XPS:
1734
1229
 
1735
1230
  # GroupSpinParametersGet : Get Spin parameters on selected group
1736
1231
  def GroupSpinParametersGet (self, socketId, GroupName):
1737
- command = 'GroupSpinParametersGet(' + GroupName + ',double *,double *)'
1232
+ outputs = XPSOutputs('double', 'double')
1233
+ command = f'GroupSpinParametersGet({GroupName},{outputs})'
1738
1234
  error, returnedString = self.Send(socketId, command)
1739
- if (error != 0):
1740
- return [error, returnedString]
1741
-
1742
- i, j, retList = 0, 0, [error]
1743
- for paramNb in range(2):
1744
- while ((i+j) < len(returnedString) and returnedString[i+j] != ','):
1745
- j += 1
1746
- retList.append(eval(returnedString[i:i+j]))
1747
- i, j = i+j+1, 0
1748
- return retList
1749
-
1235
+ return outputs.parse(error, returnedString)
1750
1236
 
1751
1237
  # GroupSpinCurrentGet : Get Spin current on selected group
1752
1238
  def GroupSpinCurrentGet (self, socketId, GroupName):
1753
- command = 'GroupSpinCurrentGet(' + GroupName + ',double *,double *)'
1239
+ outputs = XPSOutputs('double', 'double')
1240
+ command = f'GroupSpinCurrentGet({GroupName},{outputs})'
1754
1241
  error, returnedString = self.Send(socketId, command)
1755
- if (error != 0):
1756
- return [error, returnedString]
1757
-
1758
- i, j, retList = 0, 0, [error]
1759
- for paramNb in range(2):
1760
- while ((i+j) < len(returnedString) and returnedString[i+j] != ','):
1761
- j += 1
1762
- retList.append(eval(returnedString[i:i+j]))
1763
- i, j = i+j+1, 0
1764
- return retList
1242
+ return outputs.parse(error, returnedString)
1765
1243
 
1766
1244
  # GroupSpinModeStop : Stop Spin mode on selected group with specified acceleration
1767
1245
  def GroupSpinModeStop (self, socketId, GroupName, Acceleration):
@@ -1775,39 +1253,22 @@ class XPS:
1775
1253
 
1776
1254
  # XYLineArcVerificationResultGet : XY trajectory verification result get
1777
1255
  def XYLineArcVerificationResultGet (self, socketId, PositionerName):
1778
- command = 'XYLineArcVerificationResultGet(' + PositionerName + ',char *,double *,double *,double *,double *)'
1256
+ outputs = XPSOutputs('char', 'double', 'double', 'double', 'double')
1257
+ command = f'XYLineArcVerificationResultGet({PositionerName},{outputs})'
1779
1258
  error, returnedString = self.Send(socketId, command)
1780
- if (error != 0):
1781
- return [error, returnedString]
1782
-
1783
- i, j, retList = 0, 0, [error]
1784
- for paramNb in range(4):
1785
- while ((i+j) < len(returnedString) and returnedString[i+j] != ','):
1786
- j += 1
1787
- retList.append(eval(returnedString[i:i+j]))
1788
- i, j = i+j+1, 0
1789
- return retList
1259
+ return outputs.parse(error, returnedString)
1790
1260
 
1791
1261
  # XYLineArcExecution : XY trajectory execution
1792
1262
  def XYLineArcExecution (self, socketId, GroupName, TrajectoryFileName, Velocity, Acceleration, ExecutionNumber):
1793
1263
  command = 'XYLineArcExecution(' + GroupName + ',' + TrajectoryFileName + ',' + str(Velocity) + ',' + str(Acceleration) + ',' + str(ExecutionNumber) + ')'
1794
1264
  return self.Send(socketId, command)
1795
1265
 
1796
-
1797
1266
  # XYLineArcParametersGet : XY trajectory get parameters
1798
1267
  def XYLineArcParametersGet (self, socketId, GroupName):
1799
- command = 'XYLineArcParametersGet(' + GroupName + ',char *,double *,double *,int *)'
1268
+ outputs = XPSOutputs('char', 'double', 'double', 'int')
1269
+ command = f'XYLineArcParametersGet({GroupName},{outputs})'
1800
1270
  error, returnedString = self.Send(socketId, command)
1801
- if (error != 0):
1802
- return [error, returnedString]
1803
-
1804
- i, j, retList = 0, 0, [error]
1805
- for paramNb in range(3):
1806
- while ((i+j) < len(returnedString) and returnedString[i+j] != ','):
1807
- j += 1
1808
- retList.append(eval(returnedString[i:i+j]))
1809
- i, j = i+j+1, 0
1810
- return retList
1271
+ return outputs.parse(error, returnedString)
1811
1272
 
1812
1273
  # XYLineArcPulseOutputSet : Configure pulse output on trajectory
1813
1274
  def XYLineArcPulseOutputSet (self, socketId, GroupName, StartLength, EndLength, PathLengthInterval):
@@ -1816,33 +1277,17 @@ class XPS:
1816
1277
 
1817
1278
  # XYLineArcPulseOutputGet : Get pulse output on trajectory configuration
1818
1279
  def XYLineArcPulseOutputGet (self, socketId, GroupName):
1819
- command = 'XYLineArcPulseOutputGet(' + GroupName + ',double *,double *,double *)'
1280
+ outputs = XPSOutputs('double', 'double', 'double')
1281
+ command = f'XYLineArcPulseOutputGet({GroupName},{outputs})'
1820
1282
  error, returnedString = self.Send(socketId, command)
1821
- if (error != 0):
1822
- return [error, returnedString]
1823
-
1824
- i, j, retList = 0, 0, [error]
1825
- for paramNb in range(3):
1826
- while ((i+j) < len(returnedString) and returnedString[i+j] != ','):
1827
- j += 1
1828
- retList.append(eval(returnedString[i:i+j]))
1829
- i, j = i+j+1, 0
1830
- return retList
1283
+ return outputs.parse(error, returnedString)
1831
1284
 
1832
1285
  # XYZGroupPositionCorrectedProfilerGet : Return corrected profiler positions
1833
1286
  def XYZGroupPositionCorrectedProfilerGet (self, socketId, GroupName, PositionX, PositionY, PositionZ):
1834
- command = 'XYZGroupPositionCorrectedProfilerGet(' + GroupName + ',' + str(PositionX) + ',' + str(PositionY) + ',' + str(PositionZ) + ',double *,double *,double *)'
1287
+ outputs = XPSOutputs('double', 'double', 'double')
1288
+ command = f'XYZGroupPositionCorrectedProfilerGet({GroupName},{PositionX},{PositionY},{PositionZ},{outputs})'
1835
1289
  error, returnedString = self.Send(socketId, command)
1836
- if (error != 0):
1837
- return [error, returnedString]
1838
-
1839
- i, j, retList = 0, 0, [error]
1840
- for paramNb in range(3):
1841
- while ((i+j) < len(returnedString) and returnedString[i+j] != ','):
1842
- j += 1
1843
- retList.append(eval(returnedString[i:i+j]))
1844
- i, j = i+j+1, 0
1845
- return retList
1290
+ return outputs.parse(error, returnedString)
1846
1291
 
1847
1292
  # XYZSplineVerification : XYZ trajectory verifivation
1848
1293
  def XYZSplineVerification (self, socketId, GroupName, TrajectoryFileName):
@@ -1851,18 +1296,10 @@ class XPS:
1851
1296
 
1852
1297
  # XYZSplineVerificationResultGet : XYZ trajectory verification result get
1853
1298
  def XYZSplineVerificationResultGet (self, socketId, PositionerName):
1854
- command = 'XYZSplineVerificationResultGet(' + PositionerName + ',char *,double *,double *,double *,double *)'
1299
+ outputs = XPSOutputs('char', 'double', 'double', 'double', 'double')
1300
+ command = f'XYZSplineVerificationResultGet({PositionerName},{outputs})'
1855
1301
  error, returnedString = self.Send(socketId, command)
1856
- if (error != 0):
1857
- return [error, returnedString]
1858
-
1859
- i, j, retList = 0, 0, [error]
1860
- for paramNb in range(4):
1861
- while ((i+j) < len(returnedString) and returnedString[i+j] != ','):
1862
- j += 1
1863
- retList.append(eval(returnedString[i:i+j]))
1864
- i, j = i+j+1, 0
1865
- return retList
1302
+ return outputs.parse(error, returnedString)
1866
1303
 
1867
1304
  # XYZSplineExecution : XYZ trajectory execution
1868
1305
  def XYZSplineExecution (self, socketId, GroupName, TrajectoryFileName, Velocity, Acceleration):
@@ -1871,18 +1308,10 @@ class XPS:
1871
1308
 
1872
1309
  # XYZSplineParametersGet : XYZ trajectory get parameters
1873
1310
  def XYZSplineParametersGet (self, socketId, GroupName):
1874
- command = 'XYZSplineParametersGet(' + GroupName + ',char *,double *,double *,int *)'
1311
+ outputs = XPSOutputs('char', 'double', 'double', 'int')
1312
+ command = f'XYZSplineParametersGet({GroupName},{outputs})'
1875
1313
  error, returnedString = self.Send(socketId, command)
1876
- if (error != 0):
1877
- return [error, returnedString]
1878
-
1879
- i, j, retList = 0, 0, [error]
1880
- for paramNb in range(3):
1881
- while ((i+j) < len(returnedString) and returnedString[i+j] != ','):
1882
- j += 1
1883
- retList.append(eval(returnedString[i:i+j]))
1884
- i, j = i+j+1, 0
1885
- return retList
1314
+ return outputs.parse(error, returnedString)
1886
1315
 
1887
1316
  # OptionalModuleExecute : Execute an optional module
1888
1317
  def OptionalModuleExecute (self, socketId, ModuleFileName, TaskName):
@@ -1911,33 +1340,17 @@ class XPS:
1911
1340
 
1912
1341
  # CPUCoreAndBoardSupplyVoltagesGet : Get power informations
1913
1342
  def CPUCoreAndBoardSupplyVoltagesGet (self, socketId):
1914
- command = 'CPUCoreAndBoardSupplyVoltagesGet(double *,double *,double *,double *,double *,double *,double *,double *)'
1343
+ outputs = XPSOutputs('double', 'double', 'double', 'double', 'double', 'double', 'double', 'double')
1344
+ command = f'CPUCoreAndBoardSupplyVoltagesGet({outputs})'
1915
1345
  error, returnedString = self.Send(socketId, command)
1916
- if (error != 0):
1917
- return [error, returnedString]
1918
-
1919
- i, j, retList = 0, 0, [error]
1920
- for paramNb in range(8):
1921
- while ((i+j) < len(returnedString) and returnedString[i+j] != ','):
1922
- j += 1
1923
- retList.append(eval(returnedString[i:i+j]))
1924
- i, j = i+j+1, 0
1925
- return retList
1346
+ return outputs.parse(error, returnedString)
1926
1347
 
1927
1348
  # CPUTemperatureAndFanSpeedGet : Get CPU temperature and fan speed
1928
1349
  def CPUTemperatureAndFanSpeedGet (self, socketId):
1929
- command = 'CPUTemperatureAndFanSpeedGet(double *,double *)'
1350
+ outputs = XPSOutputs('double', 'double')
1351
+ command = f'CPUTemperatureAndFanSpeedGet({outputs})'
1930
1352
  error, returnedString = self.Send(socketId, command)
1931
- if (error != 0):
1932
- return [error, returnedString]
1933
-
1934
- i, j, retList = 0, 0, [error]
1935
- for paramNb in range(2):
1936
- while ((i+j) < len(returnedString) and returnedString[i+j] != ','):
1937
- j += 1
1938
- retList.append(eval(returnedString[i:i+j]))
1939
- i, j = i+j+1, 0
1940
- return retList
1353
+ return outputs.parse(error, returnedString)
1941
1354
 
1942
1355
  # ActionListGet : Action list
1943
1356
  def ActionListGet (self, socketId):
@@ -1989,7 +1402,10 @@ class XPS:
1989
1402
 
1990
1403
  # HardwareDriverAndStageGet : Smart hardware
1991
1404
  def HardwareDriverAndStageGet (self, socketId, PlugNumber):
1992
- return self.Send(socketId, 'HardwareDriverAndStageGet(%s, char *, char *)' % str(PlugNumber))
1405
+ outputs = XPSOutputs('char', 'char')
1406
+ command = f'HardwareDriverAndStageGet({PlugNumber},{outputs})'
1407
+ error, returnedString = self.Send(socketId, command)
1408
+ return outputs.parse(error, returnedString)
1993
1409
 
1994
1410
  # ObjectsListGet : Group name and positioner name
1995
1411
  def ObjectsListGet (self, socketId):
@@ -2017,33 +1433,17 @@ class XPS:
2017
1433
 
2018
1434
  # GatheringUserDatasGet : Return user data values
2019
1435
  def GatheringUserDatasGet (self, socketId):
2020
- command = 'GatheringUserDatasGet(double *,double *,double *,double *,double *,double *,double *,double *)'
1436
+ outputs = XPSOutputs('double', 'double', 'double', 'double', 'double', 'double', 'double', 'double')
1437
+ command = f'GatheringUserDatasGet({outputs})'
2021
1438
  error, returnedString = self.Send(socketId, command)
2022
- if (error != 0):
2023
- return [error, returnedString]
2024
-
2025
- i, j, retList = 0, 0, [error]
2026
- for paramNb in range(8):
2027
- while ((i+j) < len(returnedString) and returnedString[i+j] != ','):
2028
- j += 1
2029
- retList.append(eval(returnedString[i:i+j]))
2030
- i, j = i+j+1, 0
2031
- return retList
1439
+ return outputs.parse(error, returnedString)
2032
1440
 
2033
1441
  # ControllerMotionKernelPeriodMinMaxGet : Get controller motion kernel min/max periods
2034
1442
  def ControllerMotionKernelPeriodMinMaxGet (self, socketId):
2035
- command = 'ControllerMotionKernelPeriodMinMaxGet(double *,double *,double *,double *,double *,double *)'
2036
- error, returnedString = self.Send(socketId, command)
2037
- if (error != 0):
2038
- return [error, returnedString]
2039
-
2040
- i, j, retList = 0, 0, [error]
2041
- for paramNb in range(6):
2042
- while ((i+j) < len(returnedString) and returnedString[i+j] != ','):
2043
- j += 1
2044
- retList.append(eval(returnedString[i:i+j]))
2045
- i, j = i+j+1, 0
2046
- return retList
1443
+ outputs = XPSOutputs('double', 'double', 'double', 'double', 'double', 'double')
1444
+ command = f'ControllerMotionKernelPeriodMinMaxGet({outputs})'
1445
+ error, returnedString = self.Send(socketId, command)
1446
+ return outputs.parse(error, returnedString)
2047
1447
 
2048
1448
  # ControllerMotionKernelPeriodMinMaxReset : Reset controller motion kernel min/max periods
2049
1449
  def ControllerMotionKernelPeriodMinMaxReset (self, socketId):