|
|
@@ -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)));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|