2022-05-23 15:26:29 +00:00
|
|
|
#pragma once
|
|
|
|
#include "lasp_config.h"
|
|
|
|
#include "lasp_daqconfig.h"
|
2023-01-20 14:50:51 +00:00
|
|
|
#include "lasp_types.h"
|
|
|
|
#include <memory>
|
2022-05-23 15:26:29 +00:00
|
|
|
|
2022-09-03 18:59:14 +00:00
|
|
|
/** \addtogroup device
|
|
|
|
* @{
|
|
|
|
*/
|
2022-05-23 15:26:29 +00:00
|
|
|
|
2023-01-20 14:50:51 +00:00
|
|
|
using DeviceInfoList = std::vector<std::unique_ptr<DeviceInfo>>;
|
|
|
|
|
2022-05-23 15:26:29 +00:00
|
|
|
/**
|
|
|
|
* @brief Structure containing device info parameters
|
|
|
|
*/
|
|
|
|
class DeviceInfo {
|
|
|
|
public:
|
2023-01-20 14:50:51 +00:00
|
|
|
/**
|
|
|
|
* @brief Virtual desctructor. Can be derived class.
|
|
|
|
*/
|
|
|
|
virtual ~DeviceInfo() {}
|
2023-06-06 14:05:24 +00:00
|
|
|
DeviceInfo& operator=(const DeviceInfo&) = delete;
|
2023-01-20 14:50:51 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Clone a device info.
|
|
|
|
*
|
|
|
|
* @return Cloned device info
|
|
|
|
*/
|
|
|
|
virtual std::unique_ptr<DeviceInfo> clone() const {
|
|
|
|
return std::make_unique<DeviceInfo>(*this);
|
|
|
|
}
|
|
|
|
|
2022-05-23 15:26:29 +00:00
|
|
|
/**
|
|
|
|
* @brief Backend API corresponding to device
|
|
|
|
*/
|
|
|
|
DaqApi api;
|
|
|
|
/**
|
|
|
|
* @brief The name of the device
|
|
|
|
*/
|
|
|
|
string device_name = "";
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief The available data types the device can output
|
|
|
|
*/
|
|
|
|
std::vector<DataTypeDescriptor::DataType> availableDataTypes;
|
|
|
|
/**
|
|
|
|
* @brief The device's prefferd data type.
|
|
|
|
*/
|
|
|
|
int prefDataTypeIndex = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Available sample rates the device can run on
|
|
|
|
*/
|
|
|
|
dvec availableSampleRates;
|
|
|
|
/**
|
|
|
|
* @brief Preferred setting for the sample rate.
|
|
|
|
*/
|
|
|
|
int prefSampleRateIndex = -1;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Available latency-setting (number of frames passed in each
|
|
|
|
* callback).
|
|
|
|
*/
|
|
|
|
usvec availableFramesPerBlock;
|
|
|
|
/**
|
|
|
|
* @brief Preffered number of frames per callback.
|
|
|
|
*/
|
|
|
|
us prefFramesPerBlockIndex = 0;
|
|
|
|
|
|
|
|
/**
|
2024-01-10 11:26:38 +00:00
|
|
|
* @brief Available ranges for the input, i.e. +/- 1V and/or +/- 10 V etc.
|
2022-05-23 15:26:29 +00:00
|
|
|
*/
|
|
|
|
dvec availableInputRanges;
|
2024-01-10 11:26:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Available ranges for the output, i.e. +/- 1V and/or +/- 10 V etc.
|
|
|
|
*/
|
|
|
|
dvec availableOutputRanges;
|
|
|
|
|
2022-05-23 15:26:29 +00:00
|
|
|
/**
|
2024-01-10 11:26:38 +00:00
|
|
|
* @brief Its preffered input range
|
2022-05-23 15:26:29 +00:00
|
|
|
*/
|
|
|
|
int prefInputRangeIndex = 0;
|
|
|
|
|
2024-01-10 11:26:38 +00:00
|
|
|
/**
|
|
|
|
* @brief Its preffered output range
|
|
|
|
*/
|
|
|
|
int prefOutputRangeIndex = 0;
|
|
|
|
|
|
|
|
|
2022-05-23 15:26:29 +00:00
|
|
|
/**
|
|
|
|
* @brief The number of input channels available for the device
|
|
|
|
*/
|
|
|
|
unsigned ninchannels = 0;
|
|
|
|
/**
|
|
|
|
* @brief The number of output channels available for the device
|
|
|
|
*/
|
|
|
|
unsigned noutchannels = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Whether the device is capable to provide IEPE constant current
|
|
|
|
* power supply.
|
|
|
|
*/
|
|
|
|
bool hasInputIEPE = false;
|
|
|
|
/**
|
|
|
|
* @brief Whether the device is capable of enabling a hardware AC-coupling
|
|
|
|
*/
|
|
|
|
bool hasInputACCouplingSwitch = false;
|
|
|
|
/**
|
|
|
|
* @brief Whether the device is able to trigger on input
|
|
|
|
*/
|
|
|
|
bool hasInputTrigger = false;
|
|
|
|
|
|
|
|
double prefSampleRate() const {
|
|
|
|
if (((us)prefSampleRateIndex < availableSampleRates.size()) &&
|
|
|
|
(prefSampleRateIndex >= 0)) {
|
|
|
|
return availableSampleRates.at(prefSampleRateIndex);
|
|
|
|
} else {
|
|
|
|
throw std::runtime_error("No prefered sample rate available");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-07-20 12:58:48 +00:00
|
|
|
/**
|
2022-10-21 20:30:06 +00:00
|
|
|
* @brief Whether the device has an internal monitor of the output signal. If
|
|
|
|
* true, the device is able to monitor output signals internally and able to
|
|
|
|
* present output signals as virtual input signals. This only works together
|
|
|
|
* Daq's that are able to run in full duplex mode.
|
2022-07-20 12:58:48 +00:00
|
|
|
*/
|
|
|
|
bool hasInternalOutputMonitor = false;
|
|
|
|
|
2023-01-20 14:50:51 +00:00
|
|
|
/**
|
|
|
|
* @brief This flag is used to be able to indicate that the device cannot run
|
|
|
|
* input and output streams independently, without opening the device in
|
|
|
|
* duplex mode. This is for example true for the UlDaq: only one handle to
|
|
|
|
* the device can be given at the same time.
|
|
|
|
*/
|
|
|
|
bool duplexModeForced = false;
|
|
|
|
|
2022-10-21 20:30:06 +00:00
|
|
|
/**
|
2024-01-10 11:26:38 +00:00
|
|
|
* @brief Indicates whether the device is able to run in duplex mode. If false,
|
|
|
|
* devices cannot run in duplex mode, and the `duplexModeForced` flag is meaningless.
|
|
|
|
*/
|
|
|
|
bool hasDuplexMode = false;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief The physical quantity of the input signal from DAQ. For 'normal' audio
|
|
|
|
* interfaces, this is typically a 'number' between +/- full scale. For some
|
|
|
|
* real DAQ devices however, the input quantity corresponds to a physical signal,
|
|
|
|
* such a Volts.
|
|
|
|
*/
|
|
|
|
|
|
|
|
DaqChannel::Qty physicalInputQty = DaqChannel::Qty::Number;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief The physical quantity of the output signal from DAQ. For 'normal' audio
|
2022-10-21 20:30:06 +00:00
|
|
|
* devices, this is typically a 'number' between +/- full scale. For some
|
2024-01-10 11:26:38 +00:00
|
|
|
* real DAQ devices however, the input quantity corresponds to a physical signal,
|
2022-10-21 20:30:06 +00:00
|
|
|
* such a Volts.
|
|
|
|
*/
|
|
|
|
DaqChannel::Qty physicalOutputQty = DaqChannel::Qty::Number;
|
|
|
|
|
2024-01-10 11:26:38 +00:00
|
|
|
|
2022-05-23 15:26:29 +00:00
|
|
|
/**
|
|
|
|
* @brief String representation of DeviceInfo
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
operator string() const {
|
|
|
|
using std::endl;
|
|
|
|
std::stringstream str;
|
2023-01-20 14:50:51 +00:00
|
|
|
str << api.apiname + " " << endl
|
|
|
|
<< " number of input channels: " << ninchannels
|
|
|
|
<< endl
|
2022-05-23 15:26:29 +00:00
|
|
|
<< " number of output channels: " << noutchannels << endl;
|
|
|
|
return str.str();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Create a list of DeviceInfo's that are at call time avalable
|
|
|
|
*
|
|
|
|
* @return The device info's for each found device.
|
|
|
|
*/
|
2023-01-20 14:50:51 +00:00
|
|
|
static DeviceInfoList getDeviceInfo();
|
2022-05-23 15:26:29 +00:00
|
|
|
};
|
|
|
|
|
2022-09-03 18:59:14 +00:00
|
|
|
/** @} */
|