From d5fe64eb2b0c8d991fc49aef4b026503631bf203 Mon Sep 17 00:00:00 2001 From: Adrian Stanea Date: Thu, 29 Aug 2024 16:03:16 +0300 Subject: [PATCH] M2kHardwareTriggerImpl: expose missing overloads Signed-off-by: Adrian Stanea --- include/libm2k/m2khardwaretrigger.hpp | 22 +++++++++++++++++++--- src/m2khardwaretrigger_impl.cpp | 16 ++++++++-------- src/m2khardwaretrigger_impl.hpp | 7 ++----- 3 files changed, 29 insertions(+), 16 deletions(-) diff --git a/include/libm2k/m2khardwaretrigger.hpp b/include/libm2k/m2khardwaretrigger.hpp index 867d7534..bc6976f2 100644 --- a/include/libm2k/m2khardwaretrigger.hpp +++ b/include/libm2k/m2khardwaretrigger.hpp @@ -118,20 +118,36 @@ class LIBM2K_API M2kHardwareTrigger /** * @brief Get the trigger condition for the digital trigger on a specific channel - * @param chnIdx the required channel - * @return the trigger condition + * @param chnIdx The index of the required channel + * @return The trigger condition */ virtual M2K_TRIGGER_CONDITION_DIGITAL getDigitalCondition(unsigned int chnIdx) = 0; + /** + * @brief Get the trigger condition for the digital trigger on a specific channel + * @param chnIdx An enumerator corresponding to the index of the required channel + * @return The trigger condition + */ + virtual M2K_TRIGGER_CONDITION_DIGITAL getDigitalCondition(libm2k::digital::DIO_CHANNEL chnIdx) = 0; + + /** * @brief Set the trigger condition for the digital trigger on a specific channel - * @param chnIdx the required channel + * @param chnIdx The index of the required channel * @param cond the specific trigger condition */ virtual void setDigitalCondition(unsigned int chnIdx, M2K_TRIGGER_CONDITION_DIGITAL cond) = 0; + /** + * @brief Set the trigger condition for the digital trigger on a specific channel + * @param chnIdx An enumerator corresponding to the index of the required channel + * @param cond the specific trigger condition + */ + virtual void setDigitalCondition(libm2k::digital::DIO_CHANNEL chnIdx, M2K_TRIGGER_CONDITION_DIGITAL cond) = 0; + + /** * @brief Get the mode for the analog trigger on a specific channel diff --git a/src/m2khardwaretrigger_impl.cpp b/src/m2khardwaretrigger_impl.cpp index 73c8a3e1..05fecc49 100644 --- a/src/m2khardwaretrigger_impl.cpp +++ b/src/m2khardwaretrigger_impl.cpp @@ -273,9 +273,9 @@ void M2kHardwareTriggerImpl::setAnalogCondition(unsigned int chnIdx, M2K_TRIGGER } -M2K_TRIGGER_CONDITION_DIGITAL M2kHardwareTriggerImpl::getDigitalCondition(DIO_CHANNEL chn) +M2K_TRIGGER_CONDITION_DIGITAL M2kHardwareTriggerImpl::getDigitalCondition(DIO_CHANNEL chnIdx) { - std::string trigger_val = m_digital_trigger_device->getStringValue(chn, "trigger", false); + std::string trigger_val = m_digital_trigger_device->getStringValue(chnIdx, "trigger", false); std::vector available_digital_conditions = getAvailableDigitalConditions(); auto it = std::find(available_digital_conditions.begin(), @@ -288,21 +288,21 @@ M2K_TRIGGER_CONDITION_DIGITAL M2kHardwareTriggerImpl::getDigitalCondition(DIO_CH (it - available_digital_conditions.begin()); } -M2K_TRIGGER_CONDITION_DIGITAL M2kHardwareTriggerImpl::getDigitalCondition(unsigned int chn) +M2K_TRIGGER_CONDITION_DIGITAL M2kHardwareTriggerImpl::getDigitalCondition(unsigned int chnIdx) { - DIO_CHANNEL idx = static_cast(chn); + DIO_CHANNEL idx = static_cast(chnIdx); return getDigitalCondition(idx); } -void M2kHardwareTriggerImpl::setDigitalCondition(DIO_CHANNEL chn, M2K_TRIGGER_CONDITION_DIGITAL cond) +void M2kHardwareTriggerImpl::setDigitalCondition(DIO_CHANNEL chnIdx, M2K_TRIGGER_CONDITION_DIGITAL cond) { std::string trigger_val = getAvailableDigitalConditions()[cond]; - m_digital_trigger_device->setStringValue(chn, "trigger", trigger_val, false); + m_digital_trigger_device->setStringValue(chnIdx, "trigger", trigger_val, false); } -void M2kHardwareTriggerImpl::setDigitalCondition(unsigned int chn, M2K_TRIGGER_CONDITION_DIGITAL cond) +void M2kHardwareTriggerImpl::setDigitalCondition(unsigned int chnIdx, M2K_TRIGGER_CONDITION_DIGITAL cond) { - DIO_CHANNEL idx = static_cast(chn); + DIO_CHANNEL idx = static_cast(chnIdx); setDigitalCondition(idx, cond); } diff --git a/src/m2khardwaretrigger_impl.hpp b/src/m2khardwaretrigger_impl.hpp index d11fbf30..e5901a90 100644 --- a/src/m2khardwaretrigger_impl.hpp +++ b/src/m2khardwaretrigger_impl.hpp @@ -58,7 +58,9 @@ class M2kHardwareTriggerImpl : public M2kHardwareTrigger void setAnalogCondition(unsigned int chnIdx, M2K_TRIGGER_CONDITION_ANALOG cond) override; M2K_TRIGGER_CONDITION_DIGITAL getDigitalCondition(unsigned int chnIdx) override; + M2K_TRIGGER_CONDITION_DIGITAL getDigitalCondition(DIO_CHANNEL chnIdx) override; void setDigitalCondition(unsigned int chnIdx, M2K_TRIGGER_CONDITION_DIGITAL cond) override; + void setDigitalCondition(DIO_CHANNEL chnIdx, M2K_TRIGGER_CONDITION_DIGITAL cond) override; M2K_TRIGGER_MODE getAnalogMode(unsigned int chnIdx) override; void setAnalogMode(unsigned int chnIdx, M2K_TRIGGER_MODE mode) override; @@ -102,11 +104,6 @@ class M2kHardwareTriggerImpl : public M2kHardwareTrigger bool hasExternalTriggerOut() const; bool hasCrossInstrumentTrigger() const; - - M2K_TRIGGER_CONDITION_DIGITAL getDigitalCondition(DIO_CHANNEL chn); - void setDigitalCondition(DIO_CHANNEL chn, M2K_TRIGGER_CONDITION_DIGITAL cond); - - void setAnalogOutTriggerSource(M2K_TRIGGER_SOURCE_OUT src) override; M2K_TRIGGER_SOURCE_OUT getAnalogOutTriggerSource() const override;