Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import { from } from 'rxjs';
import { parseMuseSignalQuality } from './pipes';
import {
MUSE_SAMPLING_RATE,
MUSE_CHANNELS,
PLOTTING_INTERVAL
} from '../../constants/constants';
const INTER_SAMPLE_INTERVAL = -(1 / 256) * 1000;
let bluetooth = {};
let client = {};
if (process.platform !== 'win32' || release().split('.')[0] >= 10) {
// Just returns the client object from Muse JS
bluetooth = require('bleat').webbluetooth;
client = new MuseClient();
client.enableAux = true;
}
// Gets an available Muse device
// TODO: test whether this will ever return multiple devices if available
export const getMuse = async () => {
let device = {};
if (process.platform === 'win32') {
if (release().split('.')[0] < 10) {
console.log('win 7 ');
return null;
}
device = await bluetooth.requestDevice({
filters: [{ services: [MUSE_SERVICE] }]
});
} else {
device = await navigator.bluetooth.requestDevice({