Commit 117eb7e7 authored by Jussi Lindgren's avatar Jussi Lindgren

Merge branch 'wip-jlindgre-fix-gmobilab-coexistence' of...

Merge branch 'wip-jlindgre-fix-gmobilab-coexistence' of git+ssh://scm.gforge.inria.fr//gitroot/openvibe/openvibe into release-1.2.1-bugfixes
parents bbeaf72e bf2425bc
......@@ -10,16 +10,6 @@
# Adds include path
# ---------------------------------
# We have the following block to make sure gUSBAmp is not on the system. It will always override
# mobilab by default until we can figure out how to have both gUSBAmp and gMobilab drivers built
# in at the same time.
INCLUDE("FindThirdPartyGUSBampCAPI")
IF(OV_ThirdPartyGUSBAmp)
MESSAGE(STATUS " NOTE gtec USBAmp has been found, cannot have gMobilab driver in the same executable")
MESSAGE(STATUS " [ SKIP ] GMobiLabCAPI ...")
RETURN()
ENDIF(OV_ThirdPartyGUSBAmp)
IF(WIN32)
# note that the API must be 32bit with OpenViBE
FIND_PATH(PATH_GMobiLabCAPI GMobiLabPlus.h PATHS
......@@ -32,14 +22,15 @@ IF(WIN32)
"C:/Windows/SysWOW64"
${OV_CUSTOM_DEPENDENCIES_PATH})
FIND_LIBRARY(LIB_GMobiLabCAPI GMobiLabplus PATHS ${PATH_GMobiLabCAPI}/x86)
IF(PATH_GMobiLabCAPI AND PATH_GMobiLabDLL AND LIB_GMobiLabCAPI)
MESSAGE(STATUS " Found GMobiLabCAPI ...")
MESSAGE(STATUS " [ OK ] lib ${LIB_GMobiLabCAPI}")
INCLUDE_DIRECTORIES(${PATH_GMobiLabCAPI})
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${LIB_GMobiLabCAPI} )
# Do not link to the dll! Its opened runtime with dlopen()
# TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${LIB_GMobiLabCAPI} )
INSTALL(PROGRAMS ${PATH_GMobiLabDLL}/gMOBIlabplus.dll DESTINATION "bin")
......@@ -48,6 +39,7 @@ IF(WIN32)
ELSE(PATH_GMobiLabCAPI AND PATH_GMobiLabDLL AND LIB_GMobiLabCAPI)
MESSAGE(STATUS " FAILED to find GMobiLabPlusAPI + lib + dll")
MESSAGE(STATUS " Results were ${PATH_GMobiLabCAPI} AND ${PATH_GMobiLabDLL} AND ${LIB_GMobiLabCAPI}")
ENDIF(PATH_GMobiLabCAPI AND PATH_GMobiLabDLL AND LIB_GMobiLabCAPI)
ENDIF(WIN32)
......@@ -57,7 +49,8 @@ IF(UNIX)
MESSAGE(STATUS " Found GMobiLabPlusAPI...")
MESSAGE(STATUS " [ OK ] Third party lib ${gMOBIlabplus_LIBRARY}")
ADD_DEFINITIONS(-DTARGET_HAS_ThirdPartyGMobiLabPlusAPI)
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${gMOBIlabplus_LIBRARY} )
# Do not link to the dll! Its opened runtime with dlopen()
# TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${gMOBIlabplus_LIBRARY} )
ELSE(gMOBIlabplus_LIBRARY)
MESSAGE(STATUS " FAILED to find GMobiLabPlusAPI... (optional)")
MESSAGE(STATUS " : If it should be found, see that 'gmobilabapi.so' link exists on the fs, with no numeric suffixes in the filename.")
......
......@@ -4,12 +4,6 @@
# Adds include path
# ---------------------------------
IF(OV_ThirdPartyGMobilab)
MESSAGE(STATUS " NOTE gtec Mobilab has already been found, cannot have gUSBAmp driver in the same executable")
MESSAGE(STATUS " [ SKIP ] gUSBBampCAPI...")
RETURN()
ENDIF(OV_ThirdPartyGMobilab)
IF(WIN32)
FIND_PATH(PATH_GUSBampCAPI gUSBamp.h PATHS
"C:/Program Files/gtec/gUSBampCAPI/API"
......
......@@ -10,12 +10,10 @@
#if defined TARGET_HAS_ThirdPartyGMobiLabPlusAPI
#ifndef GMOBILABPLUS_API
#ifdef TARGET_OS_Windows
#include <Windows.h>
#endif
#include <gMOBIlabplus.h>
#endif
// #ifdef TARGET_OS_Windows
// #include <Windows.h>
// #endif
#include <gtk/gtk.h>
......
......@@ -11,7 +11,6 @@
#include "ovasIDriver.h"
#include "../ovasCHeader.h"
#include "../ovasCSettingsHelper.h"
#include "../ovasCSettingsHelperOperators.h"
......@@ -19,10 +18,11 @@
#ifdef TARGET_OS_Windows
#include <Windows.h>
#endif
#include <gMOBIlabplus.h>
namespace OpenViBEAcquisitionServer
{
class CDriverGTecGMobiLabPlusPrivate; // fwd declare
/**
* \class CDriverGTecGMobiLabPlus
* \author Lucie Daubigney (Supelec Metz)
......@@ -68,16 +68,19 @@ namespace OpenViBEAcquisitionServer
//params
std::string m_oPortName;
OpenViBE::boolean m_bTestMode;
//usefull data to communicate with the gTec module
_BUFFER_ST m_oBuffer;
HANDLE m_oDevice;
_AIN m_oAnalogIn;
// Pointers do gtec-specific data and function pointers
OpenViBEAcquisitionServer::CDriverGTecGMobiLabPlusPrivate* m_pGtec;
// Register the function pointers from the dll. (The dll approach
// is used with gMobilab to avoid conflicts with the gUSBAmp lib)
OpenViBE::boolean registerLibraryFunctions(void);
#if defined(TARGET_OS_Windows)
OVERLAPPED m_oOverlap;
HINSTANCE m_pLibrary;
#elif defined(TARGET_OS_Linux)
void* m_pLibrary;
#endif
private:
void allowAnalogInputs(OpenViBE::uint32 ui32ChannelIndex);
......
/*
* The only purpose of this class is to hide the gtec API
* data types from the ov driver header. An approach resembling
* this is sometimes called a 'd-pointer'.
*
* Previous situation:
*
* gUsbamp ov driver header depends on gtec gUSBAmp API types
* gMobilab ov driver header depends on gtec gMobilab API types
* Acquisition Server includes both these driver headers
*
* But the gtec types are declared differently in the two gtec APIs.
* Hence we get a conflict if both headers are included by the
* same compilation unit.
*
* With this class, the gmobilab API is not exposed just by
* including ovasCDriverGtecMobiLabPlus.h to the Acquisition Server.
*
*/
#ifndef __OpenViBE_AcquisitionServer_CDriverGTecGMobiLabPlusPrivate_H__
#define __OpenViBE_AcquisitionServer_CDriverGTecGMobiLabPlusPrivate_H__
#if defined TARGET_HAS_ThirdPartyGMobiLabPlusAPI
#include <gMOBIlabplus.h>
namespace OpenViBEAcquisitionServer
{
/**
* \author Jussi T. Lindgren (Inria)
*
* The class collects all members that used to be in
* CDriverGtecMobiLabPlus header that depend on the gmobilab API.
*
*/
class CDriverGTecGMobiLabPlusPrivate
{
public:
//useful data to communicate with the gTec module
_BUFFER_ST m_oBuffer;
HANDLE m_oDevice;
_AIN m_oAnalogIn;
#if defined(TARGET_OS_Windows)
OVERLAPPED m_oOverlap;
#endif
// These functions are defined in the gmobilab library
#if defined(TARGET_OS_Windows)
typedef HANDLE(__stdcall *OV_GT_OpenDevice)(LPSTR lpPort);
typedef BOOL(__stdcall *OV_GT_CloseDevice)(HANDLE hDevice);
typedef BOOL(__stdcall *OV_GT_SetTestmode)(HANDLE hDevice, BOOL Testmode);
typedef BOOL(__stdcall *OV_GT_StartAcquisition)(HANDLE hDevice);
typedef BOOL(__stdcall *OV_GT_GetData)(HANDLE hDevice, _BUFFER_ST *buffer, LPOVERLAPPED lpOvl);
typedef BOOL(__stdcall *OV_GT_InitChannels)(HANDLE hDevice, _AIN analogCh, _DIO digitalCh);
typedef bool(__stdcall *OV_GT_StopAcquisition)(HANDLE hDevice);
typedef bool(__stdcall *OV_GT_GetLastError)(UINT * LastError);
typedef bool(__stdcall *OV_GT_TranslateErrorCode)(_ERRSTR *ErrorString, UINT ErrorCode);
#else
typedef HANDLE(*OV_GT_OpenDevice)(const char* lpPort);
typedef bool(*OV_GT_CloseDevice)(HANDLE hDevice);
typedef bool(*OV_GT_SetTestmode)(HANDLE hDevice, bool Testmode);
typedef bool(*OV_GT_StartAcquisition)(HANDLE hDevice);
typedef bool(*OV_GT_GetData)(HANDLE hDevice, _BUFFER_ST *buffer);
typedef bool(*OV_GT_InitChannels)(HANDLE hDevice, _AIN analogCh, _DIO digitalCh);
typedef bool(*OV_GT_StopAcquisition)(HANDLE hDevice);
typedef bool(*OV_GT_GetLastError)(unsigned int* LastError);
typedef bool(*OV_GT_TranslateErrorCode)(_ERRSTR *ErrorString, unsigned int ErrorCode);
#endif
// Function pointers to the dll
OV_GT_OpenDevice m_fOpenDevice;
OV_GT_CloseDevice m_fCloseDevice;
OV_GT_SetTestmode m_fSetTestmode;
OV_GT_StartAcquisition m_fStartAcquisition;
OV_GT_GetData m_fGetData;
OV_GT_InitChannels m_fInitChannels;
OV_GT_StopAcquisition m_fStopAcquisition;
OV_GT_GetLastError m_fGetLastError;
OV_GT_TranslateErrorCode m_fTranslateErrorCode;
};
};
#endif // TARGET_HAS_ThirdPartyGMobiLabPlusAPI
#endif // __OpenViBE_AcquisitionServer_CDriverGTecGMobiLabPlusPrivate_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