Skip to content

Commit f6256a0

Browse files
authored
nirfsg: Synchronize API updates with latest driver (#2169)
1 parent c021ccb commit f6256a0

13 files changed

Lines changed: 544 additions & 158 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1702,6 +1702,9 @@
17021702
#### [nirfsg] Unreleased
17031703
- Added
17041704
- Python 3.14 Support
1705+
- `get_script` and `delete_script` methods
1706+
- `SCRIPTS` added to enum `LoadOptions`
1707+
- `DO_NOT_DRIVE_SIGNAL` added to enum `PulseModulationSource`
17051708
- Changed
17061709
- Removed
17071710

docs/nirfsg/class.rst

Lines changed: 65 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1071,6 +1071,31 @@ delete_deembedding_table
10711071

10721072
:type table_name: str
10731073

1074+
delete_script
1075+
-------------
1076+
1077+
.. py:currentmodule:: nirfsg.Session
1078+
1079+
.. py:method:: delete_script(script_name)
1080+
1081+
Deletes a specified script from the pool of currently defined scripts. The NI-RFSG device must be in the Configuration state before you call this method.
1082+
1083+
**Supported Devices** :PXIe-5820/5830/5831/5832/5840/5841/5842/5860
1084+
1085+
1086+
1087+
1088+
1089+
:param script_name:
1090+
1091+
1092+
Specifies the name of the script to delete. This string is case-insensitive.
1093+
1094+
1095+
1096+
1097+
:type script_name: str
1098+
10741099
disable_script_trigger
10751100
----------------------
10761101

@@ -1342,6 +1367,41 @@ get_max_settable_power
13421367

13431368

13441369

1370+
get_script
1371+
----------
1372+
1373+
.. py:currentmodule:: nirfsg.Session
1374+
1375+
.. py:method:: get_script(script_name)
1376+
1377+
Returns the content of specified script.
1378+
1379+
**Supported Devices** :PXIe-5820/5830/5831/5832/5840/5841/5842/5860
1380+
1381+
1382+
1383+
1384+
1385+
:param script_name:
1386+
1387+
1388+
Specifies the name of the script. This string is case-insensitive.
1389+
1390+
1391+
1392+
1393+
:type script_name: str
1394+
1395+
:rtype: str
1396+
:return:
1397+
1398+
1399+
Returns the script.
1400+
1401+
1402+
1403+
1404+
13451405
get_self_cal_last_date_and_time
13461406
-------------------------------
13471407

@@ -2114,7 +2174,11 @@ self_cal
21142174

21152175

21162176

2117-
.. note:: If there is an existing NI-RFSA session open for the same PXIe-5820/5830/5831/5832/5840/5841/5842/5860 while this method runs, it may remain open but cannot be used for operations that access the hardware, for example niRFSA_Commit or niRFSA_Initiate.
2177+
.. note:: If there is an existing NI-RFSA session open for the same PXIe-5820/5830/5831/5832/5840/5841/5842/5860 while this method runs, it may remain open but cannot be used for operations that access the hardware, for example niRFSA_Commit or niRFSA_Initiate. For the existing open session to use the new self-calibration data, the session will need to be closed and reopened.
2178+
2179+
**PXIe-5860**
2180+
2181+
While this VI is running on one channel, if there are any existing NI-RFSG or NI-RFSA sessions open on the other channel, they may remain open but cannot be used for operations that access the hardware, for example niRFSG Commit or niRFSG Initiate or niRFSA Commit or niRFSA Initiate. For the existing open session to use the new self-calibration data, the session will need to be closed and reopened.
21182182

21192183

21202184

docs/nirfsg/enums.rst

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -711,6 +711,16 @@ LoadOptions
711711

712712

713713

714+
.. py:attribute:: LoadOptions.SCRIPTS
715+
716+
717+
718+
NI-RFSG skips loading the scripts to the session.
719+
720+
721+
722+
723+
714724
LoopBandwidth
715725
-------------
716726

@@ -1136,6 +1146,16 @@ PulseModulationSource
11361146

11371147

11381148

1149+
.. py:attribute:: PulseModulationSource.DO_NOT_DRIVE_SIGNAL
1150+
1151+
1152+
1153+
Do not drive pulse modulation.
1154+
1155+
1156+
1157+
1158+
11391159
RFBlanking
11401160
----------
11411161

generated/nirfsg/nirfsg/_library.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ def __init__(self, ctypes_library):
4444
self.niRFSG_CreateDeembeddingSparameterTableS2PFile_cfunc = None
4545
self.niRFSG_DeleteAllDeembeddingTables_cfunc = None
4646
self.niRFSG_DeleteDeembeddingTable_cfunc = None
47+
self.niRFSG_DeleteScript_cfunc = None
4748
self.niRFSG_DisableScriptTrigger_cfunc = None
4849
self.niRFSG_DisableStartTrigger_cfunc = None
4950
self.niRFSG_ErrorMessage_cfunc = None
@@ -60,6 +61,7 @@ def __init__(self, ctypes_library):
6061
self.niRFSG_GetError_cfunc = None
6162
self.niRFSG_GetExternalCalibrationLastDateAndTime_cfunc = None
6263
self.niRFSG_GetMaxSettablePower_cfunc = None
64+
self.niRFSG_GetScript_cfunc = None
6365
self.niRFSG_GetSelfCalibrationDateAndTime_cfunc = None
6466
self.niRFSG_GetSelfCalibrationTemperature_cfunc = None
6567
self.niRFSG_GetTerminalName_cfunc = None
@@ -301,6 +303,14 @@ def niRFSG_DeleteDeembeddingTable(self, vi, port, table_name): # noqa: N802
301303
self.niRFSG_DeleteDeembeddingTable_cfunc.restype = ViStatus # noqa: F405
302304
return self.niRFSG_DeleteDeembeddingTable_cfunc(vi, port, table_name)
303305

306+
def niRFSG_DeleteScript(self, vi, script_name): # noqa: N802
307+
with self._func_lock:
308+
if self.niRFSG_DeleteScript_cfunc is None:
309+
self.niRFSG_DeleteScript_cfunc = self._get_library_function('niRFSG_DeleteScript')
310+
self.niRFSG_DeleteScript_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar)] # noqa: F405
311+
self.niRFSG_DeleteScript_cfunc.restype = ViStatus # noqa: F405
312+
return self.niRFSG_DeleteScript_cfunc(vi, script_name)
313+
304314
def niRFSG_DisableScriptTrigger(self, vi, trigger_id): # noqa: N802
305315
with self._func_lock:
306316
if self.niRFSG_DisableScriptTrigger_cfunc is None:
@@ -429,6 +439,14 @@ def niRFSG_GetMaxSettablePower(self, vi, value): # noqa: N802
429439
self.niRFSG_GetMaxSettablePower_cfunc.restype = ViStatus # noqa: F405
430440
return self.niRFSG_GetMaxSettablePower_cfunc(vi, value)
431441

