typedef struct ei_signal_t {
    int (*get_data)(size_t, size_t, float *);
#ifdef __MBED__
    mbed::Callback<int(size_t offset, size_t length, float *out_ptr)> get_data;
    std::function<int(size_t offset, size_t length, float *out_ptr)> get_data;
#endif // __MBED__

    size_t total_length;
} signal_t;

Brief: Holds the callback pointer for retrieving raw data and the length of data to be retrieved.

Location: edge-impulse-sdk/dsp/numpy_types.h

signal_t is a structure that holds the callback function, get_data(size_t offset, size_t length, float *out_ptr). This callback should be implemented by the user and fills the memory location given by *out_ptr with raw features. Features must be flattened to a 1-dimensional vector, as described in this guide.

get_data() may be called multiple times during preprocessing or inference (e.g. during execution of run_classifier() or run_classifier_continuous()). The offset argument will update to point to new data, and length data must be copied into the location specified by out_ptr. This scheme allows raw features to be stored in RAM or flash memory and paged in as necessary.

Note that get_data() (even after multiple calls during a single execution of run_classifier() or run_classifier_continuous()) will never request more than a total number of features as given by total_length.


  • get_data - Callback function to be implemented by the user. Parameters are given as get_data(size_t offset, size_t length, float *out_ptr) and should return an int (e.g. EIDSP_OK if copying completed successfully).
  • total_length - Total number of raw features required for a full window (run_classifier()) or for a new slice (run_classifier_continuous()) in order to perform preprocessing and inference.