Commit 8cfba6fe authored by Ben Beltran's avatar Ben Beltran
Browse files

Update binary and docs

parent 23df3629
# sorting-hat
A sorting hat, sorts you to a variety of sets of 4
# 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
'use strict';
const Config = require('../config/config');
const SortingHat = require('..');
const internals = {
// Main entry point of the application
run() {
const sortingHat = new SortingHat(Config);
sortingHat.start();
}
};
internals.run();
## Classes
<dl>
<dt><a href="#SortingHat">SortingHat</a></dt>
<dd></dd>
</dl>
## Typedefs
<dl>
<dt><a href="#tSortingHatConfig">tSortingHatConfig</a> : <code>object</code></dt>
<dd><p>The configuration used to extend the SortingHat class</p>
</dd>
</dl>
<a name="SortingHat"></a>
## SortingHat
**Kind**: global class
* [SortingHat](#SortingHat)
* [new SortingHat(config)](#new_SortingHat_new)
* [.deviceLocation](#SortingHat+deviceLocation) : <code>string</code>
<a name="new_SortingHat_new"></a>
### new SortingHat(config)
The main server for the sorting hat, it is in charge of connecting to the
device and emitting events for the GUI via a socket
| Param | Type | Description |
| --- | --- | --- |
| config | [<code>tSortingHatConfig</code>](#tSortingHatConfig) | the configuration to extend the object |
<a name="SortingHat+deviceLocation"></a>
### sortingHat.deviceLocation : <code>string</code>
The location of the mindwae device we'll be listening to
**Kind**: instance property of [<code>SortingHat</code>](#SortingHat)
**Default**: <code>&quot;/dev/cu.Bluetooth-Incoming-Port&quot;</code>
<a name="tSortingHatConfig"></a>
## tSortingHatConfig : <code>object</code>
The configuration used to extend the SortingHat class
**Kind**: global typedef
**Properties**
| Name | Type | Description |
| --- | --- | --- |
| deviceLocation | <code>string</code> | the location of the mindwave device |
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment