ceti-stream is an server daemon to CETI whale tags that forwards sensor data on UDP ports.
The server daemon consists of a tcp listener hosted on port 8080 to handle incoming requests. Requests are sent as an ascii string and available commands are as follows:
audio subscribe <udp_port> - Subscribe your udp port to the raw audio data stream
audio unsubscribe <udp_port> - Unsubscribe your udp port from the raw audio data stream
// todo: add remaining subscription commands
// todo: add pipe command forwarding
stop - kill the server
Except for audio and ecg, all data samples are sent as Plain Old Data (POD) with C structure representation as defined in ceti.rs. Data is transferred in the tag's native endianess (little-endian) not network endianess (big-endian). All data samples start with an i64 representing their unix time timestamp for packet reordering.
Audio: Unlike the other data, audio is sent in big-endian ordering. The first 4-bytes of the packet represent the packet's index as a u32. The index is incremented for each consecutive packet sent and wraps back to zero if 4,294,967,295 packets have been sent. The remaining 1494 bytes represents 249 samples of audio. A sample consists of 3 interleaved channels of 16-bit audio captured at a sample rate of 96 kSPS. The packets are always sample (channel and byte) aligned, to avoid data misalignment if packets are lost.
Ecg streaming is not yet implemented.
Cross compile binary (or download release) and move onto whale tag.
Guarentee ceti-tag-data-capture.service is running on the tag prior to running the server, to ensure that the sensor data shared memory objects exist and are being populated.
-
install rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -
install raspberry pi cross compiliation toolchain following the instructions here for
aarch64architecture. -
add platform target to rustc
rustup target add aarch64-unknown-linux-gnu -
build with cargo
cargo build --bin daemon --target aarch64-unknown-linux-gnu
- wrap daemon executable in systemd service with
ceti-tag-data-capture.serviceas a requirement. - finish implementing tcp commands
- implement ecg sample forwarding
- create docker image for consistent build environment
- create installation script