From 8324315bf2402a5e179d1eb48c205d7ef7fc7373 Mon Sep 17 00:00:00 2001 From: Tobias Baumann Date: Fri, 4 Mar 2022 12:41:24 +0000 Subject: [PATCH] =?UTF-8?q?=E2=80=9Esrc/TactiloController/ovpCBoxAlgorithm?= =?UTF-8?q?TactiloController.h=E2=80=9C=20=C3=A4ndern?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ovpCBoxAlgorithmTactiloController.h | 230 +++++++++--------- 1 file changed, 115 insertions(+), 115 deletions(-) diff --git a/src/TactiloController/ovpCBoxAlgorithmTactiloController.h b/src/TactiloController/ovpCBoxAlgorithmTactiloController.h index 67f47c4..f29ec1f 100644 --- a/src/TactiloController/ovpCBoxAlgorithmTactiloController.h +++ b/src/TactiloController/ovpCBoxAlgorithmTactiloController.h @@ -1,115 +1,115 @@ -///------------------------------------------------------------------------------------------------- -/// -/// \file ovpCBoxAlgorithmTactiloController.h -/// \brief Classes of the Box Tactilo Controller. -/// \author Tobias Baumann (TH-Nürnberg). -/// \version 1.0. -/// \date Mon Feb 21 14:59:56 2022. -/// \copyright GNU Affero General Public License v3.0. -/// -///------------------------------------------------------------------------------------------------- - -//includes -#pragma once - -#include "../ovp_defines.h" - -#include -#include -#include -#include - -namespace OpenViBE -{ - namespace Plugins - { - namespace Tactilebci - { - /// The class CBoxAlgorithmTactiloController describes the box Tactilo Controller. - class CBoxAlgorithmTactiloController final : virtual public Toolkit::TBoxAlgorithm - { - public: - void release() override { delete this; } - - bool initialize() override; - bool uninitialize() override; - bool processInput(const size_t index) override; - bool process() override; - - // As we do with any class in openvibe, we use the macro below to associate this box to an unique identifier. - // The inheritance information is also made available, as we provide the superclass Toolkit::TBoxAlgorithm < IBoxAlgorithm > - _IsDerivedFromClass_Final_(Toolkit::TBoxAlgorithm, OVP_ClassId_BoxAlgorithm_TactiloController) - - protected: - // Input decoder: - Toolkit::TStimulationDecoder m_StimDecoder; - // Output decoder: - Toolkit::TStimulationEncoder m_StimEncoder; - - private: - //Box Settings - CString m_PortName; - uint64_t m_RowBase; - uint64_t m_StartStimulation; - uint64_t m_StopStimulation; - uint64_t m_NumberofTactilos; - - //Serial Port - boost::asio::io_service m_IO; - boost::asio::serial_port m_Port{m_IO}; - }; - - /// Descriptor of the box Tactilo Controller. - class CBoxAlgorithmTactiloControllerDesc final : virtual public IBoxAlgorithmDesc - { - public: - - void release() override { } - - CString getName() const override { return CString("Tactile Stimulation"); } - CString getAuthorName() const override { return CString("Tobias Baumann"); } - CString getAuthorCompanyName() const override { return CString("TH-Nürnberg"); } - CString getShortDescription() const override { return CString("Controls the Tactilos on the Lattepandas GPIOs"); } - CString getDetailedDescription() const override { return CString("Communicates with the Arduino Coprocessor of the Lattepanda over a Serial Inteface, to control the Tactilos connected to the Arduinos GPIOs"); } - CString getCategory() const override { return CString("TactileBCI"); } - CString getVersion() const override { return CString("1.0"); } - CString getStockItemName() const override { return CString("gtk-network"); } - - CIdentifier getCreatedClass() const override { return OVP_ClassId_BoxAlgorithm_TactiloController; } - IPluginObject* create() override { return new CBoxAlgorithmTactiloController; } - - /* - IBoxListener* createBoxListener() const override { return new CBoxAlgorithmTactiloControllerListener; } - void releaseBoxListener(IBoxListener* listener) const override { delete listener; } - */ - bool getBoxPrototype(Kernel::IBoxProto& prototype) const override - { - prototype.addInput("StimInput",OV_TypeId_Stimulations); - - //prototype.addFlag(Kernel::BoxFlag_CanModifyInput); - //prototype.addFlag(Kernel::BoxFlag_CanAddInput); - - prototype.addOutput("StimOutput",OV_TypeId_Stimulations); - - //prototype.addFlag(Kernel::BoxFlag_CanModifyOutput); - //prototype.addFlag(Kernel::BoxFlag_CanAddOutput); - - //Box Settings - prototype.addSetting("Serial Port Name",OV_TypeId_String,"/dev/ttyACM0"); - prototype.addSetting("Row Stimulation Base",OV_TypeId_Stimulation,"OVTK_StimulationId_Label_01"); - prototype.addSetting("Flash Start Stimulation",OV_TypeId_Stimulation,"OVTK_StimulationId_VisualStimulationStart"); - prototype.addSetting("Flash Stop Stimulation",OV_TypeId_Stimulation,"OVTK_StimulationId_VisualStimulationStop"); - //prototype.addSetting("Number of Tactilos",OV_TypeId_Integer,"6"); //used to make this setting accessable in the box settings - - //prototype.addFlag(Kernel::BoxFlag_CanModifySetting); - //prototype.addFlag(Kernel::BoxFlag_CanAddSetting); - - prototype.addFlag(OV_AttributeId_Box_FlagIsUnstable); - - return true; - } - _IsDerivedFromClass_Final_(IBoxAlgorithmDesc, OVP_ClassId_BoxAlgorithm_TactiloControllerDesc) - }; - } // namespace Tactilebci - } // namespace Plugins -} // namespace OpenViBE +///------------------------------------------------------------------------------------------------- +/// +/// \file ovpCBoxAlgorithmTactiloController.h +/// \brief Classes of the Box Tactilo Controller. +/// \author Tobias Baumann (TH-Nürnberg). +/// \version 1.0. +/// \date Mon Feb 21 14:59:56 2022. +/// \copyright GNU Affero General Public License v3.0. +/// +///------------------------------------------------------------------------------------------------- + +//includes +#pragma once + +#include "../ovp_defines.h" + +#include +#include +#include +#include + +namespace OpenViBE +{ + namespace Plugins + { + namespace Tactilebci + { + /// The class CBoxAlgorithmTactiloController describes the box Tactilo Controller. + class CBoxAlgorithmTactiloController final : virtual public Toolkit::TBoxAlgorithm + { + public: + void release() override { delete this; } + + bool initialize() override; + bool uninitialize() override; + bool processInput(const size_t index) override; + bool process() override; + + // As we do with any class in openvibe, we use the macro below to associate this box to an unique identifier. + // The inheritance information is also made available, as we provide the superclass Toolkit::TBoxAlgorithm < IBoxAlgorithm > + _IsDerivedFromClass_Final_(Toolkit::TBoxAlgorithm, OVP_ClassId_BoxAlgorithm_TactiloController) + + protected: + // Input decoder: + Toolkit::TStimulationDecoder m_StimDecoder; + // Output decoder: + Toolkit::TStimulationEncoder m_StimEncoder; + + private: + //Box Settings + CString m_PortName; + uint64_t m_RowBase; + uint64_t m_StartStimulation; + uint64_t m_StopStimulation; + uint64_t m_NumberofTactilos; + + //Serial Port + boost::asio::io_service m_IO; + boost::asio::serial_port m_Port{m_IO}; + }; + + /// Descriptor of the box Tactilo Controller. + class CBoxAlgorithmTactiloControllerDesc final : virtual public IBoxAlgorithmDesc + { + public: + + void release() override { } + + CString getName() const override { return CString("Tactilo Controller"); } + CString getAuthorName() const override { return CString("Tobias Baumann"); } + CString getAuthorCompanyName() const override { return CString("TH-Nürnberg"); } + CString getShortDescription() const override { return CString("Controls the Tactilos on the Lattepandas GPIOs"); } + CString getDetailedDescription() const override { return CString("Communicates with the Arduino Coprocessor of the Lattepanda over a Serial Inteface, to control the Tactilos connected to the Arduinos GPIOs"); } + CString getCategory() const override { return CString("TactileBCI"); } + CString getVersion() const override { return CString("1.0"); } + CString getStockItemName() const override { return CString("gtk-network"); } + + CIdentifier getCreatedClass() const override { return OVP_ClassId_BoxAlgorithm_TactiloController; } + IPluginObject* create() override { return new CBoxAlgorithmTactiloController; } + + /* + IBoxListener* createBoxListener() const override { return new CBoxAlgorithmTactiloControllerListener; } + void releaseBoxListener(IBoxListener* listener) const override { delete listener; } + */ + bool getBoxPrototype(Kernel::IBoxProto& prototype) const override + { + prototype.addInput("StimInput",OV_TypeId_Stimulations); + + //prototype.addFlag(Kernel::BoxFlag_CanModifyInput); + //prototype.addFlag(Kernel::BoxFlag_CanAddInput); + + prototype.addOutput("StimOutput",OV_TypeId_Stimulations); + + //prototype.addFlag(Kernel::BoxFlag_CanModifyOutput); + //prototype.addFlag(Kernel::BoxFlag_CanAddOutput); + + //Box Settings + prototype.addSetting("Serial Port Name",OV_TypeId_String,"/dev/ttyACM0"); + prototype.addSetting("Row Stimulation Base",OV_TypeId_Stimulation,"OVTK_StimulationId_Label_01"); + prototype.addSetting("Flash Start Stimulation",OV_TypeId_Stimulation,"OVTK_StimulationId_VisualStimulationStart"); + prototype.addSetting("Flash Stop Stimulation",OV_TypeId_Stimulation,"OVTK_StimulationId_VisualStimulationStop"); + //prototype.addSetting("Number of Tactilos",OV_TypeId_Integer,"6"); //used to make this setting accessable in the box settings + + //prototype.addFlag(Kernel::BoxFlag_CanModifySetting); + //prototype.addFlag(Kernel::BoxFlag_CanAddSetting); + + prototype.addFlag(OV_AttributeId_Box_FlagIsUnstable); + + return true; + } + _IsDerivedFromClass_Final_(IBoxAlgorithmDesc, OVP_ClassId_BoxAlgorithm_TactiloControllerDesc) + }; + } // namespace Tactilebci + } // namespace Plugins +} // namespace OpenViBE