Skip to content

Commit 8b4c517

Browse files
corrected datatype to float64 list and turned on some apis
1 parent 67b6f7d commit 8b4c517

File tree

6 files changed

+1591
-162
lines changed

6 files changed

+1591
-162
lines changed

docs/nirfsg/class.rst

Lines changed: 730 additions & 44 deletions
Large diffs are not rendered by default.

generated/nirfsg/nirfsg/_library.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ def __init__(self, ctypes_library):
5959
self.niRFSG_Disable_cfunc = None
6060
self.niRFSG_DisableScriptTrigger_cfunc = None
6161
self.niRFSG_DisableStartTrigger_cfunc = None
62+
self.niRFSG_ErrorMessage_cfunc = None
63+
self.niRFSG_ErrorQuery_cfunc = None
6264
self.niRFSG_ExportSignal_cfunc = None
6365
self.niRFSG_GetAttributeViBoolean_cfunc = None
6466
self.niRFSG_GetAttributeViInt32_cfunc = None
@@ -87,6 +89,7 @@ def __init__(self, ctypes_library):
8789
self.niRFSG_ResetAttribute_cfunc = None
8890
self.niRFSG_ResetDevice_cfunc = None
8991
self.niRFSG_ResetWithDefaults_cfunc = None
92+
self.niRFSG_RevisionQuery_cfunc = None
9093
self.niRFSG_SaveConfigurationsToFile_cfunc = None
9194
self.niRFSG_SelectArbWaveform_cfunc = None
9295
self.niRFSG_SelfCal_cfunc = None
@@ -436,6 +439,22 @@ def niRFSG_DisableStartTrigger(self, vi): # noqa: N802
436439
self.niRFSG_DisableStartTrigger_cfunc.restype = ViStatus # noqa: F405
437440
return self.niRFSG_DisableStartTrigger_cfunc(vi)
438441

442+
def niRFSG_ErrorMessage(self, vi, error_code, error_message): # noqa: N802
443+
with self._func_lock:
444+
if self.niRFSG_ErrorMessage_cfunc is None:
445+
self.niRFSG_ErrorMessage_cfunc = self._get_library_function('niRFSG_ErrorMessage')
446+
self.niRFSG_ErrorMessage_cfunc.argtypes = [ViSession, ViStatus, ctypes.POINTER(ViChar)] # noqa: F405
447+
self.niRFSG_ErrorMessage_cfunc.restype = ViStatus # noqa: F405
448+
return self.niRFSG_ErrorMessage_cfunc(vi, error_code, error_message)
449+
450+
def niRFSG_ErrorQuery(self, vi, error_code, error_message): # noqa: N802
451+
with self._func_lock:
452+
if self.niRFSG_ErrorQuery_cfunc is None:
453+
self.niRFSG_ErrorQuery_cfunc = self._get_library_function('niRFSG_ErrorQuery')
454+
self.niRFSG_ErrorQuery_cfunc.argtypes = [ViSession, ctypes.POINTER(ViInt32), ctypes.POINTER(ViChar)] # noqa: F405
455+
self.niRFSG_ErrorQuery_cfunc.restype = ViStatus # noqa: F405
456+
return self.niRFSG_ErrorQuery_cfunc(vi, error_code, error_message)
457+
439458
def niRFSG_ExportSignal(self, vi, signal, signal_identifier, output_terminal): # noqa: N802
440459
with self._func_lock:
441460
if self.niRFSG_ExportSignal_cfunc is None:
@@ -660,6 +679,14 @@ def niRFSG_ResetWithDefaults(self, vi): # noqa: N802
660679
self.niRFSG_ResetWithDefaults_cfunc.restype = ViStatus # noqa: F405
661680
return self.niRFSG_ResetWithDefaults_cfunc(vi)
662681

682+
def niRFSG_RevisionQuery(self, vi, instrument_driver_revision, firmware_revision): # noqa: N802
683+
with self._func_lock:
684+
if self.niRFSG_RevisionQuery_cfunc is None:
685+
self.niRFSG_RevisionQuery_cfunc = self._get_library_function('niRFSG_RevisionQuery')
686+
self.niRFSG_RevisionQuery_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViChar)] # noqa: F405
687+
self.niRFSG_RevisionQuery_cfunc.restype = ViStatus # noqa: F405
688+
return self.niRFSG_RevisionQuery_cfunc(vi, instrument_driver_revision, firmware_revision)
689+
663690
def niRFSG_SaveConfigurationsToFile(self, vi, channel_name, file_path): # noqa: N802
664691
with self._func_lock:
665692
if self.niRFSG_SaveConfigurationsToFile_cfunc is None:

generated/nirfsg/nirfsg/_library_interpreter.py

Lines changed: 60 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,22 @@ def disable_start_trigger(self): # noqa: N802
383383
errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False)
384384
return
385385

386+
def error_message(self, error_code, error_message): # noqa: N802
387+
vi_ctype = _visatype.ViSession(self._vi) # case S110
388+
error_code_ctype = _visatype.ViStatus(error_code) # case S150
389+
error_message_ctype = ctypes.create_string_buffer(error_message.encode(self._encoding)) # case C020
390+
error_code = self._library.niRFSG_ErrorMessage(vi_ctype, error_code_ctype, error_message_ctype)
391+
errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=True)
392+
return
393+
394+
def error_query(self): # noqa: N802
395+
vi_ctype = _visatype.ViSession(self._vi) # case S110
396+
error_code_ctype = _visatype.ViInt32() # case S220
397+
error_message_ctype = (_visatype.ViChar * 256)() # case C070
398+
error_code = self._library.niRFSG_ErrorQuery(vi_ctype, None if error_code_ctype is None else (ctypes.pointer(error_code_ctype)), error_message_ctype)
399+
errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False)
400+
return int(error_code_ctype.value), error_message_ctype.value.decode(self._encoding)
401+
386402
def export_signal(self, signal, signal_identifier, output_terminal): # noqa: N802
387403
vi_ctype = _visatype.ViSession(self._vi) # case S110
388404
signal_ctype = _visatype.ViInt32(signal.value) # case S130
@@ -515,32 +531,38 @@ def get_stream_endpoint_handle(self, stream_endpoint): # noqa: N802
515531
def get_waveform_burst_start_locations(self, channel_name, number_of_locations): # noqa: N802
516532
vi_ctype = _visatype.ViSession(self._vi) # case S110
517533
channel_name_ctype = ctypes.create_string_buffer(channel_name.encode(self._encoding)) # case C010
518-
number_of_locations_ctype = _visatype.ViInt32(number_of_locations) # case S150
519-
locations_ctype = _visatype.ViReal64() # case S220
534+
number_of_locations_ctype = _visatype.ViInt32(number_of_locations) # case S210
535+
locations_size = number_of_locations # case B600
536+
locations_array = array.array("d", [0]) * locations_size # case B600
537+
locations_ctype = _get_ctypes_pointer_for_buffer(value=locations_array, library_type=_visatype.ViReal64) # case B600
520538
required_size_ctype = _visatype.ViInt32() # case S220
521-
error_code = self._library.niRFSG_GetWaveformBurstStartLocations(vi_ctype, channel_name_ctype, number_of_locations_ctype, None if locations_ctype is None else (ctypes.pointer(locations_ctype)), None if required_size_ctype is None else (ctypes.pointer(required_size_ctype)))
539+
error_code = self._library.niRFSG_GetWaveformBurstStartLocations(vi_ctype, channel_name_ctype, number_of_locations_ctype, locations_ctype, None if required_size_ctype is None else (ctypes.pointer(required_size_ctype)))
522540
errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False)
523-
return float(locations_ctype.value), int(required_size_ctype.value)
541+
return locations_array, int(required_size_ctype.value)
524542

525543
def get_waveform_burst_stop_locations(self, channel_name, number_of_locations): # noqa: N802
526544
vi_ctype = _visatype.ViSession(self._vi) # case S110
527545
channel_name_ctype = ctypes.create_string_buffer(channel_name.encode(self._encoding)) # case C010
528-
number_of_locations_ctype = _visatype.ViInt32(number_of_locations) # case S150
529-
locations_ctype = _visatype.ViReal64() # case S220
546+
number_of_locations_ctype = _visatype.ViInt32(number_of_locations) # case S210
547+
locations_size = number_of_locations # case B600
548+
locations_array = array.array("d", [0]) * locations_size # case B600
549+
locations_ctype = _get_ctypes_pointer_for_buffer(value=locations_array, library_type=_visatype.ViReal64) # case B600
530550
required_size_ctype = _visatype.ViInt32() # case S220
531-
error_code = self._library.niRFSG_GetWaveformBurstStopLocations(vi_ctype, channel_name_ctype, number_of_locations_ctype, None if locations_ctype is None else (ctypes.pointer(locations_ctype)), None if required_size_ctype is None else (ctypes.pointer(required_size_ctype)))
551+
error_code = self._library.niRFSG_GetWaveformBurstStopLocations(vi_ctype, channel_name_ctype, number_of_locations_ctype, locations_ctype, None if required_size_ctype is None else (ctypes.pointer(required_size_ctype)))
532552
errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False)
533-
return float(locations_ctype.value), int(required_size_ctype.value)
553+
return locations_array, int(required_size_ctype.value)
534554

535555
def get_waveform_marker_event_locations(self, channel_name, number_of_locations): # noqa: N802
536556
vi_ctype = _visatype.ViSession(self._vi) # case S110
537557
channel_name_ctype = ctypes.create_string_buffer(channel_name.encode(self._encoding)) # case C010
538-
number_of_locations_ctype = _visatype.ViInt32(number_of_locations) # case S150
539-
locations_ctype = _visatype.ViReal64() # case S220
558+
number_of_locations_ctype = _visatype.ViInt32(number_of_locations) # case S210
559+
locations_size = number_of_locations # case B600
560+
locations_array = array.array("d", [0]) * locations_size # case B600
561+
locations_ctype = _get_ctypes_pointer_for_buffer(value=locations_array, library_type=_visatype.ViReal64) # case B600
540562
required_size_ctype = _visatype.ViInt32() # case S220
541-
error_code = self._library.niRFSG_GetWaveformMarkerEventLocations(vi_ctype, channel_name_ctype, number_of_locations_ctype, None if locations_ctype is None else (ctypes.pointer(locations_ctype)), None if required_size_ctype is None else (ctypes.pointer(required_size_ctype)))
563+
error_code = self._library.niRFSG_GetWaveformMarkerEventLocations(vi_ctype, channel_name_ctype, number_of_locations_ctype, locations_ctype, None if required_size_ctype is None else (ctypes.pointer(required_size_ctype)))
542564
errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False)
543-
return float(locations_ctype.value), int(required_size_ctype.value)
565+
return locations_array, int(required_size_ctype.value)
544566

545567
def init_with_options(self, resource_name, id_query, reset_device, option_string): # noqa: N802
546568
resource_name_ctype = ctypes.create_string_buffer(resource_name.encode(self._encoding)) # case C020
@@ -629,6 +651,14 @@ def reset_with_defaults(self): # noqa: N802
629651
errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False)
630652
return
631653

654+
def revision_query(self): # noqa: N802
655+
vi_ctype = _visatype.ViSession(self._vi) # case S110
656+
instrument_driver_revision_ctype = (_visatype.ViChar * 256)() # case C070
657+
firmware_revision_ctype = (_visatype.ViChar * 256)() # case C070
658+
error_code = self._library.niRFSG_RevisionQuery(vi_ctype, instrument_driver_revision_ctype, firmware_revision_ctype)
659+
errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False)
660+
return instrument_driver_revision_ctype.value.decode(self._encoding), firmware_revision_ctype.value.decode(self._encoding)
661+
632662
def save_configurations_to_file(self, channel_name, file_path): # noqa: N802
633663
vi_ctype = _visatype.ViSession(self._vi) # case S110
634664
channel_name_ctype = ctypes.create_string_buffer(channel_name.encode(self._encoding)) # case C010
@@ -740,32 +770,35 @@ def set_attribute_vi_string(self, channel_name, attribute, value): # noqa: N802
740770
errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False)
741771
return
742772

