Comparar commits
4 Commits
| Autor | SHA1 | Data | |
|---|---|---|---|
| 595c6dea5a | |||
| 89b5f35abc | |||
| 9dd090df44 | |||
| 8993a6c23b |
+2
-7
@@ -1,12 +1,5 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "4.0"
|
||||
- "4.1"
|
||||
- "4.2"
|
||||
- "4.3"
|
||||
- "4.4"
|
||||
- "4.5"
|
||||
- "4.6"
|
||||
- "5.11.0"
|
||||
- "6.0"
|
||||
- "6.1"
|
||||
@@ -17,6 +10,8 @@ node_js:
|
||||
- "6.6"
|
||||
- "6.7"
|
||||
- "6.8"
|
||||
- "7.0"
|
||||
- "7.1"
|
||||
install:
|
||||
- npm install --all
|
||||
script:
|
||||
|
||||
+299
-297
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
+26
-1
@@ -1,3 +1,28 @@
|
||||
# 2.0.0
|
||||
|
||||
### New Features
|
||||
* `index.js` file allows for ES6 destructing
|
||||
|
||||
### Breaking Changes
|
||||
* Change name of `OpenBCIBoard` to `Cyton` to follow new naming convention.
|
||||
Simply change:
|
||||
```ecmascript 6
|
||||
const OpenBCIBoard = require('openbci').OpenBCIBoard;
|
||||
const ourBoard = new OpenBCIBoard();
|
||||
```
|
||||
```ecmascript 6
|
||||
const Cyton = require('openbci').Cyton;
|
||||
const ourBoard = new Cyton();
|
||||
```
|
||||
* Major change to how board is initialized with removal of `factory` paradigm.
|
||||
* Drop support for Node 4 and 5 due to lack of EMACS 6
|
||||
|
||||
### Bug Fixes
|
||||
* Documentation error with `testSignal` function.
|
||||
|
||||
### Enhancements
|
||||
* Add more tests for public API functions.
|
||||
|
||||
# 1.4.3
|
||||
|
||||
### New examples
|
||||
@@ -237,7 +262,7 @@ The second major release for the OpenBCI Node.js SDK brings major changes, impro
|
||||
### Bug Fixes
|
||||
|
||||
* updates to README.me and comments to change ntp to sntp, because the two are similar, but not the same and we do not want to be misleading
|
||||
* Extended [Stnp](https://www.npmjs.com/package/sntp) to main openBCIBoard.js
|
||||
* Extended [Stnp](https://www.npmjs.com/package/sntp) to main openBCICyton.js
|
||||
* Add `.sntpNow()` function to get ntp time.
|
||||
|
||||
# 0.3.1
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
module.exports.Cyton = require('./openBCICyton');
|
||||
module.exports.Constants = require('./openBCIConstants');
|
||||
-2407
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
@@ -203,6 +203,7 @@ const obciSimulatorFragmentationNone = 'none';
|
||||
|
||||
/** Possible Sample Rates */
|
||||
const obciSampleRate125 = 125;
|
||||
const obciSampleRate200 = 200;
|
||||
const obciSampleRate250 = 250;
|
||||
|
||||
/** Max sample number */
|
||||
@@ -232,9 +233,13 @@ const obciByteStart = 0xA0;
|
||||
const obciByteStop = 0xC0;
|
||||
|
||||
/** Errors */
|
||||
const errorNobleAlreadyScanning = 'Scan already under way';
|
||||
const errorNobleNotAlreadyScanning = 'No scan started';
|
||||
const errorNobleNotInPoweredOnState = 'Please turn blue tooth on.';
|
||||
const errorInvalidByteLength = 'Invalid Packet Byte Length';
|
||||
const errorInvalidByteStart = 'Invalid Start Byte';
|
||||
const errorInvalidByteStop = 'Invalid Stop Byte';
|
||||
const errorInvalidType = 'Invalid Type';
|
||||
const errorTimeSyncIsNull = "'this.sync.curSyncObj' must not be null";
|
||||
const errorTimeSyncNoComma = 'Missed the time sync sent confirmation. Try sync again';
|
||||
const errorUndefinedOrNullInput = 'Undefined or Null Input';
|
||||
@@ -337,6 +342,7 @@ const obciEmitterClose = 'close';
|
||||
const obciEmitterDroppedPacket = 'droppedPacket';
|
||||
const obciEmitterError = 'error';
|
||||
const obciEmitterImpedanceArray = 'impedanceArray';
|
||||
const obciEmitterMessage = 'message';
|
||||
const obciEmitterQuery = 'query';
|
||||
const obciEmitterRawDataPacket = 'rawDataPacket';
|
||||
const obciEmitterReady = 'ready';
|
||||
@@ -749,6 +755,7 @@ module.exports = {
|
||||
},
|
||||
/** Possible Sample Rates */
|
||||
OBCISampleRate125: obciSampleRate125,
|
||||
OBCISampleRate200: obciSampleRate200,
|
||||
OBCISampleRate250: obciSampleRate250,
|
||||
/** Max sample number */
|
||||
OBCISampleNumberMax: obciSampleNumberMax,
|
||||
@@ -758,9 +765,13 @@ module.exports = {
|
||||
OBCIByteStart: obciByteStart,
|
||||
OBCIByteStop: obciByteStop,
|
||||
/** Errors */
|
||||
OBCIErrorNobleAlreadyScanning: errorNobleAlreadyScanning,
|
||||
OBCIErrorNobleNotAlreadyScanning: errorNobleNotAlreadyScanning,
|
||||
OBCIErrorNobleNotInPoweredOnState: errorNobleNotInPoweredOnState,
|
||||
OBCIErrorInvalidByteLength: errorInvalidByteLength,
|
||||
OBCIErrorInvalidByteStart: errorInvalidByteStart,
|
||||
OBCIErrorInvalidByteStop: errorInvalidByteStop,
|
||||
OBCIErrorInvalidType: errorInvalidType,
|
||||
OBCIErrorTimeSyncIsNull: errorTimeSyncIsNull,
|
||||
OBCIErrorTimeSyncNoComma: errorTimeSyncNoComma,
|
||||
OBCIErrorUndefinedOrNullInput: errorUndefinedOrNullInput,
|
||||
@@ -896,6 +907,7 @@ module.exports = {
|
||||
OBCIEmitterDroppedPacket: obciEmitterDroppedPacket,
|
||||
OBCIEmitterError: obciEmitterError,
|
||||
OBCIEmitterImpedanceArray: obciEmitterImpedanceArray,
|
||||
OBCIEmitterMessage: obciEmitterMessage,
|
||||
OBCIEmitterQuery: obciEmitterQuery,
|
||||
OBCIEmitterRawDataPacket: obciEmitterRawDataPacket,
|
||||
OBCIEmitterReady: obciEmitterReady,
|
||||
|
||||
+2351
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
+4
-4
@@ -1,7 +1,7 @@
|
||||
'use strict';
|
||||
var gaussian = require('gaussian');
|
||||
var k = require('./openBCIConstants');
|
||||
var StreamSearch = require('streamsearch');
|
||||
const gaussian = require('gaussian');
|
||||
const k = require('./openBCIConstants');
|
||||
const StreamSearch = require('streamsearch');
|
||||
|
||||
/** Constants for interpreting the EEG data */
|
||||
// Reference voltage for ADC in ADS1299.
|
||||
@@ -274,7 +274,7 @@ var sampleModule = {
|
||||
|
||||
return (prefix << 16) | (twoByteBuffer[0] << 8) | twoByteBuffer[1];
|
||||
},
|
||||
interpret24bitAsInt32: threeByteBuffer => {
|
||||
interpret24bitAsInt32: (threeByteBuffer) => {
|
||||
var prefix = 0;
|
||||
|
||||
if (threeByteBuffer[0] > 127) {
|
||||
|
||||
@@ -120,7 +120,7 @@ function OpenBCISimulatorFactory () {
|
||||
|
||||
if (size > this.outputBuffered) size = this.outputBuffered;
|
||||
|
||||
// buffer is copied because presently openBCIBoard.js reuses it
|
||||
// buffer is copied because presently openBCICyton.js reuses it
|
||||
var outBuffer = new Buffer(this.outputBuffer.slice(0, size));
|
||||
|
||||
this.outputBuffer.copy(this.outputBuffer, 0, size, this.outputBuffered);
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
module.exports = {
|
||||
debugBytes
|
||||
};
|
||||
|
||||
/**
|
||||
* @description Output passed bytes on the console as a hexdump, if enabled
|
||||
* @param prefix - label to show to the left of bytes
|
||||
* @param data - bytes to output, a buffer or string
|
||||
* @private
|
||||
*/
|
||||
function debugBytes (prefix, data) {
|
||||
if (typeof data === 'string') data = new Buffer(data);
|
||||
|
||||
console.log('Debug bytes:');
|
||||
|
||||
for (var j = 0; j < data.length;) {
|
||||
var hexPart = '';
|
||||
var ascPart = '';
|
||||
for (var end = Math.min(data.length, j + 16); j < end; ++j) {
|
||||
var byt = data[j];
|
||||
|
||||
var hex = ('0' + byt.toString(16)).slice(-2);
|
||||
hexPart += (((j & 0xf) === 0x8) ? ' ' : ' '); // puts an extra space 8 bytes in
|
||||
hexPart += hex;
|
||||
|
||||
var asc = (byt >= 0x20 && byt < 0x7f) ? String.fromCharCode(byt) : '.';
|
||||
ascPart += asc;
|
||||
}
|
||||
|
||||
// pad to fixed width for alignment
|
||||
hexPart = (hexPart + ' ').substring(0, 3 * 17);
|
||||
|
||||
console.log(prefix + ' ' + hexPart + '|' + ascPart + '|');
|
||||
}
|
||||
}
|
||||
+6
-3
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"name": "openbci",
|
||||
"version": "1.4.2",
|
||||
"version": "2.0.0",
|
||||
"description": "The official Node.js SDK for the OpenBCI Biosensor Board.",
|
||||
"main": "openBCIBoard",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"start": "node index",
|
||||
"test": "semistandard | snazzy && mocha test",
|
||||
@@ -16,10 +16,12 @@
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"buffer-equal": "^1.0.0",
|
||||
"clone": "^2.0.0",
|
||||
"gaussian": "^1.0.0",
|
||||
"lodash": "^4.16.6",
|
||||
"mathjs": "^3.3.0",
|
||||
"performance-now": "^0.2.0",
|
||||
"serialport": "4.0.1",
|
||||
"serialport": "4.0.6",
|
||||
"sntp": "^2.0.0",
|
||||
"streamsearch": "^0.1.2"
|
||||
},
|
||||
@@ -53,6 +55,7 @@
|
||||
"semistandard": {
|
||||
"globals": [
|
||||
"describe",
|
||||
"xdescribe",
|
||||
"context",
|
||||
"before",
|
||||
"beforeEach",
|
||||
|
||||
@@ -764,6 +764,9 @@ describe('OpenBCIConstants', function () {
|
||||
it('should be 125', function () {
|
||||
assert.equal(125, k.OBCISampleRate125);
|
||||
});
|
||||
it('should be 250', function () {
|
||||
assert.equal(200, k.OBCISampleRate200);
|
||||
});
|
||||
it('should be 250', function () {
|
||||
assert.equal(250, k.OBCISampleRate250);
|
||||
});
|
||||
@@ -1446,6 +1449,9 @@ describe('OpenBCIConstants', function () {
|
||||
it('Event Emitter Impedance Array', function () {
|
||||
assert.equal('impedanceArray', k.OBCIEmitterImpedanceArray);
|
||||
});
|
||||
it('Event Emitter Message', function () {
|
||||
assert.equal('message', k.OBCIEmitterMessage);
|
||||
});
|
||||
it('Event Emitter Query', function () {
|
||||
assert.equal('query', k.OBCIEmitterQuery);
|
||||
});
|
||||
@@ -1459,7 +1465,4 @@ describe('OpenBCIConstants', function () {
|
||||
assert.equal('sample', k.OBCIEmitterSample);
|
||||
});
|
||||
});
|
||||
describe('Errors', function () {
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
@@ -2,28 +2,28 @@
|
||||
* Created by ajk on 12/15/15.
|
||||
*/
|
||||
'use strict';
|
||||
var bluebirdChecks = require('./bluebirdChecks');
|
||||
var openBCISample = require('../openBCISample');
|
||||
var chai = require('chai');
|
||||
var expect = chai.expect;
|
||||
var assert = chai.assert;
|
||||
var should = chai.should(); // eslint-disable-line no-unused-vars
|
||||
const bluebirdChecks = require('./bluebirdChecks');
|
||||
const openBCISample = require('../openBCISample');
|
||||
const chai = require('chai');
|
||||
const expect = chai.expect;
|
||||
const assert = chai.assert;
|
||||
const should = chai.should(); // eslint-disable-line no-unused-vars
|
||||
|
||||
var chaiAsPromised = require('chai-as-promised');
|
||||
var sinonChai = require('sinon-chai');
|
||||
const chaiAsPromised = require('chai-as-promised');
|
||||
const sinonChai = require('sinon-chai');
|
||||
chai.use(chaiAsPromised);
|
||||
chai.use(sinonChai);
|
||||
var bufferEqual = require('buffer-equal');
|
||||
const bufferEqual = require('buffer-equal');
|
||||
|
||||
var k = openBCISample.k;
|
||||
const k = require('../openBCIConstants');
|
||||
|
||||
const defaultChannelSettingsArray = k.channelSettingsArrayInit(k.OBCINumberOfChannelsDefault);
|
||||
|
||||
var sampleBuf = openBCISample.samplePacket();
|
||||
const sampleBuf = openBCISample.samplePacket();
|
||||
|
||||
var accelArray;
|
||||
let accelArray;
|
||||
|
||||
var channelScaleFactor = 4.5 / 24 / (Math.pow(2, 23) - 1);
|
||||
const channelScaleFactor = 4.5 / 24 / (Math.pow(2, 23) - 1);
|
||||
|
||||
describe('openBCISample', function () {
|
||||
beforeEach(function () {
|
||||
@@ -600,28 +600,6 @@ describe('openBCISample', function () {
|
||||
expect(sample.timeStamp).to.equal(time + timeOffset);
|
||||
});
|
||||
});
|
||||
describe('#interpret24bitAsInt32', function () {
|
||||
it('converts a small positive number', function () {
|
||||
var buf1 = new Buffer([0x00, 0x06, 0x90]); // 0x000690 === 1680
|
||||
var num = openBCISample.interpret24bitAsInt32(buf1);
|
||||
assert.equal(num, 1680);
|
||||
});
|
||||
it('converts a large positive number', function () {
|
||||
var buf1 = new Buffer([0x02, 0xC0, 0x01]); // 0x02C001 === 180225
|
||||
var num = openBCISample.interpret24bitAsInt32(buf1);
|
||||
assert.equal(num, 180225);
|
||||
});
|
||||
it('converts a small negative number', function () {
|
||||
var buf1 = new Buffer([0xFF, 0xFF, 0xFF]); // 0xFFFFFF === -1
|
||||
var num = openBCISample.interpret24bitAsInt32(buf1);
|
||||
num.should.be.approximately(-1, 1);
|
||||
});
|
||||
it('converts a large negative number', function () {
|
||||
var buf1 = new Buffer([0x81, 0xA1, 0x01]); // 0x81A101 === -8281855
|
||||
var num = openBCISample.interpret24bitAsInt32(buf1);
|
||||
num.should.be.approximately(-8281855, 1);
|
||||
});
|
||||
});
|
||||
describe('#interpret16bitAsInt32', function () {
|
||||
it('converts a small positive number', function () {
|
||||
var buf1 = new Buffer([0x06, 0x90]); // 0x0690 === 1680
|
||||
@@ -644,6 +622,28 @@ describe('openBCISample', function () {
|
||||
assert.equal(num, -32351);
|
||||
});
|
||||
});
|
||||
describe('#interpret24bitAsInt32', function () {
|
||||
it('converts a small positive number', function () {
|
||||
var buf1 = new Buffer([0x00, 0x06, 0x90]); // 0x000690 === 1680
|
||||
var num = openBCISample.interpret24bitAsInt32(buf1);
|
||||
assert.equal(num, 1680);
|
||||
});
|
||||
it('converts a large positive number', function () {
|
||||
var buf1 = new Buffer([0x02, 0xC0, 0x01]); // 0x02C001 === 180225
|
||||
var num = openBCISample.interpret24bitAsInt32(buf1);
|
||||
assert.equal(num, 180225);
|
||||
});
|
||||
it('converts a small negative number', function () {
|
||||
var buf1 = new Buffer([0xFF, 0xFF, 0xFF]); // 0xFFFFFF === -1
|
||||
var num = openBCISample.interpret24bitAsInt32(buf1);
|
||||
num.should.be.approximately(-1, 1);
|
||||
});
|
||||
it('converts a large negative number', function () {
|
||||
var buf1 = new Buffer([0x81, 0xA1, 0x01]); // 0x81A101 === -8281855
|
||||
var num = openBCISample.interpret24bitAsInt32(buf1);
|
||||
num.should.be.approximately(-8281855, 1);
|
||||
});
|
||||
});
|
||||
describe('#floatTo3ByteBuffer', function () {
|
||||
it('converts random floats to a 3-byte buffer', function () {
|
||||
var generateSample = openBCISample.randomSample(k.OBCINumberOfChannelsDefault, k.OBCISampleRate250);
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
'use strict';
|
||||
var bluebirdChecks = require('./bluebirdChecks');
|
||||
var chai = require('chai');
|
||||
var should = chai.should(); // eslint-disable-line no-unused-vars
|
||||
var openBCIBoard = require('../openBCIBoard');
|
||||
var openBCISample = openBCIBoard.OpenBCISample;
|
||||
var k = openBCISample.k;
|
||||
const bluebirdChecks = require('./bluebirdChecks');
|
||||
const chai = require('chai');
|
||||
const should = chai.should(); // eslint-disable-line no-unused-vars
|
||||
const Cyton = require('../openBCICyton');
|
||||
const openBCISample = require('../openBCISample');
|
||||
const k = openBCISample.k;
|
||||
|
||||
var chaiAsPromised = require('chai-as-promised');
|
||||
var sinonChai = require('sinon-chai');
|
||||
const chaiAsPromised = require('chai-as-promised');
|
||||
const sinonChai = require('sinon-chai');
|
||||
chai.use(chaiAsPromised);
|
||||
chai.use(sinonChai);
|
||||
|
||||
@@ -16,7 +16,7 @@ describe('#impedanceTesting', function () {
|
||||
this.timeout(20000);
|
||||
|
||||
before(function (done) {
|
||||
ourBoard = new openBCIBoard.OpenBCIBoard({
|
||||
ourBoard = new Cyton({
|
||||
verbose: true,
|
||||
simulatorFragmentation: k.OBCISimulatorFragmentationRandom
|
||||
});
|
||||
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
@@ -1,13 +1,13 @@
|
||||
'use strict';
|
||||
var bluebirdChecks = require('./bluebirdChecks');
|
||||
var bufferEqual = require('buffer-equal');
|
||||
var chai = require('chai');
|
||||
var chaiAsPromised = require(`chai-as-promised`);
|
||||
var expect = chai.expect;
|
||||
var should = chai.should(); // eslint-disable-line no-unused-vars
|
||||
var openBCISimulator = require('../openBCISimulator');
|
||||
var openBCISample = require('../openBCISample');
|
||||
var k = openBCISample.k;
|
||||
const bluebirdChecks = require('./bluebirdChecks');
|
||||
const bufferEqual = require('buffer-equal');
|
||||
const chai = require('chai');
|
||||
const chaiAsPromised = require(`chai-as-promised`);
|
||||
const expect = chai.expect;
|
||||
const should = chai.should(); // eslint-disable-line no-unused-vars
|
||||
const openBCISimulator = require('../openBCISimulator');
|
||||
const openBCISample = require('../openBCISample');
|
||||
const k = require('../openBCIConstants');
|
||||
|
||||
chai.use(chaiAsPromised);
|
||||
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário