Skip to content

Commit 4d3bfe4

Browse files
committed
Files generated from nirfsg AzDo exports
1 parent f1879fd commit 4d3bfe4

File tree

6 files changed

+140
-0
lines changed

6 files changed

+140
-0
lines changed

docs/nirfsg/class.rst

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1803,6 +1803,44 @@ get_max_settable_power
18031803

18041804

18051805

1806+
get_script
1807+
----------
1808+
1809+
.. py:currentmodule:: nirfsg.Session
1810+
1811+
.. py:method:: get_script(script_name)
1812+
1813+
TBD
1814+
1815+
1816+
1817+
1818+
1819+
:param script_name:
1820+
1821+
1822+
1823+
1824+
1825+
:type script_name: str
1826+
1827+
:rtype: tuple (script, actual_buffer_size)
1828+
1829+
WHERE
1830+
1831+
script (str):
1832+
1833+
1834+
1835+
1836+
1837+
actual_buffer_size (int):
1838+
1839+
1840+
1841+
1842+
1843+
18061844
get_self_calibration_last_date_and_time
18071845
---------------------------------------
18081846

generated/nirfsg/nirfsg/_library.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ def __init__(self, ctypes_library):
7272
self.niRFSG_GetError_cfunc = None
7373
self.niRFSG_GetExternalCalibrationLastDateAndTime_cfunc = None
7474
self.niRFSG_GetMaxSettablePower_cfunc = None
75+
self.niRFSG_GetScript_cfunc = None
7576
self.niRFSG_GetSelfCalibrationDateAndTime_cfunc = None
7677
self.niRFSG_GetSelfCalibrationTemperature_cfunc = None
7778
self.niRFSG_GetTerminalName_cfunc = None
@@ -539,6 +540,14 @@ def niRFSG_GetMaxSettablePower(self, vi, value): # noqa: N802
539540
self.niRFSG_GetMaxSettablePower_cfunc.restype = ViStatus # noqa: F405
540541
return self.niRFSG_GetMaxSettablePower_cfunc(vi, value)
541542

543+
def niRFSG_GetScript(self, vi, script_name, script, buffer_size, actual_buffer_size): # noqa: N802
544+
with self._func_lock:
545+
if self.niRFSG_GetScript_cfunc is None:
546+
self.niRFSG_GetScript_cfunc = self._get_library_function('niRFSG_GetScript')
547+
self.niRFSG_GetScript_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViChar), ViInt32, ctypes.POINTER(ViInt32)] # noqa: F405
548+
self.niRFSG_GetScript_cfunc.restype = ViStatus # noqa: F405
549+
return self.niRFSG_GetScript_cfunc(vi, script_name, script, buffer_size, actual_buffer_size)
550+
542551
def niRFSG_GetSelfCalibrationDateAndTime(self, vi, module, year, month, day, hour, minute, second): # noqa: N802
543552
with self._func_lock:
544553
if self.niRFSG_GetSelfCalibrationDateAndTime_cfunc is None:

generated/nirfsg/nirfsg/_library_interpreter.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -535,6 +535,20 @@ def get_max_settable_power(self): # noqa: N802
535535
errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False)
536536
return float(value_ctype.value)
537537

538+
def get_script(self, script_name): # noqa: N802
539+
vi_ctype = _visatype.ViSession(self._vi) # case S110
540+
script_name_ctype = ctypes.create_string_buffer(script_name.encode(self._encoding)) # case C020
541+
script_ctype = None # case C050
542+
buffer_size_ctype = _visatype.ViInt32() # case S170
543+
actual_buffer_size_ctype = _visatype.ViInt32() # case S220
544+
error_code = self._library.niRFSG_GetScript(vi_ctype, script_name_ctype, script_ctype, buffer_size_ctype, None if actual_buffer_size_ctype is None else (ctypes.pointer(actual_buffer_size_ctype)))
545+
errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False)
546+
buffer_size_ctype = _visatype.ViInt32(error_code) # case S180
547+
script_ctype = (_visatype.ViChar * buffer_size_ctype.value)() # case C060
548+
error_code = self._library.niRFSG_GetScript(vi_ctype, script_name_ctype, script_ctype, buffer_size_ctype, None if actual_buffer_size_ctype is None else (ctypes.pointer(actual_buffer_size_ctype)))
549+
errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False)
550+
return script_ctype.value.decode(self._encoding), int(actual_buffer_size_ctype.value)
551+
538552
def get_self_calibration_date_and_time(self, module): # noqa: N802
539553
vi_ctype = _visatype.ViSession(self._vi) # case S110
540554
module_ctype = _visatype.ViInt32(module.value) # case S130

generated/nirfsg/nirfsg/session.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7477,6 +7477,25 @@ def get_max_settable_power(self):
74777477
value = self._interpreter.get_max_settable_power()
74787478
return value
74797479

7480+
@ivi_synchronized
7481+
def get_script(self, script_name):
7482+
r'''get_script
7483+
7484+
TBD
7485+
7486+
Args:
7487+
script_name (str):
7488+
7489+
7490+
Returns:
7491+
script (str):
7492+
7493+
actual_buffer_size (int):
7494+
7495+
'''
7496+
script, actual_buffer_size = self._interpreter.get_script(script_name)
7497+
return script, actual_buffer_size
7498+
74807499
@ivi_synchronized
74817500
def _get_self_calibration_date_and_time(self, module):
74827501
r'''_get_self_calibration_date_and_time

generated/nirfsg/nirfsg/unit_tests/_mock_helper.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,10 @@ def __init__(self):
149149
self._defaults['GetMaxSettablePower'] = {}
150150
self._defaults['GetMaxSettablePower']['return'] = 0
151151
self._defaults['GetMaxSettablePower']['value'] = None
152+
self._defaults['GetScript'] = {}
153+
self._defaults['GetScript']['return'] = 0
154+
self._defaults['GetScript']['actualBufferSize'] = None
155+
self._defaults['GetScript']['script'] = None
152156
self._defaults['GetSelfCalibrationDateAndTime'] = {}
153157
self._defaults['GetSelfCalibrationDateAndTime']['return'] = 0
154158
self._defaults['GetSelfCalibrationDateAndTime']['year'] = None
@@ -686,6 +690,22 @@ def niRFSG_GetMaxSettablePower(self, vi, value): # noqa: N802
686690
value.contents.value = self._defaults['GetMaxSettablePower']['value']
687691
return self._defaults['GetMaxSettablePower']['return']
688692

693+
def niRFSG_GetScript(self, vi, script_name, script, buffer_size, actual_buffer_size): # noqa: N802
694+
if self._defaults['GetScript']['return'] != 0:
695+
return self._defaults['GetScript']['return']
696+
# actual_buffer_size
697+
if self._defaults['GetScript']['actualBufferSize'] is None:
698+
raise MockFunctionCallError("niRFSG_GetScript", param='actualBufferSize')
699+
if actual_buffer_size is not None:
700+
actual_buffer_size.contents.value = self._defaults['GetScript']['actualBufferSize']
701+
# script
702+
if self._defaults['GetScript']['script'] is None:
703+
raise MockFunctionCallError("niRFSG_GetScript", param='script')
704+
if buffer_size.value == 0:
705+
return len(self._defaults['GetScript']['script'])
706+
script.value = self._defaults['GetScript']['script'].encode('ascii')
707+
return self._defaults['GetScript']['return']
708+
689709
def niRFSG_GetSelfCalibrationDateAndTime(self, vi, module, year, month, day, hour, minute, second): # noqa: N802
690710
if self._defaults['GetSelfCalibrationDateAndTime']['return'] != 0:
691711
return self._defaults['GetSelfCalibrationDateAndTime']['return']
@@ -1154,6 +1174,8 @@ def set_side_effects_and_return_values(self, mock_library):
11541174
mock_library.niRFSG_GetExternalCalibrationLastDateAndTime.return_value = 0
11551175
mock_library.niRFSG_GetMaxSettablePower.side_effect = MockFunctionCallError("niRFSG_GetMaxSettablePower")
11561176
mock_library.niRFSG_GetMaxSettablePower.return_value = 0
1177+
mock_library.niRFSG_GetScript.side_effect = MockFunctionCallError("niRFSG_GetScript")
1178+
mock_library.niRFSG_GetScript.return_value = 0
11571179
mock_library.niRFSG_GetSelfCalibrationDateAndTime.side_effect = MockFunctionCallError("niRFSG_GetSelfCalibrationDateAndTime")
11581180
mock_library.niRFSG_GetSelfCalibrationDateAndTime.return_value = 0
11591181
mock_library.niRFSG_GetSelfCalibrationTemperature.side_effect = MockFunctionCallError("niRFSG_GetSelfCalibrationTemperature")

src/nirfsg/metadata/functions.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2998,6 +2998,44 @@
29982998
],
29992999
'returns': 'ViStatus'
30003000
},
3001+
'GetScript': {
3002+
'documentation': {
3003+
'description': 'TBD'
3004+
},
3005+
'included_in_proto': True,
3006+
'parameters': [
3007+
{
3008+
'direction': 'in',
3009+
'name': 'vi',
3010+
'type': 'ViSession'
3011+
},
3012+
{
3013+
'direction': 'in',
3014+
'name': 'scriptName',
3015+
'type': 'ViConstString'
3016+
},
3017+
{
3018+
'direction': 'out',
3019+
'name': 'script',
3020+
'size': {
3021+
'mechanism': 'ivi-dance',
3022+
'value': 'bufferSize'
3023+
},
3024+
'type': 'ViChar[]'
3025+
},
3026+
{
3027+
'direction': 'in',
3028+
'name': 'bufferSize',
3029+
'type': 'ViInt32'
3030+
},
3031+
{
3032+
'direction': 'out',
3033+
'name': 'actualBufferSize',
3034+
'type': 'ViInt32'
3035+
}
3036+
],
3037+
'returns': 'ViStatus'
3038+
},
30013039
'GetSelfCalibrationDateAndTime': {
30023040
'codegen_method': 'private',
30033041
'documentation': {

0 commit comments

Comments
 (0)