MetaWear C++ API  0.20.0
C++ implementation of the MetaWear protocol
Enumerations | Functions
delta.h File Reference

Only allows data through that is a min distance from a reference value. More...

#include "processor_common.h"

Go to the source code of this file.

Enumerations

enum  MblMwDeltaMode { MBL_MW_DELTA_MODE_ABSOLUTE = 0 , MBL_MW_DELTA_MODE_DIFFERENTIAL , MBL_MW_DELTA_MODE_BINARY }
 Output modes of the data processor. More...
 

Functions

METAWEAR_API int32_t mbl_mw_dataprocessor_delta_create (MblMwDataSignal *source, MblMwDeltaMode mode, float magnitude, void *context, MblMwFnDataProcessor processor_created)
 Create a delta processor which looks for changes in the input. More...
 
METAWEAR_API int32_t mbl_mw_dataprocessor_delta_set_reference (MblMwDataProcessor *delta, float previous_value)
 Sets the reference value of the processor. More...
 
METAWEAR_API int32_t mbl_mw_dataprocessor_delta_modify_magnitude (MblMwDataProcessor *delta, float magnitude)
 Modifies the magnitude that allows data through. More...
 

Detailed Description

Only allows data through that is a min distance from a reference value.

Enumeration Type Documentation

◆ MblMwDeltaMode

Output modes of the data processor.

Enumerator
MBL_MW_DELTA_MODE_ABSOLUTE 

Return the data as is.

MBL_MW_DELTA_MODE_DIFFERENTIAL 

Return the difference between the input and the reference value.

MBL_MW_DELTA_MODE_BINARY 

Return 1 if input > reference, -1 if input < reference.

Function Documentation

◆ mbl_mw_dataprocessor_delta_create()

METAWEAR_API int32_t mbl_mw_dataprocessor_delta_create ( MblMwDataSignal source,
MblMwDeltaMode  mode,
float  magnitude,
void *  context,
MblMwFnDataProcessor  processor_created 
)

Create a delta processor which looks for changes in the input.

Only allows data through that is a min distance from a reference value. A pointer representing the processor will be passed back to the user via a callback function.

Parameters
sourceData signal providing the input for the processor
modeOutput mode of the processor
magnitudeMin distance from the reference value to allow the input to pass
contextPointer to additional data for the callback function
processor_createdCallback function to be executed when the processor is created

◆ mbl_mw_dataprocessor_delta_modify_magnitude()

METAWEAR_API int32_t mbl_mw_dataprocessor_delta_modify_magnitude ( MblMwDataProcessor delta,
float  magnitude 
)

Modifies the magnitude that allows data through.

Parameters
deltaDelta processor to modify
magnitudeMin distance from the reference value to allow the input to pass
Returns
MBL_MW_STATUS_OK if processor configuration was updated, MBL_MW_STATUS_WARNING_INVALID_PROCESSOR_TYPE if a non-delta processor was passed in

◆ mbl_mw_dataprocessor_delta_set_reference()

METAWEAR_API int32_t mbl_mw_dataprocessor_delta_set_reference ( MblMwDataProcessor delta,
float  previous_value 
)

Sets the reference value of the processor.

Parameters
deltaDelta processor to modify
previous_valueMin distance from the reference value to allow the input to pass
Returns
MBL_MW_STATUS_OK if processor state was updated, MBL_MW_STATUS_WARNING_INVALID_PROCESSOR_TYPE if a non-delta processor was passed in