Commit 600cd21b authored by Jussi Lindgren's avatar Jussi Lindgren

Merge remote-tracking branch 'origin/wip-jlindgre-merge-cognionics'

* origin/wip-jlindgre-merge-cognionics:
  Contrib: Added Cognionics driver
parents acbf21c0 644977c0
......@@ -24,6 +24,7 @@ ENDFUNCTION(OV_ADD_CONTRIB_DRIVER)
OV_ADD_CONTRIB_DRIVER("${CMAKE_SOURCE_DIR}/contrib/plugins/server-drivers/brainmaster-discovery")
OV_ADD_CONTRIB_DRIVER("${CMAKE_SOURCE_DIR}/contrib/plugins/server-drivers/brainproducts-actichamp")
OV_ADD_CONTRIB_DRIVER("${CMAKE_SOURCE_DIR}/contrib/plugins/server-drivers/brainproducts-brainvisionrecorder")
OV_ADD_CONTRIB_DRIVER("${CMAKE_SOURCE_DIR}/contrib/plugins/server-drivers/cognionics")
OV_ADD_CONTRIB_DRIVER("${CMAKE_SOURCE_DIR}/contrib/plugins/server-drivers/ctfvsm-meg")
OV_ADD_CONTRIB_DRIVER("${CMAKE_SOURCE_DIR}/contrib/plugins/server-drivers/field-trip-protocol")
OV_ADD_CONTRIB_DRIVER("${CMAKE_SOURCE_DIR}/contrib/plugins/server-drivers/gtec-gipsa")
......
......@@ -9,6 +9,7 @@
#include "ovasCDriverBrainmasterDiscovery.h"
#include "ovasCDriverBrainProductsActiCHamp.h"
#include "ovasCDriverBrainProductsBrainVisionRecorder.h"
#include "ovasCDriverCognionics.h"
#include "ovasCDriverCtfVsmMeg.h"
#include "ovasCDriverGTecGUSBamp.h"
#include "ovasCDriverGTecGUSBampLegacy.h"
......@@ -27,6 +28,9 @@ namespace OpenViBEContributions {
void initiateContributions(OpenViBEAcquisitionServer::CAcquisitionServerGUI* pGUI, OpenViBEAcquisitionServer::CAcquisitionServer* pAcquisitionServer, const OpenViBE::Kernel::IKernelContext& rKernelContext, std::vector<OpenViBEAcquisitionServer::IDriver*>* vDriver)
{
vDriver->push_back(new OpenViBEAcquisitionServer::CDriverBrainProductsBrainVisionRecorder(pAcquisitionServer->getDriverContext()));
#if defined WIN32
vDriver->push_back(new OpenViBEAcquisitionServer::CDriverCognionics(pAcquisitionServer->getDriverContext()));
#endif
vDriver->push_back(new OpenViBEAcquisitionServer::CDriverCtfVsmMeg(pAcquisitionServer->getDriverContext()));
#if defined TARGET_HAS_ThirdPartyGUSBampCAPI
vDriver->push_back(new OpenViBEAcquisitionServer::CDriverGTecGUSBamp(pAcquisitionServer->getDriverContext()));
......
#if defined(WIN32)
#include "ovasCConfigurationCognionics.h"
using namespace OpenViBE;
using namespace OpenViBE::Kernel;
using namespace OpenViBEAcquisitionServer;
using namespace std;
/*_________________________________________________
Insert callback to specific widget here
Example with a button that launch a calibration of the device:
//Callback connected to a dedicated gtk button:
static void button_calibrate_pressed_cb(::GtkButton* pButton, void* pUserData)
{
CConfigurationCognionics* l_pConfig=static_cast<CConfigurationCognionics*>(pUserData);
l_pConfig->buttonCalibratePressedCB();
}
//Callback actually called:
void CConfigurationGTecGUSBamp::buttonCalibratePressedCB(void)
{
// Connect to the hardware, ask for calibration, verify the return code, etc.
}
_________________________________________________*/
// If you added more reference attribute, initialize them here
CConfigurationCognionics::CConfigurationCognionics(IDriverContext& rDriverContext, const char* sGtkBuilderFileName,
uint32& rCOMPORT)
:CConfigurationBuilder(sGtkBuilderFileName)
,m_rDriverContext(rDriverContext)
,m_rCOMPORT(rCOMPORT)
{
}
boolean CConfigurationCognionics::preConfigure(void)
{
if(! CConfigurationBuilder::preConfigure())
{
return false;
}
::GtkSpinButton* l_pSpinButtonCOMPORT=GTK_SPIN_BUTTON(gtk_builder_get_object(m_pBuilderConfigureInterface, "spinbutton_comport"));
gtk_spin_button_set_value(l_pSpinButtonCOMPORT, m_rCOMPORT);
// Connect here all callbacks
// Example:
// g_signal_connect(gtk_builder_get_object(m_pBuilderConfigureInterface, "button_calibrate"), "pressed", G_CALLBACK(button_calibrate_pressed_cb), this);
// Insert here the pre-configure code.
// For example, you may want to check if a device is currently connected
// and if more than one are connected. Then you can list in a dedicated combo-box
// the device currently connected so the user can choose which one he wants to acquire from.
return true;
}
boolean CConfigurationCognionics::postConfigure(void)
{
if(m_bApplyConfiguration)
{
::GtkSpinButton* l_pSpinButtonCOMPORT=GTK_SPIN_BUTTON(gtk_builder_get_object(m_pBuilderConfigureInterface, "spinbutton_comport"));
m_rCOMPORT=(uint32)::gtk_spin_button_get_value(l_pSpinButtonCOMPORT);
//printf("Selected COM Port: %d", m_rCOMPORT);
// If the user pressed the "apply" button, you need to save the changes made in the configuration.
// For example, you can save the connection ID of the selected device:
// m_ui32ConnectionID = <value-from-gtk-widget>
}
if(! CConfigurationBuilder::postConfigure()) // normal header is filled (Subject ID, Age, Gender, channels, sampling frequency), ressources are realesed
{
return false;
}
return true;
}
#endif // WIN32
#ifndef __OpenViBE_AcquisitionServer_CConfigurationCognionics_H__
#define __OpenViBE_AcquisitionServer_CConfigurationCognionics_H__
#include "../ovasCConfigurationBuilder.h"
#include "ovasIDriver.h"
#include <gtk/gtk.h>
namespace OpenViBEAcquisitionServer
{
/**
* \class CConfigurationCognionics
* \author Mike Chi (Cognionics, Inc.)
* \copyright AGPL3
* \date Thu Apr 18 21:19:49 2013
* \brief The CConfigurationCognionics handles the configuration dialog specific to the Cognionics device.
*
* TODO: details
*
* \sa CDriverCognionics
*/
class CConfigurationCognionics : public OpenViBEAcquisitionServer::CConfigurationBuilder
{
public:
// you may have to add to your constructor some reference parameters
// for example, a connection ID:
//CConfigurationCognionics(OpenViBEAcquisitionServer::IDriverContext& rDriverContext, const char* sGtkBuilderFileName, OpenViBE::uint32& rConnectionId);
CConfigurationCognionics(OpenViBEAcquisitionServer::IDriverContext& rDriverContext, const char* sGtkBuilderFileName, OpenViBE::uint32& rCOMPORT);
virtual OpenViBE::boolean preConfigure(void);
virtual OpenViBE::boolean postConfigure(void);
OpenViBE::uint32& m_rCOMPORT;
protected:
OpenViBEAcquisitionServer::IDriverContext& m_rDriverContext;
private:
/*
* Insert here all specific attributes, such as a connection ID.
* use references to directly modify the corresponding attribute of the driver
* Example:
*/
};
};
#endif // __OpenViBE_AcquisitionServer_CConfigurationCognionics_H__
#ifndef __OpenViBE_AcquisitionServer_CDriverCognionics_H__
#define __OpenViBE_AcquisitionServer_CDriverCognionics_H__
#include "ovasIDriver.h"
#include "../ovasCHeader.h"
#include <openvibe/ov_all.h>
#include "../ovasCSettingsHelper.h"
#include "../ovasCSettingsHelperOperators.h"
namespace OpenViBEAcquisitionServer
{
/**
* \class CDriverCognionics
* \author Mike Chi (Cognionics, Inc.)
* \copyright AGPL3
* \date Thu Apr 18 21:19:49 2013
* \brief The CDriverCognionics allows the acquisition server to acquire data from a Cognionics device.
*
* TODO: details
*
* \sa CConfigurationCognionics
*/
class CDriverCognionics : public OpenViBEAcquisitionServer::IDriver
{
public:
CDriverCognionics(OpenViBEAcquisitionServer::IDriverContext& rDriverContext);
virtual ~CDriverCognionics(void);
virtual const char* getName(void);
virtual OpenViBE::boolean initialize(
const OpenViBE::uint32 ui32SampleCountPerSentBlock,
OpenViBEAcquisitionServer::IDriverCallback& rCallback);
virtual OpenViBE::boolean uninitialize(void);
virtual OpenViBE::boolean start(void);
virtual OpenViBE::boolean stop(void);
virtual OpenViBE::boolean loop(void);
virtual OpenViBE::boolean isConfigurable(void);
virtual OpenViBE::boolean configure(void);
virtual const OpenViBEAcquisitionServer::IHeader* getHeader(void) { return &m_oHeader; }
virtual OpenViBE::boolean isFlagSet(
const OpenViBEAcquisitionServer::EDriverFlag eFlag) const
{
return eFlag==DriverFlag_IsUnstable;
}
protected:
SettingsHelper m_oSettings;
OpenViBEAcquisitionServer::IDriverCallback* m_pCallback;
// Replace this generic Header with any specific header you might have written
OpenViBEAcquisitionServer::CHeader m_oHeader;
OpenViBE::uint32 m_ui32SampleCountPerSentBlock;
OpenViBE::float32* m_pSample;
private:
/*
* Insert here all specific attributes, such as USB port number or device ID.
* Example :
*/
OpenViBE::uint32 m_ui32ComPort;
};
};
#endif // __OpenViBE_AcquisitionServer_CDriverCognionics_H__
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