Skip to content

Commit

Permalink
enabled support for DAQmxSelfCal
Browse files Browse the repository at this point in the history
  • Loading branch information
Arsh Sharma committed Dec 11, 2023
1 parent 7f2849a commit c216e1c
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 3 deletions.
4 changes: 4 additions & 0 deletions generated/nidaqmx/_base_interpreter.py
Original file line number Diff line number Diff line change
Expand Up @@ -1345,6 +1345,10 @@ def save_scale(self, scale_name, save_as, author, options):
def save_task(self, task, save_as, author, options):
raise NotImplementedError

@abc.abstractmethod
def self_cal(self, device_name):
raise NotImplementedError

@abc.abstractmethod
def self_test_device(self, device_name):
raise NotImplementedError
Expand Down
5 changes: 5 additions & 0 deletions generated/nidaqmx/_grpc_interpreter.py
Original file line number Diff line number Diff line change
Expand Up @@ -2758,6 +2758,11 @@ def save_task(self, task, save_as, author, options):
task=task, save_as=save_as, author=author,
options_raw=options))

def self_cal(self, device_name):
response = self._invoke(
self._client.SelfCal,
grpc_types.SelfCalRequest(device_name=device_name))

def self_test_device(self, device_name):
response = self._invoke(
self._client.SelfTestDevice,
Expand Down
12 changes: 12 additions & 0 deletions generated/nidaqmx/_library_interpreter.py
Original file line number Diff line number Diff line change
Expand Up @@ -4632,6 +4632,18 @@ def save_task(self, task, save_as, author, options):
task, save_as, author, options)
self.check_for_error(error_code)

def self_cal(self, device_name):
cfunc = lib_importer.windll.DAQmxSelfCal
if cfunc.argtypes is None:
with cfunc.arglock:
if cfunc.argtypes is None:
cfunc.argtypes = [
ctypes_byte_str]

error_code = cfunc(
device_name)
self.check_for_error(error_code)

def self_test_device(self, device_name):
cfunc = lib_importer.windll.DAQmxSelfTestDevice
if cfunc.argtypes is None:
Expand Down
12 changes: 12 additions & 0 deletions generated/nidaqmx/system/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -1069,6 +1069,18 @@ def reset_device(self):
self._interpreter.reset_device(
self._name)

def self_cal(self):
"""
Measures the onboard reference voltage of the device and adjusts
the self-calibration constants to account for any errors caused
by short-term fluctuations in the operating environment. When
you self-calibrate a device, no external signal connections are
necessary.
"""

self._interpreter.self_cal(
self._name)

def self_test_device(self):
"""
Performs a brief test of device resources. If a failure occurs,
Expand Down
16 changes: 14 additions & 2 deletions src/codegen/metadata/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -20069,14 +20069,26 @@
},
'SelfCal': {
'calling_convention': 'StdCall',
'handle_parameter': {
'ctypes_data_type': 'ctypes.c_char_p',
'cvi_name': 'deviceName',
'python_accessor': 'self._name'
},
'parameters': [
{
'ctypes_data_type': 'ctypes.c_char_p',
'direction': 'in',
'is_optional_in_python': False,
'name': 'deviceName',
'type': 'const char[]'
'python_data_type': 'str',
'python_description': '',
'python_type_annotation': 'str',
'type': 'const char[]',
'use_in_python_api': False
}
],
'python_codegen_method': 'no',
'python_class_name': 'Device',
'python_description': 'Measures the onboard reference voltage of the device and adjusts the self-calibration constants to account for any errors caused by short-term fluctuations in the operating environment. When you self-calibrate a device, no external signal connections are necessary.',
'returns': 'int32'
},
'SelfTestDevice': {
Expand Down
1 change: 0 additions & 1 deletion src/codegen/utilities/interpreter_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
"GetCalInfoAttributeString",
"GetCalInfoAttributeUInt32",
"GetSelfCalLastDateAndTime",
"SelfCal",
"SetCalInfoAttributeBool",
"SetCalInfoAttributeDouble",
"SetCalInfoAttributeString",
Expand Down

0 comments on commit c216e1c

Please sign in to comment.