Function
Static Public Summary | ||
public |
Converts raw DS18B20 temperatures to ºC. |
|
public |
LIS331HH_24G(raw: *): * |
|
public |
MMA7361_6G(raw: *): * |
|
public |
Converts raw MPX4115A temperatures to hPa. |
|
public |
analogToMV(analogReadResult: *): * |
|
public |
createLogger(name: String, db: PouchDB): Bunyan Creates a configured bunyan logger. |
|
public |
dataHandler(packet: Object): Promise A handler for incoming Serial#data. |
|
public |
Gets one bit out of a byte/bytes. |
|
public |
Gets a local database. |
|
public |
getRemoteDB(name: String, username: String, password: String): PouchDB Gets a remote database. |
|
public |
gpsAltitude(raw: *): * |
|
public |
gpsCoordinate(raw: Object): Number Convert raw coordinate object ({deg, billionths}) into an actual latitude or longitude coordinate. |
|
public |
gpsCourse(raw: *): * |
|
public |
Processes the GPS boolean flags that are crammed in one byte. |
|
public |
gpsSpeed(raw: *): * |
|
public |
Lists available ports in the system with SerialPort.list. |
|
public |
normalizePath(path: ...*): * |
|
public |
Creates and returns a "byteDelimiter" parser. |
|
public |
passEvent(sourceEmitter: EventEmitter, destEmitter: EventEmitter, sourceEvent: String, destEvent: String) Forwards an event from one EventEmitter to another. |
Static Private Summary | ||
private |
Heuristic creation helper. |
|
private |
variationH(variation: Number): Function Heuristic creation helper. |
Static Public
public DS18B20(raw: Number): Number source
import {DS18B20} from '@cansat-icarus/capture-lib/src/icarus/data-handler/unit-conv.js'
Converts raw DS18B20 temperatures to ºC.
Params:
Name | Type | Attribute | Description |
raw | Number | Raw DS18B20 temperature. |
public LIS331HH_24G(raw: *): * source
import {LIS331HH_24G} from '@cansat-icarus/capture-lib/src/icarus/data-handler/unit-conv.js'
Params:
Name | Type | Attribute | Description |
raw | * |
Return:
* |
public MMA7361_6G(raw: *): * source
import {MMA7361_6G} from '@cansat-icarus/capture-lib/src/icarus/data-handler/unit-conv.js'
Params:
Name | Type | Attribute | Description |
raw | * |
Return:
* |
public MPX4115A(raw: Number): Number source
import {MPX4115A} from '@cansat-icarus/capture-lib/src/icarus/data-handler/unit-conv.js'
Converts raw MPX4115A temperatures to hPa.
Params:
Name | Type | Attribute | Description |
raw | Number | Raw MPX4115A pressure. |
public analogToMV(analogReadResult: *): * source
import {analogToMV} from '@cansat-icarus/capture-lib/src/icarus/data-handler/unit-conv.js'
Params:
Name | Type | Attribute | Description |
analogReadResult | * |
Return:
* |
public createLogger(name: String, db: PouchDB): Bunyan source
import createLogger from '@cansat-icarus/capture-lib/src/lib/log.js'
Creates a configured bunyan logger.
Our log output configuration:
- Everything goes to stdout
- debug-level or more severe messages go to a rotating file
- info-level or more severe messages go to the database
When error-level or more severe messages are logged to the database, they include an extra "context" property with the last 30 log messages (of all levels).
Params:
Name | Type | Attribute | Description |
name | String | Logger name. |
|
db | PouchDB | Database where logs will be stored. |
Return:
Bunyan |
public dataHandler(packet: Object): Promise source
import {dataHandler} from '@cansat-icarus/capture-lib/src/icarus/data-handler/index.js'
A handler for incoming Serial#data. Saves packets to the local database. Should be called bound to a Station.
Params:
Name | Type | Attribute | Description |
packet | Object | Packet to be parsed and saved. |
public getBit(b: *, i: *): Boolean source
Gets one bit out of a byte/bytes.
Params:
Name | Type | Attribute | Description |
b | * | {Number} The byte or bytes (up to one 32bit unsigned integer). |
|
i | * | {Number} The bit index. |
public getDB(name: String): PouchDB source
import getDB from '@cansat-icarus/capture-lib/src/lib/db.js'
Gets a local database.
Params:
Name | Type | Attribute | Description |
name | String | The database name. |
Return:
PouchDB | PouchDB instance referring to the requested database. |
public getRemoteDB(name: String, username: String, password: String): PouchDB source
import {getRemoteDB} from '@cansat-icarus/capture-lib/src/lib/db.js'
Gets a remote database. When provided a URL with no port, the default CouchDB ports for HTTP and HTTPS will be added automatically.
Return:
PouchDB | PouchDB instance referring to the requested database. |
public gpsAltitude(raw: *): * source
import {gpsAltitude} from '@cansat-icarus/capture-lib/src/icarus/data-handler/unit-conv.js'
Params:
Name | Type | Attribute | Description |
raw | * |
Return:
* |
public gpsCoordinate(raw: Object): Number source
import {gpsCoordinate} from '@cansat-icarus/capture-lib/src/icarus/data-handler/unit-conv.js'
Convert raw coordinate object ({deg, billionths}) into an actual latitude or longitude coordinate. This does not check any sign/cardinal orientation. The coordinate is always positive.
Params:
Name | Type | Attribute | Description |
raw | Object | Raw coordinate as {deg, billionths}. |
public gpsCourse(raw: *): * source
import {gpsCourse} from '@cansat-icarus/capture-lib/src/icarus/data-handler/unit-conv.js'
Params:
Name | Type | Attribute | Description |
raw | * |
Return:
* |
public gpsFlags(raw: Number): Object source
import {gpsFlags} from '@cansat-icarus/capture-lib/src/icarus/data-handler/unit-conv.js'
Processes the GPS boolean flags that are crammed in one byte. In this order we have: latitude sign, longitude sign, location validity, speed validity, course validity and altitude validity.
Params:
Name | Type | Attribute | Description |
raw | Number | The number (0-255) containing the flags. |
public gpsSpeed(raw: *): * source
import {gpsSpeed} from '@cansat-icarus/capture-lib/src/icarus/data-handler/unit-conv.js'
Params:
Name | Type | Attribute | Description |
raw | * |
Return:
* |
public listPorts(): Promise<Array> source
import {listPorts} from '@cansat-icarus/capture-lib/src/serial.js'
Lists available ports in the system with SerialPort.list. Tries to fill out vendorId and productId fields in Windows from pnpId.
public normalizePath(path: ...*): * source
import normalizePath from '@cansat-icarus/capture-lib/src/lib/path.js'
Params:
Name | Type | Attribute | Description |
path | ...* |
Return:
* |
public parser(): Function source
import {parser} from '@cansat-icarus/capture-lib/src/icarus/data-handler/index.js'
Creates and returns a "byteDelimiter" parser. DISCLAIMER: It's a patched version of node-serialport's byteDelimiter parser. You can find it's source here: https://github.com/EmergingTechnologyAdvisors/node-serialport/tree/master/lib/parsers.js Changes from the original: trailing delimiters are removed, buffer passes through packetParser.parse before being emitted and empty buffers and 'Transceiver MODE' messages are ignored. Separates packets by a byte delimiter and passes them through packetParser
public passEvent(sourceEmitter: EventEmitter, destEmitter: EventEmitter, sourceEvent: String, destEvent: String) source
import passEvent from '@cansat-icarus/capture-lib/src/lib/pass-event.js'
Forwards an event from one EventEmitter to another.