How to use the nidmm.errors._handleError function in nidmm

To help you get started, we’ve selected a few nidmm examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ni / nimi-python / src / NI-DMM / nidmm / session.py View on Github external
def __init__(self, resourceName, idQuery = 0, reset = False):
        #print("__init__ entered")
        self.sessionHandle = ctypes.c_ulong(0)
        self.library = library.getLibrary()
        errorCode = self.library.niDMM_init(resourceName.encode('ascii'), idQuery, reset, ctypes.byref(self.sessionHandle))
        errors._handleError(self.library, self.sessionHandle, errorCode)
github ni / nimi-python / src / NI-DMM / nidmm / session.py View on Github external
def setAttributeViReal64(self, attributeId, value):
        errorCode = self.library.niDMM_SetAttributeViReal64(self.sessionHandle, b'', attributeId, value)
        errors._handleError(self.library, self.sessionHandle, errorCode)
github ni / nimi-python / src / NI-DMM / nidmm / session.py View on Github external
def getAttributeViReal64(self, attributeId):
        value = ctypes.c_double(0)
        errorCode = self.library.niDMM_GetAttributeViReal64(self.sessionHandle, None, attributeId, ctypes.byref(value))
        errors._handleError(self.library, self.sessionHandle, errorCode)
        return value.value
github ni / nimi-python / src / NI-DMM / nidmm / session.py View on Github external
def getAttributeViString(self, attributeId):
        errorCode = self.library.niDMM_GetAttributeViString(self.sessionHandle, None, attributeId, 0, None)
        # Do the IVI dance
        # Don't use _handleError, because positive value in errorCode means size, not warning.
        if(errors._isError(errorCode)): raise errors.Error(self.library, self.sessionHandle, errorCode)
        bufferSize = errorCode
        value = ctypes.create_string_buffer(bufferSize)
        errorCode = self.library.niDMM_GetAttributeViString(self.sessionHandle, None, attributeId, bufferSize, value)
        errors._handleError(self.library, self.sessionHandle, errorCode)
        return value.value.decode("ascii")
github ni / nimi-python / src / NI-DMM / nidmm / session.py View on Github external
def setAttributeViString(self, attributeId, value):
        errorCode = self.library.niDMM_SetAttributeViString(self.sessionHandle, b'', attributeId, value.encode('ascii'))
        errors._handleError(self.library, self.sessionHandle, errorCode)
github ni / nimi-python / src / NI-DMM / nidmm / session.py View on Github external
def getAttributeViBoolean(self, attributeId):
        value = ctypes.c_ushort(0)
        errorCode = self.library.niDMM_GetAttributeViBoolean(self.sessionHandle, None, attributeId, ctypes.byref(value))
        errors._handleError(self.library, self.sessionHandle, errorCode)
        return value.value
github ni / nimi-python / src / NI-DMM / nidmm / session.py View on Github external
def read(self, timeoutInMilliseconds = 10000):
        measurement = ctypes.c_double(0)
        errorCode = self.library.niDMM_Read(self.sessionHandle, timeoutInMilliseconds, ctypes.byref(measurement))
        errors._handleError(self.library, self.sessionHandle, errorCode)
        return measurement.value
github ni / nimi-python / src / NI-DMM / nidmm / session.py View on Github external
def configureMeasurementDigits(self, mode, range, digitsOfResolution):
        if type(mode) is not enums.Function: raise TypeError('Parameter mode must be of type ' + str(enums.Function))
        errorCode = self.library.niDMM_ConfigureMeasurementDigits(self.sessionHandle, mode.value, range, digitsOfResolution)
        errors._handleError(self.library, self.sessionHandle, errorCode)
github ni / nimi-python / src / NI-DMM / nidmm / session.py View on Github external
def setAttributeViBoolean(self, attributeId, value):
        errorCode = self.library.niDMM_SetAttributeViBoolean(self.sessionHandle, b'', attributeId, value)
        errors._handleError(self.library, self.sessionHandle, errorCode)