442+
def niRFSG_GetScript(self, vi, script_name, script, buffer_size, actual_buffer_size): # noqa: N802
443+
with self._func_lock:
444+
if self.niRFSG_GetScript_cfunc is None:
445+
self.niRFSG_GetScript_cfunc = self._get_library_function('niRFSG_GetScript')
446+
self.niRFSG_GetScript_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViChar), ViInt32, ctypes.POINTER(ViInt32)] # noqa: F405
447+
self.niRFSG_GetScript_cfunc.restype = ViStatus # noqa: F405
448+
return self.niRFSG_GetScript_cfunc(vi, script_name, script, buffer_size, actual_buffer_size)
449+
432450
def niRFSG_GetSelfCalibrationDateAndTime(self, vi, module, year, month, day, hour, minute, second): # noqa: N802
433451
with self._func_lock:
434452
if self.niRFSG_GetSelfCalibrationDateAndTime_cfunc is None:

generated/nirfsg/nirfsg/_library_interpreter.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,13 @@ def delete_deembedding_table(self, port, table_name): # noqa: N802
278278
errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False)
279279
return
280280

281+
def delete_script(self, script_name): # noqa: N802
282+
vi_ctype = _visatype.ViSession(self._vi) # case S110
283+
script_name_ctype = ctypes.create_string_buffer(script_name.encode(self._encoding)) # case C020
284+
error_code = self._library.niRFSG_DeleteScript(vi_ctype, script_name_ctype)
285+
errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False)
286+
return
287+
281288
def disable_script_trigger(self, trigger_id): # noqa: N802
282289
vi_ctype = _visatype.ViSession(self._vi) # case S110
283290
trigger_id_ctype = ctypes.create_string_buffer(trigger_id.encode(self._encoding)) # case C010
@@ -438,6 +445,20 @@ def get_max_settable_power(self): # noqa: N802
438445
errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False)
439446
return float(value_ctype.value)
440447