743-
def set_waveform_burst_start_locations(self, channel_name, number_of_locations): # noqa: N802
773+
def set_waveform_burst_start_locations(self, channel_name, number_of_locations, locations): # noqa: N802
744774
vi_ctype = _visatype.ViSession(self._vi) # case S110
745775
channel_name_ctype = ctypes.create_string_buffer(channel_name.encode(self._encoding)) # case C010
746-
number_of_locations_ctype = _visatype.ViInt32(number_of_locations) # case S150
747-
locations_ctype = _visatype.ViReal64() # case S220
748-
error_code = self._library.niRFSG_SetWaveformBurstStartLocations(vi_ctype, channel_name_ctype, number_of_locations_ctype, None if locations_ctype is None else (ctypes.pointer(locations_ctype)))
776+
number_of_locations_ctype = _visatype.ViInt32(0 if locations is None else len(locations)) # case S160
777+
locations_array = _convert_to_array(value=locations, array_type="d") # case B550
778+
locations_ctype = _get_ctypes_pointer_for_buffer(value=locations_array, library_type=_visatype.ViReal64) # case B550
779+
error_code = self._library.niRFSG_SetWaveformBurstStartLocations(vi_ctype, channel_name_ctype, number_of_locations_ctype, locations_ctype)
749780
errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False)
750-
return float(locations_ctype.value)
781+
return
751782

752-
def set_waveform_burst_stop_locations(self, channel_name, number_of_locations): # noqa: N802
783+
def set_waveform_burst_stop_locations(self, channel_name, number_of_locations, locations): # noqa: N802
753784
vi_ctype = _visatype.ViSession(self._vi) # case S110
754785
channel_name_ctype = ctypes.create_string_buffer(channel_name.encode(self._encoding)) # case C010
755-
number_of_locations_ctype = _visatype.ViInt32(number_of_locations) # case S150
756-
locations_ctype = _visatype.ViReal64() # case S220
757-
error_code = self._library.niRFSG_SetWaveformBurstStopLocations(vi_ctype, channel_name_ctype, number_of_locations_ctype, None if locations_ctype is None else (ctypes.pointer(locations_ctype)))
786+
number_of_locations_ctype = _visatype.ViInt32(0 if locations is None else len(locations)) # case S160
787+
locations_array = _convert_to_array(value=locations, array_type="d") # case B550
788+
locations_ctype = _get_ctypes_pointer_for_buffer(value=locations_array, library_type=_visatype.ViReal64) # case B550
789+
error_code = self._library.niRFSG_SetWaveformBurstStopLocations(vi_ctype, channel_name_ctype, number_of_locations_ctype, locations_ctype)
758790
errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False)
759-
return float(locations_ctype.value)
791+
return
760792

761-
def set_waveform_marker_event_locations(self, channel_name, number_of_locations): # noqa: N802
793+
def set_waveform_marker_event_locations(self, channel_name, number_of_locations, locations): # noqa: N802
762794
vi_ctype = _visatype.ViSession(self._vi) # case S110
763795
channel_name_ctype = ctypes.create_string_buffer(channel_name.encode(self._encoding)) # case C010
764-
number_of_locations_ctype = _visatype.ViInt32(number_of_locations) # case S150
765-
locations_ctype = _visatype.ViReal64() # case S220
766-
error_code = self._library.niRFSG_SetWaveformMarkerEventLocations(vi_ctype, channel_name_ctype, number_of_locations_ctype, None if locations_ctype is None else (ctypes.pointer(locations_ctype)))
796+
number_of_locations_ctype = _visatype.ViInt32(0 if locations is None else len(locations)) # case S160
797+
locations_array = _convert_to_array(value=locations, array_type="d") # case B550
798+
locations_ctype = _get_ctypes_pointer_for_buffer(value=locations_array, library_type=_visatype.ViReal64) # case B550
799+
error_code = self._library.niRFSG_SetWaveformMarkerEventLocations(vi_ctype, channel_name_ctype, number_of_locations_ctype, locations_ctype)
767800
errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False)
768-
return float(locations_ctype.value)
801+
return
769802

770803
def unlock(self): # noqa: N802
771804
vi_ctype = _visatype.ViSession(self._vi) # case S110

0 commit comments

Comments
 (0)