|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool CBoxAlgorithmTactiloController::initialize()
|
|
|
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
|
|
|
//get Box Settings
|
|
|
m_PortName = FSettingValueAutoCast(*this->getBoxAlgorithmContext(), 0);
|
|
|
m_PortName = FSettingValueAutoCast(*this->getBoxAlgorithmContext(), 0);
|
|
|
m_RowBase = FSettingValueAutoCast(*this->getBoxAlgorithmContext(), 1);
|
|
|
m_RowBase = FSettingValueAutoCast(*this->getBoxAlgorithmContext(), 1);
|
|
|
m_StartStimulation = FSettingValueAutoCast(*this->getBoxAlgorithmContext(), 2);
|
|
|
m_StartStimulation = FSettingValueAutoCast(*this->getBoxAlgorithmContext(), 2);
|
|
|
m_StopStimulation = FSettingValueAutoCast(*this->getBoxAlgorithmContext(), 3);
|
|
|
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
|
|
|
//open serial port
|
|
|
m_Port.open(m_PortName.toASCIIString());
|
|
|
m_Port.open(m_PortName.toASCIIString());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool CBoxAlgorithmTactiloController::uninitialize()
|
|
|
bool CBoxAlgorithmTactiloController::uninitialize()
|
|
|
{
|
|
|
{
|
|
|
m_input0Decoder.uninitialize();
|
|
|
|
|
|
m_output0Encoder.uninitialize();
|
|
|
|
|
|
|
|
|
m_StimDecoder.uninitialize();
|
|
|
|
|
|
m_StimEncoder.uninitialize();
|
|
|
|
|
|
|
|
|
m_Port.close();
|
|
|
m_Port.close();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{
|
|
|
{
|
|
|
StimulationID = StimSet->getStimulationIdentifier(j);
|
|
|
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";
|
|
|
this->getLogManager() << LogLevel_Debug << "Tactilo Nr. " << (StimulationID-m_RowBase+1) << "\n";
|
|
|
TactiloNr = StimulationID-m_RowBase+1;
|
|
|
TactiloNr = StimulationID-m_RowBase+1;
|
|
|
|
|
|
|
|
|
if(StimulationID == m_StartStimulation || StimulationID == m_StopStimulation)
|
|
|
if(StimulationID == m_StartStimulation || StimulationID == m_StopStimulation)
|
|
|
{
|
|
|
{
|
|
|
this->getLogManager() << LogLevel_Debug << "Toggle Tactilo Nr. " << (StimulationID-m_RowBase+1) << "\n";
|
|
|
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)));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|