ref_app_breathing.h File Reference
#include <stdbool.h>
#include <stdint.h>
#include "acc_detector_presence.h"

Go to the source code of this file.

Data Structures

struct  ref_app_breathing_config_t
 Breathing application config container. More...
 
struct  ref_app_breathing_result_t
 Breathing application results container. More...
 

Typedefs

typedef struct ref_app_breathing_handle ref_app_breathing_handle_t
 

Enumerations

enum  ref_app_breathing_app_state_t {
  REF_APP_BREATHING_APP_STATE_INIT, REF_APP_BREATHING_APP_STATE_NO_PRESENCE, REF_APP_BREATHING_APP_STATE_INTRA_PRESENCE, REF_APP_BREATHING_APP_STATE_DETERMINE_DISTANCE,
  REF_APP_BREATHING_APP_STATE_ESTIMATE_BREATHING_RATE
}
 State of the application. More...
 

Functions

ref_app_breathing_config_tref_app_breathing_config_create (void)
 Create a configuration for the ref app breathing. More...
 
void ref_app_breathing_config_destroy (ref_app_breathing_config_t *config)
 Destory a configuration for the ref app breathing. More...
 
ref_app_breathing_handle_tref_app_breathing_create (ref_app_breathing_config_t *config)
 Create a handle for the ref app breathing. More...
 
void ref_app_breathing_destroy (ref_app_breathing_handle_t *handle)
 Destroy a handle for the ref app breathing. More...
 
bool ref_app_breathing_get_buffer_size (ref_app_breathing_handle_t *handle, uint32_t *buffer_size)
 Get the buffer size needed for the provided ref app breathing handle. More...
 
bool ref_app_breathing_prepare (ref_app_breathing_handle_t *handle, ref_app_breathing_config_t *config, acc_sensor_t *sensor, const acc_cal_result_t *sensor_cal_result, void *buffer, uint32_t buffer_size)
 Prepare the application to do a measurement. More...
 
bool ref_app_breathing_process (ref_app_breathing_handle_t *handle, void *buffer, ref_app_breathing_result_t *result)
 Process the data. More...
 

Typedef Documentation

◆ ref_app_breathing_handle_t

Definition at line 20 of file ref_app_breathing.h.

Enumeration Type Documentation

◆ ref_app_breathing_app_state_t

State of the application.

Enumerator
REF_APP_BREATHING_APP_STATE_INIT 
REF_APP_BREATHING_APP_STATE_NO_PRESENCE 
REF_APP_BREATHING_APP_STATE_INTRA_PRESENCE 
REF_APP_BREATHING_APP_STATE_DETERMINE_DISTANCE 
REF_APP_BREATHING_APP_STATE_ESTIMATE_BREATHING_RATE 

Definition at line 60 of file ref_app_breathing.h.

Function Documentation

◆ ref_app_breathing_config_create()

ref_app_breathing_config_t* ref_app_breathing_config_create ( void  )

Create a configuration for the ref app breathing.

Returns
A configuration for the ref app breathing, NULL if creation was not possible

Definition at line 100 of file ref_app_breathing.c.

◆ ref_app_breathing_config_destroy()

void ref_app_breathing_config_destroy ( ref_app_breathing_config_t config)

Destory a configuration for the ref app breathing.

Parameters
[in]configThe configuration to destroy

Definition at line 143 of file ref_app_breathing.c.

◆ ref_app_breathing_create()

ref_app_breathing_handle_t* ref_app_breathing_create ( ref_app_breathing_config_t config)

Create a handle for the ref app breathing.

Parameters
[in]configThe configuration to create the handle with
Returns
A handle for the ref app breathing, NULL if creation was not possible

Definition at line 156 of file ref_app_breathing.c.

◆ ref_app_breathing_destroy()

void ref_app_breathing_destroy ( ref_app_breathing_handle_t handle)

Destroy a handle for the ref app breathing.

Parameters
[in]handleThe ref app breathing handle to destroy

Definition at line 265 of file ref_app_breathing.c.

◆ ref_app_breathing_get_buffer_size()

bool ref_app_breathing_get_buffer_size ( ref_app_breathing_handle_t handle,
uint32_t *  buffer_size 
)

Get the buffer size needed for the provided ref app breathing handle.

Parameters
[in]handleThe ref app breathing handle to to get the buffer size for
[out]buffer_sizeThe buffer size
Returns
true if successful, false otherwise

Definition at line 353 of file ref_app_breathing.c.

◆ ref_app_breathing_prepare()

bool ref_app_breathing_prepare ( ref_app_breathing_handle_t handle,
ref_app_breathing_config_t config,
acc_sensor_t sensor,
const acc_cal_result_t sensor_cal_result,
void *  buffer,
uint32_t  buffer_size 
)

Prepare the application to do a measurement.

Parameters
[in]handleThe ref app breathing handle to prepare for
[in]configThe configuration to prepare with
[in]sensorThe sensor instance to prepare
[in]sensor_cal_resultThe calibration result to prepare with
[in]bufferMemory used by the application to prepare the sensor for measurements The buffer will only be used during the duration of this call
[in]buffer_sizeThe size in bytes of the buffer, should be at least buffer_size from ref_app_breathing_get_buffer_size
Returns
true if successful, false otherwise

Definition at line 358 of file ref_app_breathing.c.

◆ ref_app_breathing_process()

bool ref_app_breathing_process ( ref_app_breathing_handle_t handle,
void *  buffer,
ref_app_breathing_result_t result 
)

Process the data.

Parameters
[in]handleThe ref app breathing handle for to get the next result for
[in]bufferA reference to the buffer (populated by acc_sensor_read) containing the data to be processed.
[out]resultRef app breathing results
Returns
true if successful, otherwise false

Definition at line 368 of file ref_app_breathing.c.