MetaWear C++ API  0.20.0
C++ implementation of the MetaWear protocol
Functions
counter.h File Reference

Counts the number of times an event was fired. More...

#include <stdint.h>
#include "dataprocessor_fwd.h"
#include "metawear/core/event_fwd.h"
#include "metawear/platform/dllmarker.h"

Go to the source code of this file.

Functions

METAWEAR_API int32_t mbl_mw_dataprocessor_counter_create (MblMwEvent *source, void *context, MblMwFnDataProcessor processor_created)
 Create a counter with an output size of 1 byte. More...
 
METAWEAR_API int32_t mbl_mw_dataprocessor_counter_create_size (MblMwEvent *source, uint8_t size, void *context, MblMwFnDataProcessor processor_created)
 Create a counter with a specific output size. More...
 
METAWEAR_API int32_t mbl_mw_dataprocessor_counter_set_state (MblMwDataProcessor *counter, uint32_t new_count)
 Overwrites the current count with a new value. More...
 

Detailed Description

Counts the number of times an event was fired.

Function Documentation

◆ mbl_mw_dataprocessor_counter_create()

METAWEAR_API int32_t mbl_mw_dataprocessor_counter_create ( MblMwEvent source,
void *  context,
MblMwFnDataProcessor  processor_created 
)

Create a counter with an output size of 1 byte.


Counts the number of times an event was fired. A pointer representing the processor will be passed back to the user via a callback function.

Parameters
sourceEvent the processor is counting
contextPointer to additional data for the callback function
processor_createdCallback function to be executed when the processor is created

◆ mbl_mw_dataprocessor_counter_create_size()

METAWEAR_API int32_t mbl_mw_dataprocessor_counter_create_size ( MblMwEvent source,
uint8_t  size,
void *  context,
MblMwFnDataProcessor  processor_created 
)

Create a counter with a specific output size.


Counts the number of times an event was fired with a specific output size A pointer representing the processor will be passed back to the user via a callback function.

Parameters
sourceEvent the processor is counting
sizeOutput size, between [1, 4] bytes
contextPointer to additional data for the callback function
processor_createdCallback function to be executed when the processor is created

◆ mbl_mw_dataprocessor_counter_set_state()

METAWEAR_API int32_t mbl_mw_dataprocessor_counter_set_state ( MblMwDataProcessor counter,
uint32_t  new_count 
)

Overwrites the current count with a new value.

Parameters
counterCounter processor to modify
new_countNew count value
Returns
MBL_MW_STATUS_OK if processor state was updated, MBL_MW_STATUS_WARNING_INVALID_PROCESSOR_TYPE if a non-counter was passed in