Commit 97e44651 authored by Jussi Lindgren's avatar Jussi Lindgren

Merge branch 'release-1.0.1-bugfixes' of git+ssh://scm.gforge.inria.fr//gitroot/openvibe/openvibe

parents 012fb84e 58f61892
......@@ -379,7 +379,7 @@
<TypeIdentifier>(0x330306dd, 0x74a95f98)</TypeIdentifier>
<Name>Filename to save configuration to</Name>
<DefaultValue>${Path_UserData}/my-classifier.xml</DefaultValue>
<Value>{Player_ScenarioDirectory}/motor-imagery-bci-config-classifier.cfg</Value>
<Value>${Player_ScenarioDirectory}/motor-imagery-bci-config-classifier.cfg</Value>
<Modifiability>false</Modifiability>
</Setting>
<Setting>
......@@ -2494,4 +2494,4 @@ used to stop the scenario with a &lt;i&gt;&lt;b&gt;Player Controller&lt;/b&gt;&l
<Value>INRIA</Value>
</Attribute>
</Attributes>
</OpenViBE-Scenario>
\ No newline at end of file
</OpenViBE-Scenario>
......@@ -87,7 +87,7 @@ namespace OpenViBEAcquisitionServer
*
* Gets the tolerance configured for the acquisition server. This
* tolerance is present to avoid numerous corrections on a drift
* value that would oscilate in a small range around 0. In such case,
* value that would oscillate in a small range around 0. In such case,
* a correction in a way would probably turn in a correction in the
* opposite way a few seconds later, resulting in crap measurements
* because of irregular but valid source.
......
......@@ -211,7 +211,7 @@ boolean CScheduler::setScenario(
if(m_bIsInitialized)
{
this->getLogManager() << LogLevel_Warning << "Trying to configure an intialized scheduler !\n";
this->getLogManager() << LogLevel_Warning << "Trying to configure an initialized scheduler !\n";
return false;
}
......@@ -227,7 +227,7 @@ boolean CScheduler::setFrequency(
if(m_bIsInitialized)
{
this->getLogManager() << LogLevel_Warning << "Trying to configure an intialized scheduler !\n";
this->getLogManager() << LogLevel_Warning << "Trying to configure an initialized scheduler !\n";
return false;
}
......@@ -244,7 +244,7 @@ SchedulerInitializationCode CScheduler::initialize(void)
if(m_bIsInitialized)
{
this->getLogManager() << LogLevel_Warning << "Trying to initialize an intialized scheduler !\n";
this->getLogManager() << LogLevel_Warning << "Trying to initialize an initialized scheduler !\n";
return SchedulerInitialization_Failed;
}
......
......@@ -12,7 +12,7 @@ namespace OpenViBE
* \class CIdentifier
* \author Yann Renard (INRIA/IRISA)
* \date 2006-06-16
* \brief Globally used identifiaction class
* \brief Globally used identification class
* \ingroup Group_Base
*
* This class is the basic class to use in order to identify
......@@ -43,7 +43,7 @@ namespace OpenViBE
/**
* \brief Default constructor
*
* Builds up the 64 bits identifier intialized to
* Builds up the 64 bits identifier initialized to
* \c OV_UndefinedIdentifier.
*/
CIdentifier(void);
......
......@@ -478,7 +478,7 @@ uint32 CAlgorithmClassifierOneVsOne::getClassAmount(void) const
return static_cast<uint32>((1+::sqrt(static_cast<double>(l_ui32DeltaCarre)))/2);
}
//The function take int because we don't take the "label" of the class but only the numero of declaration
//The function take int because we don't take the "label" of the class but only the number of declaration
SSubClassifierDescriptor &CAlgorithmClassifierOneVsOne::getSubClassifierDescriptor(const uint32 ui32FirstClass, const uint32 ui32SecondClass)
{
uint32 ui32Max, ui32Min;
......
......@@ -54,7 +54,7 @@ boolean CBoxAlgorithmClassifierProcessor::initialize(void)
l_sData >> l_ui32Version;
if(l_ui32Version != OVP_Classification_BoxTrainerXMLVersion)
{
this->getLogManager() << LogLevel_Warning << "The configuration file doesn't have the same version numero than the box. Trouble may appear in loading process.\n";
this->getLogManager() << LogLevel_Warning << "The configuration file doesn't have the same version number as the box. Trouble may appear in loading process.\n";
}
}
else
......@@ -68,7 +68,7 @@ boolean CBoxAlgorithmClassifierProcessor::initialize(void)
if(l_pTempNode) {
l_oAlgorithmClassIdentifier.fromString(l_pTempNode->getAttribute(c_sIdentifierAttributeName));
} else {
this->getLogManager() << LogLevel_Warning << "The configuration file had no node " << c_sStrategyNodeName << ". Trouble may appear later.\n";
this->getLogManager() << LogLevel_Warning << "The configuration file had no node [" << c_sStrategyNodeName << "]. Trouble may appear later.\n";
}
//If the Identifier is undefined, that means we need to load a native algorithm
......@@ -81,7 +81,7 @@ boolean CBoxAlgorithmClassifierProcessor::initialize(void)
}
else
{
this->getLogManager() << LogLevel_Warning << "The configuration file had no node " << c_sAlgorithmNodeName << ". Trouble may appear later.\n";
this->getLogManager() << LogLevel_Warning << "The configuration file had no node [" << c_sAlgorithmNodeName << "]. Trouble may appear later.\n";
}
//If the algorithm is still unknown, that means that we face an error
......@@ -102,13 +102,20 @@ boolean CBoxAlgorithmClassifierProcessor::initialize(void)
l_pTempNode = l_pStimulationsNode->getChild(i);
if(!l_pTempNode)
{
this->getLogManager() << LogLevel_Error << "Expected child node " << i << " for node " << c_sStimulationsNodeName << ". Output labels not known. Aborting.\n";
this->getLogManager() << LogLevel_Error << "Expected child node " << i << " for node [" << c_sStimulationsNodeName << "]. Output labels not known. Aborting.\n";
return false;
}
CString l_sStimulationName(l_pTempNode->getPCData());
OpenViBE::float64 l_f64ClassId;
std::stringstream l_sIdentifierData(l_pTempNode->getAttribute(c_sIdentifierAttributeName));
const char *l_sAttributeData = l_pTempNode->getAttribute(c_sIdentifierAttributeName);
if(!l_sAttributeData)
{
this->getLogManager() << LogLevel_Error << "Expected child node " << i << " for node [" << c_sStimulationsNodeName << "] to have attribute [" << c_sIdentifierAttributeName << "]. Aborting.\n";
return false;
}
std::stringstream l_sIdentifierData(l_sAttributeData);
l_sIdentifierData >> l_f64ClassId ;
m_vStimulation[l_f64ClassId]=this->getTypeManager().getEnumerationEntryValueFromName(OV_TypeId_Stimulation, l_sStimulationName);
}
......
......@@ -87,7 +87,7 @@ namespace OpenViBEPlugins
virtual OpenViBE::int32 getStrategySettingsCount(OpenViBE::Kernel::IBox& rBox)
{
if(m_i32StrategyAmountSettings < 0)//The value have never been intialized
if(m_i32StrategyAmountSettings < 0)//The value have never been initialized
{
initializedStrategy(rBox);
}
......@@ -110,7 +110,7 @@ namespace OpenViBEPlugins
virtual OpenViBE::boolean onInputAdded(OpenViBE::Kernel::IBox& rBox, const OpenViBE::uint32 ui32Index)
{
//ui32Index represent the numero of the class (because of rejected offset)
//ui32Index represent the number of the class (because of rejected offset)
char l_sBuffer[64];
sprintf(l_sBuffer, "Class %d label", ui32Index);
char l_sStimulation[64];
......@@ -147,7 +147,7 @@ namespace OpenViBEPlugins
rBox.getSettingName(getStrategyIndex()+2, l_sStrategyName);//this one is a class label
std::string l_sSettingName(l_sStrategyName.toASCIIString());
if(l_sSettingName.find("Class ") == std::string::npos)//We doesn't intialized the box so let's do it)
if(l_sSettingName.find("Class ") == std::string::npos)//We haven't initialized the box so let's do it
{
//Now added Settings for classes
for(OpenViBE::uint32 i = 1 ; i< rBox.getInputCount() ; ++i)
......
......@@ -84,12 +84,24 @@ namespace OpenViBEPlugins
virtual OpenViBE::boolean onSettingValueChanged(OpenViBE::Kernel::IBox& rBox, const OpenViBE::uint32 ui32Index)
{
//we are only interested in the setting 0
if((ui32Index==0)&&(!m_bHasUserSetName))
//we are only interested in the setting 0 and the type changes (select or reject)
if((ui32Index==0 || ui32Index==1) && (!m_bHasUserSetName))
{
OpenViBE::CString l_sSettings;
rBox.getSettingValue(0, l_sSettings);
rBox.setName(l_sSettings);
OpenViBE::CString l_sChannels;
rBox.getSettingValue(0, l_sChannels);
OpenViBE::CString l_sSelectionMethod;
OpenViBE::CIdentifier l_oSelectionEnumIdentifier;
rBox.getSettingValue(1, l_sSelectionMethod);
rBox.getSettingType(1, l_oSelectionEnumIdentifier);
const OpenViBE::CIdentifier l_oSelectionMethodIdentifier = this->getTypeManager().getEnumerationEntryValueFromName(l_oSelectionEnumIdentifier, l_sSelectionMethod);
if(l_oSelectionMethodIdentifier==OVP_TypeId_SelectionMethod_Reject)
{
l_sChannels = OpenViBE::CString("!") + l_sChannels;
}
rBox.setName(l_sChannels);
}
return true;
}
......
......@@ -107,8 +107,8 @@ boolean CBoxAlgorithmMatrixTranspose::process(void)
else
{
// 2 dim
const uint32 l_ui32nCols = l_pInput->getDimensionSize(0);
const uint32 l_ui32nRows = l_pInput->getDimensionSize(1);
const uint32 l_ui32nRows = l_pInput->getDimensionSize(0);
const uint32 l_ui32nCols = l_pInput->getDimensionSize(1);
const float64* l_pInputBuffer = l_pInput->getBuffer();
float64* l_pOutputBuffer = l_pOutput->getBuffer();
......
......@@ -9,13 +9,15 @@ using namespace OpenViBEPlugins::Stimulation;
boolean CBoxAlgorithmTimeout::initialize(void)
{
m_bTimeoutReached = false;
m_ui32TimeoutState = 0;
m_oStimulationEncoder.initialize(*this,0);
m_ui64Timeout = static_cast<uint64>(FSettingValueAutoCast(*this->getBoxAlgorithmContext(), 0)) << 32;
m_ui64StimulationToSend = FSettingValueAutoCast(*this->getBoxAlgorithmContext(), 1);
m_ui64LastTimePolled = 0;
m_ui64PreviousTime = 0;
return true;
}
......@@ -32,17 +34,12 @@ boolean CBoxAlgorithmTimeout::uninitialize(void)
boolean CBoxAlgorithmTimeout::processClock(IMessageClock& rMessageClock)
{
if (m_bTimeoutReached)
{
return true;
}
// if there was nothing received on the input for a period of time we raise the
// timeout flag and let the box send a stimulation
if (getPlayerContext().getCurrentTime() > m_ui64LastTimePolled + m_ui64Timeout)
if (m_ui32TimeoutState == 0 && getPlayerContext().getCurrentTime() > m_ui64LastTimePolled + m_ui64Timeout)
{
getLogManager() << LogLevel_Info << "Timeout reached" << "\n";
m_bTimeoutReached = true;
m_ui32TimeoutState = 1;
}
getBoxAlgorithmContext()->markAlgorithmAsReadyToProcess();
......@@ -72,20 +69,24 @@ boolean CBoxAlgorithmTimeout::processInput(uint32 ui32InputIndex)
boolean CBoxAlgorithmTimeout::process(void)
{
// If the timeout is reached we send the stimulation on the output 0
if (m_bTimeoutReached)
{
IStimulationSet* l_pStimulationSet = m_oStimulationEncoder.getInputStimulationSet();
l_pStimulationSet->clear();
uint64 l_ui64StimulationDate = this->getPlayerContext().getCurrentTime();
IStimulationSet* l_pStimulationSet = m_oStimulationEncoder.getInputStimulationSet();
l_pStimulationSet->clear();
l_pStimulationSet->appendStimulation(m_ui64StimulationToSend, l_ui64StimulationDate, 0);
const uint64 l_ui64StimulationDate = this->getPlayerContext().getCurrentTime();
// encoding the stimulation
m_oStimulationEncoder.encodeBuffer();
this->getDynamicBoxContext().markOutputAsReadyToSend(0, m_ui64LastTimePolled, l_ui64StimulationDate);
// If the timeout is reached we send the stimulation on the output 0
if (m_ui32TimeoutState == 1)
{
l_pStimulationSet->appendStimulation(m_ui64StimulationToSend, l_ui64StimulationDate, 0);
m_ui32TimeoutState = 2;
}
// we need to send an empty chunk even if there's no stim
m_oStimulationEncoder.encodeBuffer();
this->getDynamicBoxContext().markOutputAsReadyToSend(0, m_ui64PreviousTime, l_ui64StimulationDate);
m_ui64PreviousTime = l_ui64StimulationDate;
return true;
}
......@@ -41,9 +41,10 @@ namespace OpenViBEPlugins
OpenViBEToolkit::TStimulationEncoder < CBoxAlgorithmTimeout > m_oStimulationEncoder;
private:
OpenViBE::boolean m_bTimeoutReached;
OpenViBE::uint32 m_ui32TimeoutState; // 0 == no timeout, 1 == timeout, 2 == timeout sent
OpenViBE::uint64 m_ui64Timeout;
OpenViBE::uint64 m_ui64LastTimePolled;
OpenViBE::uint64 m_ui64PreviousTime;
OpenViBE::uint64 m_ui64StimulationToSend;
};
......@@ -67,7 +68,7 @@ namespace OpenViBEPlugins
virtual OpenViBE::CString getShortDescription(void) const { return OpenViBE::CString("Sends a stimulation after a period of time without receiving signal"); }
virtual OpenViBE::CString getDetailedDescription(void) const { return OpenViBE::CString("Sends a stimulation after a period of time without receiving signal. Useful for stopping scenarios after hardware disconnection."); }
virtual OpenViBE::CString getCategory(void) const { return OpenViBE::CString("Stimulation"); }
virtual OpenViBE::CString getVersion(void) const { return OpenViBE::CString("1.0"); }
virtual OpenViBE::CString getVersion(void) const { return OpenViBE::CString("1.1"); }
virtual OpenViBE::CString getStockItemName(void) const { return OpenViBE::CString("gtk-disconnect"); }
virtual OpenViBE::CIdentifier getCreatedClass(void) const { return OVP_ClassId_BoxAlgorithm_Timeout; }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment