aboutsummaryrefslogtreecommitdiff
path: root/README.md
blob: 75b6b80b0f08521697a544955ddb3c0ff82d5c0d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# Sorting Hat

A sorting hat, sorts you to a variety of sets based on the assignment of
mind waves.

## Usage

This package can be used as a standalone executable or as a library
inside other node applications

### As an executable

It can be used as a local or global installation

#### Local Install

```
$ npm install sorting-hat
$ npx sorting-hat
```

#### Global Install

```
$ npm install -g sorting-hat
$ sorting-hat
```

#### Overriding configuration in the binary

The binary uses environment variables to override the defaults

* `SORTING_HAT_DEVICE_LOCATION`: The path from where we'll listen to the
  mindwave, defaults to `/dev/tty.MindWaveMobile-SerialPo`
* `SORTING_HAT_MAPPING_STRATEGY`: The strategy used to sort the waves,
  it defaults to `tmnt`. That is also the only supported value as of
  right now
* `SORTING_HAT_PORT`: The port on which we'll start the websocket server
  to send state updates to the frontends

### As a Library

You can include it in other libraries by requiring the file. For more
information on the public API and the used data structures, please check
`doc/README.md`

```
'use strict';

const sortingHat = new SortingHat({
  deviceLocation: '/dev/tty.MindWaveMobile-SerialPo',
  mappingStrategy: 'tmnt',
  port: 1987
});
sortingHat.start();
```

At the moment it's not built right, so you can't really do much with
this mode. But you can do it.

## Further Improvements

* Give independent weights to each wave and category so we can balance
* Allow actual use as a library