diff --git a/EEG101/android/app/build.gradle b/EEG101/android/app/build.gradle index f4662e81..42e83b7b 100644 --- a/EEG101/android/app/build.gradle +++ b/EEG101/android/app/build.gradle @@ -90,7 +90,7 @@ android { applicationId "com.eeg_project" minSdkVersion 16 targetSdkVersion 25 - versionCode 14 + versionCode 15 versionName "2.0" ndk { abiFilters "armeabi-v7a" diff --git a/EEG101/android/app/src/main/java/com/eeg_project/components/graphs/EEGGraph.java b/EEG101/android/app/src/main/java/com/eeg_project/components/graphs/EEGGraph.java index 9379aea9..442a42fe 100644 --- a/EEG101/android/app/src/main/java/com/eeg_project/components/graphs/EEGGraph.java +++ b/EEG101/android/app/src/main/java/com/eeg_project/components/graphs/EEGGraph.java @@ -139,8 +139,6 @@ public void initView(Context context) { // Create eegPlot eegPlot = new XYPlot(context, "Raw EEG Plot"); - // get datasets (Y will be dataSeries, x will be implicitly generated): - //dataSource = new EEGDataSource(appState.connectedMuse.isLowEnergy()); dataSeries = new DynamicSeries("dataSeries"); diff --git a/EEG101/src/assets/light.png b/EEG101/src/assets/light.png index 3cea70fa..29477718 100644 Binary files a/EEG101/src/assets/light.png and b/EEG101/src/assets/light.png differ diff --git a/EEG101/src/assets/vibrate.png b/EEG101/src/assets/vibrate.png index 9bee9f59..334c4652 100644 Binary files a/EEG101/src/assets/vibrate.png and b/EEG101/src/assets/vibrate.png differ diff --git a/EEG101/src/components/DataCollector.js b/EEG101/src/components/DataCollector.js index f8919348..91d5d6ca 100644 --- a/EEG101/src/components/DataCollector.js +++ b/EEG101/src/components/DataCollector.js @@ -99,7 +99,7 @@ export default class DataCollector extends Component { {I18n.t("totalCleanData")} ); @@ -127,7 +127,7 @@ export default class DataCollector extends Component { {I18n.t("totalCleanData2")} ); diff --git a/EEG101/src/components/MiniChart.js b/EEG101/src/components/MiniChart.js index 28ebbce9..9e91b3c6 100644 --- a/EEG101/src/components/MiniChart.js +++ b/EEG101/src/components/MiniChart.js @@ -41,6 +41,7 @@ export default class MiniChart extends Component { style={{ position: "absolute", left: -20, + bottom: 75, fontWeight: "100", color: colors.black, fontFamily: "Roboto-Light", @@ -48,12 +49,12 @@ export default class MiniChart extends Component { transform: [{ rotate: "270deg" }] }} > - {" "}Feature Rank + {" "}Feature Power @@ -67,6 +68,7 @@ export default class MiniChart extends Component { /> + + + ); } diff --git a/EEG101/src/components/PlayPauseButton.js b/EEG101/src/components/PlayPauseButton.js index cf93473f..f8f5f3ff 100644 --- a/EEG101/src/components/PlayPauseButton.js +++ b/EEG101/src/components/PlayPauseButton.js @@ -19,7 +19,7 @@ export default class PlayPauseButton extends Component{ return( + style={{height: 80, width: 80, alignSelf: 'center'}}/> ) } diff --git a/EEG101/src/i18n/locales/en.js b/EEG101/src/i18n/locales/en.js index 8d4917f3..2dce3af2 100644 --- a/EEG101/src/i18n/locales/en.js +++ b/EEG101/src/i18n/locales/en.js @@ -240,6 +240,7 @@ export default { trainSamples: 'samples', trainStop: 'STOP', trainCollect: 'COLLECT', + trainCollectMore: 'COLLECT MORE (OPTIONAL)', trainOn: 'ON', trainOff: 'OFF', trainFitClassifier: 'FIT CLASSIFIER', diff --git a/EEG101/src/redux/reducer.js b/EEG101/src/redux/reducer.js index c30846f4..9e6f9441 100644 --- a/EEG101/src/redux/reducer.js +++ b/EEG101/src/redux/reducer.js @@ -44,14 +44,12 @@ export default function reducer(state = initialState, action = {}) { }; case SET_AVAILABLE_MUSES: - console.log(JSON.stringify(action.payload)); return { ...state, availableMuses: action.payload, }; case SET_MUSE_INFO: - console.log(JSON.stringify(action.payload)); return { ...state, museInfo: action.payload @@ -60,7 +58,8 @@ export default function reducer(state = initialState, action = {}) { case SET_OFFLINE_MODE: return { ...state, - isOfflineMode: action.payload + isOfflineMode: action.payload, + connectionStatus: config.connectionStatus.NO_MUSES }; case SET_MENU: diff --git a/EEG101/src/scenes/bci-01.js b/EEG101/src/scenes/bci-01.js index 2e4998e6..6b198915 100644 --- a/EEG101/src/scenes/bci-01.js +++ b/EEG101/src/scenes/bci-01.js @@ -3,6 +3,7 @@ import React, { Component } from "react"; import { StyleSheet, Text, View, ViewPagerAndroid, Image } from "react-native"; import { connect } from "react-redux"; import { MediaQueryStyleSheet } from "react-native-responsive"; +import config from "../redux/config"; import I18n from "../i18n/i18n"; import LinkButton from "../components/LinkButton"; import PopUp from "../components/PopUp"; @@ -13,6 +14,7 @@ import * as colors from "../styles/colors"; function mapStateToProps(state) { return { + connectionStatus: state.connectionStatus, dimensions: state.graphViewDimensions, isOfflineMode: state.isOfflineMode }; @@ -83,6 +85,16 @@ class BCIOne extends Component { title={I18n.t('machineLearningTitle')} > {I18n.t('machineLearningDefinition')} + this.props.history.push('/connectorOne')} + visible={ + this.props.connectionStatus === config.connectionStatus.DISCONNECTED + } + title={I18n.t('museDisconnectedTitle')} + > + {I18n.t('museDisconnectedDescription')} + + ); } diff --git a/EEG101/src/scenes/bci-02.js b/EEG101/src/scenes/bci-02.js index bb6244af..7d3ae796 100644 --- a/EEG101/src/scenes/bci-02.js +++ b/EEG101/src/scenes/bci-02.js @@ -17,6 +17,7 @@ import * as colors from "../styles/colors"; function mapStateToProps(state) { return { + connectionStatus: state.connectionStatus, dimensions: state.graphViewDimensions, bciAction: state.bciAction }; @@ -171,6 +172,16 @@ class BCITwo extends Component { + + this.props.history.push('/connectorOne')} + visible={ + this.props.connectionStatus === config.connectionStatus.DISCONNECTED + } + title={I18n.t('museDisconnectedTitle')} + > + {I18n.t('museDisconnectedDescription')} + ); } diff --git a/EEG101/src/scenes/bci-run.js b/EEG101/src/scenes/bci-run.js index a3bea53f..61c148cd 100644 --- a/EEG101/src/scenes/bci-run.js +++ b/EEG101/src/scenes/bci-run.js @@ -28,6 +28,7 @@ import * as colors from "../styles/colors"; function mapStateToProps(state) { return { + connectionStatus: state.connectionStatus, dimensions: state.graphViewDimensions, bciAction: state.bciAction }; @@ -40,7 +41,7 @@ class ClassifierRun extends Component { // Initialize States this.state = { popUp1Visible: false, - data: [1,1,1], + data: new Array(30).fill(1), noise: [], isRunning: false, }; @@ -153,6 +154,15 @@ class ClassifierRun extends Component { + this.props.history.push('/connectorOne')} + visible={ + this.props.connectionStatus === config.connectionStatus.DISCONNECTED + } + title={I18n.t('museDisconnectedTitle')} + > + {I18n.t('museDisconnectedDescription')} + ); } diff --git a/EEG101/src/scenes/bci-train.js b/EEG101/src/scenes/bci-train.js index 916c1dd3..8c5f9c87 100644 --- a/EEG101/src/scenes/bci-train.js +++ b/EEG101/src/scenes/bci-train.js @@ -15,6 +15,7 @@ import { setBCIAction } from "../redux/actions"; import config from "../redux/config.js"; import { MediaQueryStyleSheet } from "react-native-responsive"; import Classifier from "../interface/Classifier.js"; +import PopUp from "../components/PopUp"; import DecisionButton from "../components/DecisionButton.js"; import SandboxButton from "../components/SandboxButton.js"; import Button from "../components/Button.js"; @@ -25,6 +26,7 @@ import * as colors from "../styles/colors"; function mapStateToProps(state) { return { + connectionStatus: state.connectionStatus, bciAction: state.bciAction, dimensions: state.graphViewDimensions }; @@ -197,7 +199,7 @@ class BCITrain extends Component { - {I18n.t("trainAccuracy")}:{" "} + {I18n.t("trainAccuracy")}:{"\n"} {Math.round(this.state.score * 1000) / 1000} {I18n.t("trainReFit")} - Classifier.exportClassifier()}>EXPORT CLASSIFIER + Classifier.exportClassifier()}>EXPORT + this.props.history.push('/connectorOne')} + visible={ + this.props.connectionStatus === config.connectionStatus.DISCONNECTED + } + title={I18n.t('museDisconnectedTitle')} + > + {I18n.t('museDisconnectedDescription')} + ); } diff --git a/EEG101/src/scenes/slide-01-offline.js b/EEG101/src/scenes/slide-01-offline.js deleted file mode 100644 index ff203691..00000000 --- a/EEG101/src/scenes/slide-01-offline.js +++ /dev/null @@ -1,268 +0,0 @@ -import React, { Component } from "react"; -import { StyleSheet, Text, View, ViewPagerAndroid, Image } from "react-native"; -import { connect } from "react-redux"; -import config from "../redux/config"; -import { bindActionCreators } from "redux"; -import { setGraphViewDimensions } from "../redux/actions"; -import LinkButton from "../components/LinkButton"; -import PopUp from "../components/PopUp"; -import PopUpLink from "../components/PopUpLink"; -import { MediaQueryStyleSheet } from "react-native-responsive"; -import I18n from '../i18n/i18n'; -import * as colors from "../styles/colors"; - -//Interfaces. For elements that bridge to native -import GraphView from "../interface/GraphView"; - -// Sets isVisible prop by comparing state.scene.key (active scene) to the key of the wrapped scene -function mapStateToProps(state) { - return { - connectionStatus: state.connectionStatus, - isOfflineMode: state.isOfflineMode, - }; -} - -// Binds actions to component's props -function mapDispatchToProps(dispatch) { - return bindActionCreators( - { - setGraphViewDimensions - }, - dispatch - ); -} - -class SlideOne extends Component { - constructor(props) { - super(props); - - // Initialize States - this.state = { - popUp1Visible: false, - popUp2Visible: false, - popUp3Visible: false, - popUp4Visible: false, - slidePosition: 0 - }; - } - - offlineDataSource(slidePosition) { - console.log(slidePosition + 'slidePosition') - if(this.props.isOfflineMode){ - switch (slidePosition) { - case 0: - return "clean"; - break; - case 1: - return "blinks" - break; - case 2: - return "cat"; - break; - case 3: - return "relax"; - break; - } - } - } - - render() { - return ( - - - { - // Captures the width and height of the graphContainer to determine overlay positioning properties in PSDGraph - let { x, y, width, height } = event.nativeEvent.layout; - this.props.setGraphViewDimensions({ - x: x, - y: y, - width: width, - height: height - }); - }} - > - - - - {I18n.t('introductionSlideTitle')} - - - this.setState({ slidePosition: e.nativeEvent.position })} - > - - - {this.props.isOfflineMode ? I18n.t('brainElectricityOffline') : I18n.t('brainElectricity')} - - {I18n.t('usingThe')} this.setState({ popUp1Visible: true })}>{I18n.t('EEGLink')}{this.props.isOfflineMode ? I18n.t('deviceCanDetectOffline') : I18n.t('deviceCanDetect')} - - - - - - {I18n.t('tryBlinkingEyes')} - {I18n.t('doesSignalChange')} - - {I18n.t('eyeMovementCreates')} this.setState({ popUp2Visible: true })}>{I18n.t('noiseLink')}{I18n.t('inEEGSignal')} - - - - - {I18n.t('tryThinkingAbout')} - {I18n.t('doesSignalChange')} - - {I18n.t('althoughEEG')} this.setState({ popUp3Visible: true })}>{I18n.t('readingMindsLink')}. - - - - - {I18n.t('tryClosingEyes10')} - - {I18n.t('mayNoticeSignalChange')} this.setState({ popUp4Visible: true })}>{I18n.t('alphaWavesLink')} - - {I18n.t('nextLink')} - - - - - this.setState({ popUp1Visible: false })} - visible={this.state.popUp1Visible} - title={I18n.t('whatIsEEGTitle')} - image={require("../assets/hansberger.jpg")} - > - {I18n.t('whatIsEEGDescription')} - - - this.setState({ popUp2Visible: false })} - visible={this.state.popUp2Visible} - title={I18n.t('noiseTitle')} - > - {I18n.t('noiseDescription')} - - - this.setState({ popUp3Visible: false })} - visible={this.state.popUp3Visible} - title={I18n.t('cannotReadMindsTitle')} - > - {I18n.t('cannotReadMindsDescription')} - - - this.setState({ popUp4Visible: false })} - visible={this.state.popUp4Visible} - title={I18n.t('eyeRythymsTitle')} - > - {I18n.t('eyeRythymsDescription')} - - - this.props.history.push('/connectorOne')} - visible={ - this.props.connectionStatus === config.connectionStatus.DISCONNECTED - } - title={I18n.t('museDisconnectedTitle')} - > - {I18n.t('museDisconnectedDescription')} - - - ); - } -} - -export default connect(mapStateToProps, mapDispatchToProps)(SlideOne); - -const styles = MediaQueryStyleSheet.create( - // Base styles - { - pageStyle: { - padding: 15, - alignItems: "stretch", - justifyContent: "space-around" - }, - - currentTitle: { - marginLeft: 20, - marginTop: 10, - fontSize: 13, - fontFamily: "Roboto-Medium", - color: colors.skyBlue - }, - - body: { - fontFamily: "Roboto-Light", - color: colors.black, - fontSize: 19 - }, - - container: { - backgroundColor: colors.white, - flex: 1, - justifyContent: "space-around", - alignItems: "stretch" - }, - - graphContainer: { - flex: 4, - justifyContent: "center", - alignItems: "stretch" - }, - - sandboxButtonContainer: { - position: "absolute", - right: 5, - top: 5 - }, - - header: { - fontFamily: "Roboto-Bold", - color: colors.black, - fontSize: 20 - }, - - viewPager: { - borderWidth: 1, - flex: 4 - }, - - swipeImage: { - height: 40, - alignSelf: "center" - } - }, - // Responsive styles - { - "@media (min-device-height: 700)": { - viewPager: { - flex: 3 - }, - - header: { - fontSize: 30 - }, - - currentTitle: { - fontSize: 20 - }, - - body: { - fontSize: 25 - }, - - swipeImage: { - height: 75, - width: 75 - } - } - } -); diff --git a/EEG101/src/scenes/slide-01.js b/EEG101/src/scenes/slide-01.js index c7190a9d..01dbfa5c 100644 --- a/EEG101/src/scenes/slide-01.js +++ b/EEG101/src/scenes/slide-01.js @@ -18,6 +18,7 @@ import GraphView from "../interface/GraphView"; function mapStateToProps(state) { return { connectionStatus: state.connectionStatus, + isOfflineMode: state.isOfflineMode, }; } @@ -37,6 +38,7 @@ class SlideOne extends Component { // Initialize States this.state = { + slidePosition: 0, popUp1Visible: false, popUp2Visible: false, popUp3Visible: false, @@ -44,6 +46,25 @@ class SlideOne extends Component { }; } + offlineDataSource(slidePosition) { + if(this.props.isOfflineMode){ + switch (slidePosition) { + case 0: + return "clean"; + break; + case 1: + return "blinks" + break; + case 2: + return "cat"; + break; + case 3: + return "relax"; + break; + } + } + } + render() { return ( @@ -60,8 +81,11 @@ class SlideOne extends Component { height: height }); }} + // Receives a native callback event e that is used to set slidePosition state + onPageSelected={e => + this.setState({ slidePosition: e.nativeEvent.position })} > - + {I18n.t('introductionSlideTitle')} diff --git a/EEG101/src/scenes/slide-03.js b/EEG101/src/scenes/slide-03.js index a58f60bc..d8a44f62 100644 --- a/EEG101/src/scenes/slide-03.js +++ b/EEG101/src/scenes/slide-03.js @@ -136,7 +136,7 @@ class SlideThree extends Component { this.props.history.push("/connectorOne")} visible={ - this.props.connectionStatus === config.connectionStatus.DISCONNECTED + this.props.connectionStatus === config.connectionStatus.DISCONNECTED } title={I18n.t("museDisconnectedTitle")} > diff --git a/EEG101/src/scenes/slide-04.js b/EEG101/src/scenes/slide-04.js index a61fbbf0..484096e5 100644 --- a/EEG101/src/scenes/slide-04.js +++ b/EEG101/src/scenes/slide-04.js @@ -95,7 +95,7 @@ class SlideFour extends Component { this.props.history.push("/connectorOne")} visible={ - this.props.connectionStatus === config.connectionStatus.DISCONNECTED + this.props.connectionStatus === config.connectionStatus.DISCONNECTED } title={I18n.t("museDisconnectedTitle")} > diff --git a/EEG101/src/scenes/slide-05.js b/EEG101/src/scenes/slide-05.js index 8d7f0ec9..37b5a4f7 100644 --- a/EEG101/src/scenes/slide-05.js +++ b/EEG101/src/scenes/slide-05.js @@ -101,7 +101,7 @@ class SlideFive extends Component { this.props.history.push('/connectorOne')} visible={ - this.props.connectionStatus === config.connectionStatus.DISCONNECTED + this.props.connectionStatus === config.connectionStatus.DISCONNECTED } title={I18n.t('museDisconnectedTitle')} > diff --git a/EEG101/src/scenes/slide-06.js b/EEG101/src/scenes/slide-06.js index 67f124da..227b9dba 100644 --- a/EEG101/src/scenes/slide-06.js +++ b/EEG101/src/scenes/slide-06.js @@ -65,7 +65,7 @@ class SlideSix extends Component { this.props.history.push('/connectorOne')} visible={ - this.props.connectionStatus === config.connectionStatus.DISCONNECTED + this.props.connectionStatus === config.connectionStatus.DISCONNECTED } title={I18n.t('museDisconnectedTitle')} > diff --git a/EEG101/src/scenes/slide-08.js b/EEG101/src/scenes/slide-08.js index 105a87da..ca2908df 100644 --- a/EEG101/src/scenes/slide-08.js +++ b/EEG101/src/scenes/slide-08.js @@ -91,7 +91,7 @@ class SlideEight extends Component { this.props.history.push("/connectorOne")} visible={ - this.props.connectionStatus === config.connectionStatus.DISCONNECTED + this.props.connectionStatus === config.connectionStatus.DISCONNECTED } title={I18n.t("museDisconnectedTitle")} > diff --git a/EEG101/src/scenes/slide-09.js b/EEG101/src/scenes/slide-09.js index 9c33c4ae..a4483204 100644 --- a/EEG101/src/scenes/slide-09.js +++ b/EEG101/src/scenes/slide-09.js @@ -124,7 +124,7 @@ class SlideNine extends Component { this.props.history.push("/connectorOne")} visible={ - this.props.connectionStatus === config.connectionStatus.DISCONNECTED + this.props.connectionStatus === config.connectionStatus.DISCONNECTED } title={I18n.t("museDisconnectedTitle")} >