openbci-utilities
Advanced tools
Comparing version 0.1.2 to 0.1.3
@@ -0,1 +1,7 @@ | ||
# 0.1.3 | ||
### New Features | ||
* A bunch of functions to support synchronization of channel settings with cyton. Will be used by both the Wifi and the Cyton node modules. | ||
# 0.1.2 | ||
@@ -2,0 +8,0 @@ |
@@ -6,3 +6,3 @@ 'use strict'; | ||
const openBCISample = require('./openBCIUtilities'); | ||
const obciUtilities = require('./openBCIUtilities'); | ||
const k = require('./openBCIConstants'); | ||
@@ -19,3 +19,3 @@ const now = require('performance-now'); | ||
drift: 0, | ||
firmwareVersion: [k.OBCIFirmwareV1, k.OBCIFirmwareV2], | ||
firmwareVersion: [k.OBCIFirmwareV1, k.OBCIFirmwareV2, k.OBCIFirmwareV3], | ||
fragmentation: [k.OBCISimulatorFragmentationNone, k.OBCISimulatorFragmentationRandom, k.OBCISimulatorFragmentationFullBuffers, k.OBCISimulatorFragmentationOneByOne], | ||
@@ -35,3 +35,3 @@ latencyTime: 16, | ||
options = options || {}; | ||
var opts = {}; | ||
let opts = {}; | ||
@@ -41,5 +41,5 @@ stream.Stream.call(this); | ||
/** Configuring Options */ | ||
var o; | ||
let o; | ||
for (o in _options) { | ||
var userValue = options[o]; | ||
let userValue = options[o]; | ||
delete options[o]; | ||
@@ -89,3 +89,3 @@ | ||
// Objects | ||
this.sampleGenerator = openBCISample.randomSample(k.OBCINumberOfChannelsDefault, this.options.sampleRate, this.options.alpha, this.options.lineNoise); | ||
this.sampleGenerator = obciUtilities.randomSample(k.OBCINumberOfChannelsDefault, this.options.sampleRate, this.options.alpha, this.options.lineNoise); | ||
this.time = { | ||
@@ -130,3 +130,3 @@ current: 0, | ||
// buffer is copied because presently openBCICyton.js reuses it | ||
var outBuffer = new Buffer(this.outputBuffer.slice(0, size)); | ||
let outBuffer = new Buffer(this.outputBuffer.slice(0, size)); | ||
@@ -143,3 +143,3 @@ this.outputBuffer.copy(this.outputBuffer, 0, size, this.outputBuffered); | ||
while (this.outputBuffered + dataBuffer.length > this.outputBuffer.length) { | ||
var len = dataBuffer.copy(this.outputBuffer, this.outputBuffered); | ||
let len = dataBuffer.copy(this.outputBuffer, this.outputBuffered); | ||
dataBuffer = dataBuffer.slice(len); | ||
@@ -156,3 +156,3 @@ this.outputBuffered += len; | ||
if (!this.outputLoopHandle) { | ||
var latencyTime = this.options.latencyTime; | ||
let latencyTime = this.options.latencyTime; | ||
if (this.options.fragmentation === k.OBCISimulatorFragmentationOneByOne || | ||
@@ -164,4 +164,4 @@ this.options.fragmentation === k.OBCISimulatorFragmentationNone) { | ||
} | ||
var outputLoop = () => { | ||
var size; | ||
let outputLoop = () => { | ||
let size; | ||
switch (this.options.fragmentation) { | ||
@@ -290,2 +290,15 @@ case k.OBCISimulatorFragmentationRandom: | ||
break; | ||
case k.OBCIMiscQueryRegisterSettings: | ||
let outputString = k.OBCIRegisterQueryCyton; | ||
if (this.options.daisy) { | ||
outputString += k.OBCIRegisterQueryCytonDaisy; | ||
} | ||
if (this.options.firmwareVersion === k.OBCIFirmwareV3) { | ||
outputString += k.OBCIRegisterQueryAccelerometerFirmwareV3; | ||
} else { | ||
outputString += k.OBCIRegisterQueryAccelerometerFirmwareV1; | ||
} | ||
this._output(Buffer.from(outputString)); | ||
this._printEOT(); | ||
break; | ||
default: | ||
@@ -320,7 +333,7 @@ break; | ||
Simulator.prototype._startStream = function () { | ||
var intervalInMS = 1000 / this.options.sampleRate; | ||
let intervalInMS = 1000 / this.options.sampleRate; | ||
if (intervalInMS < 2) intervalInMS = 2; | ||
var getNewPacket = sampNumber => { | ||
let getNewPacket = sampNumber => { | ||
if (this.options.accel) { | ||
@@ -330,8 +343,8 @@ if (this.synced) { | ||
this.sendSyncSetPacket = false; | ||
return openBCISample.convertSampleToPacketAccelTimeSyncSet(this.sampleGenerator(sampNumber), now().toFixed(0)); | ||
return obciUtilities.convertSampleToPacketAccelTimeSyncSet(this.sampleGenerator(sampNumber), now().toFixed(0)); | ||
} else { | ||
return openBCISample.convertSampleToPacketAccelTimeSynced(this.sampleGenerator(sampNumber), now().toFixed(0)); | ||
return obciUtilities.convertSampleToPacketAccelTimeSynced(this.sampleGenerator(sampNumber), now().toFixed(0)); | ||
} | ||
} else { | ||
return openBCISample.convertSampleToPacketStandard(this.sampleGenerator(sampNumber)); | ||
return obciUtilities.convertSampleToPacketStandard(this.sampleGenerator(sampNumber)); | ||
} | ||
@@ -342,8 +355,8 @@ } else { | ||
this.sendSyncSetPacket = false; | ||
return openBCISample.convertSampleToPacketRawAuxTimeSyncSet(this.sampleGenerator(sampNumber), now().toFixed(0), new Buffer([0, 0, 0, 0, 0, 0])); | ||
return obciUtilities.convertSampleToPacketRawAuxTimeSyncSet(this.sampleGenerator(sampNumber), now().toFixed(0), new Buffer([0, 0, 0, 0, 0, 0])); | ||
} else { | ||
return openBCISample.convertSampleToPacketRawAuxTimeSynced(this.sampleGenerator(sampNumber), now().toFixed(0), new Buffer([0, 0, 0, 0, 0, 0])); | ||
return obciUtilities.convertSampleToPacketRawAuxTimeSynced(this.sampleGenerator(sampNumber), now().toFixed(0), new Buffer([0, 0, 0, 0, 0, 0])); | ||
} | ||
} else { | ||
return openBCISample.convertSampleToPacketRawAux(this.sampleGenerator(sampNumber), new Buffer([0, 0, 0, 0, 0, 0])); | ||
return obciUtilities.convertSampleToPacketRawAux(this.sampleGenerator(sampNumber), new Buffer([0, 0, 0, 0, 0, 0])); | ||
} | ||
@@ -350,0 +363,0 @@ } |
{ | ||
"name": "openbci-utilities", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"description": "The official utility package of Node.js SDK for the OpenBCI Biosensor Boards.", | ||
@@ -40,2 +40,3 @@ "main": "index.js", | ||
"dirty-chai": "^2.0.1", | ||
"eslint-plugin-chai-friendly": "^0.4.0", | ||
"istanbul": "^0.4.4", | ||
@@ -42,0 +43,0 @@ "mocha": "^3.0.2", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
175349
4116
13