#pragma once #include "lasp_config.h" #include "lasp_daqconfig.h" #include "lasp_types.h" #include /** \addtogroup device * @{ */ using DeviceInfoList = std::vector>; /** * @brief Structure containing device info parameters */ class DeviceInfo { public: /** * @brief Virtual desctructor. Can be derived class. */ virtual ~DeviceInfo() {} DeviceInfo& operator=(const DeviceInfo&) = delete; /** * @brief Clone a device info. * * @return Cloned device info */ virtual std::unique_ptr clone() const { return std::make_unique(*this); } /** * @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 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; /** * @brief Available ranges for the input, i.e. +/- 1V and/or +/- 10 V etc. */ dvec availableInputRanges; /** * @brief Available ranges for the output, i.e. +/- 1V and/or +/- 10 V etc. */ dvec availableOutputRanges; /** * @brief Its preffered input range */ int prefInputRangeIndex = 0; /** * @brief Its preffered output range */ int prefOutputRangeIndex = 0; /** * @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"); } } /** * @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. */ bool hasInternalOutputMonitor = false; /** * @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; /** * @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 * devices, 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 physicalOutputQty = DaqChannel::Qty::Number; /** * @brief String representation of DeviceInfo * * @return string */ operator string() const { using std::endl; std::stringstream str; str << api.apiname + " " << endl << " number of input channels: " << ninchannels << endl << " 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. */ static DeviceInfoList getDeviceInfo(); }; /** @} */