MetaWear C++ API  0.18.0
C++ implementation of the MetaWear protocol
Enumerations | Functions
threshold.h File Reference

Allows data through that crosses a boundary. More...

#include "processor_common.h"

Go to the source code of this file.

Enumerations

enum  MblMwThresholdMode { MBL_MW_THRESHOLD_MODE_ABSOLUTE = 0, MBL_MW_THRESHOLD_MODE_BINARY }
 Output modes of the processor. More...
 

Functions

METAWEAR_API int32_t mbl_mw_dataprocessor_threshold_create (MblMwDataSignal *source, MblMwThresholdMode mode, float boundary, float hysteresis, void *context, MblMwFnDataProcessor processor_created)
 Create a threshold processor. More...
 
METAWEAR_API int32_t mbl_mw_dataprocessor_threshold_modify_boundary (MblMwDataProcessor *threshold, float boundary, float hysteresis)
 Modifies the threshold processor configuration. More...
 

Detailed Description

Allows data through that crosses a boundary.

Enumeration Type Documentation

◆ MblMwThresholdMode

Output modes of the processor.

Enumerator
MBL_MW_THRESHOLD_MODE_ABSOLUTE 

Return the data as is.

MBL_MW_THRESHOLD_MODE_BINARY 

Return 1 if data > bounday, -1 if data < boundary.

Function Documentation

◆ mbl_mw_dataprocessor_threshold_create()

METAWEAR_API int32_t mbl_mw_dataprocessor_threshold_create ( MblMwDataSignal source,
MblMwThresholdMode  mode,
float  boundary,
float  hysteresis,
void *  context,
MblMwFnDataProcessor  processor_created 
)

Create a threshold processor.

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
modeProcessor output mode
boundaryLimit that triggers an event when data crosses it
hysteresisMin distance between the limit and value to signal a successful crossing
contextPointer to additional data for the callback function
processor_createdCallback function to be executed when the processor is created

◆ mbl_mw_dataprocessor_threshold_modify_boundary()

METAWEAR_API int32_t mbl_mw_dataprocessor_threshold_modify_boundary ( MblMwDataProcessor threshold,
float  boundary,
float  hysteresis 
)

Modifies the threshold processor configuration.

Parameters
thresholdThreshold processor to modify
boundaryLimit that triggers an event when data crosses it
hysteresisMin distance between the limit and value to signal a successful crossing
Returns
MBL_MW_STATUS_OK if processor configuration was updated, MBL_MW_STATUS_WARNING_INVALID_PROCESSOR_TYPE if a non-threshold processor was passed in