bci2k
TypeScript icon, indicating that this package has built-in type declarations

3.1.3 • Public • Published

bci2k.js

A javascript connector for BCI2000

badge badge MIT license

bci2k.js relies on a binary server called BCI2000Web, which allows browsers to communicate with Operator using the Operator Scripting language and stream data in to the browser using websockets.

Install

npm install --save bci2k

Usage

Connect to BCI2000

import { BCI2K_OperatorConnection } from "./dist/index.js";

const bciOperator = new BCI2K_OperatorConnection();

(async () => {
    try{
        await bciOperator.connect("ws://127.0.0.1")
        console.log("Connected"))
    } catch(err){
        console.log(err)
    }
})()

Execute system commands

bciOperator.showWindow();
bciOperator.hideWindow();
bciOperator.resetSystem();
bciOperator.start();
bciOperator.getVersion();
bciOperator.execute("args"); //args are any BCI2000 Operator commands

Tap data from part of the signal processing chain

import { BCI2K_DataConnection } from "./dist/index.js";

async () => {
    let bciSourceConnection = new BCI2K_DataConnection();
    try{
        await bciSourceConnection.connect("ws://localhost:20100")
        bciSourceConnection.onStateFormat = data => console.log(data);
        bciSourceConnection.onSignalProperties = data => console.log(data);
        bciSourceConnection.onGenericSignal = data => console.log(data);}
    }
    catch(err){
        console.log(err);
    }

Development

npm run build
npm run dev

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i bci2k

Weekly Downloads

5

Version

3.1.3

License

ISC

Unpacked Size

28.2 kB

Total Files

8

Last publish

Collaborators

  • collard
  • griffinmilsap
  • ccoogan