2022-10-05 17:23:00 +00:00
|
|
|
/* #define DEBUGTRACE_ENABLED */
|
2022-10-05 09:27:46 +00:00
|
|
|
#include "debugtrace.hpp"
|
|
|
|
#include "lasp_config.h"
|
2022-07-20 12:58:48 +00:00
|
|
|
#if LASP_HAS_ULDAQ == 1
|
2022-05-23 15:26:29 +00:00
|
|
|
#include <uldaq.h>
|
2023-01-04 13:21:39 +00:00
|
|
|
#include "lasp_uldaq.h"
|
|
|
|
#include "lasp_uldaq_impl.h"
|
2022-05-23 15:26:29 +00:00
|
|
|
|
|
|
|
|
2023-01-04 13:21:39 +00:00
|
|
|
void fillUlDaqDeviceInfo(std::vector<DeviceInfo> &devinfolist,void* vDescriptors) {
|
2022-05-23 15:26:29 +00:00
|
|
|
|
|
|
|
DEBUGTRACE_ENTER;
|
|
|
|
|
2023-01-04 13:21:39 +00:00
|
|
|
DaqDeviceDescriptor* descriptors_copy = static_cast<DaqDeviceDescriptor*>(vDescriptors);
|
2022-05-23 15:26:29 +00:00
|
|
|
|
2022-06-13 17:35:41 +00:00
|
|
|
UlError err;
|
2023-01-04 13:21:39 +00:00
|
|
|
unsigned int numdevs = MAX_ULDAQ_DEV_COUNT_PER_API;
|
2022-05-23 15:26:29 +00:00
|
|
|
|
2023-01-04 13:21:39 +00:00
|
|
|
DaqDeviceDescriptor devdescriptors[MAX_ULDAQ_DEV_COUNT_PER_API];
|
2022-05-23 15:26:29 +00:00
|
|
|
DaqDeviceDescriptor descriptor;
|
|
|
|
DaqDeviceInterface interfaceType = ANY_IFC;
|
|
|
|
|
|
|
|
err = ulGetDaqDeviceInventory(interfaceType, devdescriptors,
|
2022-06-13 17:35:41 +00:00
|
|
|
static_cast<unsigned *>(&numdevs));
|
2022-05-23 15:26:29 +00:00
|
|
|
|
|
|
|
if (err != ERR_NO_ERROR) {
|
2022-10-05 09:27:46 +00:00
|
|
|
throw rte("UlDaq device inventarization failed");
|
2022-05-23 15:26:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
for (unsigned i = 0; i < numdevs; i++) {
|
|
|
|
|
|
|
|
descriptor = devdescriptors[i];
|
|
|
|
|
2023-01-04 13:21:39 +00:00
|
|
|
// Copy structure over, if given as not nullptr
|
|
|
|
if(descriptors_copy) {
|
|
|
|
descriptors_copy[i] = descriptor;
|
|
|
|
}
|
|
|
|
|
2022-05-23 15:26:29 +00:00
|
|
|
DeviceInfo devinfo;
|
|
|
|
devinfo.api = uldaqapi;
|
|
|
|
string name, interface;
|
|
|
|
if (string(descriptor.productName) != "DT9837A") {
|
2022-10-05 09:27:46 +00:00
|
|
|
throw rte("Unknown UlDAQ type");
|
2022-05-23 15:26:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
switch (descriptor.devInterface) {
|
2022-06-13 17:35:41 +00:00
|
|
|
case USB_IFC:
|
|
|
|
name = "USB - ";
|
|
|
|
break;
|
|
|
|
case BLUETOOTH_IFC:
|
|
|
|
/* devinfo. */
|
|
|
|
name = "Bluetooth - ";
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ETHERNET_IFC:
|
|
|
|
/* devinfo. */
|
|
|
|
name = "Ethernet - ";
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
name = "Uknown interface = ";
|
2022-05-23 15:26:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
name += string(descriptor.productName) + " " + string(descriptor.uniqueId);
|
|
|
|
devinfo.device_name = std::move(name);
|
|
|
|
|
2022-10-21 20:30:06 +00:00
|
|
|
devinfo.physicalOutputQty = DaqChannel::Qty::Voltage;
|
|
|
|
|
2022-05-23 15:26:29 +00:00
|
|
|
devinfo.api_specific_devindex = i;
|
|
|
|
devinfo.availableDataTypes.push_back(
|
|
|
|
DataTypeDescriptor::DataType::dtype_fl64);
|
|
|
|
devinfo.prefDataTypeIndex = 0;
|
|
|
|
|
|
|
|
devinfo.availableSampleRates = {8000, 10000, 11025, 16000, 20000,
|
2022-06-13 17:35:41 +00:00
|
|
|
22050, 24000, 32000, 44056, 44100,
|
|
|
|
47250, 48000, 50000, 50400, 51000};
|
2022-05-23 15:26:29 +00:00
|
|
|
|
|
|
|
devinfo.prefSampleRateIndex = 11;
|
|
|
|
|
|
|
|
devinfo.availableFramesPerBlock = {512, 1024, 2048, 4096, 8192};
|
|
|
|
|
|
|
|
devinfo.availableInputRanges = {1.0, 10.0};
|
|
|
|
devinfo.prefInputRangeIndex = 0;
|
|
|
|
|
|
|
|
devinfo.ninchannels = 4;
|
|
|
|
devinfo.noutchannels = 1;
|
|
|
|
|
|
|
|
devinfo.hasInputIEPE = true;
|
|
|
|
devinfo.hasInputACCouplingSwitch = true;
|
|
|
|
devinfo.hasInputTrigger = true;
|
|
|
|
|
2022-10-05 09:27:46 +00:00
|
|
|
devinfo.hasInternalOutputMonitor = true;
|
|
|
|
|
2022-05-23 15:26:29 +00:00
|
|
|
// Finally, this devinfo is pushed back in list
|
|
|
|
devinfolist.push_back(devinfo);
|
|
|
|
}
|
|
|
|
}
|
2023-01-04 13:21:39 +00:00
|
|
|
|
|
|
|
std::unique_ptr<Daq> createUlDaqDevice(const DeviceInfo &devinfo,
|
|
|
|
const DaqConfiguration &config) {
|
|
|
|
return std::make_unique<DT9837A>(devinfo, config);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-10-05 09:27:46 +00:00
|
|
|
#endif // LASP_HAS_ULDAQ
|