448+
def get_script(self, script_name): # noqa: N802
449+
vi_ctype = _visatype.ViSession(self._vi) # case S110
450+
script_name_ctype = ctypes.create_string_buffer(script_name.encode(self._encoding)) # case C020
451+
script_ctype = None # case C090
452+
buffer_size_ctype = _visatype.ViInt32(0) # case S190
453+
actual_buffer_size_ctype = _visatype.ViInt32() # case S220
454+
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)))
455+
errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False)
456+
buffer_size_ctype = _visatype.ViInt32(actual_buffer_size_ctype.value) # case S200
457+
script_ctype = (_visatype.ViChar * actual_buffer_size_ctype.value)() # case C100
458+
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)))
459+
errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False)
460+
return script_ctype.value.decode(self._encoding)
461+
441462
def get_self_calibration_date_and_time(self, module): # noqa: N802
442463
vi_ctype = _visatype.ViSession(self._vi) # case S110
443464
module_ctype = _visatype.ViInt32(module.value) # case S130

generated/nirfsg/nirfsg/enums.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,10 @@ class LoadOptions(Enum):
308308
r'''
309309
NI-RFSG skips loading the waveform configurations to the session.
310310
'''
311+
SCRIPTS = 2
312+
r'''
313+
NI-RFSG skips loading the scripts to the session.
314+
'''
311315

312316

313317
class LoopBandwidth(Enum):
@@ -491,6 +495,10 @@ class PulseModulationSource(Enum):
491495
r'''
492496
The trigger is received from the Marker 3.
493497
'''
498+
DO_NOT_DRIVE_SIGNAL = ''
499+
r'''
500+
Do not drive pulse modulation.
501+
'''
494502

495503

496504
class RFBlanking(Enum):

generated/nirfsg/nirfsg/session.py

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6291,6 +6291,20 @@ def delete_deembedding_table(self, port, table_name):
62916291
'''
62926292
self._interpreter.delete_deembedding_table(port, table_name)
62936293

6294+
@ivi_synchronized
6295+
def delete_script(self, script_name):
6296+
r'''delete_script
6297+
6298+
Deletes a specified script from the pool of currently defined scripts. The NI-RFSG device must be in the Configuration state before you call this method.
6299+
6300+
**Supported Devices** :PXIe-5820/5830/5831/5832/5840/5841/5842/5860
6301+
6302+
Args:
6303+
script_name (str): Specifies the name of the script to delete. This string is case-insensitive.
6304+
6305+
'''
6306+
self._interpreter.delete_script(script_name)
6307+
62946308
@ivi_synchronized
62956309
def disable_start_trigger(self):
62966310
r'''disable_start_trigger
@@ -6502,6 +6516,25 @@ def get_max_settable_power(self):
65026516
value = self._interpreter.get_max_settable_power()
65036517
return value
65046518

