pxi6733: add ping method to the driver

This commit is contained in:
Yann Sionneau 2015-05-25 21:36:14 +02:00
parent f30d671359
commit 36cda96df0
1 changed files with 12 additions and 1 deletions

View File

@ -1,6 +1,6 @@
# Yann Sionneau <ys@m-labs.hk>, 2015 # Yann Sionneau <ys@m-labs.hk>, 2015
from ctypes import byref from ctypes import byref, c_ulong
import numpy as np import numpy as np
@ -11,6 +11,9 @@ class DAQmxSim:
def close(self): def close(self):
pass pass
def ping(self):
return True
class DAQmx: class DAQmx:
"""NI PXI6733 DAQ interface.""" """NI PXI6733 DAQ interface."""
@ -28,6 +31,14 @@ class DAQmx:
self.daq.DAQmxClearTask(taskhandle) self.daq.DAQmxClearTask(taskhandle)
self.tasks.remove(taskhandle) self.tasks.remove(taskhandle)
def ping(self):
try:
data = (c_ulong*1)()
self.daq.DAQmxGetDevSerialNum(self.device, data)
except:
return False
return True
def load_sample_values(self, values): def load_sample_values(self, values):
"""Load sample values into PXI 6733 device. """Load sample values into PXI 6733 device.