Dateien hochladen nach „src/TactiloController“
This commit is contained in:
parent
6360e97231
commit
a4b9a30d83
@ -26,10 +26,20 @@ bool CBoxAlgorithmTactiloController::initialize()
|
||||
m_StimEncoder.initialize(*this, 0);
|
||||
|
||||
//get Box Settings
|
||||
m_PortName = FSettingValueAutoCast(*this->getBoxAlgorithmContext(), 0);
|
||||
m_RowBase = FSettingValueAutoCast(*this->getBoxAlgorithmContext(), 1);
|
||||
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
|
||||
m_PortName = FSettingValueAutoCast(*this->getBoxAlgorithmContext(), 0);
|
||||
m_RowBase = FSettingValueAutoCast(*this->getBoxAlgorithmContext(), 1);
|
||||
m_nTactilos = FSettingValueAutoCast(*this->getBoxAlgorithmContext(), 3);
|
||||
|
||||
//set m_nTactilos to 2 if lower than 2
|
||||
if(m_nTactilos < 2)
|
||||
{
|
||||
m_nTactilos = 2;
|
||||
}
|
||||
//set m_nTactilos to MAX if greater than MAX_TACTILOS
|
||||
if(m_nTactilos > MAX_TACTILOS)
|
||||
{
|
||||
m_nTactilos = MAX_TACTILOS;
|
||||
}
|
||||
|
||||
//open serial port and set baudrate to 115200
|
||||
m_Port.open(m_PortName.toASCIIString());
|
||||
@ -99,19 +109,19 @@ bool CBoxAlgorithmTactiloController::process()
|
||||
{
|
||||
StimulationID = StimSet->getStimulationIdentifier(j);
|
||||
|
||||
if(StimulationID >= m_RowBase && StimulationID < (m_RowBase + m_NumberofTactilos))
|
||||
if(StimulationID >= m_RowBase && StimulationID < (m_RowBase + m_nTactilos))
|
||||
{
|
||||
m_TactiloNr = StimulationID-m_RowBase+1;
|
||||
m_currTactiloNr = StimulationID-m_RowBase+1;
|
||||
}
|
||||
if(StimulationID == OVTK_StimulationId_VisualStimulationStart)
|
||||
{
|
||||
this->getLogManager() << LogLevel_Info << "Tactilo Nr. " << m_TactiloNr << " ON\n";
|
||||
m_Port.write_some(boost::asio::buffer(std::to_string(m_TactiloNr)));
|
||||
this->getLogManager() << LogLevel_Info << "Tactilo Nr. " << m_currTactiloNr << " ON\n";
|
||||
m_Port.write_some(boost::asio::buffer(std::to_string(m_currTactiloNr)));
|
||||
}
|
||||
if(StimulationID == OVTK_StimulationId_VisualStimulationStop)
|
||||
{
|
||||
this->getLogManager() << LogLevel_Info << "Tactilo Nr. " << m_TactiloNr << " OFF\n";
|
||||
m_Port.write_some(boost::asio::buffer(std::to_string(m_TactiloNr)));
|
||||
this->getLogManager() << LogLevel_Info << "Tactilo Nr. " << m_currTactiloNr << " OFF\n";
|
||||
m_Port.write_some(boost::asio::buffer(std::to_string(m_currTactiloNr)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -48,15 +48,15 @@ namespace OpenViBE
|
||||
|
||||
private:
|
||||
//variable to store the current TactiloNr
|
||||
uint64_t m_TactiloNr = 0;
|
||||
uint64_t m_currTactiloNr = 0;
|
||||
//Box Settings
|
||||
CString m_PortName = "";
|
||||
uint64_t m_RowBase = 0;
|
||||
uint64_t m_NumberofTactilos = 0;
|
||||
CString m_PortName = "";
|
||||
uint64_t m_RowBase = 0;
|
||||
uint64_t m_nTactilos = 0;
|
||||
|
||||
//Serial Port
|
||||
boost::asio::io_service m_IO;
|
||||
boost::asio::serial_port m_Port{m_IO};
|
||||
boost::asio::io_service m_IOService;
|
||||
boost::asio::serial_port m_Port{m_IOService};
|
||||
};
|
||||
|
||||
/// <summary> Descriptor of the box Tactilo Controller. </summary>
|
||||
@ -78,10 +78,6 @@ namespace OpenViBE
|
||||
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);
|
||||
@ -97,7 +93,7 @@ namespace OpenViBE
|
||||
//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("Number of Tactilos",OV_TypeId_Integer,"6"); //used to make this setting accessable in the box settings
|
||||
prototype.addSetting("Number of Tactilos",OV_TypeId_Integer,"6");
|
||||
|
||||
//prototype.addFlag(Kernel::BoxFlag_CanModifySetting);
|
||||
//prototype.addFlag(Kernel::BoxFlag_CanAddSetting);
|
||||
|
Loading…
x
Reference in New Issue
Block a user