Trying to get Physical Channel names from my connected DAQs using the ctypes package from Python. So far I can get the System Device names by:
nidaq = ctypes.windll.nicaiu
buf_size = 100
buf = ctypes.create_string_buffer('\000'*buf_size)
detected_devices = (buf.raw).split(", ")
Which returns a list of the System Devices: [Dev1, Dev3]
One step further I am trying to use DaqmxGetPhysicalChanName in a similar fashion by looking through the devices so that I can end up with something like:
nidaq.DaqmxGetPhysicalChanName(TaskHandle(0), const char channel , buf, buf_size)
What am I supposed to be passing for const char channel ? Obviously a const char, but what would an example of that be?
Things I have tried:
nidaq.DaqmxGetPhysicalChanName(TaskHandle(0), 'Dev1' , buf, buf_size) a python string
Returns : -200088
nidaq.DaqmxGetPhysicalChanName(TaskHandle(0), ctypes.c_char_p("Dev1") , buf, buf_size) equivalent to char*
Returns : -200088
If I call this twice in a loop, the function also returns 00088.
Any help would be great. Keep in mind the end-goal is to be able to find each device, along with all of it's analog output channels names.
So I have at least gotten as far as figuring out that these returns codes mean something. Any documentation out there?
I do not know if you have seen these links before, but I think they could be useful, so just to be sure I am sharing them with you:
I hope they give you more tools to work with.
Regarding the error codes you are getting, this is what I found:
error code -200088
Task specified is invalid or does not exist.
error code 00088
LabVIEW: Run-time menu error.
Hey thanks for the links!
I figured it out, and most of my problems come from my lack of C knowledge. Good reads though if anybody else stumbles into this.