Skip to content

Commit

Permalink
Merge pull request #20 from daniellasry/master
Browse files Browse the repository at this point in the history
v2.0.1: Fixed references to openbci-utilities and openbci-cyton to the new @OpenBCI module names
  • Loading branch information
daniellasry authored Feb 18, 2019
2 parents 0401a93 + 88f885f commit 0f003fb
Show file tree
Hide file tree
Showing 17 changed files with 132 additions and 109 deletions.
48 changes: 24 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[![Build Status](https://travis-ci.org/OpenBCI/OpenBCI_NodeJS_Cyton.svg?branch=master)](https://travis-ci.org/OpenBCI/OpenBCI_NodeJS_Cyton)
[![codecov](https://codecov.io/gh/OpenBCI/OpenBCI_NodeJS_Cyton/branch/master/graph/badge.svg)](https://codecov.io/gh/OpenBCI/OpenBCI_NodeJS_Cyton)
[![Dependency Status](https://david-dm.org/OpenBCI/OpenBCI_NodeJS_Cyton.svg)](https://david-dm.org/OpenBCI/OpenBCI_NodeJS_Cyton)
[![npm](https://img.shields.io/npm/dm/openbci.svg?maxAge=2592000)](http://npmjs.com/package/openbci-cyton)
[![npm](https://img.shields.io/npm/dm/openbci.svg?maxAge=2592000)](http://npmjs.com/package/@openbci/cyton)
[![js-semistandard-style](https://img.shields.io/badge/code%20style-semistandard-brightgreen.svg?style=flat-square)](https://github.com/Flet/semistandard)

# OpenBCI Node.js Cyton SDK
Expand Down Expand Up @@ -66,7 +66,7 @@ Get connected and [start streaming right now with the example code](examples/get
#### Cyton (8 and 16 channel boards)

```ecmascript 6
const Cyton = require('openbci-cyton');
const Cyton = require('@openbci/cyton');
const ourBoard = new Cyton();
ourBoard.connect(portName) // Port name is a serial port name, see `.listPorts()`
.then(() => {
Expand Down Expand Up @@ -108,7 +108,7 @@ Python researcher or developer? Check out how easy it is to [get access to the e
Initializing the board:

```js
const Cyton = require("openbci-cyton");
const Cyton = require("@openbci/cyton");
const ourBoard = new Cyton();
```

Expand All @@ -117,7 +117,7 @@ Go [checkout out the get streaming example](examples/getStreaming/getStreaming.j
For initializing with options, such as verbose print outs:

```js
const Cyton = require("openbci-cyton");
const Cyton = require("@openbci/cyton");
const ourBoard = new Cyton({
verbose: true
});
Expand All @@ -126,7 +126,7 @@ const ourBoard = new Cyton({
Or if you don't have a board and want to use synthetic data:

```js
const Cyton = require("openbci-cyton");
const Cyton = require("@openbci/cyton");
const ourBoard = new Cyton({
simulate: true
});
Expand All @@ -135,7 +135,7 @@ const ourBoard = new Cyton({
Have a daisy?:

```js
var Cyton = require("openbci-cyton");
var Cyton = require("@openbci/cyton");
var ourBoard = new Cyton({
boardType: `daisy`,
hardSet: true
Expand All @@ -147,8 +147,8 @@ Go [checkout out the get streaming with daisy example](examples/getStreamingDais
Another useful way to start the simulator:

```js
const Cyton = require("openbci-cyton");
const k = require("openbci-utilities").Constants;
const Cyton = require("@openbci/cyton");
const k = require("@openbci/utilities").Constants;
const ourBoard = new Cyton();
ourBoard
.connect(k.OBCISimulatorPortName) // This will set `simulate` to true
Expand All @@ -167,16 +167,16 @@ You can also start the simulator by sending [`.connect(portName)`](#method-conne
or if you are using ES6:

```js
import Cyton from "openbci-cyton";
import { Constants } from "openbci-utilities";
import Cyton from "@openbci/cyton";
import { Constants } from "@openbci/utilities";
const ourBoard = new Cyton();
ourBoard.connect(Constants.OBCISimulatorPortName);
```

To debug, it's amazing, do:

```js
const Cyton = require("openbci-cyton");
const Cyton = require("@openbci/cyton");
const ourBoard = new Cyton({
debug: true
});
Expand All @@ -190,7 +190,7 @@ You MUST wait for the 'ready' event to be emitted before streaming/talking with
so installing the 'sample' listener and writing before the ready event might result in... nothing at all.

```js
const Cyton = require("openbci-cyton");
const Cyton = require("@openbci/cyton");
const ourBoard = new Cyton();
ourBoard
.connect(portName)
Expand Down Expand Up @@ -225,7 +225,7 @@ The power of this module is in using the sample emitter, to be provided with sam
4. Install the ['sample'](#event-sample) event emitter

```js
const Cyton = require("openbci-cyton");
const Cyton = require("@openbci/cyton");
const ourBoard = new Cyton();
ourBoard
.connect(portName)
Expand All @@ -243,7 +243,7 @@ ourBoard
Close the connection with [`.streamStop()`](#method-stream-stop) and disconnect with [`.disconnect()`](#method-disconnect)

```js
const Cyton = require("openbci-cyton");
const Cyton = require("@openbci/cyton");
const ourBoard = new Cyton();
ourBoard.streamStop().then(ourBoard.disconnect());
```
Expand All @@ -259,8 +259,8 @@ Keep your resync interval above 50ms. While it's important to resync every coupl
Using local computer time:

```js
const Cyton = require("openbci-cyton");
const k = require("openbci-utilities").Constants;
const Cyton = require("@openbci/cyton");
const k = require("@openbci/utilities").Constants;
const ourBoard = new Cyton({
verbose: true
});
Expand Down Expand Up @@ -328,7 +328,7 @@ You must have the OpenBCI board connected to the PC before trying to automatical
If a port is not automatically found, then call [`.listPorts()`](#method-list-ports) to get a list of all serial ports this would be a good place to present a drop down picker list to the user, so they may manually select the serial port name.

```js
const Cyton = require("openbci-cyton");
const Cyton = require("@openbci/cyton");
const ourBoard = new Cyton();
ourBoard.autoFindOpenBCIBoard().then(portName => {
if (portName) {
Expand Down Expand Up @@ -371,7 +371,7 @@ Where there are the same number of elements as channels and each element can be
Without further ado, here is an example:

```js
const Cyton = require("openbci-cyton");
const Cyton = require("@openbci/cyton");
const ourBoard = new Cyton();
ourBoard
.connect(portName)
Expand Down Expand Up @@ -432,7 +432,7 @@ To run an impedance test on all inputs, one channel at a time:
For example:

```js
const Cyton = require('openbci-cyton');
const Cyton = require('@openbci/cyton');
const ourBoard = new Cyton();
ourBoard.connect(portName).then(function(boardSerial) {
ourBoard.streamStart();
Expand Down Expand Up @@ -657,7 +657,7 @@ A Number, specifies which channel you want to test.
**Example**
```js
const Cyton = require("openbci-cyton");
const Cyton = require("@openbci/cyton");
const ourBoard = new Cyton();
ourBoard
.connect(portName)
Expand Down Expand Up @@ -706,7 +706,7 @@ A Number, specifies which channel you want to test.
**Example**
```js
const Cyton = require("openbci-cyton");
const Cyton = require("@openbci/cyton");
const ourBoard = new Cyton();
ourBoard
.connect(portName)
Expand Down Expand Up @@ -755,7 +755,7 @@ A Number, specifies which channel you want to test.
**Example**
```ecmascript 6
const Cyton = require('openbci-cyton');
const Cyton = require('@openbci/cyton');
const ourBoard = new Cyton();
ourBoard.connect(portName).then(() => {
ourBoard.on('ready',() => {
Expand Down Expand Up @@ -1057,7 +1057,7 @@ Send the command to tell the board to start the syncing protocol. Must be connec
Syncing multiple times to base the offset of the average of the four syncs.
```javascript
const Cyton = require('openbci-cyton');
const Cyton = require('@openbci/cyton');
const ourBoard = new Cyton({
verbose:true
});
Expand Down Expand Up @@ -1245,7 +1245,7 @@ Emitted when there is a new sample available.
To use the constants file simply:
```js
const k = require("openbci-utilities").Constants;
const k = require("@openbci/utilities").Constants;

console.log(k.OBCISimulatorPortName); // prints OpenBCISimulator to the console.
```
Expand Down
6 changes: 6 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# 2.0.1

### Bug Fixes

- Fixing references to openbci-utilities and openbci-cyton

# 2.0.0

### Breaking Changes
Expand Down
28 changes: 14 additions & 14 deletions examples/debug/debug.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
const stream = true;
const debug = true; // Pretty print any bytes in and out... it's amazing...
const verbose = true; // Adds verbosity to functions
const Cyton = require("../../openBCICyton");
const Cyton = require('../../openBCICyton');

let ourBoard = new Cyton({
debug: debug,
Expand All @@ -38,7 +38,7 @@ ourBoard.autoFindOpenBCIBoard().then(portName => {
});
} else {
/** Unable to auto find OpenBCI board */
console.log("Unable to auto find OpenBCI board");
console.log('Unable to auto find OpenBCI board');
}
});

Expand All @@ -62,55 +62,55 @@ var sampleFunc = sample => {
};

// Subscribe to your functions
ourBoard.on("ready", readyFunc);
ourBoard.on("sample", sampleFunc);
ourBoard.on('ready', readyFunc);
ourBoard.on('sample', sampleFunc);

function exitHandler(options, err) {
function exitHandler (options, err) {
if (options.cleanup) {
if (verbose) console.log("clean");
if (verbose) console.log('clean');
ourBoard.removeAllListeners();
/** Do additional clean up here */
}
if (err) console.log(err.stack);
if (options.exit) {
if (verbose) console.log("exit");
if (verbose) console.log('exit');
if (stream) {
ourBoard.streamStop().catch(console.log);
}
ourBoard.disconnect().catch(console.log);
}
}

if (process.platform === "win32") {
const rl = require("readline").createInterface({
if (process.platform === 'win32') {
const rl = require('readline').createInterface({
input: process.stdin,
output: process.stdout
});

rl.on("SIGINT", function() {
process.emit("SIGINT");
rl.on('SIGINT', function () {
process.emit('SIGINT');
});
}

// do something when app is closing
process.on(
"exit",
'exit',
exitHandler.bind(null, {
cleanup: true
})
);

// catches ctrl+c event
process.on(
"SIGINT",
'SIGINT',
exitHandler.bind(null, {
exit: true
})
);

// catches uncaught exceptions
process.on(
"uncaughtException",
'uncaughtException',
exitHandler.bind(null, {
exit: true
})
Expand Down
2 changes: 1 addition & 1 deletion examples/impedance/impedance.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ let ourBoard = new Cyton({
verbose: verbose
});

const k = require('openbci-utilities').Constants;
const k = require('@openbci/utilities').Constants;

let startedImpedance = false;
let iBuffer = [];
Expand Down
2 changes: 1 addition & 1 deletion examples/impedance/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
"license": "MIT",
"dependencies": {
"openbci": "^2.0.0",
"openbci-utilities": "0.0.9"
"@openbci/utilities": "0.0.9"
}
}
Loading

0 comments on commit 0f003fb

Please sign in to comment.