Commit 9d05fa07 authored by Jussi Lindgren's avatar Jussi Lindgren

Drivers: Fix candidate for VAmp driver

Merged from patches by Laurent Bonnet and Jussi T. Lindgren.
parent 3d449abc
......@@ -221,9 +221,6 @@ boolean CConfigurationBrainProductsVAmp::preConfigure(void)
m_iDeviceCount = l_uint32DeviceCount;
// acquisition mode
gtk_combo_box_set_active(GTK_COMBO_BOX(m_pAcquisitionMode), m_pHeaderBrainProductsVAmp->getAcquisitionMode());
//SETTINGS:
//Adding all possible settings : 7/8/9/10 and -1
// and setting active text
......@@ -433,9 +430,9 @@ void CConfigurationBrainProductsVAmp::comboBoxAcquisitionModeCB(::GtkComboBox* p
{
gint l_iAcquisitionMode=gtk_combo_box_get_active(pComboBox);
gtk_spin_button_set_value(GTK_SPIN_BUTTON(m_pNumberOfChannels),
m_pHeaderBrainProductsVAmp->getEEGChannelCount(l_iAcquisitionMode)+
m_pHeaderBrainProductsVAmp->getEEGChannelCount(l_iAcquisitionMode)/*+
m_pHeaderBrainProductsVAmp->getAuxiliaryChannelCount(l_iAcquisitionMode)+
m_pHeaderBrainProductsVAmp->getTriggerChannelCount(l_iAcquisitionMode));
m_pHeaderBrainProductsVAmp->getTriggerChannelCount(l_iAcquisitionMode)*/); // we do not need to add trigger and Aux channels, this is done at initialization time as it is a token configuration.
gtk_widget_set_sensitive(GTK_WIDGET(gtk_builder_get_object(m_pBuilderConfigureInterface, "button_change_channel_names")), l_iAcquisitionMode!=AcquisitionMode_VAmp4Fast);
gtk_widget_set_sensitive(GTK_WIDGET(gtk_builder_get_object(m_pBuilderConfigureInterface, "button_fast_mode_settings")), l_iAcquisitionMode==AcquisitionMode_VAmp4Fast);
}
......
......@@ -28,9 +28,6 @@ CDriverBrainProductsVAmp::CDriverBrainProductsVAmp(IDriverContext& rDriverContex
,m_oSettings("AcquisitionServer_Driver_BrainProducts-VAmp", m_rDriverContext.getConfigurationManager())
,m_bAcquireAuxiliaryAsEEG(false)
,m_bAcquireTriggerAsEEG(false)
,m_oHeader(
m_bAcquireAuxiliaryAsEEG,
m_bAcquireTriggerAsEEG)
,m_pCallback(NULL)
,m_ui32SampleCountPerSentBlock(0)
,m_ui32TotalSampleCount(0)
......@@ -62,7 +59,6 @@ CDriverBrainProductsVAmp::CDriverBrainProductsVAmp(IDriverContext& rDriverContex
m_oSettings.add("AcquireAuxiliaryAsEEG", &m_bAcquireAuxiliaryAsEEG);
m_oSettings.add("AcquireTriggerAsEEG", &m_bAcquireTriggerAsEEG);
m_oSettings.load();
}
CDriverBrainProductsVAmp::~CDriverBrainProductsVAmp(void)
......@@ -94,6 +90,39 @@ boolean CDriverBrainProductsVAmp::initialize(
m_rDriverContext.getLogManager() << LogLevel_Error << "[INIT] VAmp Driver: Channel count or frequency not set.\n";
return false;
}
m_ui32AcquisitionMode=m_oHeader.getAcquisitionMode();
m_ui32EEGChannelCount=m_oHeader.getEEGChannelCount(m_ui32AcquisitionMode);
m_ui32AuxiliaryChannelCount=(m_bAcquireAuxiliaryAsEEG ? m_oHeader.getAuxiliaryChannelCount(m_ui32AcquisitionMode) : 0);
m_ui32TriggerChannelCount=(m_bAcquireTriggerAsEEG ? m_oHeader.getTriggerChannelCount(m_ui32AcquisitionMode) : 0);
m_oHeader.setChannelCount(m_ui32EEGChannelCount + m_ui32AuxiliaryChannelCount + m_ui32TriggerChannelCount);
// there can be 2 or 0 aux channels depending on the mode
if(m_bAcquireAuxiliaryAsEEG)
{
m_rDriverContext.getLogManager() << LogLevel_Trace << "[INIT] VAmp Driver: will acquire aux as EEG\n";
char l_sBuffer[32];
for(uint32 i = 0; i < m_oHeader.getAuxiliaryChannelCount(m_ui32AcquisitionMode); i++)
{
sprintf(l_sBuffer,"Aux%i", i+1);
m_oHeader.setChannelName(m_ui32EEGChannelCount+i,CString(l_sBuffer));
}
}
else
{
m_rDriverContext.getLogManager() << LogLevel_Trace << "[INIT] VAmp Driver: will NOT acquire aux as EEG\n";
}
// always one trigger channel
if(m_bAcquireTriggerAsEEG)
{
m_rDriverContext.getLogManager() << LogLevel_Trace << "[INIT] VAmp Driver: will acquire trigger as EEG\n";
m_oHeader.setChannelName(m_ui32EEGChannelCount + m_ui32AuxiliaryChannelCount,"Triggers");
}
else
{
m_rDriverContext.getLogManager() << LogLevel_Trace << "[INIT] VAmp Driver: will NOT acquire trigger as EEG\n";
}
// Builds up a buffer to store acquired samples. This buffer will be sent to the acquisition server later.
m_pSample=new float32[m_oHeader.getChannelCount()*ui32SampleCountPerSentBlock];
......@@ -110,16 +139,6 @@ boolean CDriverBrainProductsVAmp::initialize(
//__________________________________
// Hardware initialization
if(m_bAcquireAuxiliaryAsEEG) m_rDriverContext.getLogManager() << LogLevel_Trace << "[INIT] VAmp Driver: will acquire aux as EEG\n";
else m_rDriverContext.getLogManager() << LogLevel_Trace << "[INIT] VAmp Driver: will NOT acquire aux as EEG\n";
if(m_bAcquireTriggerAsEEG) m_rDriverContext.getLogManager() << LogLevel_Trace << "[INIT] VAmp Driver: will acquire trigger as EEG\n";
else m_rDriverContext.getLogManager() << LogLevel_Trace << "[INIT] VAmp Driver: will NOT acquire trigger as EEG\n";
m_ui32AcquisitionMode=m_oHeader.getAcquisitionMode();
m_ui32EEGChannelCount=m_oHeader.getEEGChannelCount(m_ui32AcquisitionMode);
m_ui32AuxiliaryChannelCount=m_oHeader.getAuxiliaryChannelCount(m_ui32AcquisitionMode);
m_ui32TriggerChannelCount=m_oHeader.getTriggerChannelCount(m_ui32AcquisitionMode);
// if no device selected with the properties dialog
// we take the last device connected
if(l_i32DeviceId == FA_ID_INVALID)
......@@ -234,6 +253,24 @@ boolean CDriverBrainProductsVAmp::loop(void)
uint32 l_uint32ReadZeroCount = 0;
#endif
if(m_bFirstStart)
{
//empty buffer
switch(m_ui32AcquisitionMode)
{
case AcquisitionMode_VAmp16:
while(faGetData(l_i32DeviceId, &l_DataBufferVAmp16, l_uint32ReadLengthVAmp16) > 0);
break;
case AcquisitionMode_VAmp8:
while(faGetData(l_i32DeviceId, &l_DataBufferVAmp8, l_uint32ReadLengthVAmp8) > 0);
break;
case AcquisitionMode_VAmp4Fast:
while(faGetData(l_i32DeviceId, &l_DataBufferVamp4Fast, l_uint32ReadLengthVamp4Fast) > 0);
break;
}
m_bFirstStart = false;
}
while(l_i32ReceivedSamples < m_ui32SampleCountPerSentBlock)
{
// we need to "getData" with the right output structure according to acquisition mode
......
......@@ -30,11 +30,8 @@ namespace
//___________________________________________________________________//
// //
CHeaderBrainProductsVAmp::CHeaderBrainProductsVAmp(boolean bAcquireAuxiliaryAsEEG, boolean bAcquireTriggerAsEEG)
CHeaderBrainProductsVAmp::CHeaderBrainProductsVAmp(void)
{
System::Memory::set(g_vAuxiliaryChannelCount, sizeof(g_vAuxiliaryChannelCount)*(bAcquireAuxiliaryAsEEG?0:1), 0);
System::Memory::set(g_vTriggerChannelCount, sizeof(g_vTriggerChannelCount)*(bAcquireTriggerAsEEG?0:1), 0);
m_pBasicHeader = new CHeader();
// additional information
......@@ -64,17 +61,17 @@ void CHeaderBrainProductsVAmp::reset(void)
uint32 CHeaderBrainProductsVAmp::getEEGChannelCount(uint32 ui32AcquisitionMode)
{
return g_vEEGChannelCount[ui32AcquisitionMode];
return ::g_vEEGChannelCount[ui32AcquisitionMode];
}
uint32 CHeaderBrainProductsVAmp::getAuxiliaryChannelCount(uint32 ui32AcquisitionMode)
{
return g_vAuxiliaryChannelCount[ui32AcquisitionMode];
return ::g_vAuxiliaryChannelCount[ui32AcquisitionMode];
}
uint32 CHeaderBrainProductsVAmp::getTriggerChannelCount(uint32 ui32AcquisitionMode)
{
return g_vTriggerChannelCount[ui32AcquisitionMode];
return ::g_vTriggerChannelCount[ui32AcquisitionMode];
}
// Pair information
......
......@@ -26,7 +26,7 @@ namespace OpenViBEAcquisitionServer
{
public:
CHeaderBrainProductsVAmp(OpenViBE::boolean bAcquireAuxiliaryAsEEG, OpenViBE::boolean bAcquireTriggerAsEEG);
CHeaderBrainProductsVAmp(void);
virtual ~CHeaderBrainProductsVAmp(void);
virtual void reset(void);
......
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