Skip to content

Commit

Permalink
Merge remote-tracking branch 'openbci/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrey1994 committed Oct 5, 2019
2 parents 2e344f5 + 1e66886 commit 257dbd9
Show file tree
Hide file tree
Showing 44 changed files with 25,697 additions and 89 deletions.
6 changes: 5 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ script:
- sudo -H python3 $TRAVIS_BUILD_DIR/emulator/brainflow_emulator/cyton_linux.py python3 $TRAVIS_BUILD_DIR/tests/python/brainflow_get_data.py --log --board 0 --port
- sudo -H python3 $TRAVIS_BUILD_DIR/emulator/brainflow_emulator/cyton_linux.py Rscript $TRAVIS_BUILD_DIR/tests/r/brainflow_get_data.R
- LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$TRAVIS_BUILD_DIR/installed/lib python3 $TRAVIS_BUILD_DIR/emulator/brainflow_emulator/cyton_linux.py $TRAVIS_BUILD_DIR/tests/cpp/build/test_get_data 0
# tests for synthetic board
# tests for synthetic board
- python3 $TRAVIS_BUILD_DIR/tests/python/brainflow_get_data.py --log --board -1 --port "smth"
- python3 $TRAVIS_BUILD_DIR/tests/python/brainflow_multiboard_get_data.py --log --first-board -1 --first-port "smth1" --second-board -1 --second-port "smth2"
- $TRAVIS_BUILD_DIR/tests/cpp/build/test_get_data -1 "smth"
Expand All @@ -72,6 +72,10 @@ script:
# tests for novaxr
- sudo -H python3 $TRAVIS_BUILD_DIR/emulator/brainflow_emulator/novaxr_udp.py python3 $TRAVIS_BUILD_DIR/tests/python/brainflow_get_data.py --board 3 --port 127.0.0.1
- LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$TRAVIS_BUILD_DIR/installed/lib python3 $TRAVIS_BUILD_DIR/emulator/brainflow_emulator/novaxr_udp.py $TRAVIS_BUILD_DIR/tests/cpp/build/test_get_data 3 127.0.0.1
# tests for wifi shield based boards
# on unix socket after close () goes to time_wait state and it fails to create a new socket on this port when previous connection is in time_wait state
# I dont want to add network restart or timeout, so test only one wifi shield board
- sudo -H python3 $TRAVIS_BUILD_DIR/emulator/brainflow_emulator/wifi_shield_emulator.py python3 $TRAVIS_BUILD_DIR/tests/python/brainflow_get_data.py --log --board 4 --port "127.0.0.1"

# deploy only in openbci's fork
#after_success:
Expand Down
7 changes: 6 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,13 @@ set (LIBRARY_SRC
"src/utils/timestamp.cpp"
"src/utils/data_buffer.cpp"
"src/utils/serial.cpp"
"src/utils/socket.cpp"
"src/utils/socket_client.cpp"
"src/utils/socket_server.cpp"
"src/board_controller/openbci/openbci_serial_board.cpp"
"src/board_controller/openbci/openbci_wifi_shield_board.cpp"
"src/board_controller/openbci/ganglion_wifi.cpp"
"src/board_controller/openbci/cyton_wifi.cpp"
"src/board_controller/openbci/cyton_daisy_wifi.cpp"
"src/board_controller/openbci/ganglion.cpp"
"src/board_controller/openbci/cyton.cpp"
"src/board_controller/openbci/cyton_daisy.cpp"
Expand Down
66 changes: 37 additions & 29 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ install:
- mkdir %APPVEYOR_BUILD_FOLDER%\tests\cpp\build && cd %APPVEYOR_BUILD_FOLDER%\tests\cpp\build && cmake -G "Visual Studio 15 2017 Win64" -DCMAKE_SYSTEM_VERSION=8.1 -DCMAKE_PREFIX_PATH=%APPVEYOR_BUILD_FOLDER%\installed64\ .. && cmake --build . --config Release > cpp_test_build64_stdout.txt
- mkdir %APPVEYOR_BUILD_FOLDER%\tests\cpp\build32 && cd %APPVEYOR_BUILD_FOLDER%\tests\cpp\build32 && cmake -G "Visual Studio 15 2017" -DCMAKE_SYSTEM_VERSION=8.1 -DCMAKE_PREFIX_PATH=%APPVEYOR_BUILD_FOLDER%\installed32\ .. && cmake --build . --config Release > cpp_test_build32_stdout.txt
# mvn package for java
- cd %APPVEYOR_BUILD_FOLDER%\java-package\brainflow && mvn package > maven_package_stdout.txt && cd ..\..\tests\java && javac -classpath ..\..\java-package\brainflow\target\brainflow-jar-with-dependencies.jar BrainFlowGetData.java
- cd %APPVEYOR_BUILD_FOLDER%\java-package\brainflow && mvn package > maven_package_stdout.txt

test_script:
# tests for cyton
Expand All @@ -83,6 +83,10 @@ test_script:
- python %APPVEYOR_BUILD_FOLDER%\emulator\brainflow_emulator\novaxr_udp.py %APPVEYOR_BUILD_FOLDER%\tests\cpp\build\Release\test_get_data.exe 3 127.0.0.1
- python %APPVEYOR_BUILD_FOLDER%\emulator\brainflow_emulator\novaxr_udp.py %APPVEYOR_BUILD_FOLDER%\tests\cpp\build32\Release\test_get_data.exe 3 127.0.0.1
- python %APPVEYOR_BUILD_FOLDER%\emulator\brainflow_emulator\novaxr_udp.py %APPVEYOR_BUILD_FOLDER%\tests\csharp\build\Release\test.exe 3 127.0.0.1
# tests for wifi shield based boards
- python %APPVEYOR_BUILD_FOLDER%\emulator\brainflow_emulator\wifi_shield_emulator.py python %APPVEYOR_BUILD_FOLDER%\tests\python\brainflow_get_data.py --board 4 --port 127.0.0.1
- python %APPVEYOR_BUILD_FOLDER%\emulator\brainflow_emulator\wifi_shield_emulator.py %APPVEYOR_BUILD_FOLDER%\tests\cpp\build\Release\test_get_data.exe 5 127.0.0.1
- python %APPVEYOR_BUILD_FOLDER%\emulator\brainflow_emulator\wifi_shield_emulator.py %APPVEYOR_BUILD_FOLDER%\tests\csharp\build\Release\test.exe 6 127.0.0.1

# replace mocked libraries by real libs
after_test:
Expand All @@ -99,50 +103,54 @@ after_test:
# - aws s3 cp %APPVEYOR_BUILD_FOLDER%\installed64\lib\ s3://brainflow-artifacts/%APPVEYOR_REPO_COMMIT%/lib64 --recursive
# # download files from travis using S3 create package and publish it
# - ps: >-
# If ($env:APPVEYOR_REPO_TAG -eq "true" -And $env:APPVEYOR_REPO_BRANCH -eq "master") {
# $lin = $false;
# $osx = $false;
# for ($i=0; $i -lt 30; $i++) {
# # wait 30 minutes or until mac and linux binaries appear in s3
# $lin = $false;
# $osx = $false;
# for ($i=0; $i -lt 30; $i++) {
# aws s3 ls s3://brainflow-artifacts/$env:APPVEYOR_REPO_COMMIT/linux_success;
# $lin = $?;
# aws s3 ls s3://brainflow-artifacts/$env:APPVEYOR_REPO_COMMIT/osx_success;
# $osx = $?
# if($lin -and $osx) {break}
# Start-Sleep -s 60;
# echo "not found"
# }
# If ($lin -and $osx) {
# write-output "Binaries found - running deployment"
# New-Item $env:APPVEYOR_BUILD_FOLDER\linux -itemtype directory
# New-Item $env:APPVEYOR_BUILD_FOLDER\osx -itemtype directory
# aws s3 cp s3://brainflow-artifacts/$env:APPVEYOR_REPO_COMMIT/linux/ $env:APPVEYOR_BUILD_FOLDER\linux\ --recursive
# aws s3 cp s3://brainflow-artifacts/$env:APPVEYOR_REPO_COMMIT/osx/ $env:APPVEYOR_BUILD_FOLDER\osx\ --recursive
# aws s3 ls s3://brainflow-artifacts/$env:APPVEYOR_REPO_COMMIT/linux_success;
# $lin = $?;
# aws s3 ls s3://brainflow-artifacts/$env:APPVEYOR_REPO_COMMIT/osx_success;
# $osx = $?
# if($lin -and $osx) {break}
# Start-Sleep -s 60;
# echo "not found"
# }
# If ($lin -and $osx) {
# write-output "Binaries found - running deployment"
# New-Item $env:APPVEYOR_BUILD_FOLDER\linux -itemtype directory
# New-Item $env:APPVEYOR_BUILD_FOLDER\osx -itemtype directory
# aws s3 cp s3://brainflow-artifacts/$env:APPVEYOR_REPO_COMMIT/linux/ $env:APPVEYOR_BUILD_FOLDER\linux\ --recursive
# aws s3 cp s3://brainflow-artifacts/$env:APPVEYOR_REPO_COMMIT/osx/ $env:APPVEYOR_BUILD_FOLDER\osx\ --recursive
# cd $env:APPVEYOR_BUILD_FOLDER\java-package\brainflow
# mvn package > mvn_final_stdout.txt
# #upload .jars to aws
# aws s3 cp %APPVEYOR_BUILD_FOLDER%\java-package\brainflow\target\ s3://brainflow-artifacts/%APPVEYOR_REPO_COMMIT%/jars --recursive

# If ($env:APPVEYOR_REPO_TAG -eq "true" -And $env:APPVEYOR_REPO_BRANCH -eq "master") {
# Copy-Item "$env:APPVEYOR_BUILD_FOLDER\linux\*" -Destination "$env:APPVEYOR_BUILD_FOLDER\python-package\brainflow\lib" -Recurse
# Copy-Item "$env:APPVEYOR_BUILD_FOLDER\osx\*" -Destination "$env:APPVEYOR_BUILD_FOLDER\python-package\brainflow\lib" -Recurse
# ls $env:APPVEYOR_BUILD_FOLDER\python-package\brainflow\lib
# cd $env:APPVEYOR_BUILD_FOLDER\python-package
# python setup.py sdist bdist_wheel
# twine upload --skip-existing dist/*.whl --user OpenBCI --password $env:PYPI_PASSWORD
# cd $env:APPVEYOR_BUILD_FOLDER\java-package\brainflow
# mvn package > mvn_final_stdout.txt
# cd $env:APPVEYOR_BUILD_FOLDER\tools
# .\github-release.exe release --user OpenBCI --repo brainflow --tag $env:APPVEYOR_REPO_TAG_NAME
# .\github-release.exe upload --user OpenBCI --repo brainflow --tag $env:APPVEYOR_REPO_TAG_NAME --name brainflow.jar --file $env:APPVEYOR_BUILD_FOLDER\java-package\brainflow\target\brainflow.jar
# .\github-release.exe upload --user OpenBCI --repo brainflow --tag $env:APPVEYOR_REPO_TAG_NAME --name brainflow-jar-with-dependencies.jar --file $env:APPVEYOR_BUILD_FOLDER\java-package\brainflow\target\brainflow-jar-with-dependencies.jar
# }
# Else {
# write-output "Failed to wait for mac and linux libs"
# write-output "Skip deployment for non tag"
# }
# } Else {
# write-output "Skip deployment for non tag"
# }
# Else {
# write-output "Failed to wait for mac and linux libs"
# }

on_finish:
- appveyor PushArtifact %APPVEYOR_BUILD_FOLDER%\build32\brainflow_build32_stdout.txt
- appveyor PushArtifact %APPVEYOR_BUILD_FOLDER%\build64\brainflow_build64_stdout.txt
- appveyor PushArtifact %APPVEYOR_BUILD_FOLDER%\GanglionBLEAPI\Mock\build\ganglion_mock_build64_stdout.txt
- appveyor PushArtifact %APPVEYOR_BUILD_FOLDER%\java-package\brainflow\maven_package_stdout.txt
# on_finish:
# - appveyor PushArtifact %APPVEYOR_BUILD_FOLDER%\build32\brainflow_build32_stdout.txt
# - appveyor PushArtifact %APPVEYOR_BUILD_FOLDER%\build64\brainflow_build64_stdout.txt
# - appveyor PushArtifact %APPVEYOR_BUILD_FOLDER%\GanglionBLEAPI\Mock\build\ganglion_mock_build64_stdout.txt
# - appveyor PushArtifact %APPVEYOR_BUILD_FOLDER%\java-package\brainflow\maven_package_stdout.txt

notifications:
- provider: Email
Expand Down
54 changes: 54 additions & 0 deletions cpp-package/src/board_info_getter.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,36 @@ class NOVAXR
};


class CYTON_WIFI
{
public:
static const int fs_hz = 1000;
static const int num_eeg_channels = 8;
static const int package_length = 12;
static const int first_eeg_channel = 1;
};


class CYTON_DAISY_WIFI
{
public:
static const int fs_hz = 1000;
static const int num_eeg_channels = 16;
static const int package_length = 20;
static const int first_eeg_channel = 1;
};


class GANGLION_WIFI
{
public:
static const int fs_hz = 1600;
static const int num_eeg_channels = 4;
static const int package_length = 8;
static const int first_eeg_channel = 1;
};


// todo: move it to low level api during implementation of signal processing in c++
class BoardInfoGetter
{
Expand All @@ -72,6 +102,12 @@ class BoardInfoGetter
return CYTON_DAISY::package_length;
case NOVAXR_BOARD:
return NOVAXR::package_length;
case CYTON_WIFI_BOARD:
return CYTON_WIFI::package_length;
case CYTON_DAISY_WIFI_BOARD:
return CYTON_DAISY_WIFI::package_length;
case GANGLION_WIFI_BOARD:
return GANGLION_WIFI::package_length;
default:
throw BrainFlowException ("Unsupported Board Error", UNSUPPORTED_BOARD_ERROR);
}
Expand All @@ -91,6 +127,12 @@ class BoardInfoGetter
return CYTON_DAISY::num_eeg_channels;
case NOVAXR_BOARD:
return NOVAXR::num_eeg_channels;
case CYTON_WIFI_BOARD:
return CYTON_WIFI::num_eeg_channels;
case CYTON_DAISY_WIFI_BOARD:
return CYTON_DAISY_WIFI::num_eeg_channels;
case GANGLION_WIFI_BOARD:
return GANGLION_WIFI::num_eeg_channels;
default:
throw BrainFlowException ("Unsupported Board Error", UNSUPPORTED_BOARD_ERROR);
}
Expand All @@ -110,6 +152,12 @@ class BoardInfoGetter
return CYTON_DAISY::fs_hz;
case NOVAXR_BOARD:
return NOVAXR::fs_hz;
case CYTON_WIFI_BOARD:
return CYTON_WIFI::fs_hz;
case CYTON_DAISY_WIFI_BOARD:
return CYTON_DAISY_WIFI::fs_hz;
case GANGLION_WIFI_BOARD:
return GANGLION_WIFI::fs_hz;
default:
throw BrainFlowException ("Unsupported Board Error", UNSUPPORTED_BOARD_ERROR);
}
Expand All @@ -129,6 +177,12 @@ class BoardInfoGetter
return CYTON_DAISY::first_eeg_channel;
case NOVAXR_BOARD:
return NOVAXR::first_eeg_channel;
case CYTON_WIFI_BOARD:
return CYTON_WIFI::first_eeg_channel;
case CYTON_DAISY_WIFI_BOARD:
return CYTON_DAISY_WIFI::first_eeg_channel;
case GANGLION_WIFI_BOARD:
return GANGLION_WIFI::first_eeg_channel;
default:
throw BrainFlowException ("Unsupported Board Error", UNSUPPORTED_BOARD_ERROR);
}
Expand Down
24 changes: 24 additions & 0 deletions csharp-package/brainflow/brainflow/board_info_getter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ public static int get_fs_hz (int board_id)
return CytonDaisy.fs_hz;
case (int)BoardIds.NOVAXR_BOARD:
return Novaxr.fs_hz;
case (int)BoardIds.GANGLION_WIFI:
return GanglionWifi.fs_hz;
case (int)BoardIds.CYTON_WIFI:
return CytonWifi.fs_hz;
case (int)BoardIds.CYTON_DAISY_WIFI:
return CytonDaisyWifi.fs_hz;
default:
throw new BrainFlowExceptioin ((int)CustomExitCodes.UNSUPPORTED_BOARD_ERROR);
}
Expand All @@ -35,6 +41,12 @@ public static int get_first_eeg_channel (int board_id)
return CytonDaisy.first_eeg_channel;
case (int)BoardIds.NOVAXR_BOARD:
return Novaxr.first_eeg_channel;
case (int)BoardIds.GANGLION_WIFI:
return GanglionWifi.first_eeg_channel;
case (int)BoardIds.CYTON_WIFI:
return CytonWifi.first_eeg_channel;
case (int)BoardIds.CYTON_DAISY_WIFI:
return CytonDaisyWifi.first_eeg_channel;
default:
throw new BrainFlowExceptioin ((int)CustomExitCodes.UNSUPPORTED_BOARD_ERROR);
}
Expand All @@ -54,6 +66,12 @@ public static int get_num_eeg_channels (int board_id)
return CytonDaisy.num_eeg_channels;
case (int)BoardIds.NOVAXR_BOARD:
return Novaxr.num_eeg_channels;
case (int)BoardIds.GANGLION_WIFI:
return GanglionWifi.num_eeg_channels;
case (int)BoardIds.CYTON_WIFI:
return CytonWifi.num_eeg_channels;
case (int)BoardIds.CYTON_DAISY_WIFI:
return CytonDaisyWifi.num_eeg_channels;
default:
throw new BrainFlowExceptioin ((int)CustomExitCodes.UNSUPPORTED_BOARD_ERROR);
}
Expand All @@ -73,6 +91,12 @@ public static int get_package_length (int board_id)
return CytonDaisy.package_length;
case (int)BoardIds.NOVAXR_BOARD:
return Novaxr.package_length;
case (int)BoardIds.GANGLION_WIFI:
return GanglionWifi.package_length;
case (int)BoardIds.CYTON_WIFI:
return CytonWifi.package_length;
case (int)BoardIds.CYTON_DAISY_WIFI:
return CytonDaisyWifi.package_length;
default:
throw new BrainFlowExceptioin ((int)CustomExitCodes.UNSUPPORTED_BOARD_ERROR);
}
Expand Down
3 changes: 3 additions & 0 deletions csharp-package/brainflow/brainflow/brainflow.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@
<Compile Include="board_info_getter.cs" />
<Compile Include="board_data.cs" />
<Compile Include="board_shim.cs" />
<Compile Include="cyton_daisy_wifi.cs" />
<Compile Include="cyton_wifi.cs" />
<Compile Include="ganglion_wifi.cs" />
<Compile Include="novaxr.cs" />
<Compile Include="cyton.cs" />
<Compile Include="cyton_daisy.cs" />
Expand Down
11 changes: 11 additions & 0 deletions csharp-package/brainflow/brainflow/cyton_daisy_wifi.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
namespace brainflow
{
public class CytonDaisyWifi
{
public const int board_id = (int) BoardIds.CYTON_DAISY_WIFI;
public const int fs_hz = 1000;
public const int first_eeg_channel = 1;
public const int num_eeg_channels = 16;
public const int package_length = 20;
}
}
11 changes: 11 additions & 0 deletions csharp-package/brainflow/brainflow/cyton_wifi.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
namespace brainflow
{
public class CytonWifi
{
public const int board_id = (int) BoardIds.CYTON_WIFI;
public const int fs_hz = 1000;
public const int first_eeg_channel = 1;
public const int num_eeg_channels = 8;
public const int package_length = 12;
}
}
11 changes: 11 additions & 0 deletions csharp-package/brainflow/brainflow/ganglion_wifi.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
namespace brainflow
{
public class GanglionWifi
{
public const int board_id = (int) BoardIds.GANGLION_WIFI;
public const int fs_hz = 1600;
public const int first_eeg_channel = 1;
public const int num_eeg_channels = 4;
public const int package_length = 8;
}
}
5 changes: 4 additions & 1 deletion csharp-package/brainflow/brainflow/library.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ public enum BoardIds
CYTON_BOARD = 0,
GANGLION_BOARD = 1,
CYTON_DAISY_BOARD = 2,
NOVAXR_BOARD = 3
NOVAXR_BOARD = 3,
GANGLION_WIFI = 4,
CYTON_WIFI = 5,
CYTON_DAISY_WIFI = 6
};


Expand Down

0 comments on commit 257dbd9

Please sign in to comment.