0.3.7 • Published 6 years ago
react-native-mindwave-mobile v0.3.7
react-native-mindwave-mobile
Getting started
$ npm install react-native-mindwave-mobile --save
Mostly automatic installation
$ react-native link react-native-mindwave-mobile
Manual installation
iOS
- In XCode, in the project navigator, right click
Libraries➜Add Files to [your project's name] - Go to
node_modules➜react-native-mindwave-mobileand addRNMindWaveMobile.xcodeproj - In XCode, in the project navigator, select your project. Add
libRNMindWaveMobile.ato your project'sBuild Phases➜Link Binary With Libraries - Run your project (
Cmd+R)<
Android
- Open up
android/app/src/main/java/[...]/MainActivity.java
- Add
import com.reactlibrary.RNMindWaveMobilePackage;to the imports at the top of the file - Add
new RNMindWaveMobilePackage()to the list returned by thegetPackages()method
- Append the following lines to
android/settings.gradle:include ':react-native-mindwave-mobile' project(':react-native-mindwave-mobile').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-mindwave-mobile/android') - Insert the following lines inside the dependencies block in
android/app/build.gradle:compile project(':react-native-mindwave-mobile')
Usage
import MindWaveMobile from 'react-native-mindwave-mobile';
const mwm = new MindWaveMobile()
mwm.scan()
mwm.onFoundDevice(device => {
console.log(device)
})Method
scan()
Scan devices, will callback on onFoundDevice event
s
connect(deviceId)
Connect device with device id, will callback on onConnect event
disconnect()
Disconnect all of device, will callback on onDisconnect event
removeAllListeners()
Remove all listeners
Event
onConnect
- callback
function(state)
state = {
success
}onDisconnect
- callback
function(state)
state = {
success
}onFoundDevice(callback)
- callback
function(device)
device = {
id, name, mfgId
}onEEGPowerLowBeta(callback)
- callback
function(data)
data = {
lowBeta, highBeta, lowGamma, midGamma
}onEEGPowerDelta(callback)
- callback
function(data)
data = {
delta, theta, lowAplpha, highAlpha
}onESense(callback)
- callback
function(data)
data = {
poorSignal, attention, meditation
}onEEGBlink(callback) * iOS only
- callback
function(data)
data = {
blinkValue
}onMWMBaudRate(callback) * iOS only
- callback
function(data)
data = {
baudRate, notchFilter
}