Further Adventures in Hardware Detection
Currently when using Typica with devices supported by NI DAQmxBase, the program configuration must be written with a device identifier such as "Dev1". Ordinarily this isn't a problem as there's usually only one device connected and whichever device is connected is always "Dev1". With some of the new features in the branch that's going to be Typica 2.0, device configuration is being moved into the program properly and it's not necessarily the case that only one device is connected. As such, I needed a way to find out how many devices were connected that are accessible through this library and what devices these are. Unfortunately, DAQmxBase doesn't have that functionality built into it.
A little searching turns up the possibility of using another library that comes with that, NI VISA, and that it comes with a bit of example code that almost does what's needed. It was just missing a call to viGetAttribute() (three arguments, the first is an instrument obtained from viOpen() called with an identifier from viFindRsrc() [the example code here needs to be changed so this searches for ?* {all devices}] or viFindNext(), the second is an unsigned long constant representing the attribute we want [VI_ATTR_MODEL_NAME], and the third is where the model name is written). While that doesn't get the device identifiers that DAQmxBase needs, the device list comes in the right order that these are easy to generate.










