Skip to main content
The C Ingestion SDK is a portable header-only library written in C99 for data collection on embedded devices. It’s designed to reliably store sampled data from sensors at a high frequency in very little memory. On top of this it allows cryptographic signing of the data when sampling is complete. Data can be stored on a POSIX file system, in memory, or on a raw block device.

Installation instructions

Usage

The following application:
  • Initializes the library.
  • Sets up the Mbed TLS signing context with the key my-hmac-sha256-key.
  • Creates a file with three axes (accX, accY, accZ) and four readings.
  • It then prints out the CBOR buffer.
This example is also available in the SDK, and can be built with any modern C compiler:
You can paste the output into cbor.me to decode.

Signing contexts

If you are using a different TLS library you can implement a custom signing context. Here’s an example:

Adding fields to the protected header

The signing context can also add new fields to the protected header, such as an expiration date for the token. We suggest to use the JWT Claim Names. You do this by registering a set_protected callback:

Usage on non-POSIX systems

The storage layer is pluggable. You’ll need to set the EI_SENSOR_AQ_STREAM macro to an object of your choice, and then implement fwrite() and fseek() methods to interact with the storage layer. If your system has a clock you can also implement the time() method. If not, the iat (issued at) field in the header will be omitted. This is an example of using a memory-backed storage layer: