// Autogenerated C header file for Sensor Aggregator
#ifndef _JACDAC_SPEC_SENSOR_AGGREGATOR_H
#define _JACDAC_SPEC_SENSOR_AGGREGATOR_H 1

#define JD_SERVICE_CLASS_SENSOR_AGGREGATOR  0x1d90e1c5

// enum SampleType (uint8_t)
#define JD_SENSOR_AGGREGATOR_SAMPLE_TYPE_U8 0x8
#define JD_SENSOR_AGGREGATOR_SAMPLE_TYPE_I8 0x88
#define JD_SENSOR_AGGREGATOR_SAMPLE_TYPE_U16 0x10
#define JD_SENSOR_AGGREGATOR_SAMPLE_TYPE_I16 0x90
#define JD_SENSOR_AGGREGATOR_SAMPLE_TYPE_U32 0x20
#define JD_SENSOR_AGGREGATOR_SAMPLE_TYPE_I32 0xa0

/**
 * Set automatic input collection.
 * These settings are stored in flash.
 */
#define JD_SENSOR_AGGREGATOR_REG_INPUTS 0x80
typedef struct jd_sensor_aggregator_inputs {
    uint16_t sampling_interval; // ms
    uint16_t samples_in_window;
    uint32_t reserved;
    uint64_t device_id;
    uint32_t service_class;
    uint8_t service_num;
    uint8_t sample_size; // B
    uint8_t sample_type;  // SampleType
    int8_t sample_shift;
} jd_sensor_aggregator_inputs_t;


/**
 * Read-only uint32_t. Number of input samples collected so far.
 */
#define JD_SENSOR_AGGREGATOR_REG_NUM_SAMPLES 0x180

/**
 * Read-only B uint8_t. Size of a single sample.
 */
#define JD_SENSOR_AGGREGATOR_REG_SAMPLE_SIZE 0x181

/**
 * Read-write # uint32_t. When set to `N`, will stream `N` samples as `current_sample` reading.
 */
#define JD_SENSOR_AGGREGATOR_REG_STREAMING_SAMPLES 0x81

/**
 * Read-only bytes. Last collected sample.
 */
#define JD_SENSOR_AGGREGATOR_REG_CURRENT_SAMPLE JD_REG_READING

#endif
