Listens to the data coming from the serial port connected to Zeo.
The serial port is set at baud 38400, no parity, one stop bit. Data is sent Least Significant Byte first.
- A is a character starting the message
- n is the protocol “version”, ie “4”
- c is a one byte checksum formed by summing the identifier byte and all the data bytes
- ll is a two byte message length sent LSB first. This length includes the size of the data block plus the identifier.
- LL is the inverse of ll sent for redundancy. If ll does not match ~LL, we can start looking for the start of the next block immediately, instead of reading some arbitrary number of bytes, based on a bad length.
- T is the lower 8 bits of Zeo’s unix time.
- tt is the 16-bit sub-second (runs through 0xFFFF in 1second), LSB first.
- s is an 8-bit sequence number.
- i is the datatype
- d is the array of binary data
The incoming data is cleaned up into packets containing a timestamp, the raw data output version, and the associated data.
External code can be sent new data as it arrives by adding themselves to the callback list using the addCallBack function. It is suggested, however, that external code use the ZeoParser to organize the data into events and slices of data.
Runs on a seperate thread and handles the raw serial communications and parsing required to communicate with Zeo. Each time data is successfully received, it is sent out to all of the callbacks.
Add a callback that will be passed valid data.
Function for error printing.
Begins thread execution and raw serial parsing.
This module parses data from the BaseCapture module and assembles them into slices that encompass a range of data representative of Zeo’s current status.
There are two different callbacks. One for slice callbacks and one that the module will pass events to.
Interprets the incoming Zeo data and encapsulates it into an easy to use dictionary.
Add a function to call when an Event has occured.
Add a function to call when a Slice of data is completed.
Resets the current Slice
Update the current Slice with new data from Zeo. This function is setup to be easily added to the BaseLink’s callbacks.
A collection of general purpose functions and datatypes.
A dictionary containing all types of data the base may send.
A dictionary containing all the types of event that may be fired.
Filters out 60hz noise from a signal. In practice it is a sinc low pass filter with cutoff frequency of 50hz.
A dictionary containing all of the frequency bins.
Creates a signed 16bit integer from a 2 item array
Creates a signed 32bit integer from a 4 item array
Creates an unsigned 16bit integer from a 2 item array
Creates an unsigned 32bit integer from a 4 item array
A dictionary containing the sleepstages output by the base.