Commit 679f56b0 authored by Jussi Lindgren's avatar Jussi Lindgren

Merge branch 'master' of...

Merge branch 'master' of git+ssh://scm.gforge.inria.fr//gitroot/openvibe/openvibe into wip-jlindgre-multicore-scheduling

Conflicts:
	applications/platform/designer/src/ovd_main.cpp
	kernel/src/kernel/player/ovkCSchedulerMulticore.cpp
	kernel/src/kernel/player/ovkCSchedulerMulticore.h
parents daae40db 7f30cc68
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
# Here we set a few policies to get rid of warnings on newer cmakes.
# we should update the scripts after upgrading each platform's cmake to 3.x.
if(POLICY CMP0026)
cmake_policy(SET CMP0026 OLD)
endif()
if(POLICY CMP0043)
cmake_policy(SET CMP0043 OLD)
endif()
if(POLICY CMP0048)
cmake_policy(SET CMP0048 OLD)
endif()
PROJECT(OpenVIBE)
# These versions are used by the subprojects by default.
# If you wish to maintain specific version numbers for a subproject, please do so in the projects CMakeLists.txt
SET(OV_GLOBAL_VERSION_MAJOR 1)
SET(OV_GLOBAL_VERSION_MINOR 0)
SET(OV_GLOBAL_VERSION_PATCH 1+git)
SET(OV_GLOBAL_VERSION_MINOR 1)
SET(OV_GLOBAL_VERSION_PATCH 0+git)
# Default is to build to dist/. If you wish a custom install, set your own MAKE_INSTALL_PREFIX when you call CMake. Safest to do under a fakeroot.
#IF(NOT CMAKE_INSTALL_PREFIX)
......@@ -16,11 +28,16 @@ MESSAGE(STATUS "Appending compilation flags...")
SET(OV_CUSTOM_DEPENDENCIES_PATH "${CMAKE_SOURCE_DIR}/dependencies")
# If OpenMP is available, it will allow Eigen to use multiple cores in matrix math.
INCLUDE("FindOpenMP")
IF(OPENMP_FOUND)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
ENDIF(OPENMP_FOUND)
IF(WIN32)
ADD_DEFINITIONS("-DNOMINMAX -DBOOST_ALL_NO_LIB")
# the /openmp switch allows eigen to use multiple cores. Switch /arch:SSE2 enables vectorization. Remove if your CPU/compiler doesn't support them.
SET(OV_EIGEN_FLAGS "/openmp /arch:SSE2")
# Switch /arch:SSE2 enables vectorization. Remove if your CPU/compiler doesn't support it.
SET(OV_EIGEN_FLAGS "/arch:SSE2")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4355 /MP ${OV_EIGEN_FLAGS}")
SET(OV_WIN32_BOOST_VERSION "1_47")
ELSEIF(UNIX)
......@@ -38,11 +55,26 @@ ELSEIF(UNIX)
MESSAGE(WARNING "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. In the future this may be required.")
ENDIF(COMPILER_SUPPORTS_CXX11)
# the -fopenmp switch allows eigen to use multiple cores; Switch -msse2 is for vectorization. Remove if your CPU/compiler doesn't support them.
SET(OV_EIGEN_FLAGS "-fopenmp -msse2")
# Switch -msse2 enables vectorization. Remove if your CPU/compiler doesn't support it.
SET(OV_EIGEN_FLAGS "-msse2")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall ${OV_EIGEN_FLAGS}")
# This ENV var is needed to locate our custom IT++ on Linux
SET(ENV{PKG_CONFIG_PATH} "${OV_CUSTOM_DEPENDENCIES_PATH}/lib/pkgconfig")
SET(ENV{PKG_CONFIG_PATH} "${OV_CUSTOM_DEPENDENCIES_PATH}/lib/pkgconfig")
if (${CMAKE_SYSTEM_PROCESSOR} MATCHES i386|i586|i686)
set ( BIT_MODE "32")
else ()
set ( BIT_MODE "64")
endif ()
if(EXISTS "/etc/debian_version")
set (PLATFORM "Debian")
endif(EXISTS "/etc/debian_version")
if(EXISTS "/etc/fedora-release")
set (PLATFORM "Fedora")
endif(EXISTS "/etc/fedora-release")
ELSE(WIN32)
MESSAGE(WARNING "Warning: unknown platform")
ENDIF(WIN32)
......@@ -70,6 +102,11 @@ SET(OV_COMPILE_TESTS "true")
# This option is mostly of interest to hackers who are interested in using a minimal OpenViBE kernel in their own projects.
# SET(OV_DISABLE_GTK "true")
# The CoAdapt P300 speller is currently only working in the v0.18 version
# of OpenViBE. It is intended to be replaced by an even more robust and easy
# to use P300 speller from the same authors.
SET(OV_DISABLE_COADAPT_P300 "1")
# By setting SKIP[_FOLDER]* you can skip a subtree (example: SKIP_A_B_C skips folder a/b/c and all its subfolders if any)
# Skip building documentation
......@@ -82,6 +119,7 @@ SET(SKIP_DOCUMENTATION "1")
#SET(SKIP_APPLICATIONS_DEMOS "1")
#SET(SKIP_CONTRIB_APPLICATIONS "1")
IF(UNIX)
# On Linux, the presence of matlab plugin .so can cause crashes in Simple DSP box as the two may use different versions of boost which are
# then wrongly exposed to the other party due to the dlopen() flag RTLD_GLOBAL. Unfortunately this flag is needed or the python plugin
......
<OpenViBE-SettingsOverride>
<SettingValue>2.693394e-001 -2.082757e-001 2.391615e-001 2.344401e-001 3.927157e-001 2.381559e-001 1.105450e-001 5.748063e-001 3.098411e-001 2.888676e-001 1.972432e-001 -2.803966e-001 8.610541e-002 -2.669093e-001 -2.873429e-001 -3.080204e-001 -2.313958e-001 -3.049153e-001 -3.205304e-001 -4.424281e-001 -2.981316e-001 -3.624890e-001 -2.713850e-002 -7.049823e-001 -1.550608e-002 -1.321822e-001 1.119925e-001 1.023369e-002 5.826165e-002 -2.615791e-001 -2.637424e-001 -3.941850e-001 4.185020e-001 1.442614e-001 3.069018e-001 3.027673e-001 3.956899e-001 2.814762e-001 2.776705e-001 3.540791e-001 2.828738e-001 3.027926e-001 3.106658e-001 2.946954e-001 8.165735e-001 3.035239e-001 1.979707e-001 2.325919e-001 1.767888e-001 -1.389007e-001 -2.142701e-001 6.029197e-002 1.522051e-001 1.241781e-001 9.543869e-002 2.155692e-001 2.680507e-001 3.076862e-001 3.604533e-001 3.075757e-001 2.513993e-001 2.252315e-001 3.295531e-001 2.891706e-001 4.002560e-001 3.100291e-001 </SettingValue>
<SettingValue>2.703843e-01 -2.033501e-01 2.403197e-01 2.356381e-01 3.924335e-01 2.392063e-01 1.126995e-01 5.732521e-01 3.104990e-01 2.895368e-01 1.986909e-01 -2.802677e-01 8.642671e-02 -2.668902e-01 -2.873131e-01 -3.079679e-01 -2.311899e-01 -3.049967e-01 -3.204300e-01 -4.425812e-01 -2.982544e-01 -3.624583e-01 -1.743516e-02 -7.034854e-01 -5.985984e-03 -1.229407e-01 1.248006e-01 2.071428e-02 6.843323e-02 -2.541336e-01 -2.561801e-01 -3.879860e-01 4.338449e-01 1.443236e-01 3.069893e-01 3.027873e-01 3.956782e-01 2.813831e-01 2.775939e-01 3.539175e-01 2.829925e-01 3.027860e-01 3.108203e-01 2.946542e-01 8.225417e-01 2.972165e-01 1.898254e-01 2.250985e-01 1.687560e-01 -1.534876e-01 -2.300926e-01 4.962169e-02 1.434810e-01 1.137737e-01 8.608912e-02 2.163422e-01 2.683768e-01 3.076638e-01 3.600548e-01 3.077418e-01 2.519825e-01 2.256518e-01 3.292366e-01 2.892911e-01 3.994613e-01 3.099987e-01 </SettingValue>
<SettingValue>6</SettingValue>
<SettingValue>11</SettingValue>
<SettingValue></SettingValue>
</OpenViBE-SettingsOverride>
......@@ -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>
......
......@@ -2,4 +2,5 @@
<SettingValue>-2.942546e-01 -6.720542e-01 6.795273e-01 4.949070e-01 3.561403e-01 7.926104e-01 6.437580e-01 -3.948110e-01 6.555150e-01 </SettingValue>
<SettingValue>3</SettingValue>
<SettingValue>3</SettingValue>
<SettingValue></SettingValue>
</OpenViBE-SettingsOverride>
......@@ -11,6 +11,12 @@ IF(NOT PATH_VRPN)
RETURN()
ENDIF(NOT PATH_VRPN)
INCLUDE("FindThirdPartyCEGUI_Check")
IF(NOT CEGUI_FOUND OR NOT OgreCEGUIRenderer_FOUND)
MESSAGE(STATUS " --> Not building ${PROJECT_NAME}")
RETURN()
ENDIF(NOT CEGUI_FOUND OR NOT OgreCEGUIRenderer_FOUND)
FILE(GLOB_RECURSE source_files src/*.cpp src/*.h src/*.inl)
ADD_EXECUTABLE(${PROJECT_NAME} ${source_files})
......
......@@ -11,6 +11,12 @@ IF(NOT PATH_VRPN)
RETURN()
ENDIF(NOT PATH_VRPN)
INCLUDE("FindThirdPartyCEGUI_Check")
IF(NOT CEGUI_FOUND OR NOT OgreCEGUIRenderer_FOUND)
MESSAGE(STATUS " --> Not building ${PROJECT_NAME}")
RETURN()
ENDIF(NOT CEGUI_FOUND OR NOT OgreCEGUIRenderer_FOUND)
FILE(GLOB_RECURSE source_files src/*.cpp src/*.h src/*.inl)
ADD_EXECUTABLE(${PROJECT_NAME} ${source_files})
......
......@@ -144,6 +144,7 @@ function process(box)
cfg_file:write(" <SettingValue>OVTK_StimulationId_ExperimentStop</SettingValue>\n")
cfg_file:write(string.format(box:get_config(" <SettingValue>${Player_ScenarioDirectory}/classifiers/csp-%db</SettingValue>\n"), i))
cfg_file:write(string.format(" <SettingValue>%d</SettingValue>\n", csp_filter_order))
cfg_file:write(" <SettingValue></SettingValue>\n")
cfg_file:write("</OpenViBE-SettingsOverride>\n")
cfg_file:close()
......@@ -154,6 +155,7 @@ function process(box)
cfg_file:write(" <SettingValue>OVTK_StimulationId_ExperimentStop</SettingValue>\n")
cfg_file:write(string.format(box:get_config(" <SettingValue>${Player_ScenarioDirectory}/classifiers/csp-%dh1</SettingValue>\n"), i))
cfg_file:write(string.format(" <SettingValue>%d</SettingValue>\n", csp_filter_order))
cfg_file:write(" <SettingValue></SettingValue>\n")
cfg_file:write("</OpenViBE-SettingsOverride>\n")
cfg_file:close()
......
......@@ -11,6 +11,12 @@ IF(NOT PATH_VRPN)
RETURN()
ENDIF(NOT PATH_VRPN)
INCLUDE("FindThirdPartyCEGUI_Check")
IF(NOT CEGUI_FOUND OR NOT OgreCEGUIRenderer_FOUND)
MESSAGE(STATUS " --> Not building ${PROJECT_NAME}")
RETURN()
ENDIF(NOT CEGUI_FOUND OR NOT OgreCEGUIRenderer_FOUND)
FILE(GLOB_RECURSE source_files src/*.cpp src/*.h src/*.inl)
ADD_EXECUTABLE(${PROJECT_NAME} ${source_files})
......
......@@ -1726,7 +1726,7 @@ in which step the experiment is. It also triggers
the instructions given to the user.
The &lt;b&gt;Analog Server&lt;/b&gt; provides the feedback value
computed by the classifier (distance to LDA hyperplan).</Text>
computed by the classifier (distance to LDA hyperplane).</Text>
<Attributes>
<Attribute>
<Identifier>(0x473d9a43, 0x97fc0a97)</Identifier>
......
......@@ -187,7 +187,6 @@ int main(int argc, char ** argv)
{
l_sConfigPath = CString(l_oConfiguration.m_sConfigPath.c_str());
}
l_pKernelContext=l_pKernelDesc->createKernel("plugin-inspector", l_sConfigPath );
if(!l_pKernelContext)
{
......
......@@ -56,7 +56,7 @@
</Attribute>
<Attribute>
<Identifier>(0xc46b3d00, 0x3e0454e1)</Identifier>
<Value>(0x00000000, 0x02017c54)</Value>
<Value>(0x00000000, 0x015d7484)</Value>
</Attribute>
<Attribute>
<Identifier>(0xc80ce8af, 0xf699f813)</Identifier>
......@@ -68,6 +68,79 @@
</Attribute>
</Attributes>
</Box>
<Box>
<Identifier>(0x00002e3e, 0x00002059)</Identifier>
<Name>Stimuli to TCP</Name>
<AlgorithmClassIdentifier>(0x02f24947, 0x17fa0477)</AlgorithmClassIdentifier>
<Inputs>
<Input>
<TypeIdentifier>(0x6f752dd0, 0x082a321e)</TypeIdentifier>
<Name>Input 1</Name>
</Input>
</Inputs>
<Settings>
<Setting>
<TypeIdentifier>(0x007deef9, 0x2f3e95c6)</TypeIdentifier>
<Name>Port</Name>
<DefaultValue>5678</DefaultValue>
<Value>5679</Value>
<Modifiability>false</Modifiability>
</Setting>
<Setting>
<TypeIdentifier>(0x6d7e53dd, 0x6a0a4753)</TypeIdentifier>
<Name>Stimulus output</Name>
<DefaultValue>Raw</DefaultValue>
<Value>String</Value>
<Modifiability>false</Modifiability>
</Setting>
</Settings>
<Attributes>
<Attribute>
<Identifier>(0x1fa7a38f, 0x54edbe0b)</Identifier>
<Value>400.000000</Value>
</Attribute>
<Attribute>
<Identifier>(0x1fa963f5, 0x1a638cd4)</Identifier>
<Value>53</Value>
</Attribute>
<Attribute>
<Identifier>(0x207c9054, 0x3c841b63)</Identifier>
<Value>480.000000</Value>
</Attribute>
<Attribute>
<Identifier>(0x4e7b798a, 0x183beafb)</Identifier>
<Value>(0xd1b2ff20, 0x919e4441)</Value>
</Attribute>
<Attribute>
<Identifier>(0x527ad68d, 0x16d746a0)</Identifier>
<Value></Value>
</Attribute>
<Attribute>
<Identifier>(0xad100179, 0xa3c984ab)</Identifier>
<Value>100</Value>
</Attribute>
<Attribute>
<Identifier>(0xc46b3d00, 0x3e0454e1)</Identifier>
<Value>(0x00000000, 0x016b97f3)</Value>
</Attribute>
<Attribute>
<Identifier>(0xc67a01dc, 0x28ce06c1)</Identifier>
<Value></Value>
</Attribute>
<Attribute>
<Identifier>(0xc73e83ec, 0xf855c5bc)</Identifier>
<Value>false</Value>
</Attribute>
<Attribute>
<Identifier>(0xce18836a, 0x9c0eb403)</Identifier>
<Value>2</Value>
</Attribute>
<Attribute>
<Identifier>(0xcfad85b0, 0x7c6d841c)</Identifier>
<Value>1</Value>
</Attribute>
</Attributes>
</Box>
<Box>
<Identifier>(0x0000360b, 0x0000614e)</Identifier>
<Name>Signal display</Name>
......@@ -178,7 +251,7 @@
</Attribute>
<Attribute>
<Identifier>(0xc46b3d00, 0x3e0454e1)</Identifier>
<Value>(0x00000000, 0x033e3986)</Value>
<Value>(0x00000000, 0x01e683c6)</Value>
</Attribute>
<Attribute>
<Identifier>(0xc73e83ec, 0xf855c5bc)</Identifier>
......@@ -236,7 +309,7 @@
</Attribute>
<Attribute>
<Identifier>(0xc46b3d00, 0x3e0454e1)</Identifier>
<Value>(0x00000000, 0x02dff832)</Value>
<Value>(0x00000000, 0x01b4ded6)</Value>
</Attribute>
<Attribute>
<Identifier>(0xc80ce8af, 0xf699f813)</Identifier>
......@@ -249,7 +322,7 @@
</Attributes>
</Box>
<Box>
<Identifier>(0x00004e8d, 0x00003806)</Identifier>
<Identifier>(0x000054a6, 0x00001c9c)</Identifier>
<Name>Signal to TCP</Name>
<AlgorithmClassIdentifier>(0x02f24947, 0x17fa0477)</AlgorithmClassIdentifier>
<Inputs>
......@@ -267,7 +340,7 @@
<Modifiability>false</Modifiability>
</Setting>
<Setting>
<TypeIdentifier>(0x6d7e53dd, 0x6a0a4753)</TypeIdentifier>
<TypeIdentifier>(0x77d3e238, 0xb954ec48)</TypeIdentifier>
<Name>Stimulus output</Name>
<DefaultValue>Raw</DefaultValue>
<Value>Raw</Value>
......@@ -289,7 +362,7 @@
</Attribute>
<Attribute>
<Identifier>(0x4e7b798a, 0x183beafb)</Identifier>
<Value>(0xb3ff8941, 0x4943ae4b)</Value>
<Value>(0xd1b2ff20, 0x919e4441)</Value>
</Attribute>
<Attribute>
<Identifier>(0x527ad68d, 0x16d746a0)</Identifier>
......@@ -301,80 +374,7 @@
</Attribute>
<Attribute>
<Identifier>(0xc46b3d00, 0x3e0454e1)</Identifier>
<Value>(0x00000000, 0x019d6582)</Value>
</Attribute>
<Attribute>
<Identifier>(0xc73e83ec, 0xf855c5bc)</Identifier>
<Value>false</Value>
</Attribute>
<Attribute>
<Identifier>(0xce18836a, 0x9c0eb403)</Identifier>
<Value>2</Value>
</Attribute>
<Attribute>
<Identifier>(0xcfad85b0, 0x7c6d841c)</Identifier>
<Value>1</Value>
</Attribute>
<Attribute>
<Identifier>(0xf191c1c8, 0xa0123976)</Identifier>
<Value></Value>
</Attribute>
</Attributes>
</Box>
<Box>
<Identifier>(0x00005ae2, 0x000004fd)</Identifier>
<Name>Stimuli to TCP</Name>
<AlgorithmClassIdentifier>(0x02f24947, 0x17fa0477)</AlgorithmClassIdentifier>
<Inputs>
<Input>
<TypeIdentifier>(0x6f752dd0, 0x082a321e)</TypeIdentifier>
<Name>Input 1</Name>
</Input>
</Inputs>
<Settings>
<Setting>
<TypeIdentifier>(0x007deef9, 0x2f3e95c6)</TypeIdentifier>
<Name>Port</Name>
<DefaultValue>5678</DefaultValue>
<Value>5679</Value>
<Modifiability>false</Modifiability>
</Setting>
<Setting>
<TypeIdentifier>(0x6d7e53dd, 0x6a0a4753)</TypeIdentifier>
<Name>Stimulus output</Name>
<DefaultValue>Raw</DefaultValue>
<Value>String</Value>
<Modifiability>false</Modifiability>
</Setting>
</Settings>
<Attributes>
<Attribute>
<Identifier>(0x1fa7a38f, 0x54edbe0b)</Identifier>
<Value>400.000000</Value>
</Attribute>
<Attribute>
<Identifier>(0x1fa963f5, 0x1a638cd4)</Identifier>
<Value>53</Value>
</Attribute>
<Attribute>
<Identifier>(0x207c9054, 0x3c841b63)</Identifier>
<Value>480.000000</Value>
</Attribute>
<Attribute>
<Identifier>(0x4e7b798a, 0x183beafb)</Identifier>
<Value>(0xb3ff8941, 0x4943ae4b)</Value>
</Attribute>
<Attribute>
<Identifier>(0x527ad68d, 0x16d746a0)</Identifier>
<Value></Value>
</Attribute>
<Attribute>
<Identifier>(0xad100179, 0xa3c984ab)</Identifier>
<Value>100</Value>
</Attribute>
<Attribute>
<Identifier>(0xc46b3d00, 0x3e0454e1)</Identifier>
<Value>(0x00000000, 0x027c9cc4)</Value>
<Value>(0x00000000, 0x00dda356)</Value>
</Attribute>
<Attribute>
<Identifier>(0xc73e83ec, 0xf855c5bc)</Identifier>
......@@ -388,23 +388,19 @@
<Identifier>(0xcfad85b0, 0x7c6d841c)</Identifier>
<Value>1</Value>
</Attribute>
<Attribute>
<Identifier>(0xf191c1c8, 0xa0123976)</Identifier>
<Value></Value>
</Attribute>
</Attributes>
</Box>
</Boxes>
<Links>
<Link>
<Identifier>(0x000027e0, 0x00000a8f)</Identifier>
<Identifier>(0x0000169e, 0x000043c2)</Identifier>
<Source>
<BoxIdentifier>(0x000047dd, 0x00002575)</BoxIdentifier>
<BoxIdentifier>(0x00002055, 0x00006c8d)</BoxIdentifier>
<BoxOutputIndex>0</BoxOutputIndex>
</Source>
<Target>
<BoxIdentifier>(0x0000360b, 0x0000614e)</BoxIdentifier>
<BoxInputIndex>1</BoxInputIndex>
<BoxIdentifier>(0x000054a6, 0x00001c9c)</BoxIdentifier>
<BoxInputIndex>0</BoxInputIndex>
</Target>
<Attributes>
<Attribute>
......@@ -413,26 +409,26 @@
</Attribute>
<Attribute>
<Identifier>(0x358ae8b5, 0x0f8bacd1)</Identifier>
<Value>448</Value>
<Value>224</Value>
</Attribute>
<Attribute>
<Identifier>(0x3f0a3b27, 0x570913d2)</Identifier>
<Value>283</Value>
<Value>369</Value>
</Attribute>
<Attribute>
<Identifier>(0x6267b5c5, 0x676e3e42)</Identifier>
<Value>352</Value>
<Value>208</Value>
</Attribute>
</Attributes>
</Link>
<Link>
<Identifier>(0x0000384a, 0x00007419)</Identifier>
<Identifier>(0x00002314, 0x00004bab)</Identifier>
<Source>
<BoxIdentifier>(0x000047dd, 0x00002575)</BoxIdentifier>
<BoxOutputIndex>0</BoxOutputIndex>
</Source>
<Target>
<BoxIdentifier>(0x00005ae2, 0x000004fd)</BoxIdentifier>
<BoxIdentifier>(0x00002e3e, 0x00002059)</BoxIdentifier>
<BoxInputIndex>0</BoxInputIndex>
</Target>
<Attributes>
......@@ -455,14 +451,14 @@
</Attributes>
</Link>
<Link>
<Identifier>(0x00005f85, 0x00005a35)</Identifier>
<Identifier>(0x000027e0, 0x00000a8f)</Identifier>
<Source>
<BoxIdentifier>(0x00002055, 0x00006c8d)</BoxIdentifier>
<BoxIdentifier>(0x000047dd, 0x00002575)</BoxIdentifier>
<BoxOutputIndex>0</BoxOutputIndex>
</Source>
<Target>
<BoxIdentifier>(0x00004e8d, 0x00003806)</BoxIdentifier>
<BoxInputIndex>0</BoxInputIndex>
<BoxIdentifier>(0x0000360b, 0x0000614e)</BoxIdentifier>
<BoxInputIndex>1</BoxInputIndex>
</Target>
<Attributes>
<Attribute>
......@@ -471,15 +467,15 @@
</Attribute>
<Attribute>
<Identifier>(0x358ae8b5, 0x0f8bacd1)</Identifier>
<Value>224</Value>
<Value>448</Value>
</Attribute>
<Attribute>
<Identifier>(0x3f0a3b27, 0x570913d2)</Identifier>
<Value>369</Value>
<Value>283</Value>
</Attribute>
<Attribute>
<Identifier>(0x6267b5c5, 0x676e3e42)</Identifier>
<Value>208</Value>
<Value>352</Value>
</Attribute>
</Attributes>
</Link>
......
/*
* Receives data from two OpenViBE TCPWriter boxes, a signal writer and a stimulus writer.
* Receives data from one or two OpenViBE TCPWriter boxes, a signal writer and a stimulus writer.
*
* The code reads the two corresponding sockets asynchronously. With signal, the header contents
* are printed first. Next, every time a stimulus is received, the code will print out the stimulus
* and how many bytes of signal have been read and discarded the meanwhile. In order not to make this
* code more complicated by mutexes, the signal thread does not try to print anything to cout but just
* discards the data.
* are printed first. If a stimulus is received, the code will print out the stimulus
* and how many bytes of signal have been read the meanwhile. In order not to make this
* code more complicated by mutexes, the signal thread does not try to print anything to cout.
* Instead, it either discards the data or writes it to a file (if name has been given)
*
* This code is meant to be used with the corresponding scenario 'tcpwriter.xml'
*
......@@ -17,6 +17,7 @@
#ifdef TARGET_HAS_Boost
#include <iostream>
#include <fstream>
#include <cstdlib>
#include <boost/array.hpp>
......@@ -31,50 +32,73 @@ using boost::asio::ip::tcp;
*/
class TCPWriterClient {
public:
TCPWriterClient(boost::asio::io_service& ioService, const char* sAddress, const char* sSignalPort, const char* sStimulusPort) :
stimulusSocket(ioService),
signalSocket(ioService),
signalBytesRead(0)
~TCPWriterClient()
{
if(m_dataFile.is_open()) {
m_dataFile.close();
}
}
TCPWriterClient(boost::asio::io_service& ioService, const char* sAddress, const char* sSignalPort, const char* sStimulusPort,
const char* sDataFilename) :
m_stimulusSocket(ioService),
m_signalSocket(ioService),
m_signalBytesRead(0)
{
boost::system::error_code error;
tcp::resolver resolver(ioService);
// Signal port
std::cout << "Connecting to signal port [" << sAddress << " : " << sSignalPort << "]\n";
tcp::resolver::query query = tcp::resolver::query(tcp::v4(), sAddress, sSignalPort);
signalSocket.connect(*resolver.resolve(query), error);
// Stimulus port
std::cout << "Connecting to stimulus port [" << sAddress << " : " << sStimulusPort << "]\n";
query = tcp::resolver::query(tcp::v4(), sAddress, sStimulusPort);
stimulusSocket.connect(*resolver.resolve(query), error);
if(sDataFilename) {
m_dataFile.open(sDataFilename, std::ios::binary|std::ios::trunc|std::ios::out);
}
if(sStimulusPort && strcmp(sStimulusPort,"0")!=0)
{
// Stimulus port
std::cout << "Connecting to stimulus port [" << sAddress << " : " << sStimulusPort << "]\n";
tcp::resolver::query query = tcp::resolver::query(tcp::v4(), sAddress, sStimulusPort);
m_stimulusSocket.connect(*resolver.resolve(query), error);
// Tell ASIO to read a stimulus
boost::asio::async_read_until(m_stimulusSocket, m_stimulusStream,