You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ovpCBoxAlgorithmTactileStimulator.h 4.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. ///-------------------------------------------------------------------------------------------------
  2. ///
  3. /// \file ovpCBoxAlgorithmTactileStimulator.h
  4. /// \brief Classes of the Box Tactile Stimulator.
  5. /// \author Tobias Baumann (TH-Nürnberg).
  6. /// \version 1.0.
  7. /// \date Mon Feb 21 14:59:56 2022.
  8. /// \copyright <a href="https://choosealicense.com/licenses/agpl-3.0/">GNU Affero General Public License v3.0</a>.
  9. ///
  10. ///-------------------------------------------------------------------------------------------------
  11. //includes
  12. #pragma once
  13. #include "../ovp_defines.h"
  14. #include <boost/asio>
  15. #include <openvibe/ov_all.h>
  16. #include <toolkit/ovtk_all.h>
  17. namespace OpenViBE
  18. {
  19. namespace Plugins
  20. {
  21. namespace Tactilebci
  22. {
  23. /// <summary> The class CBoxAlgorithmTactileStimulator describes the box Tactile Stimulator. </summary>
  24. class CBoxAlgorithmTactileStimulation final : virtual public Toolkit::TBoxAlgorithm<IBoxAlgorithm>
  25. {
  26. public:
  27. void release() override { delete this; }
  28. bool initialize() override;
  29. bool uninitialize() override;
  30. //Here is the different process callbacks possible
  31. // - On clock ticks :
  32. //bool processClock(Kernel::CMessageClock& msg) override;
  33. // - On new input received (the most common behaviour for signal processing) :
  34. //bool processInput(const size_t index) override;
  35. // If you want to use processClock, you must provide the clock frequency.
  36. //uint64_t getClockFrequency() override;
  37. bool process() override;
  38. // As we do with any class in openvibe, we use the macro below to associate this box to an unique identifier.
  39. // The inheritance information is also made available, as we provide the superclass Toolkit::TBoxAlgorithm < IBoxAlgorithm >
  40. _IsDerivedFromClass_Final_(Toolkit::TBoxAlgorithm<IBoxAlgorithm>, OVP_ClassId_BoxAlgorithm_TactileStimulation)
  41. protected:
  42. // Input decoder:
  43. Toolkit::TStimulationDecoder<CBoxAlgorithmTactileStimulation> m_input0Decoder;
  44. // Output decoder:
  45. Toolkit::TStimulationEncoder<CBoxAlgorithmTactileStimulation> m_output0Encoder;
  46. };
  47. /// <summary> Descriptor of the box Tactile Stimulator. </summary>
  48. class CBoxAlgorithmTactileStimulationDesc final : virtual public IBoxAlgorithmDesc
  49. {
  50. public:
  51. void release() override { }
  52. CString getName() const override { return CString("Tactile Stimulation"); }
  53. CString getAuthorName() const override { return CString("Tobias Baumann"); }
  54. CString getAuthorCompanyName() const override { return CString("TH-Nürnberg"); }
  55. CString getShortDescription() const override { return CString("Controls the Tactilos on the Lattepanda GPIOs"); }
  56. CString getDetailedDescription() const override { return CString(""); }
  57. CString getCategory() const override { return CString("TactileBCI"); }
  58. CString getVersion() const override { return CString("1.0"); }
  59. CString getStockItemName() const override { return CString("gtk-network"); }
  60. CIdentifier getCreatedClass() const override { return OVP_ClassId_BoxAlgorithm_TactileStimulator; }
  61. IPluginObject* create() override { return new CBoxAlgorithmTactileStimulator; }
  62. /*
  63. IBoxListener* createBoxListener() const override { return new CBoxAlgorithmTactileStimulatorListener; }
  64. void releaseBoxListener(IBoxListener* listener) const override { delete listener; }
  65. */
  66. bool getBoxPrototype(Kernel::IBoxProto& prototype) const override
  67. {
  68. prototype.addInput("StimInput",OV_TypeId_Stimulations);
  69. //prototype.addFlag(Kernel::BoxFlag_CanModifyInput);
  70. //prototype.addFlag(Kernel::BoxFlag_CanAddInput);
  71. prototype.addOutput("StimOutput",OV_TypeId_Stimulations);
  72. //prototype.addFlag(Kernel::BoxFlag_CanModifyOutput);
  73. //prototype.addFlag(Kernel::BoxFlag_CanAddOutput);
  74. //No setting specified.To add settings use :
  75. //prototype.addSetting("SettingName",OV_TypeId_XXXX,"default value");
  76. //prototype.addFlag(Kernel::BoxFlag_CanModifySetting);
  77. //prototype.addFlag(Kernel::BoxFlag_CanAddSetting);
  78. prototype.addFlag(OV_AttributeId_Box_FlagIsUnstable);
  79. return true;
  80. }
  81. _IsDerivedFromClass_Final_(IBoxAlgorithmDesc, OVP_ClassId_BoxAlgorithm_TactileStimulationDesc)
  82. };
  83. } // namespace Tactilebci
  84. } // namespace Plugins
  85. } // namespace OpenViBE