Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

openbci-ganglion

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

openbci-ganglion - npm Package Compare versions

Comparing version 0.4.2 to 0.4.3

5

changelog.md

@@ -0,1 +1,6 @@

# 0.4.3
### Bug Fixes
* Fix #23 by hard setting noble to 0.1.7, 0.1.8 breaks
# 0.4.2

@@ -2,0 +7,0 @@

33

examples/ganglionServer/ganglionServer.js

@@ -5,4 +5,3 @@ const Ganglion = require('../../index').Ganglion;

let ganglion = new Ganglion({
// debug: true; ,
nobleAutoStart: false,
debug: true,
sendCounts: true,

@@ -67,3 +66,3 @@ verbose: verbose

ganglion.on('message', (message) => {
// console.log('message: ', message.toString());
console.log('message: ', message.toString());
});

@@ -86,17 +85,19 @@

ganglion.once('ready', () => {
if (accel) {
ganglion.accelStart()
.then(() => {
return ganglion.streamStart();
})
.catch(errorFunc);
} else if (impedance) {
ganglion.impedanceStart().catch(errorFunc);
} else {
// ganglion.streamStart().catch(errorFunc);
}
console.log('ready');
// if (accel) {
// ganglion.accelStart()
// .then(() => {
// return ganglion.streamStart();
// })
// .catch(errorFunc);
// } else if (impedance) {
// ganglion.impedanceStart().catch(errorFunc);
// } else {
//
// }
ganglion.streamStart().catch(errorFunc);
console.log('ready');
});
ganglion.connect(peripheral).catch(errorFunc);
ganglion.connect("Ganglion-58f3").catch(errorFunc);
});

@@ -103,0 +104,0 @@

@@ -514,5 +514,10 @@ 'use strict';

}
if (this.options.debug) openBCIUtils.debugBytes('>>>', data);
this._sendCharacteristic.write(data);
resolve();
this._sendCharacteristic.write(data, true, (err) => {
if (err) {
reject(err);
} else {
if (this.options.debug) openBCIUtils.debugBytes('>>>', data);
resolve();
}
});
} else {

@@ -519,0 +524,0 @@ reject('Send characteristic not set, please call connect method');

{
"name": "openbci-ganglion",
"version": "0.4.2",
"version": "0.4.3",
"description": "The official Node.js SDK for the OpenBCI Ganglion Biosensor Board.",

@@ -25,3 +25,3 @@ "main": "index.js",

"mathjs": "^3.3.0",
"noble": "^1.7.0",
"noble": "1.7.0",
"performance-now": "^0.2.0",

@@ -28,0 +28,0 @@ "sntp": "^2.0.0",

@@ -8,3 +8,3 @@ [![Join the chat at https://gitter.im/OpenBCI/OpenBCI_NodeJS](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/OpenBCI/OpenBCI_NodeJS?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

# OpenBCI Node.js SDK
# OpenBCI Node.js Ganglion SDK

@@ -577,2 +577,47 @@ A Node.js module for OpenBCI ~ written with love by [Push The World!](http://www.pushtheworldllc.com)

## <a name="interfacing-with-other-tools"></a> Interfacing With Other Tools:
### <a name="interfacing-with-other-tools-labstreaminglayer"></a> LabStreamingLayer
[LabStreamingLayer](https://github.com/sccn/labstreaminglayer) by SCCN is a stream management tool designed to time-synchronize multiple data streams, potentially from different sources, over a LAN network with millisecond accuracy (given configuration).
For example, a VR display device running a Unity simulation may, using the [LSL4Unity](https://github.com/xfleckx/LSL4Unity) library, emit string markers into LSL corresponding to events of interest (For the P300 ERP, this event would be the onset of an attended, unusual noise in a pattern of commonplace ones). The computer doing data collection via the OpenBCI_NodeJS library (potentially with 4ms accuracy) would then output into an LSL stream the EEG and AUX data. LSL can then synchronize the two clocks relative to each other before inputting into a different program or toolkit, like [BCILAB](https://github.com/sccn/BCILAB) for analysis to trigger responses in the Unity display.
This requires OpenBCI_NodeJS exporting data into LSL. Currently, there does not exist a pre-built NodeJS module for LSL, though LSL comes with tools that could possibly allow creation of one. In the meantime, the simpler route is to use a concurrent python script (driven by NodeJS module [python-shell](https://www.npmjs.com/package/python-shell)) to handoff the data to LSL for you, like so:
In your NodeJS code, before initializing/connecting to the OpenBCIBoard:
```js
// Construct LSL Handoff Python Shell
var PythonShell = require('python-shell');
var lsloutlet = new PythonShell('LslHandoff.py');
lsloutlet.on('message', function(message){
console.log('LslOutlet: ' + message);
});
console.log('Python Shell Created for LSLHandoff');
```
In your NodeJS code, when reading samples:
```js
st = sample.channelData.join(' ')
//getTime returns milliseconds since midnight 1970/01/01
var s = ''+ sample.timeStamp + ': '+ st
lsloutlet.send(s)
```
in LSLHandoff.py:
```py
from pylsl import StreamInfo, StreamOutlet
info = StreamInfo('OpenBCI_EEG', 'EEG', 4, 200, 'float32', '[RANDOM NUMBER HERE]')
outlet = StreamOutlet(info)
while True:
strSample = raw_input().split(': ',1)
sample = map(float, strSample[1].split(' '))
stamp = float(strSample[0])
outlet.push_sample(sample, stamp)
print('Pushed Sample At: ' + strSample[0])
```
AUX data would be done the same way in a separate LSL stream.
## <a name="developing"></a> Developing:

@@ -579,0 +624,0 @@ ### <a name="developing-running"></a> Running:

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc