diff --git a/src/applications/mne_scan/plugins/CMakeLists.txt b/src/applications/mne_scan/plugins/CMakeLists.txt index 775c74dbf69..6b4b0745f9c 100644 --- a/src/applications/mne_scan/plugins/CMakeLists.txt +++ b/src/applications/mne_scan/plugins/CMakeLists.txt @@ -17,6 +17,7 @@ add_subdirectory(fiffsimulator) add_subdirectory(ftbuffer) add_subdirectory(babymeg) add_subdirectory(natus) +add_subdirectory(signalgen) # Algorithm Plugin add_subdirectory(rtcmne) diff --git a/src/applications/mne_scan/plugins/signalgen/CMakeLists.txt b/src/applications/mne_scan/plugins/signalgen/CMakeLists.txt new file mode 100644 index 00000000000..145b3bc1719 --- /dev/null +++ b/src/applications/mne_scan/plugins/signalgen/CMakeLists.txt @@ -0,0 +1,79 @@ +cmake_minimum_required(VERSION 3.14) +project(scan_signalgen LANGUAGES CXX) + +#Handle qt uic, moc, rrc automatically +set(CMAKE_AUTOUIC ON) +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) + +find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core Widgets Network Concurrent) +find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Widgets Network Concurrent) + +set(SOURCES + signalgen_global.cpp + FormFiles/signalgensetupwidget.cpp + signalgen.cpp +) + +set(HEADERS + signalgen_global.h + FormFiles/signalgensetupwidget.h + signalgen.h +) + +set(RESOURCES +) + +set(FILE_TO_UPDATE signalgen_global.cpp) + +set(SOURCE_PATHS ${SOURCES}) +list(TRANSFORM SOURCE_PATHS PREPEND "${CMAKE_CURRENT_SOURCE_DIR}/") +set_source_files_properties(${FILE_TO_UPDATE} PROPERTIES OBJECT_DEPENDS "${SOURCE_PATHS}") + +add_library(${PROJECT_NAME} ${SOURCES} ${HEADERS} ${RESOURCES}) + +set(FFTW_LIBS "") + +if(USE_FFTW) + if (WIN32) + set(FFTW_LIBS + ${FFTW_DIR_LIBS}/libfftw3-3.dll + ${FFTW_DIR_LIBS}/libfftw3f-3.dll + ${FFTW_DIR_LIBS}/libfftwf3l-3.dll + ) + target_include_directories(${PROJECT_NAME} PRIVATE ${FFTW_DIR_INCLUDE}) + elseif(UNIX AND NOT APPLE) + set(FFTW_LIBS ${FFTW_DIR_LIBS}/lib/libfftw3.so) + target_include_directories(${PROJECT_NAME} PRIVATE ${FFTW_DIR_INCLUDE}/api) + endif() +endif() + +target_include_directories(${PROJECT_NAME} PUBLIC ../) + +target_link_libraries(${PROJECT_NAME} PRIVATE + Qt${QT_VERSION_MAJOR}::Core + Qt${QT_VERSION_MAJOR}::Widgets + Qt${QT_VERSION_MAJOR}::Network + Qt${QT_VERSION_MAJOR}::Concurrent + eigen + mne_disp + mne_utils + mne_fiff + mne_fs + mne_mne + mne_fwd + mne_inverse + mne_rtprocessing + mne_connectivity + mne_events + mne_communication + scDisp + scShared + scMeas + ${FFTW_LIBS}) + +target_compile_definitions(${PROJECT_NAME} PRIVATE SCAN_signalgen_PLUGIN MNE_GIT_HASH_SHORT="${MNE_GIT_HASH_SHORT}" MNE_GIT_HASH_LONG="${MNE_GIT_HASH_LONG}") + +if(NOT BUILD_SHARED_LIBS) + target_compile_definitions(${PROJECT_NAME} PRIVATE STATICBUILD QT_STATICPLUGIN) +endif() diff --git a/src/applications/mne_scan/plugins/signalgen/FormFiles/signalgensetupwidget.cpp b/src/applications/mne_scan/plugins/signalgen/FormFiles/signalgensetupwidget.cpp new file mode 100644 index 00000000000..d46cbfdd95c --- /dev/null +++ b/src/applications/mne_scan/plugins/signalgen/FormFiles/signalgensetupwidget.cpp @@ -0,0 +1,100 @@ +#include "signalgensetupwidget.h" +#include "ui_signalgensetupwidget.h" + +SignalGenSetupWidget::SignalGenSetupWidget(QWidget *parent) : + QWidget(parent), + ui(new Ui::SignalGenSetupWidget) +{ + ui->setupUi(this); + + connect(ui->nchannels_spinBox, QOverload::of(&QSpinBox::valueChanged), + this, &SignalGenSetupWidget::numChannelsChanged, Qt::UniqueConnection); + + connect(ui->samplefreq_spinBox, QOverload::of(&QSpinBox::valueChanged), + this, &SignalGenSetupWidget::sampleFreqChanged, Qt::UniqueConnection); + + connect(ui->blockpersecond_spinBox, QOverload::of(&QSpinBox::valueChanged), + this, &SignalGenSetupWidget::blocksPerSecondChanged, Qt::UniqueConnection); + + connect(ui->checkBox_random, &QCheckBox::stateChanged, + [this](int state){if(state == Qt::Checked) this->emit modeChanged(SIGNALGENPLUGIN::SignalGen::Mode::Noise); this->updateUiState();}); + + connect(ui->checkBox_wave, &QCheckBox::stateChanged, + [this](int state){if(state == Qt::Checked) this->emit modeChanged(SIGNALGENPLUGIN::SignalGen::Mode::Wave); this->updateUiState();}); + + connect(ui->checkBox_zero, &QCheckBox::stateChanged, + [this](int state){if(state == Qt::Checked) this->emit modeChanged(SIGNALGENPLUGIN::SignalGen::Mode::Zero); this->updateUiState();}); + + connect(ui->spinBox_gen_frq, QOverload::of(&QSpinBox::valueChanged), + this, &SignalGenSetupWidget::genFreqChanged, Qt::UniqueConnection); + + updateUiState(); +} + +SignalGenSetupWidget::~SignalGenSetupWidget() +{ + delete ui; +} + +void SignalGenSetupWidget::defineChannelSettings(int min, int max, int def) +{ + ui->nchannels_spinBox->setMinimum(min); + ui->nchannels_spinBox->setMaximum(max); + ui->nchannels_spinBox->setValue(def); +} + +void SignalGenSetupWidget::defineSampleFreqSettings(int min, int max, int def) +{ + ui->samplefreq_spinBox->setMinimum(min); + ui->samplefreq_spinBox->setMaximum(max); + ui->samplefreq_spinBox->setValue(def); +} + +void SignalGenSetupWidget::defineBlockSettings(int min, int max, int def) +{ + ui->blockpersecond_spinBox->setMinimum(min); + ui->blockpersecond_spinBox->setMaximum(max); + ui->blockpersecond_spinBox->setValue(def); +} + +void SignalGenSetupWidget::defineGeneratedFreqSettings(int min, int max, int def) +{ + ui->spinBox_gen_frq->setMinimum(min); + ui->spinBox_gen_frq->setMaximum(max); + ui->spinBox_gen_frq->setValue(def); +} + +void SignalGenSetupWidget::defineMode(SIGNALGENPLUGIN::SignalGen::Mode mode) +{ + switch (mode){ + case SIGNALGENPLUGIN::SignalGen::Mode::Noise: + { + ui->checkBox_random->setChecked(true); + break; + } + case SIGNALGENPLUGIN::SignalGen::Mode::Wave: + { + ui->checkBox_wave->setChecked(true); + break; + } + case SIGNALGENPLUGIN::SignalGen::Mode::Zero: + { + ui->checkBox_zero->setChecked(true); + break; + } + } + + updateUiState(); +} + + +void SignalGenSetupWidget::updateUiState() +{ + if(ui->checkBox_wave->isChecked()){ + ui->label_gen_freq->show(); + ui->spinBox_gen_frq->show(); + } else { + ui->label_gen_freq->hide(); + ui->spinBox_gen_frq->hide(); + } +} diff --git a/src/applications/mne_scan/plugins/signalgen/FormFiles/signalgensetupwidget.h b/src/applications/mne_scan/plugins/signalgen/FormFiles/signalgensetupwidget.h new file mode 100644 index 00000000000..1e15e51842e --- /dev/null +++ b/src/applications/mne_scan/plugins/signalgen/FormFiles/signalgensetupwidget.h @@ -0,0 +1,39 @@ +#ifndef SIGNALGENSETUPWIDGET_H +#define SIGNALGENSETUPWIDGET_H + +#include + +#include "../signalgen.h" + +namespace Ui { +class SignalGenSetupWidget; +} + +class SignalGenSetupWidget : public QWidget +{ + Q_OBJECT + +public: + explicit SignalGenSetupWidget(QWidget *parent = nullptr); + ~SignalGenSetupWidget(); + + void defineChannelSettings(int min, int max, int def); + void defineSampleFreqSettings(int min, int max, int def); + void defineBlockSettings(int min, int max, int def); + void defineGeneratedFreqSettings(int min, int max, int def); + void defineMode(SIGNALGENPLUGIN::SignalGen::Mode mode); + +signals: + void numChannelsChanged(int numChannels); + void sampleFreqChanged(int sampleFreq); + void blocksPerSecondChanged(int blocksPerSecond); + void genFreqChanged(int genFreq); + void modeChanged(SIGNALGENPLUGIN::SignalGen::Mode mode); +private: + + void updateUiState(); + + Ui::SignalGenSetupWidget *ui; +}; + +#endif // SIGNALGENSETUPWIDGET_H diff --git a/src/applications/mne_scan/plugins/signalgen/FormFiles/signalgensetupwidget.ui b/src/applications/mne_scan/plugins/signalgen/FormFiles/signalgensetupwidget.ui new file mode 100644 index 00000000000..efe6808596b --- /dev/null +++ b/src/applications/mne_scan/plugins/signalgen/FormFiles/signalgensetupwidget.ui @@ -0,0 +1,187 @@ + + + SignalGenSetupWidget + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + + + 0 + 0 + + + + + 75 + true + + + + Signal Generator Configuration + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + + 0 + 0 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + Number of Channels + + + + + + + Mode + + + + + + + Blocks per second + + + + + + + Generated Frequency + + + + + + + Random + + + true + + + checkGroup + + + + + + + Zero + + + checkGroup + + + + + + + Sample Frequency + + + + + + + Wave + + + checkGroup + + + + + + + 1 + + + 999 + + + 32 + + + + + + + 1 + + + 100 + + + 5 + + + + + + + 1 + + + 9999 + + + 1000 + + + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + diff --git a/src/applications/mne_scan/plugins/signalgen/signalgen.cpp b/src/applications/mne_scan/plugins/signalgen/signalgen.cpp new file mode 100644 index 00000000000..61ff28bf965 --- /dev/null +++ b/src/applications/mne_scan/plugins/signalgen/signalgen.cpp @@ -0,0 +1,267 @@ +//============================================================================================================= +/** + * @file signalgen.cpp + * @author Christoph Dinh ; + * Lorenz Esch + * @since 0.1.0 + * @date February, 2013 + * + * @section LICENSE + * + * Copyright (C) 2013, Christoph Dinh, Lorenz Esch. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted provided that + * the following conditions are met: + * * Redistributions of source code must retain the above copyright notice, this list of conditions and the + * following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and + * the following disclaimer in the documentation and/or other materials provided with the distribution. + * * Neither the name of MNE-CPP authors nor the names of its contributors may be used + * to endorse or promote products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * + * @brief Definition of the SignalGen class. + * + */ + +//============================================================================================================= +// INCLUDES +//============================================================================================================= + +#include "signalgen.h" +#include "FormFiles/signalgensetupwidget.h" +#include +#include +#include +#include +#include + +//============================================================================================================= +// QT INCLUDES +//============================================================================================================= + +#include +#include +#include +#include +#include + +#include + +//============================================================================================================= +// USED NAMESPACES +//============================================================================================================= + +using namespace SIGNALGENPLUGIN; +using namespace UTILSLIB; +using namespace SCSHAREDLIB; +using namespace UTILSLIB; +using namespace SCMEASLIB; +using namespace COMMUNICATIONLIB; +using namespace Eigen; + +//============================================================================================================= +// DEFINE MEMBER METHODS +//============================================================================================================= + +SignalGen::SignalGen() +: numChannels(32) +, numBlocksPerSecond(5) +, sample_freq(1000.f) +, gen_freq(3) +, m_mode(Mode::Noise) +{ +} + +//============================================================================================================= + +SignalGen::~SignalGen() +{ + if(this->isRunning()) { + stop(); + } +} + +//============================================================================================================= + +void SignalGen::clear() +{ + QMutexLocker locker(&m_qMutex); + m_pFiffInfo.reset(); +} + +//============================================================================================================= + +QSharedPointer SignalGen::clone() const +{ + QSharedPointer pSignalGenClone(new SignalGen()); + return std::move(pSignalGenClone); +} + +//============================================================================================================= + +void SignalGen::init() +{ + m_pRTMSA_SignalGen = PluginOutputData::create(this, "SignalGen", "Signal Generator Output"); + m_pRTMSA_SignalGen->measurementData()->setName(this->getName());//Provide name to auto store widget settings + m_outputConnectors.append(m_pRTMSA_SignalGen); + + //Try to connect the cmd client on start up using localhost connection + // this->connectCmdClient(); +} + +//============================================================================================================= + +void SignalGen::unload() +{ + qDebug() << "SignalGen::unload()"; +} + +//============================================================================================================= + +bool SignalGen::start() +{ + initOutput(); + QThread::start(); + + return true; +} + +//============================================================================================================= + +bool SignalGen::stop() +{ + // Stop this (consumer) thread first + requestInterruption(); + wait(500); + + m_pRTMSA_SignalGen->measurementData()->clear(); + + return true; +} + +//============================================================================================================= + +AbstractPlugin::PluginType SignalGen::getType() const +{ + return _ISensor; +} + +//============================================================================================================= + +QString SignalGen::getName() const +{ + return "Signal Generator"; +} + +//============================================================================================================= + +QWidget* SignalGen::setupWidget() +{ + auto* widget = new SignalGenSetupWidget(); + + connect(widget, &SignalGenSetupWidget::numChannelsChanged, [this](int nchans){this->numChannels = nchans;}); + connect(widget, &SignalGenSetupWidget::sampleFreqChanged, [this](int freq){this->sample_freq = freq;}); + connect(widget, &SignalGenSetupWidget::blocksPerSecondChanged, [this](int bps){this->numBlocksPerSecond = bps;}); + connect(widget, &SignalGenSetupWidget::genFreqChanged, [this](int freq){this->gen_freq = freq;}); + + connect(widget, &SignalGenSetupWidget::modeChanged, [this](Mode m){this->m_mode = m;}); + + widget->defineChannelSettings(1, 999, numChannels); + widget->defineSampleFreqSettings(100, 10000, static_cast(sample_freq)); + widget->defineBlockSettings(1, 100, numBlocksPerSecond); + widget->defineGeneratedFreqSettings(1,999, gen_freq); + + widget->defineMode(m_mode); + + return widget; +} + +//============================================================================================================= + +void SignalGen::run() +{ + MatrixXd matValue; + int samplesPerBlock = sample_freq / numBlocksPerSecond; + + matValue.resize(numChannels, samplesPerBlock); + + int sleep_time_ms = 1000 * samplesPerBlock / sample_freq; + + double time = 0; + double pi = 2*acos(0.0); + + while(!isInterruptionRequested()) { + switch(m_mode){ + case Mode::Zero:{ + matValue = MatrixXd::Zero(numChannels, samplesPerBlock); + break; + } + case Mode::Wave: { + for(auto i = 0; i < matValue.cols(); ++i){ + time += 1/sample_freq; + auto value = sin(2 * pi * gen_freq * time); + for (auto& val : matValue.col(i)){ + val = value; + } + } + matValue *= 1e-12; + break; + } + case Mode::Noise:{ + matValue = MatrixXd::Random(numChannels, samplesPerBlock); + matValue *= 1e-12; + break; + } + } + m_pRTMSA_SignalGen->measurementData()->setValue(matValue); + msleep(sleep_time_ms); + } +} + +//============================================================================================================= + +void SignalGen::initOutput() +{ + QMutexLocker locker (&m_qMutex); + m_pFiffInfo = QSharedPointer(new FIFFLIB::FiffInfo()); + + m_pFiffInfo->sfreq = sample_freq; + m_pFiffInfo->nchan = numChannels; + + m_pFiffInfo->chs.clear(); + + for (int i = 0; i< m_pFiffInfo->nchan; i++){ + FIFFLIB::FiffChInfo channel; + + channel.ch_name = "Ch. " + QString::number(i + 1); + channel.kind = FIFFV_MEG_CH; + channel.unit = FIFF_UNIT_T; + channel.unit_mul = FIFF_UNITM_NONE; + channel.chpos.coil_type = FIFFV_COIL_NONE; + + m_pFiffInfo->chs.append(channel); + + m_pFiffInfo->ch_names.append(m_pFiffInfo->chs[i].ch_name); + } + + m_pRTMSA_SignalGen->measurementData()->initFromFiffInfo(m_pFiffInfo); + m_pRTMSA_SignalGen->measurementData()->setMultiArraySize(1); + m_pRTMSA_SignalGen->measurementData()->setVisibility(true); +} + +//============================================================================================================= + +QString SignalGen::getBuildInfo() +{ + return QString(SIGNALGENPLUGIN::buildDateTime()) + QString(" - ") + QString(SIGNALGENPLUGIN::buildHash()); +} diff --git a/src/applications/mne_scan/plugins/signalgen/signalgen.h b/src/applications/mne_scan/plugins/signalgen/signalgen.h new file mode 100644 index 00000000000..770b60d9192 --- /dev/null +++ b/src/applications/mne_scan/plugins/signalgen/signalgen.h @@ -0,0 +1,190 @@ +//============================================================================================================= +/** + * @file signalgen.h + * @author Christoph Dinh ; + * Lorenz Esch + * @since 0.1.0 + * @date February, 2013 + * + * @section LICENSE + * + * Copyright (C) 2013, Christoph Dinh, Lorenz Esch. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted provided that + * the following conditions are met: + * * Redistributions of source code must retain the above copyright notice, this list of conditions and the + * following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and + * the following disclaimer in the documentation and/or other materials provided with the distribution. + * * Neither the name of MNE-CPP authors nor the names of its contributors may be used + * to endorse or promote products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * + * @brief Contains the declaration of the SignalGen class. + * + */ + +#ifndef SIGNALGEN_H +#define SIGNALGEN_H + +//============================================================================================================= +// INCLUDES +//============================================================================================================= + +#include "signalgen_global.h" + +#include +#include +#include + +//============================================================================================================= +// QT INCLUDES +//============================================================================================================= + +#include +#include +#include + +//============================================================================================================= +// EIGEN INCLUDES +//============================================================================================================= + +#include + +//============================================================================================================= +// FORWARD DECLARATIONS +//============================================================================================================= + +namespace SCMEASLIB { + class RealTimeMultiSampleArray; +} + +namespace FIFFLIB { + class FiffInfo; +} + +//============================================================================================================= +// DEFINE NAMESPACE SIGNALGENPLUGIN +//============================================================================================================= + +namespace SIGNALGENPLUGIN +{ + +//============================================================================================================= +// SIGNALGENPLUGIN FORWARD DECLARATIONS +//============================================================================================================= + +class SignalGenProducer; + +//============================================================================================================= +/** + * DECLARE CLASS SignalGen + * + * @brief The SignalGen class provides a stream of data. + */ +class SIGNALGENSHARED_EXPORT SignalGen : public SCSHAREDLIB::AbstractSensor +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID "scsharedlib/1.0" FILE "signalgen.json") //New Qt5 Plugin system replaces Q_EXPORT_PLUGIN2 macro + // Use the Q_INTERFACES() macro to tell Qt's meta-object system about the interfaces + Q_INTERFACES(SCSHAREDLIB::AbstractSensor) + + friend class SignalGenProducer; + friend class SignalGenSetupWidget; + +public: + + enum Mode{ + Zero, + Wave, + Noise + }; + + //========================================================================================================= + /** + * Constructs a SignalGen. + */ + SignalGen(); + + //========================================================================================================= + /** + * Destroys the SignalGen. + */ + virtual ~SignalGen(); + + //========================================================================================================= + /** + * Clears the rt server + */ + void clear(); + + //========================================================================================================= + /** + * Clone the plugin + */ + virtual QSharedPointer clone() const; + + //========================================================================================================= + /** + * Initialise the SignalGen. + */ + virtual void init(); + + //========================================================================================================= + /** + * Is called when plugin is detached of the stage. Can be used to safe settings. + */ + virtual void unload(); + + virtual bool start(); + virtual bool stop(); + + virtual AbstractPlugin::PluginType getType() const; + virtual QString getName() const; + virtual QString getBuildInfo(); + + //========================================================================================================= + /** + * Creates the setup widget. + * + * @return Returns the setup widget. + */ + virtual QWidget* setupWidget(); + +protected: + //========================================================================================================= + /** + * Initialises the output. + */ + void initOutput(); + + virtual void run(); + + SCSHAREDLIB::PluginOutputData::SPtr m_pRTMSA_SignalGen; /**< The RealTimeMultiSampleArray to provide the rt_server Channels.*/ + + QSharedPointer m_pFiffInfo; /**< Fiff measurement info.*/ + + QMutex m_qMutex; /**< The mutex to ensure thread safety.*/ + + int numChannels; + int numBlocksPerSecond; + + float sample_freq; + + float gen_freq; + + Mode m_mode; + +}; +} // NAMESPACE + +#endif // SIGNALGEN_H diff --git a/src/applications/mne_scan/plugins/signalgen/signalgen.json b/src/applications/mne_scan/plugins/signalgen/signalgen.json new file mode 100644 index 00000000000..e69de29bb2d diff --git a/src/applications/mne_scan/plugins/signalgen/signalgen_global.cpp b/src/applications/mne_scan/plugins/signalgen/signalgen_global.cpp new file mode 100644 index 00000000000..c3f256cab6b --- /dev/null +++ b/src/applications/mne_scan/plugins/signalgen/signalgen_global.cpp @@ -0,0 +1,54 @@ +//============================================================================================================= +/** + * @file signalgen_global.cpp + * @author Juan G Prieto ; + * Gabriel B Motta ; + * @since 0.1.9 + * @date September, 2021 + * + * @section LICENSE + * + * Copyright (C) 2021, Juan G Prieto, Gabriel B Motta. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted provided that + * the following conditions are met: + * * Redistributions of source code must retain the above copyright notice, this list of conditions and the + * following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and + * the following disclaimer in the documentation and/or other materials provided with the distribution. + * * Neither the name of MNE-CPP authors nor the names of its contributors may be used + * to endorse or promote products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * + * @brief signalgen plugin global definitions. + * + */ + +//============================================================================================================= +// INCLUDES +//============================================================================================================= + +#include "signalgen_global.h" + +//============================================================================================================= +// DEFINE METHODS +//============================================================================================================= + +const char* SIGNALGENPLUGIN::buildDateTime(){ return UTILSLIB::dateTimeNow();} + +//============================================================================================================= + +const char* SIGNALGENPLUGIN::buildHash(){ return UTILSLIB::gitHash();} + +//============================================================================================================= + +const char* SIGNALGENPLUGIN::buildHashLong(){ return UTILSLIB::gitHashLong();} diff --git a/src/applications/mne_scan/plugins/signalgen/signalgen_global.h b/src/applications/mne_scan/plugins/signalgen/signalgen_global.h new file mode 100644 index 00000000000..88da0f1bb8a --- /dev/null +++ b/src/applications/mne_scan/plugins/signalgen/signalgen_global.h @@ -0,0 +1,82 @@ +//============================================================================================================= +/** + * @file signalgen_global.h + * @author Christoph Dinh ; + * Lorenz Esch + * @since 0.1.0 + * @date February, 2013 + * + * @section LICENSE + * + * Copyright (C) 2013, Christoph Dinh, Lorenz Esch. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted provided that + * the following conditions are met: + * * Redistributions of source code must retain the above copyright notice, this list of conditions and the + * following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and + * the following disclaimer in the documentation and/or other materials provided with the distribution. + * * Neither the name of MNE-CPP authors nor the names of its contributors may be used + * to endorse or promote products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * + * @brief Contains the SignalGen library export/import macros. + * + */ + +#ifndef SIGNALGEN_GLOBAL_H +#define SIGNALGEN_GLOBAL_H + +//============================================================================================================= +// INCLUDES +//============================================================================================================= + +#include + +//============================================================================================================= +// QT INCLUDES +//============================================================================================================= + +#include + +//============================================================================================================= +// PREPROCESSOR DEFINES +//============================================================================================================= + +#if defined(SCAN_SIGNALGEN_PLUGIN) +# define SIGNALGENSHARED_EXPORT Q_DECL_EXPORT /**< Q_DECL_EXPORT must be added to the declarations of symbols used when compiling a shared library. */ +#else +# define SIGNALGENSHARED_EXPORT Q_DECL_IMPORT /**< Q_DECL_IMPORT must be added to the declarations of symbols used when compiling a client that uses the shared library. */ +#endif + +namespace SIGNALGENPLUGIN{ + +//============================================================================================================= +/** + * Returns build date and time. + */ +SIGNALGENSHARED_EXPORT const char* buildDateTime(); + +//============================================================================================================= +/** + * Returns abbreviated build git hash. + */ +SIGNALGENSHARED_EXPORT const char* buildHash(); + +//============================================================================================================= +/** + * Returns full build git hash. + */ +SIGNALGENSHARED_EXPORT const char* buildHashLong(); +} + +#endif // SIGNALGEN_GLOBAL_H