openbci-utilities
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -0,3 +1,15 @@ | ||
# 0.0.2 | ||
### Breaking Changes | ||
* Renamed `Sample` to `Utilities` in `index.js` | ||
* Renamed openBCIUtilities.js to openBCIUtilities.js | ||
* Renamed openBCIUtilities-test.js to openBCIUtilities-test.js | ||
### New Features | ||
* Added a function in the sample module that parses a raw buffer of OpenBCI data, extracts raw data packets and returns the buffer with just the raw data packets removed. Allowing the user to process other data that is not a raw data. | ||
# 0.0.1 | ||
Initial release |
module.exports.Constants = require('./openBCIConstants'); | ||
module.exports.Debug = require('./openBCIDebug'); | ||
module.exports.Sample = require('./openBCISample'); | ||
module.exports.Utilities = require('./openBCIUtilities'); |
@@ -8,2 +8,3 @@ /** | ||
const _ = require('lodash'); | ||
const Buffer = require('safe-buffer').Buffer; | ||
@@ -560,3 +561,3 @@ /** Turning channels off */ | ||
default: | ||
reject('Error [commandChannelOff]: Invalid Channel Number'); | ||
reject(Error('Error [commandChannelOff]: Invalid Channel Number')); | ||
break; | ||
@@ -635,3 +636,3 @@ } | ||
default: | ||
reject('Error [commandChannelOn]: Invalid Channel Number'); | ||
reject(Error('Error [commandChannelOn]: Invalid Channel Number')); | ||
break; | ||
@@ -673,3 +674,3 @@ } | ||
default: | ||
reject('Invalid selection! Check your spelling.'); | ||
reject(Error('Invalid selection! Check your spelling.')); | ||
break; | ||
@@ -813,5 +814,4 @@ } | ||
default: | ||
reject(new Error(TypeError)); | ||
reject(Error(TypeError)); | ||
break; | ||
} | ||
@@ -864,3 +864,3 @@ }); | ||
default: | ||
reject('Invalid channel number'); | ||
reject(Error('Invalid channel number')); | ||
break; | ||
@@ -1212,9 +1212,9 @@ } | ||
// Validate the input | ||
if (!isNumber(channelNumber)) reject("channelNumber must be of type 'number' "); | ||
if (!isBoolean(powerDown)) reject("powerDown must be of type 'boolean' "); | ||
if (!isNumber(gain)) reject("gain must be of type 'number' "); | ||
if (!isString(inputType)) reject("inputType must be of type 'string' "); | ||
if (!isBoolean(bias)) reject("bias must be of type 'boolean' "); | ||
if (!isBoolean(srb2)) reject("srb1 must be of type 'boolean' "); | ||
if (!isBoolean(srb1)) reject("srb2 must be of type 'boolean' "); | ||
if (!isNumber(channelNumber)) reject(Error("channelNumber must be of type 'number' ")); | ||
if (!isBoolean(powerDown)) reject(Error("powerDown must be of type 'boolean' ")); | ||
if (!isNumber(gain)) reject(Error("gain must be of type 'number' ")); | ||
if (!isString(inputType)) reject(Error("inputType must be of type 'string' ")); | ||
if (!isBoolean(bias)) reject(Error("bias must be of type 'boolean' ")); | ||
if (!isBoolean(srb2)) reject(Error("srb1 must be of type 'boolean' ")); | ||
if (!isBoolean(srb1)) reject(Error("srb2 must be of type 'boolean' ")); | ||
@@ -1286,5 +1286,5 @@ // Set Channel Number | ||
// validate inputs | ||
if (!isNumber(channelNumber)) reject("channelNumber must be of type 'number' "); | ||
if (!isBoolean(pInputApplied)) reject("pInputApplied must be of type 'boolean' "); | ||
if (!isBoolean(nInputApplied)) reject("nInputApplied must be of type 'boolean' "); | ||
if (!isNumber(channelNumber)) reject(Error("channelNumber must be of type 'number' ")); | ||
if (!isBoolean(pInputApplied)) reject(Error("pInputApplied must be of type 'boolean' ")); | ||
if (!isBoolean(nInputApplied)) reject(Error("nInputApplied must be of type 'boolean' ")); | ||
@@ -1321,5 +1321,5 @@ // Set pInputApplied | ||
// validate inputs | ||
if (!isString(boardType)) return reject("board type must be of type 'string' "); | ||
if (!isString(boardType)) return reject(Error("board type must be of type 'string' ")); | ||
if (!isNumber(sampleRate)) return reject("sampleRate must be of type 'number' "); | ||
if (!isNumber(sampleRate)) return reject(Error("sampleRate must be of type 'number' ")); | ||
@@ -1334,3 +1334,3 @@ sampleRate = Math.floor(sampleRate); | ||
} else { | ||
return reject(`boardType must be either ${obciBoardCyton} or ${obciBoardGanglion}`); | ||
return reject(Error(`boardType must be either ${obciBoardCyton} or ${obciBoardGanglion}`)); | ||
} | ||
@@ -1360,3 +1360,3 @@ | ||
// validate inputs | ||
if (!isString(boardMode)) return reject("board mode must be of type 'string' "); | ||
if (!isString(boardMode)) return reject(Error("board mode must be of type 'string' ")); | ||
// Set Channel Number | ||
@@ -1418,3 +1418,3 @@ commandBoardModeForMode(boardMode).then(command => { | ||
default: | ||
reject('Invalid ADC string'); | ||
reject(Error('Invalid ADC string')); | ||
break; | ||
@@ -1450,3 +1450,3 @@ } | ||
default: | ||
reject('Invalid gain setting of ' + gainSetting + ' tisk tisk, gain must be (1,2,4,6,8,12,24)'); | ||
reject(Error('Invalid gain setting of ' + gainSetting + ' tisk tisk, gain must be (1,2,4,6,8,12,24)')); | ||
break; | ||
@@ -1509,3 +1509,3 @@ } | ||
default: | ||
reject('Invalid channel number'); | ||
reject(Error('Invalid channel number')); | ||
break; | ||
@@ -1557,3 +1557,3 @@ } | ||
default: | ||
reject('Invalid sample rate'); | ||
reject(Error('Invalid sample rate')); | ||
break; | ||
@@ -1597,3 +1597,3 @@ } | ||
default: | ||
reject('Invalid sample rate'); | ||
reject(Error('Invalid sample rate')); | ||
break; | ||
@@ -1625,3 +1625,3 @@ } | ||
default: | ||
reject('Invalid sample rate'); | ||
reject(Error('Invalid sample rate')); | ||
break; | ||
@@ -1644,3 +1644,3 @@ } | ||
} else { | ||
return reject(`No peripherals discovered with prefix equal to ${obciGanglionPrefix}`); | ||
return reject(Error(`No peripherals discovered with prefix equal to ${obciGanglionPrefix}`)); | ||
} | ||
@@ -1657,3 +1657,3 @@ }); | ||
return new Promise((resolve, reject) => { | ||
if (typeof (pArray) !== 'object') return reject(`pArray must be of type Object`); | ||
if (typeof (pArray) !== 'object') return reject(Error(`pArray must be of type Object`)); | ||
_.forEach(pArray, (perif) => { | ||
@@ -1666,3 +1666,3 @@ if (perif.advertisement.hasOwnProperty('localName')) { | ||
}); | ||
return reject(`No peripheral found with localName: ${localName}`); | ||
return reject(Error(`No peripheral found with localName: ${localName}`)); | ||
}); | ||
@@ -1669,0 +1669,0 @@ } |
@@ -0,1 +1,2 @@ | ||
var Buffer = require('safe-buffer').Buffer; | ||
module.exports = { | ||
@@ -2,0 +3,0 @@ debugBytes |
{ | ||
"name": "openbci-utilities", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "The official utility package of Node.js SDK for the OpenBCI Biosensor Boards.", | ||
@@ -25,2 +25,3 @@ "main": "index.js", | ||
"mathjs": "^3.3.0", | ||
"safe-buffer": "^5.1.1", | ||
"streamsearch": "^0.1.2" | ||
@@ -36,2 +37,3 @@ }, | ||
"codecov": "^2.2.0", | ||
"dirty-chai": "^2.0.1", | ||
"istanbul": "^0.4.4", | ||
@@ -38,0 +40,0 @@ "mocha": "^3.0.2", |
129556
3115
7
12
+ Addedsafe-buffer@^5.1.1
+ Addedsafe-buffer@5.2.1(transitive)