Skip to content

Commit 3f341d6

Browse files
authored
adding Muse 2 and Muse S devices using native BLE API(no dongle) (brainflow-dev#350)
* add SimpleBLE library and Muse wo dongle Signed-off-by: Andrey Parfenov <a1994ndrey@gmail.com>
1 parent 67b05bf commit 3f341d6

181 files changed

Lines changed: 11513 additions & 33 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/cppcheck.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
env:
1616
DEBIAN_FRONTEND: noninteractive
1717
- name: Run Cppcheck
18-
run: cppcheck --std=c++11 -ithird_party/spdlog -ithird_party/libsvm --error-exitcode=1 --xml --xml-version=2 --force src cpp-package third_party 2>cppcheck_res.xml
18+
run: cppcheck --std=c++11 -ithird_party/spdlog -ithird_party/libsvm -ithird_party/SimpleBLE -ithird_party/SimpleDBus -ithird_party/SimpleBluez --error-exitcode=1 --xml --xml-version=2 --force src cpp-package third_party 2>cppcheck_res.xml
1919
- name: Generate Report
2020
if: ${{ failure() }}
2121
run: cppcheck-htmlreport --title=BrainFlow --file=cppcheck_res.xml --report-dir=report

‎.github/workflows/run_unix.yml‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,15 @@ jobs:
4545
uses: actions/setup-java@v1
4646
with:
4747
java-version: 11.0.3
48+
# build simpleble outside from brainflow because of different deployment targets
49+
- name: Compile SimpleBLE MacOS
50+
if: (matrix.os == 'macos-11.0')
51+
run: |
52+
mkdir $GITHUB_WORKSPACE/third_party/SimpleBLE/build
53+
cd $GITHUB_WORKSPACE/third_party/SimpleBLE/build
54+
cmake -G Ninja -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/installed -DCMAKE_BUILD_TYPE=Release ..
55+
ninja
56+
ninja install
4857
- name: Compile BrainFlow MacOS
4958
if: (matrix.os == 'macos-11.0')
5059
run: |
@@ -66,7 +75,7 @@ jobs:
6675
if: (matrix.os == 'ubuntu-latest')
6776
run: |
6877
docker pull dockcross/manylinux2014-x64:20210708-94745ff
69-
docker run -e GITHUB_WORKSPACE=$GITHUB_WORKSPACE -v $GITHUB_WORKSPACE:$GITHUB_WORKSPACE dockcross/manylinux2014-x64:20210708-94745ff /bin/bash -c "yum install -y bluez-libs-devel && /opt/python/cp36-cp36m/bin/pip3.6 install cmake==3.13.3 && cd $GITHUB_WORKSPACE && mkdir build_docker && cd build_docker && cmake -DBUILD_BLUETOOTH=ON -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/installed_docker -DCMAKE_BUILD_TYPE=Release .. && make && make install"
78+
docker run -e GITHUB_WORKSPACE=$GITHUB_WORKSPACE -v $GITHUB_WORKSPACE:$GITHUB_WORKSPACE dockcross/manylinux2014-x64:20210708-94745ff /bin/bash -c "yum install -y bluez-libs-devel dbus-devel && /opt/python/cp36-cp36m/bin/pip3.6 install cmake==3.13.3 && cd $GITHUB_WORKSPACE && mkdir build_docker && cd build_docker && cmake -DBUILD_BLE=ON -DBUILD_BLUETOOTH=ON -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/installed_docker -DCMAKE_BUILD_TYPE=Release .. && make && make install"
7079
- name: Setup Python Package
7180
run: |
7281
cd $GITHUB_WORKSPACE/python-package

‎.github/workflows/run_windows.yml‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,21 @@ jobs:
4242
cmake -DBUILD_OYMOTION_SDK=ON -DBUILD_BLUETOOTH=ON -DWARNINGS_AS_ERRORS=ON -G "Visual Studio 16 2019" -A x64 -DCMAKE_SYSTEM_VERSION=8.1 -DCMAKE_INSTALL_PREFIX=..\installed64\ ..
4343
cmake --build . --target install --config Release -j 2 --parallel 2
4444
shell: cmd
45+
# need to build SimpleBLE outside from BrainFlow because they have different Windows System Versions
46+
- name: Compile SimpleBLE x32
47+
run: |
48+
mkdir %GITHUB_WORKSPACE%\third_party\SimpleBLE\build32
49+
cd %GITHUB_WORKSPACE%\third_party\SimpleBLE\build32
50+
cmake -G "Visual Studio 16 2019" -A Win32 -DCMAKE_SYSTEM_VERSION=10.0.19041.0 -DCMAKE_INSTALL_PREFIX=%GITHUB_WORKSPACE%\installed32\ ..
51+
cmake --build . --target install --config Release -j 2 --parallel 2
52+
shell: cmd
53+
- name: Compile SimpleBLE x64
54+
run: |
55+
mkdir %GITHUB_WORKSPACE%\third_party\SimpleBLE\build64
56+
cd %GITHUB_WORKSPACE%\third_party\SimpleBLE\build64
57+
cmake -G "Visual Studio 16 2019" -A x64 -DCMAKE_SYSTEM_VERSION=10.0.19041.0 -DCMAKE_INSTALL_PREFIX=%GITHUB_WORKSPACE%\installed64\ ..
58+
cmake --build . --target install --config Release -j 2 --parallel 2
59+
shell: cmd
4560
- name: C# build
4661
run: |
4762
cd %GITHUB_WORKSPACE%\csharp-package\brainflow

‎CMakeLists.txt‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ option (USE_OPENMP "USE_OPENMP" OFF)
2020
option (WARNINGS_AS_ERRORS "WARNINGS_AS_ERRORS" OFF)
2121
option (BUILD_OYMOTION_SDK "BUILD_OYMOTION_SDK" OFF)
2222
option (BUILD_BLUETOOTH "BUILD_BLUETOOTH" OFF)
23+
option (BUILD_BLE "BUILD_BLE" OFF)
2324
option (USE_PERIPHERY "USE_PERIPHERY" OFF)
2425

2526
include (${CMAKE_HOME_DIRECTORY}/cmake/macros.cmake)

‎docs/SupportedBoards.rst‎

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ To create an instance of BoardShim class for your board check required inputs in
4545
"AntNeuroBoardEE224", "BoardIds.ANT_NEURO_EE_224_BOARD (35)", "-", "-", "-", "-", "-", "-", "-", "-", "-"
4646
"AntNeuroBoardEE225", "BoardIds.ANT_NEURO_EE_225_BOARD (36)", "-", "-", "-", "-", "-", "-", "-", "-", "-"
4747
"Enophone", "BoardIds.ENOPHONE_BOARD (37)", "-", "MAC adress", "-", "-", "-", "-", "-", "-", "-"
48+
"Muse2", "BoardIds.MUSE_2_BOARD (38)", "-", "Optional: MAC adress", "-", "-", "-", "-", "-", "Optional: device name", "-"
49+
"MuseS", "BoardIds.MUSE_S_BOARD (39)", "-", "Optional: MAC adress", "-", "-", "-", "-", "-", "Optional: device name", "-"
4850

4951
Playback File Board
5052
---------------------
@@ -735,6 +737,80 @@ Board Spec:
735737
- sampling rate: 250
736738
- communication: Bluetooth Low Energy with serial port dongle
737739

740+
Muse 2
741+
~~~~~~~~~~~~~~
742+
743+
.. image:: https://live.staticflickr.com/65535/51250482419_32ce8454dd.jpg
744+
:width: 350px
745+
:height: 350px
746+
747+
`Muse Website <https://choosemuse.com/>`_
748+
749+
.. compound::
750+
751+
On Linux systems you may need to install libdbus and we recommend to compile BrainFlow from the source code ::
752+
753+
sudo apt-get install libdbus-1-dev # for ubuntu
754+
sudo yum install dbus-devel # for centos
755+
python3 tools/build.py --ble # to compile
756+
757+
To choose this board in BoardShim constructor please specify:
758+
759+
- board_id: 38
760+
- optional: MAC address
761+
- optional: serial number(device name)
762+
763+
Supported platforms:
764+
765+
- Windows 10.0.19041.0+
766+
- MacOS 10.15+
767+
- Linux, compilation from source code can be needed
768+
- Devices like Raspberry Pi
769+
770+
Muse S
771+
~~~~~~~~~
772+
773+
.. image:: https://live.staticflickr.com/65535/51249005962_026502fee0.jpg
774+
:width: 350px
775+
:height: 350px
776+
777+
`Muse Website <https://choosemuse.com/>`_
778+
779+
.. compound::
780+
781+
On Linux systems you may need to install libdbus and we recommend to compile BrainFlow from the source code ::
782+
783+
sudo apt-get install libdbus-1-dev # for ubuntu
784+
sudo yum install dbus-devel # for centos
785+
python3 tools/build.py --ble # to compile
786+
787+
To choose this board in BoardShim constructor please specify:
788+
789+
- board_id: 39
790+
- optional: MAC address
791+
- optional: serial number(device name)
792+
793+
Supported platforms:
794+
795+
- Windows 10.0.19041.0+
796+
- MacOS 10.15+
797+
- Linux, compilation from source code can be needed
798+
- Devices like Raspberry Pi
799+
800+
Board Spec:
801+
802+
- num eeg channels: 4
803+
- num acceleration channels: 3
804+
- sampling rate: 250
805+
- communication: Bluetooth Low Energy
806+
807+
Board Spec:
808+
809+
- num eeg channels: 4
810+
- num acceleration channels: 3
811+
- sampling rate: 250
812+
- communication: Bluetooth Low Energy
813+
738814
Ant Neuro
739815
----------
740816

‎java-package/brainflow/pom.xml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@
8080
<include>BrainFlowBluetooth.dll</include>
8181
<include>libBrainFlowBluetooth.so</include>
8282
<include>libBrainFlowBluetooth.dylib</include>
83+
<include>simpleble-c.dll</include>
84+
<include>libsimpleble-c.so</include>
85+
<include>libsimpleble-c.dylib</include>
8386
</includes>
8487
</resource>
8588
</resources>

‎python-package/setup.py‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,11 @@
6262
os.path.join('lib', 'BrainFlowBluetooth.dll'),
6363
os.path.join('lib', 'BrainFlowBluetooth32.dll'),
6464
os.path.join('lib', 'libBrainFlowBluetooth.so'),
65-
os.path.join('lib', 'libBrainFlowBluetooth.dylib')
65+
os.path.join('lib', 'libBrainFlowBluetooth.dylib'),
66+
os.path.join('lib', 'simpleble-c.dll'),
67+
os.path.join('lib', 'simpleble-c32.dll'),
68+
os.path.join('lib', 'libsimpleble-c.so'),
69+
os.path.join('lib', 'libsimpleble-c.dylib')
6670
]
6771
},
6872
zip_safe=True,

0 commit comments

Comments
 (0)