6519+
@ivi_synchronized
6520+
def get_script(self, script_name):
6521+
r'''get_script
6522+
6523+
Returns the content of specified script.
6524+
6525+
**Supported Devices** :PXIe-5820/5830/5831/5832/5840/5841/5842/5860
6526+
6527+
Args:
6528+
script_name (str): Specifies the name of the script. This string is case-insensitive.
6529+
6530+
6531+
Returns:
6532+
script (str): Returns the script.
6533+
6534+
'''
6535+
script = self._interpreter.get_script(script_name)
6536+
return script
6537+
65056538
@ivi_synchronized
65066539
def _get_self_calibration_date_and_time(self, module):
65076540
r'''_get_self_calibration_date_and_time
@@ -6960,7 +6993,11 @@ def self_cal(self):
69606993

69616994
**Supported Devices** : PXI-5610, PXIe-5653, PXI-5670/5671, PXIe-5672/5673/5673E, PXIe-5820/5830/5831/5832/5840/5841/5842/5860
69626995

6963-
Note: If there is an existing NI-RFSA session open for the same PXIe-5820/5830/5831/5832/5840/5841/5842/5860 while this method runs, it may remain open but cannot be used for operations that access the hardware, for example niRFSA_Commit or niRFSA_Initiate.
6996+
Note: If there is an existing NI-RFSA session open for the same PXIe-5820/5830/5831/5832/5840/5841/5842/5860 while this method runs, it may remain open but cannot be used for operations that access the hardware, for example niRFSA_Commit or niRFSA_Initiate. For the existing open session to use the new self-calibration data, the session will need to be closed and reopened.
6997+
6998+
**PXIe-5860**
6999+
7000+
While this VI is running on one channel, if there are any existing NI-RFSG or NI-RFSA sessions open on the other channel, they may remain open but cannot be used for operations that access the hardware, for example niRFSG Commit or niRFSG Initiate or niRFSA Commit or niRFSA Initiate. For the existing open session to use the new self-calibration data, the session will need to be closed and reopened.
69647001
'''
69657002
self._interpreter.self_cal()
69667003

generated/nirfsg/nirfsg/unit_tests/_mock_helper.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ def __init__(self):
6767
self._defaults['DeleteAllDeembeddingTables']['return'] = 0
6868
self._defaults['DeleteDeembeddingTable'] = {}
6969
self._defaults['DeleteDeembeddingTable']['return'] = 0
70+
self._defaults['DeleteScript'] = {}
71+
self._defaults['DeleteScript']['return'] = 0
7072
self._defaults['DisableScriptTrigger'] = {}
7173
self._defaults['DisableScriptTrigger']['return'] = 0
7274
self._defaults['DisableStartTrigger'] = {}
@@ -122,6 +124,10 @@ def __init__(self):
122124
self._defaults['GetMaxSettablePower'] = {}
123125
self._defaults['GetMaxSettablePower']['return'] = 0
124126
self._defaults['GetMaxSettablePower']['value'] = None
127+
self._defaults['GetScript'] = {}
128+
self._defaults['GetScript']['return'] = 0
129+
self._defaults['GetScript']['actualBufferSize'] = None
130+
self._defaults['GetScript']['script'] = None
125131
self._defaults['GetSelfCalibrationDateAndTime'] = {}
126132
self._defaults['GetSelfCalibrationDateAndTime']['return'] = 0
127133
self._defaults['GetSelfCalibrationDateAndTime']['year'] = None
@@ -369,6 +375,11 @@ def niRFSG_DeleteDeembeddingTable(self, vi, port, table_name): # noqa: N802
369375
return self._defaults['DeleteDeembeddingTable']['return']
370376
return self._defaults['DeleteDeembeddingTable']['return']
371377

378+
def niRFSG_DeleteScript(self, vi, script_name): # noqa: N802
379+
if self._defaults['DeleteScript']['return'] != 0:
380+
return self._defaults['DeleteScript']['return']
381+
return self._defaults['DeleteScript']['return']
382+
372383
def niRFSG_DisableScriptTrigger(self, vi, trigger_id): # noqa: N802
373384
if self._defaults['DisableScriptTrigger']['return'] != 0:
374385
return self._defaults['DisableScriptTrigger']['return']
@@ -574,6 +585,22 @@ def niRFSG_GetMaxSettablePower(self, vi, value): # noqa: N802
574585
value.contents.value = self._defaults['GetMaxSettablePower']['value']
575586
return self._defaults['GetMaxSettablePower']['return']
576587

588+
def niRFSG_GetScript(self, vi, script_name, script, buffer_size, actual_buffer_size): # noqa: N802
589+
if self._defaults['GetScript']['return'] != 0:
590+
return self._defaults['GetScript']['return']
591+
# actual_buffer_size
592+
if self._defaults['GetScript']['actualBufferSize'] is None:
593+
raise MockFunctionCallError("niRFSG_GetScript", param='actualBufferSize')
594+
if actual_buffer_size is not None:
595+
actual_buffer_size.contents.value = self._defaults['GetScript']['actualBufferSize']
596+
# script
597+
if self._defaults['GetScript']['script'] is None:
598+
raise MockFunctionCallError("niRFSG_GetScript", param='script')
599+
if buffer_size.value == 0:
600+
return len(self._defaults['GetScript']['script'])
601+
script.value = self._defaults['GetScript']['script'].encode('ascii')
602+
return self._defaults['GetScript']['return']
603+
577604
def niRFSG_GetSelfCalibrationDateAndTime(self, vi, module, year, month, day, hour, minute, second): # noqa: N802
578605
if self._defaults['GetSelfCalibrationDateAndTime']['return'] != 0:
579606
return self._defaults['GetSelfCalibrationDateAndTime']['return']
@@ -967,6 +994,8 @@ def set_side_effects_and_return_values(self, mock_library):
967994
mock_library.niRFSG_DeleteAllDeembeddingTables.return_value = 0
968995
mock_library.niRFSG_DeleteDeembeddingTable.side_effect = MockFunctionCallError("niRFSG_DeleteDeembeddingTable")
969996
mock_library.niRFSG_DeleteDeembeddingTable.return_value = 0
997+
mock_library.niRFSG_DeleteScript.side_effect = MockFunctionCallError("niRFSG_DeleteScript")
998+
mock_library.niRFSG_DeleteScript.return_value = 0
970999
mock_library.niRFSG_DisableScriptTrigger.side_effect = MockFunctionCallError("niRFSG_DisableScriptTrigger")
9711000
mock_library.niRFSG_DisableScriptTrigger.return_value = 0
9721001
mock_library.niRFSG_DisableStartTrigger.side_effect = MockFunctionCallError("niRFSG_DisableStartTrigger")
@@ -999,6 +1028,8 @@ def set_side_effects_and_return_values(self, mock_library):
9991028
mock_library.niRFSG_GetExternalCalibrationLastDateAndTime.return_value = 0
10001029
mock_library.niRFSG_GetMaxSettablePower.side_effect = MockFunctionCallError("niRFSG_GetMaxSettablePower")
10011030
mock_library.niRFSG_GetMaxSettablePower.return_value = 0
1031+
mock_library.niRFSG_GetScript.side_effect = MockFunctionCallError("niRFSG_GetScript")
1032+
mock_library.niRFSG_GetScript.return_value = 0
10021033
mock_library.niRFSG_GetSelfCalibrationDateAndTime.side_effect = MockFunctionCallError("niRFSG_GetSelfCalibrationDateAndTime")
10031034
mock_library.niRFSG_GetSelfCalibrationDateAndTime.return_value = 0
10041035
mock_library.niRFSG_GetSelfCalibrationTemperature.side_effect = MockFunctionCallError("niRFSG_GetSelfCalibrationTemperature")

src/nirfsg/metadata/attributes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -*- coding: utf-8 -*-
2-
# This file is generated from NI-RFSG API metadata version 25.8.0d197
2+
# This file is generated from NI-RFSG API metadata version 26.3.0d9999
33
attributes = {
44
1050302: {
55
'access': 'read only',

src/nirfsg/metadata/config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# -*- coding: utf-8 -*-
2-
# This file is generated from NI-RFSG API metadata version 25.8.0d197
2+
# This file is generated from NI-RFSG API metadata version 26.3.0d9999
33
config = {
4-
'api_version': '25.8.0d197',
4+
'api_version': '26.3.0d9999',
55
'c_function_prefix': 'niRFSG_',
66
'close_function': 'close',
77
'context_manager_name': {

0 commit comments

Comments
 (0)