Firmware SDK
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
bc_data_stream

Library for computations on stream of data. More...

Data Structures

struct  bc_data_stream_buffer_t
 Buffer for data stream. More...
 

Macros

#define BC_DATA_STREAM_FLOAT_BUFFER(NAME, NUMBER_OF_SAMPLES)
 Macro for float data stream buffer declaration. More...
 
#define BC_DATA_STREAM_INT_BUFFER(NAME, NUMBER_OF_SAMPLES)
 Macro for int data stream buffer declaration. More...
 

Typedefs

typedef struct bc_data_stream_t bc_data_stream_t
 Data stream instance.
 

Enumerations

enum  bc_data_stream_type_t {
  BC_DATA_STREAM_TYPE_FLOAT = 0,
  BC_DATA_STREAM_TYPE_INT = 1
}
 Data stream type.
 

Functions

void bc_data_stream_init (bc_data_stream_t *self, int min_number_of_samples, bc_data_stream_buffer_t *buffer)
 Initialize data stream instance. More...
 
void bc_data_stream_feed (bc_data_stream_t *self, void *data)
 Feed data into stream instance. More...
 
void bc_data_stream_reset (bc_data_stream_t *self)
 Reset data stream. More...
 
int bc_data_stream_get_counter (bc_data_stream_t *self)
 Get counter.
 
int bc_data_stream_get_length (bc_data_stream_t *self)
 Get length.
 
bc_data_stream_type_t bc_data_stream_get_type (bc_data_stream_t *self)
 Get type.
 
int bc_data_stream_get_number_of_samples (bc_data_stream_t *self)
 Get buffer number_of_samples.
 
bool bc_data_stream_get_average (bc_data_stream_t *self, void *result)
 Get average value of data stream. More...
 
bool bc_data_stream_get_median (bc_data_stream_t *self, void *result)
 Get median value of data stream. More...
 
bool bc_data_stream_get_first (bc_data_stream_t *self, void *result)
 Get first value in data stream. More...
 
bool bc_data_stream_get_last (bc_data_stream_t *self, void *result)
 Get last value in data stream. More...
 
bool bc_data_stream_get_nth (bc_data_stream_t *self, int n, void *result)
 Get nth value in data stream. More...
 
bool bc_data_stream_get_max (bc_data_stream_t *self, void *result)
 Get max value. More...
 
bool bc_data_stream_get_min (bc_data_stream_t *self, void *result)
 Get min value. More...
 

Detailed Description

Library for computations on stream of data.

Macro Definition Documentation

#define BC_DATA_STREAM_FLOAT_BUFFER (   NAME,
  NUMBER_OF_SAMPLES 
)
Value:
float NAME##_feed[NUMBER_OF_SAMPLES]; \
float NAME##_sort[NUMBER_OF_SAMPLES]; \
bc_data_stream_buffer_t NAME = { \
.feed = NAME##_feed, \
.sort = NAME##_sort, \
.number_of_samples = NUMBER_OF_SAMPLES, \
.type=BC_DATA_STREAM_TYPE_FLOAT \
};

Macro for float data stream buffer declaration.

Definition at line 12 of file bc_data_stream.h.

#define BC_DATA_STREAM_INT_BUFFER (   NAME,
  NUMBER_OF_SAMPLES 
)
Value:
int NAME##_feed[NUMBER_OF_SAMPLES]; \
int NAME##_sort[NUMBER_OF_SAMPLES]; \
bc_data_stream_buffer_t NAME = { \
.feed = NAME##_feed, \
.sort = NAME##_sort, \
.number_of_samples = NUMBER_OF_SAMPLES, \
.type=BC_DATA_STREAM_TYPE_INT \
};

Macro for int data stream buffer declaration.

Definition at line 24 of file bc_data_stream.h.

Function Documentation

void bc_data_stream_feed ( bc_data_stream_t self,
void *  data 
)

Feed data into stream instance.

Parameters
[in]selfInstance
[in]dataInput data to be fed into data stream

Definition at line 15 of file bc_data_stream.c.

Here is the call graph for this function:

bool bc_data_stream_get_average ( bc_data_stream_t self,
void *  result 
)

Get average value of data stream.

Parameters
[in]selfInstance
[out]selfPointer to buffer where result will be stored
Returns
true On success (desired value is available)
false On failure (desired value is not available)

Definition at line 84 of file bc_data_stream.c.

bool bc_data_stream_get_first ( bc_data_stream_t self,
void *  result 
)

Get first value in data stream.

Parameters
[in]selfInstance
[out]selfPointer to buffer where result will be stored
Returns
true On success (desired value is available)
false On failure (desired value is not available)

Definition at line 185 of file bc_data_stream.c.

bool bc_data_stream_get_last ( bc_data_stream_t self,
void *  result 
)

Get last value in data stream.

Parameters
[in]selfInstance
[out]selfPointer to buffer where result will be stored
Returns
true On success (desired value is available)
false On failure (desired value is not available)

Definition at line 220 of file bc_data_stream.c.

bool bc_data_stream_get_max ( bc_data_stream_t self,
void *  result 
)

Get max value.

Parameters
[in]selfInstance
[out]selfPointer to buffer where result will be stored
Returns
true On success (desired value is available)
false On failure (desired value is not available)

Definition at line 304 of file bc_data_stream.c.

Here is the call graph for this function:

bool bc_data_stream_get_median ( bc_data_stream_t self,
void *  result 
)

Get median value of data stream.

Parameters
[in]selfInstance
[out]selfPointer to buffer where result will be stored
Returns
true On success (desired value is available)
false On failure (desired value is not available)

Definition at line 131 of file bc_data_stream.c.

bool bc_data_stream_get_min ( bc_data_stream_t self,
void *  result 
)

Get min value.

Parameters
[in]selfInstance
[out]selfPointer to buffer where result will be stored
Returns
true On success (desired value is available)
false On failure (desired value is not available)

Definition at line 360 of file bc_data_stream.c.

Here is the call graph for this function:

bool bc_data_stream_get_nth ( bc_data_stream_t self,
int  n,
void *  result 
)

Get nth value in data stream.

Parameters
[in]selfInstance
[in]nposition (example: 0 is first, -1 is last)
[out]selfPointer to buffer where result will be stored
Returns
true On success (desired value is available)
false On failure (desired value is not available)

Definition at line 248 of file bc_data_stream.c.

void bc_data_stream_init ( bc_data_stream_t self,
int  min_number_of_samples,
bc_data_stream_buffer_t buffer 
)

Initialize data stream instance.

Parameters
[in]selfInstance
[in]intmin_number_of_samples minimal number of samples for calculation avarage, median ...
[in]bufferBuffer holding data stream content
[in]buffer_sizeSize of buffer holding data stream content

Definition at line 6 of file bc_data_stream.c.

void bc_data_stream_reset ( bc_data_stream_t self)

Reset data stream.

Parameters
[in]selfInstance

Definition at line 58 of file bc_data_stream.c.

Referenced by bc_data_stream_feed().

Here is the caller graph for this function: