import React, { Component } from 'react'; import { Button } from './ui/button'; import { Observable } from 'rxjs'; import { PLOTTING_INTERVAL, CONNECTION_STATUS, DEVICE_AVAILABILITY, DEVICES, } from '../constants/constants'; import eegImage from '../assets/common/EEG.png'; import SignalQualityIndicatorComponent from './SignalQualityIndicatorComponent'; import ViewerComponent from './ViewerComponent'; import ConnectModal from './CollectComponent/ConnectModal'; import { DeviceActions } from '../actions'; import { Device, SignalQualityData } from '../constants/interfaces'; interface Props { connectedDevice: Record; signalQualityObservable?: Observable; deviceType: DEVICES; deviceAvailability: DEVICE_AVAILABILITY; connectionStatus: CONNECTION_STATUS; DeviceActions: typeof DeviceActions; availableDevices: Array; } interface State { isConnectModalOpen: boolean; } export default class Home extends Component { constructor(props: Props) { super(props); this.state = { isConnectModalOpen: false, }; this.handleConnectModalClose = this.handleConnectModalClose.bind(this); this.handleStartConnect = this.handleStartConnect.bind(this); this.handleStopConnect = this.handleStopConnect.bind(this); } componentDidUpdate = (prevProps: Props, prevState: State) => { if ( this.props.connectionStatus === CONNECTION_STATUS.CONNECTED && prevState.isConnectModalOpen ) { this.setState({ isConnectModalOpen: false }); } }; handleStartConnect() { this.setState({ isConnectModalOpen: true }); this.props.DeviceActions.SetDeviceAvailability( DEVICE_AVAILABILITY.SEARCHING ); } handleStopConnect() { this.props.DeviceActions.DisconnectFromDevice(); this.setState({ isConnectModalOpen: false }); this.props.DeviceActions.SetDeviceAvailability(DEVICE_AVAILABILITY.NONE); } handleConnectModalClose() { this.setState({ isConnectModalOpen: false }); } render() { return (
{this.props.connectionStatus === CONNECTION_STATUS.CONNECTED && this.props.signalQualityObservable && (
)} {this.props.connectionStatus !== CONNECTION_STATUS.CONNECTED && (
EEG device

Explore Raw EEG


Connect directly to an EEG device and view raw streaming data

)}
); } }