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.3.8 to 0.4.0

9

changelog.md

@@ -0,1 +1,10 @@

# 0.4.0
### New Features
* If dropped connection, module will now disconnect and clean up.
### Breaking Changes
* Dropped connection will fire disconnect
* Auto reconnect functionality temporarily removed.
# 0.3.8

@@ -2,0 +11,0 @@

10

examples/ganglionConnectionTest/ganglionConnectionTest.js

@@ -138,9 +138,13 @@ const Ganglion = require('../../index').Ganglion;

if (verbose) console.log('clean');
ganglion.manualDisconnect = true;
ganglion.disconnect();
ganglion.removeAllListeners('droppedPacket');
ganglion.removeAllListeners('accelerometer');
ganglion.removeAllListeners('sample');
ganglion.removeAllListeners('droppedPacket');
ganglion.removeAllListeners('message');
ganglion.removeAllListeners('accelerometer');
ganglion.removeAllListeners('impedance');
ganglion.removeAllListeners(k.OBCIEmitterGanglionFound);
ganglion.removeAllListeners('close');
ganglion.removeAllListeners('ganglionFound');
ganglion.removeAllListeners('ready');
ganglion.destroyNoble();
}

@@ -147,0 +151,0 @@ if (err) console.log(err.stack);

@@ -27,20 +27,26 @@ const Ganglion = require('../../index').Ganglion;

console.log(sample.sampleNumber);
if (sample.sampleNumber === 0) {
buf.push(droppedPacketCounter);
sizeOfBuf++;
droppedPacketCounter = 0;
if (sizeOfBuf >= 60) {
var sum = 0;
for (let i = 0; i < buf.length; i++) {
sum += parseInt(buf[i], 10);
}
const percentDropped = sum / 6000 * 100;
console.log(`dropped packet rate: ${sum} - percent dropped: %${percentDropped.toFixed(2)}`);
buf.shift();
} else {
console.log(`time till average rate starts ${60 - sizeOfBuf}`);
}
}
// UNCOMMENT BELOW FOR DROPPED PACKET CALCULATIONS...
// if (sample.sampleNumber === 0) {
// buf.push(droppedPacketCounter);
// sizeOfBuf++;
// droppedPacketCounter = 0;
// if (sizeOfBuf >= 60) {
// var sum = 0;
// for (let i = 0; i < buf.length; i++) {
// sum += parseInt(buf[i], 10);
// }
// const percentDropped = sum / 6000 * 100;
// console.log(`dropped packet rate: ${sum} - percent dropped: %${percentDropped.toFixed(2)}`);
// buf.shift();
// } else {
// console.log(`time till average rate starts ${60 - sizeOfBuf}`);
// }
// }
});
ganglion.on('close', () => {
console.log('close event');
});
ganglion.on('droppedPacket', (data) => {

@@ -79,3 +85,3 @@ console.log('droppedPacket:', data);

} else {
ganglion.streamStart().catch(errorFunc);
// ganglion.streamStart().catch(errorFunc);
}

@@ -92,2 +98,13 @@ console.log('ready');

// console.log(connectedPeripheral)
ganglion.manualDisconnect = true;
ganglion.disconnect();
ganglion.removeAllListeners('droppedPacket');
ganglion.removeAllListeners('accelerometer');
ganglion.removeAllListeners('sample');
ganglion.removeAllListeners('message');
ganglion.removeAllListeners('impedance');
ganglion.removeAllListeners('close');
ganglion.removeAllListeners('ganglionFound');
ganglion.removeAllListeners('ready');
ganglion.destroyNoble();

@@ -109,2 +126,3 @@ }

ganglion.disconnect(true).catch(console.log);
process.exit(0);
}

@@ -111,0 +129,0 @@ }

@@ -222,2 +222,9 @@ 'use strict';

/**
* Destroys the noble!
*/
Ganglion.prototype.destroyNoble = function () {
this._nobleDestroy();
};
/**
* Destroys the multi packet buffer.

@@ -248,2 +255,3 @@ */

}
return Promise.resolve();
})

@@ -256,2 +264,3 @@ .then(() => {

if (err) {
this._disconnected();
reject(err);

@@ -579,7 +588,8 @@ } else {

if (this.options.verbose) console.log('Disconnected');
if (!this.manualDisconnect) {
this.autoReconnect();
// this.autoReconnect();
}
if (this.options.verbose) console.log(`Private disconnect clean up`);
this.emit('close');

@@ -618,2 +628,3 @@ };

if (this.options.verbose) console.log('Peripheral disconnected');
this._disconnected();
});

@@ -620,0 +631,0 @@

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

@@ -5,0 +5,0 @@ "main": "index.js",

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