warning: discontinued project, we now internally fork this project as a boilerplate.
This is a minimalistic cross-plateform (both iOS & android) wrapper over the Muse Headband EEG's ios & android libraries for react-native.
While it probably will work with 2014 muse headbands, it is only tested for the 2016 Headbands.
We've choosen to wrap the original libraries instead of reverse-engineering the muse's Bluetooth LE protocol as we expect the bluetooth protocol to be more prone to change than the libraries in the future.
- iOS
- android
- API doc
iOS:
- Check full compatibility information on this link. @todo check link is working
Android:
- Incompatible at the moment.
Muse 2016 x 2014
- Muse 2014 is untested.
- Paired muse 2016 appears in the available list even when powered off. See the API doc.
$ npm install react-native-eegmuselib --save
You must install Cocoapods and create an empty Podfile in your ios folder. Once it's done, you can type the following command:
$ react-native link react-native-eegmuselib
- In XCode, in the project navigator, right click
Libraries
➜Add Files to [your project's name]
- Go to
node_modules
➜react-native-eegmuselib
and addRNEegMuseLib.xcodeproj
- In XCode, in the project navigator, select your project. Add
libRNEegMuseLib.a
to your project'sBuild Phases
➜Link Binary With Libraries
- Run your project (
Cmd+R
)<
- Open up
android/app/src/main/java/[...]/MainActivity.java
- Add
import com.reactlibrary.RNEegMuseLibPackage;
to the imports at the top of the file - Add
new RNEegMuseLibPackage()
to the list returned by thegetPackages()
method
- Append the following lines to
android/settings.gradle
:include ':react-native-eegmuselib' project(':react-native-eegmuselib').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-eegmuselib/android')
- Insert the following lines inside the dependencies block in
android/app/build.gradle
:compile project(':react-native-eegmuselib')
- In Visual Studio add the
RNEegMuseLib.sln
innode_modules/react-native-eegmuselib/windows/RNEegMuseLib.sln
folder to their solution, reference from their app. - Open up your
MainPage.cs
app
- Add
using Eeg.Muse.Lib.RNEegMuseLib;
to the usings at the top of the file - Add
new RNEegMuseLibPackage()
to theList<IReactPackage>
returned by thePackages
method
import RNEegMuseLib from 'react-native-eegmuselib';
// TODO: What to do with the module?
RNEegMuseLib;
The muse-related dependencies are handled using Gradle for android & Cocoapod for iOS.
You may want to have a look at the tutorial we've used for building this react- native libraries:
To test without publishing, npm link
can be used in place of both
npm publish
and npm install
. Check the doc.
- In this library's directory:
$ npm link
- In the test project:
$ npm link react-native-eegmuselib
Publishing is done through npm via:
$ npm publish