Skip to content

Commit

Permalink
Removed noble-winrt and patch-package
Browse files Browse the repository at this point in the history
  • Loading branch information
jdpigeon committed Mar 7, 2020
1 parent d802f42 commit 35dfeba
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 439 deletions.
35 changes: 4 additions & 31 deletions app/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,16 @@
},
"scripts": {
"electron-rebuild": "node -r babel-register ../internals/scripts/ElectronRebuild.js",
"postinstall": "patch-package && npm run electron-rebuild"
"postinstall": "npm run electron-rebuild"
},
"license": "MIT",
"dependencies": {
"@babel/runtime-corejs2": "^7.0.0",
"@neurosity/pipes": "^3.2.3",
"babel-runtime": "^6.26.0",
"bleat": "^0.1.8",
"bleat": "^0.1.9",
"enchannel-zmq-backend": "^6.0.11",
"kernelspecs": "^2.0.0",
"noble-winrt": "^0.1.0",
"node-pre-gyp": "^0.10.0",
"spawnteract": "^4.0.0"
},
Expand Down
12 changes: 0 additions & 12 deletions app/patches/bleat+0.1.8.patch

This file was deleted.

55 changes: 25 additions & 30 deletions app/utils/eeg/muse.js
Original file line number Diff line number Diff line change
@@ -1,54 +1,49 @@
import 'hazardous';
import { withLatestFrom, share, startWith, filter } from 'rxjs/operators';
import "hazardous";
import { withLatestFrom, share, startWith, filter } from "rxjs/operators";
import {
addInfo,
epoch,
bandpassFilter,
addSignalQuality
} from '@neurosity/pipes';
import { release } from 'os';
import { MUSE_SERVICE, MuseClient, zipSamples } from 'muse-js';
import { from } from 'rxjs';
import { parseMuseSignalQuality } from './pipes';
} from "@neurosity/pipes";
import { release } from "os";
import { MUSE_SERVICE, MuseClient, zipSamples } from "muse-js";
import { from } from "rxjs";
import { webbluetooth } from "bleat";
import { parseMuseSignalQuality } from "./pipes";
import {
MUSE_SAMPLING_RATE,
MUSE_CHANNELS,
PLOTTING_INTERVAL
} from '../../constants/constants';
} 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;

if (process.platform === "win32" && release().split(".")[0] < 10) {
console.error("Muse EEG not available in Windows 7");
}

client = new MuseClient();
client.enableAux = false;

// 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({
filters: [{ services: [MUSE_SERVICE] }]
});
}
console.log("getting muse");
device = await webbluetooth.requestDevice({
filters: [{ services: [MUSE_SERVICE] }]
});
console.log("received ", device);
return [device];
};

// Attempts to connect to a muse device. If successful, returns a device info object
export const connectToMuse = async device => {
if (process.platform === 'win32') {
if (process.platform === "win32") {
const gatt = await device.gatt.connect();
await client.connect(gatt);
} else {
Expand Down Expand Up @@ -111,10 +106,10 @@ export const injectMuseMarker = (value, time) => {

const synchronizeTimestamp = (eegSample, marker) => {
if (
eegSample['timestamp'] - marker['timestamp'] < 0 &&
eegSample['timestamp'] - marker['timestamp'] >= INTER_SAMPLE_INTERVAL
eegSample["timestamp"] - marker["timestamp"] < 0 &&
eegSample["timestamp"] - marker["timestamp"] >= INTER_SAMPLE_INTERVAL
) {
return { ...eegSample, marker: marker['value'] };
return { ...eegSample, marker: marker["value"] };
}
return eegSample;
};
Loading

0 comments on commit 35dfeba

Please sign in to comment.