Embedded Artistry C Interfaces
A reference collection of abstract interfaces in C.
Public Attributes | List of all members
BarometricSensor_asyncWithCb Struct Reference

Virtual Barometric Pressure/Altimeter Interface (asynchronous mode) More...

#include <barometric_sensor.h>

Public Attributes

bool(* readSample )(void)
 Request a new current pressure/altitude sample from the device. More...
 
void(* setSeaLevelPressure )(uint32_t slp)
 Set the sea level pressure. More...
 
void(* registerNewSampleCb )(const NewBarometricSampleCb callback)
 Register a NewBarometricSampleCb function. More...
 
void(* unregisterNewSampleCb )(const NewBarometricSampleCb callback)
 Remove a registered NewBarometricSampleCb function. More...
 
void(* registerErrorCb )(const BarometricErrorCb callback)
 Register a BarometricErrorCb function. More...
 
void(* unregisterErrorCb )(const BarometricErrorCb callback)
 Remove a registered BarometricErrorCb function. More...
 

Detailed Description

Virtual Barometric Pressure/Altimeter Interface (asynchronous mode)

A standard interface for a device which can measure barometric pressure. This interface is intended for use with asynchronous implementations. That is, the readPressure() function cannot be a blocking function, but will instead be expected to enqueue a request to geneate a new pressure sample. The pressure sample, whenver it becomes available, will be passed along to interested parties via the registered callback functions.

Fundamental Assumptions

Undesired event assumptions

Implementation Notes

Definition at line 353 of file barometric_sensor.h.

Member Data Documentation

◆ readSample

bool(* BarometricSensor_asyncWithCb::readSample) (void)

Request a new current pressure/altitude sample from the device.

Submit a request to the device for a new sample. When available, the data will be provided to registered callback functions.

Precondition
The barometric sensor has been properly initialized by the system.
Returns
True if the request was successful, False if the request could not be successfully enqueued (e.g., the queue is full).

Definition at line 365 of file barometric_sensor.h.

◆ registerErrorCb

void(* BarometricSensor_asyncWithCb::registerErrorCb) (const BarometricErrorCb callback)

Register a BarometricErrorCb function.

This function will add the callback input to a list of functions to execute when a pressure sensor error occurs.

Precondition
callback is not NULL
Postcondition
callback is added to the list of error callbacks.
Parameters
[in]callbackThe callback function pointer to register on the "error" callback list.

Definition at line 411 of file barometric_sensor.h.

◆ registerNewSampleCb

void(* BarometricSensor_asyncWithCb::registerNewSampleCb) (const NewBarometricSampleCb callback)

Register a NewBarometricSampleCb function.

This function will add the callback input to a list of functions to execute when a new and valid sample is available.

Precondition
callback is not NULL
Postcondition
callback is added to the list of "new sample" callbacks.
Parameters
[in]callbackThe callback function pointer to register on the "new sample" callback list.

Definition at line 385 of file barometric_sensor.h.

◆ setSeaLevelPressure

void(* BarometricSensor_asyncWithCb::setSeaLevelPressure) (uint32_t slp)

Set the sea level pressure.

Parameters
[in]slpThe current sea level pressure in hPa. slp should be specified as an unsigned 32-bit fixed-point number in format UQ22.10.

Definition at line 372 of file barometric_sensor.h.

◆ unregisterErrorCb

void(* BarometricSensor_asyncWithCb::unregisterErrorCb) (const BarometricErrorCb callback)

Remove a registered BarometricErrorCb function.

This function will remove a callback function from the registered list of "error" callbacks. If the function has not been previously registered, the parameter will be ignored and the list will be unchanged.

Postcondition
callback function pointer is not present on the list of "error" callbacks.
Parameters
[in]callbackThe callback function pointer to remove from the "error" callback list.

Definition at line 424 of file barometric_sensor.h.

◆ unregisterNewSampleCb

void(* BarometricSensor_asyncWithCb::unregisterNewSampleCb) (const NewBarometricSampleCb callback)

Remove a registered NewBarometricSampleCb function.

This function will remove a callback function from the registered list of "new sample" callbacks. If the function has not been previously registered, the parameter will be ignored and the list will be unchanged.

Postcondition
callback function pointer is not present on the list of "new sample" callbacks.
Parameters
[in]callbackThe callback function pointer to remove from the "new sample" callback list.

Definition at line 398 of file barometric_sensor.h.


The documentation for this struct was generated from the following file: