Browse Source

Dateien hochladen nach „src/TactiloController“

master
Tobias Baumann 2 years ago
parent
commit
9ffc7d2479

+ 8
- 6
src/TactiloController/ovpCBoxAlgorithmTactiloController.cpp View File

@@ -22,14 +22,16 @@ using namespace /*OpenViBE::Plugins::*/Tactilebci;
bool CBoxAlgorithmTactiloController::initialize()
{
m_input0Decoder.initialize(*this, 0);
m_output0Encoder.initialize(*this, 0);
m_StimDecoder.initialize(*this, 0);
m_StimEncoder.initialize(*this, 0);
//get Box Settings
m_PortName = FSettingValueAutoCast(*this->getBoxAlgorithmContext(), 0);
m_RowBase = FSettingValueAutoCast(*this->getBoxAlgorithmContext(), 1);
m_StartStimulation = FSettingValueAutoCast(*this->getBoxAlgorithmContext(), 2);
m_StopStimulation = FSettingValueAutoCast(*this->getBoxAlgorithmContext(), 3);
m_NumberofTactilos = 6; //if this value is specified via box settings this line is not needed
//NumberofTactilos = FSettingValueAutoCast(*this->getBoxAlgorithmContext(), 3); //used if this value is set in box settings
//open serial port
m_Port.open(m_PortName.toASCIIString());
@@ -46,8 +48,8 @@ bool CBoxAlgorithmTactiloController::initialize()
bool CBoxAlgorithmTactiloController::uninitialize()
{
m_input0Decoder.uninitialize();
m_output0Encoder.uninitialize();
m_StimDecoder.uninitialize();
m_StimEncoder.uninitialize();
m_Port.close();
@@ -95,7 +97,7 @@ bool CBoxAlgorithmTactiloController::process()
{
StimulationID = StimSet->getStimulationIdentifier(j);
if(StimulationID >= m_RowBase && StimulationID < (m_RowBase + NumberofTactilos))
if(StimulationID >= m_RowBase && StimulationID < (m_RowBase + m_NumberofTactilos))
{
this->getLogManager() << LogLevel_Debug << "Tactilo Nr. " << (StimulationID-m_RowBase+1) << "\n";
TactiloNr = StimulationID-m_RowBase+1;
@@ -103,7 +105,7 @@ bool CBoxAlgorithmTactiloController::process()
if(StimulationID == m_StartStimulation || StimulationID == m_StopStimulation)
{
this->getLogManager() << LogLevel_Debug << "Toggle Tactilo Nr. " << (StimulationID-m_RowBase+1) << "\n";
boost::asio::write::async_write(m_Port, boost::asio::buffer(std::to_string(TactiloNr));
m_Port.write_some(boost::asio::buffer(std::to_string(TactiloNr)));
}
}
}

+ 5
- 2
src/TactiloController/ovpCBoxAlgorithmTactiloController.h View File

@@ -42,9 +42,9 @@ namespace OpenViBE
protected:
// Input decoder:
Toolkit::TStimulationDecoder<CBoxAlgorithmTactiloController> m_input0Decoder;
Toolkit::TStimulationDecoder<CBoxAlgorithmTactiloController> m_StimDecoder;
// Output decoder:
Toolkit::TStimulationEncoder<CBoxAlgorithmTactiloController> m_output0Encoder;
Toolkit::TStimulationEncoder<CBoxAlgorithmTactiloController> m_StimEncoder;
private:
//Box Settings
@@ -52,6 +52,7 @@ namespace OpenViBE
uint64_t m_RowBase;
uint64_t m_StartStimulation;
uint64_t m_StopStimulation;
uint64_t m_NumberofTactilos;
//Serial Port
boost::asio::io_service m_IO;
@@ -98,6 +99,8 @@ namespace OpenViBE
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);

Loading…
Cancel
Save