Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __init__(self, expected_size_or_value):
_BufferMatcher.__init__(self, _visatype.ViInt32, expected_size_or_value)
def __init__(self, expected_value):
_ScalarMatcher.__init__(self, _visatype.ViInt32, expected_value)
def __init__(self):
_PointerMatcher.__init__(self, _visatype.ViInt32)
def _get_error_description(self, error_code):
'''_get_error_description
Returns the error description.
'''
# We hand-maintain the code that calls into self._library rather than leverage code-generation
# because niModInst_GetExtendedErrorInfo() does not properly do the IVI-dance.
# See https://github.com/ni/nimi-python/issues/166
error_info_buffer_size_ctype = _visatype.ViInt32() # case S170
error_info_ctype = None # case C050
error_code = self._library.niModInst_GetExtendedErrorInfo(error_info_buffer_size_ctype, error_info_ctype)
if error_code <= 0:
return "Failed to retrieve error description."
error_info_buffer_size_ctype = _visatype.ViInt32(error_code) # case S180
error_info_ctype = (_visatype.ViChar * error_info_buffer_size_ctype.value)() # case C060
# Note we don't look at the return value. This is intentional as niModInst returns the
# original error code rather than 0 (VI_SUCCESS).
self._library.niModInst_GetExtendedErrorInfo(error_info_buffer_size_ctype, error_info_ctype)
return error_info_ctype.value.decode("ascii")
attribute_id (int): The ID of the string property you want to query. Valid Values
device_name--the name of the device, which can be used
to open an instrument driver session for that device
device_model--the model of the device (for example, NI
PXI-5122) serial_number--the serial number of the
device
Returns:
attribute_value (str): The character buffer into which the property value string is copied.
'''
handle_ctype = _visatype.ViSession(self._handle) # case S110
index_ctype = _visatype.ViInt32(index) # case S150
attribute_id_ctype = _visatype.ViInt32(attribute_id) # case S150
attribute_value_buffer_size_ctype = _visatype.ViInt32() # case S170
attribute_value_ctype = None # case C050
error_code = self._library.niModInst_GetInstalledDeviceAttributeViString(handle_ctype, index_ctype, attribute_id_ctype, attribute_value_buffer_size_ctype, attribute_value_ctype)
errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False)
attribute_value_buffer_size_ctype = _visatype.ViInt32(error_code) # case S180
attribute_value_ctype = (_visatype.ViChar * attribute_value_buffer_size_ctype.value)() # case C060
error_code = self._library.niModInst_GetInstalledDeviceAttributeViString(handle_ctype, index_ctype, attribute_id_ctype, attribute_value_buffer_size_ctype, attribute_value_ctype)
errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False)
return attribute_value_ctype.value.decode(self._encoding)
that has been properly identified in MAX. Bus Number--the bus on which
the device has been enumerated. Socket Number--the socket number on
which the device has been enumerated. Notes The bus number and socket
number can be used to form a VISA resource string for this device, of
the form "PXI::::INSTR". Traditional NI-DAQ devices do not support the
chassis number, bus number, and socket number properties.
Returns:
attribute_value (int): A pointer to a signed 32-bit integer variable that receives the value of
the requested property.
'''
handle_ctype = _visatype.ViSession(self._handle) # case S110
index_ctype = _visatype.ViInt32(index) # case S150
attribute_id_ctype = _visatype.ViInt32(attribute_id) # case S150
attribute_value_ctype = _visatype.ViInt32() # case S220
error_code = self._library.niModInst_GetInstalledDeviceAttributeViInt32(handle_ctype, index_ctype, attribute_id_ctype, None if attribute_value_ctype is None else (ctypes.pointer(attribute_value_ctype)))
errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False)
return int(attribute_value_ctype.value)
the device has been enumerated. Socket Number--the socket number on
which the device has been enumerated. Notes The bus number and socket
number can be used to form a VISA resource string for this device, of
the form "PXI::::INSTR". Traditional NI-DAQ devices do not support the
chassis number, bus number, and socket number properties.
Returns:
attribute_value (int): A pointer to a signed 32-bit integer variable that receives the value of
the requested property.
'''
handle_ctype = _visatype.ViSession(self._handle) # case S110
index_ctype = _visatype.ViInt32(index) # case S150
attribute_id_ctype = _visatype.ViInt32(attribute_id) # case S150
attribute_value_ctype = _visatype.ViInt32() # case S220
error_code = self._library.niModInst_GetInstalledDeviceAttributeViInt32(handle_ctype, index_ctype, attribute_id_ctype, None if attribute_value_ctype is None else (ctypes.pointer(attribute_value_ctype)))
errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False)
return int(attribute_value_ctype.value)
property can only be queried for PXI devices installed in a chassis
that has been properly identified in MAX. Bus Number--the bus on which
the device has been enumerated. Socket Number--the socket number on
which the device has been enumerated. Notes The bus number and socket
number can be used to form a VISA resource string for this device, of
the form "PXI::::INSTR". Traditional NI-DAQ devices do not support the
chassis number, bus number, and socket number properties.
Returns:
attribute_value (int): A pointer to a signed 32-bit integer variable that receives the value of
the requested property.
'''
handle_ctype = _visatype.ViSession(self._handle) # case S110
index_ctype = _visatype.ViInt32(index) # case S150
attribute_id_ctype = _visatype.ViInt32(attribute_id) # case S150
attribute_value_ctype = _visatype.ViInt32() # case S220
error_code = self._library.niModInst_GetInstalledDeviceAttributeViInt32(handle_ctype, index_ctype, attribute_id_ctype, None if attribute_value_ctype is None else (ctypes.pointer(attribute_value_ctype)))
errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False)
return int(attribute_value_ctype.value)
attribute_id (int): The ID of the string property you want to query. Valid Values
device_name--the name of the device, which can be used
to open an instrument driver session for that device
device_model--the model of the device (for example, NI
PXI-5122) serial_number--the serial number of the
device
Returns:
attribute_value (str): The character buffer into which the property value string is copied.
'''
handle_ctype = _visatype.ViSession(self._handle) # case S110
index_ctype = _visatype.ViInt32(index) # case S150
attribute_id_ctype = _visatype.ViInt32(attribute_id) # case S150
attribute_value_buffer_size_ctype = _visatype.ViInt32() # case S170
attribute_value_ctype = None # case C050
error_code = self._library.niModInst_GetInstalledDeviceAttributeViString(handle_ctype, index_ctype, attribute_id_ctype, attribute_value_buffer_size_ctype, attribute_value_ctype)
errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False)
attribute_value_buffer_size_ctype = _visatype.ViInt32(error_code) # case S180
attribute_value_ctype = (_visatype.ViChar * attribute_value_buffer_size_ctype.value)() # case C060
error_code = self._library.niModInst_GetInstalledDeviceAttributeViString(handle_ctype, index_ctype, attribute_id_ctype, attribute_value_buffer_size_ctype, attribute_value_ctype)
errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False)
return attribute_value_ctype.value.decode(self._encoding)