Skip to content

Commit 261dc64

Browse files
author
AJ Keller
committed
Merge pull request #21 from andyh616/master
ADD listPorts function
2 parents beb4d94 + 09b3758 commit 261dc64

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

openBCIBoard.js

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -612,6 +612,25 @@ function OpenBCIFactory() {
612612
}
613613
};
614614

615+
/**
616+
* Purpose: List available ports so the user can choose a device when not
617+
* automatically found.
618+
*
619+
* Note: This method is used for convenience essentially just wrapping up
620+
* serial port.
621+
*
622+
* Author: Andy Heusser (@andyh616)
623+
* @returns {Promise}
624+
*/
625+
OpenBCIBoard.prototype.listPorts = function() {
626+
return new Promise((resolve, reject) => {
627+
serialPort.list((err, ports) => {
628+
if(err) reject(err);
629+
else resolve(ports);
630+
})
631+
})
632+
};
633+
615634

616635
/**
617636
* Purpose: Automatically find an OpenBCI board. Returns either the name
@@ -941,4 +960,4 @@ function masterBufferMaker() {
941960
packetsRead:0,
942961
looseBytes:0
943962
};
944-
}
963+
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "openbci-sdk",
3-
"version": "0.1.8",
3+
"version": "0.1.9",
44
"description": "A fully NodeJS based API for the OpenBCI board connecting to the hardware directly over serial",
55
"main": "openBCIBoard",
66
"scripts": {

0 commit comments

Comments
 (0)