0.3.7 • Published 5 years ago

react-native-mindwave-mobile v0.3.7

Weekly downloads
-
License
MIT
Repository
gitlab
Last release
5 years ago

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

  1. In XCode, in the project navigator, right click LibrariesAdd Files to [your project's name]
  2. Go to node_modulesreact-native-mindwave-mobile and add RNMindWaveMobile.xcodeproj
  3. In XCode, in the project navigator, select your project. Add libRNMindWaveMobile.a to your project's Build PhasesLink Binary With Libraries
  4. Run your project (Cmd+R)<

Android

  1. 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 the getPackages() method
  1. 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')
  2. 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
  }
0.3.7

5 years ago

0.3.6

6 years ago

0.3.5

6 years ago

0.3.4

6 years ago

0.3.3

6 years ago

0.3.2

6 years ago

0.3.1

6 years ago

0.2.1

7 years ago

0.2.0

7 years ago

0.1.0

7 years ago

0.0.1

7 years ago