# emotiv-sdk

> SDK to interact with EMOTIV hardware via their API

Latest version **0.1.1** (published 2021-11-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install emotiv-sdk
pnpm add emotiv-sdk
yarn add emotiv-sdk
bun add emotiv-sdk
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.1 |
| Published | 2021-11-25 |
| First published | 2021-11-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 124.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Robert Beilich |
| Maintainers | robertbeilich |

## Links

- npm: https://www.npmjs.com/package/emotiv-sdk
- Repository: https://github.com/RobertBeilich/emotiv-sdk
- Homepage: https://github.com/RobertBeilich/emotiv-sdk#readme
- Issues: https://github.com/RobertBeilich/emotiv-sdk/issues
- npm.io page: https://npm.io/package/emotiv-sdk

## Dependencies (2)

- [ws](https://npm.io/package/ws.md) ^8.2.3
- [lodash](https://npm.io/package/lodash.md) ^4.17.21

## Recent versions

- 0.1.1 (latest) — 2021-11-25
- 0.1.0 — 2021-11-25

## README

# Emotiv SDK

Implementation of the [EMOTIV Cortex API](https://emotiv.gitbook.io/cortex-api/). 

Currently setup to automate flow for mental command reading.

## Feature set

Functionality is mostly read only.

### Basic

* [x] Auth flow
* [x] Headset connection
* [x] Profiles

### Streams

* [ ] Raw EEG
* [ ] Motion data
* [ ] Device data
* [ ] EEG quality
* [ ] Band power
* [ ] Performance metrics
* [x] Mental commands
* [ ] Facial expression
* [ ] System events

## Usage

`npm install emotiv-sdk` or `yarn add emotiv-sdk`

Refer to [the example](./example/example.ts) and [the typings](./src/types/api.ts) for a brief usage rundown.

### Current semi-automated flow

* run `const api = initializeEmotivApi(initData)`
  * setup callbacks for at least `setHeadsets` and `setProfiles` to continue flow
* run `api.connect()`
* automatic flow starts
  * gets user login
  * requests access for application
* accept your application in the EMOTIV app (only once per machine)
* automatic flow continues
  * authorizes without license (license only needed for raw eeg data)
  * queries headsets
* run `api.connectHeadset(headset.id)` for one of the headsets returned
* automatic flow continues
  * creates session for headset
  * queries profiles
* run `api.loadProfile(profile.name)` for one the profiles returned
* automatic flow continues
  * retrieves current active mental commands
  * subscribes to `com` data stream to retrieve mental commands

### Additional info
* if using in a Node.js environment set `process.env['NODE_TLS_REJECT_UNAUTHORIZED'] = 0` to allow connection to self signed web socket of EMOTIV

---
_Source: https://npm.io/package/emotiv-sdk · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
